Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/utils/doc/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 11.8.2025 mit Größe 5 kB image not shown  

Quelle  iterator.xml   Sprache: XML

 
<!-- ------------------------------------------------------------------- -->
<!--                                                                     -->
<!--  iterator.xml          Utils documentation                          -->
<!--                                                                     -->
<!--  Copyright (C) 2015-2019, The GAP Group                             --> 
<!--                                                                     -->
<!-- ------------------------------------------------------------------- -->

<?xml version="1.0" encoding="UTF-8"?>

<Chapter Label="chap-iterator">
<Heading>Iterators</Heading>

<Section Label="sec-group-iters">
<Heading>Some iterators for groups and their isomorphisms</Heading>

<Index>Iterators</Index>
The motivation for adding these operations is partly to give a simple example 
of an iterator for a list that does not yet exist, and need not be created.
<P/>

<ManSection>
   <Oper Name="AllIsomorphismsIterator"
         Arg="G H" />
   <Oper Name="AllIsomorphismsNumber"
         Arg="G H" />
   <Oper Name="AllIsomorphisms"
         Arg="G H" />
<Description>
The main &GAP; library contains functions producing complete lists of 
group homomorphisms such as <C>AllHomomorphisms</C>; <C>AllEndomorphisms</C> 
and <C>AllAutomorphisms</C>. 
Here we add the missing <C>AllIsomorphisms(G,H)</C> for a list of isomorphisms 
from <M>G</M> to <M>H</M>. 
The method is simple -- find one isomorphism <M>G \to H</M> and compose this 
with all the automorphisms of <M>G</M>. 
In all these cases it may not be desirable to construct a list of 
homomorphisms, but just implement an iterator, and that is what is done here. 
The operation <C>AllIsomorphismsNumber</C> returns the number of isomorphisms 
iterated over (this is, of course, just the order of the automorphisms group). 
The operation <C>AllIsomorphisms</C> produces the list or isomorphisms.
<P/> 
</Description>
</ManSection>
<Example>
<![CDATA[
gap> G := SmallGroup( 6,1);; 
gap> iter := AllIsomorphismsIterator( G, s3 );;
gap> NextIterator( iter );
[ f1, f2 ] -> [ (6,7), (5,6,7) ]
gap> n := AllIsomorphismsNumber( G, s3 );
6
gap> AllIsomorphisms( G, s3 );
[ [ f1, f2 ] -> [ (6,7), (5,6,7) ], [ f1, f2 ] -> [ (5,7), (5,6,7) ], 
  [ f1, f2 ] -> [ (5,6), (5,7,6) ], [ f1, f2 ] -> [ (6,7), (5,7,6) ], 
  [ f1, f2 ] -> [ (5,7), (5,7,6) ], [ f1, f2 ] -> [ (5,6), (5,6,7) ] ]
gap> iter := AllIsomorphismsIterator( G, s3 );;
gap> for h in iter do Print( ImageElm( h, G.1 ) = (6,7), ", " ); od;
true, false, false, true, false, false,
]]>
</Example>

<ManSection>
   <Oper Name="AllSubgroupsIterator"
         Arg="G" />
<Description> 
The manual entry for the operation <C>AllSubgroups</C> states that it is only 
intended to be used on small examples in a classroom situation. 
Access to all subgroups was required by the <Package>XMod</Package> package, 
so this iterator was introduced here. 
It used the operations <C>LatticeSubgroups(G)</C> 
and <C>ConjugacyClassesSubgroups(lat)</C>, and then iterates 
over the entries in these classes. 
<P/> 
</Description>
</ManSection>
<Example>
<![CDATA[
gap> c3c3 := Group( (1,2,3), (4,5,6) );; 
gap> iter := AllSubgroupsIterator( c3c3 );
<iterator>
gap> while not IsDoneIterator(iter) do Print(NextIterator(iter),"\n"); od;
Group( () )
Group( [ (4,5,6) ] )
Group( [ (1,2,3) ] )
Group( [ (1,2,3)(4,5,6) ] )
Group( [ (1,3,2)(4,5,6) ] )
Group( [ (4,5,6), (1,2,3) ] )
]]>
</Example>

</Section> 


<Section Label="sec-iter-ops">
<Heading>Operations on iterators</Heading>

This section considers ways of producing an iterator 
from one or more iterators. 
It may be that operations equivalent to these are available elsewhere 
in the library -- if so, the ones here can be removed in due course. 

<ManSection>
   <Oper Name="CartesianIterator"
         Arg="iter1 iter2" />
<Description> 
This iterator returns all pairs <M>[x,y]</M> where <M>x</M> is the output 
of a first iterator and <M>y</M> is the output of a second iterator. 
<P/> 
</Description>
</ManSection>
<Example>
<![CDATA[
gap> it1 := Iterator( [ 1, 2, 3 ] );;
gap> it2 := Iterator( [ 4, 5, 6 ] );;
gap> iter := CartesianIterator( it1, it2 );;
gap> while not IsDoneIterator(iter) do Print(NextIterator(iter),"\n"); od;
[ 1, 4 ]
[ 1, 5 ]
[ 1, 6 ]
[ 2, 4 ]
[ 2, 5 ]
[ 2, 6 ]
[ 3, 4 ]
[ 3, 5 ]
[ 3, 6 ]
]]>
</Example>

<ManSection>
   <Oper Name="UnorderedPairsIterator"
         Arg="iter" />
<Description> 
This operation returns pairs <M>[x,y]</M> where <M>x,y</M> are output 
from a given iterator <C>iter</C>.  
Unlike the output from <C>CartesianIterator(iter,iter)</C>, 
unordered pairs are returned. 
In the case <M>L = [1,2,3,\ldots]</M> the pairs are ordered as 
<M>[1,1],[1,2],[2,2],[1,3],[2,3],[3,3],\ldots</M>. 
<P/> 
</Description>
</ManSection>
<Example>
<![CDATA[
gap> L := [6,7,8,9];;
gap> iterL := IteratorList( L );; 
gap> pairsL := UnorderedPairsIterator( iterL );;                              
gap> while not IsDoneIterator(pairsL) do Print(NextIterator(pairsL),"\n"); od;
[ 6, 6 ]
[ 6, 7 ]
[ 7, 7 ]
[ 6, 8 ]
[ 7, 8 ]
[ 8, 8 ]
[ 6, 9 ]
[ 7, 9 ]
[ 8, 9 ]
[ 9, 9 ]
gap> iter4 := IteratorList( [ 4 ] );
<iterator>
gap> pairs4 := UnorderedPairsIterator(iter4);
<iterator>
gap> NextIterator( pairs4 );
[ 4, 4 ]
gap> IsDoneIterator( pairs4 );
true
]]>
</Example>

</Section> 

</Chapter>

94%


¤ Dauer der Verarbeitung: 0.25 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.