Goto Chapter: Top 1 2 3 4 5 6 7 Bib Ind

### 6 Various other functions

#### 6.1 Operations on folders

##### 6.1-1 FindMatchingFiles
 ‣ FindMatchingFiles( pkg, dirs, extns ) ( function )
 ‣ CreateDirIfMissing( str ) ( function )

These functions have been transferred from package AutoDoc where they were named AutoDoc_FindMatchingFiles and AutoDoc_CreateDirIfMissing.

FindMatchingFiles scans the given (by name) subdirectories of a package directory for files with one of the given extensions, and returns the corresponding filenames, as paths relative to the package directory.

CreateDirIfMissing checks whether the given directory exists and, if not, attempts to create it. In either case true is returned.

Warning: this function relies on the undocumented library function CreateDir, so use it with caution.


gap> FindMatchingFiles( "utils", [ "/", "tst" ], [ "g", "txt" ] );
"tst/testall.g" ]
gap> CreateDirIfMissing( "/Applications/gap/temp/" );
true



#### 6.2 File operations

##### 6.2-1 Log2HTML
 ‣ Log2HTML( filename ) ( function )

This function has been transferred from package RCWA.

This function converts the GAP logfile filename to HTML. The extension of the input file must be *.log. The name of the output file is the same as the one of the input file except that the extension *.log is replaced by *.html. There is a sample CSS file in utils/doc/gaplog.css, which you can adjust to your taste.


gap> LogTo("mar2.log");
gap> FindMatchingFiles( "utils", [""], ["g"] );
[ "/PackageInfo.g", "/init.g", "/makedoc.g", "/read.g" ]
gap> LogTo();
gap> Log2HTML( "mar2.log" );
gap> FindMatchingFiles( "utils", [""], ["html", "log"] );
[ "/mar2.html", "/mar2.log" ]



#### 6.3 LaTeX strings

##### 6.3-1 IntOrOnfinityToLaTeX
 ‣ IntOrOnfinityToLaTeX( n ) ( function )

This function has been transferred from package ResClasses.

IntOrInfinityToLaTeX(n) returns the LaTeX string for n.


gap> IntOrInfinityToLaTeX( 10^3 );
"1000"
gap> IntOrInfinityToLaTeX( infinity );
"\\infty"



##### 6.3-2 LaTeXStringFactorsInt
 ‣ LaTeXStringFactorsInt( n ) ( function )

This function has been transferred from package RCWA.

It returns the prime factorization of the integer n as a string in LaTeX format.


gap> LaTeXStringFactorsInt( Factorial(12) );
"2^{10} \\cdot 3^5 \\cdot 5^2 \\cdot 7 \\cdot 11"



#### 6.4 Applicable methods

##### 6.4-1 PrintApplicableMethod
 ‣ PrintApplicableMethod( arg ) ( function )

This function combines calls to ApplicableMethod, FilenameFunc, StartlineFunc and EndlineFunc and prints the location of the file containing the method found, and a listing of that method. In its simplest form it is called as PrintApplicableMethod(f,L) for a function f and a list of parameters L. Alternatively, it is called as PrintApplicableMethod(f,L,0,n) and then prints the method returned by ApplicableMethod(f,L,0,n).


gap> PrintApplicableMethod( IsCyclic, [ Group((1,2,3),(4,5)) ] );
this method is contained in lines [30,36] of file:
/Applications/gap/gapdev/lib/grp.gi
function ( G )
if Length( GeneratorsOfGroup( G ) ) = 1  then
return true;
else
return TRY_NEXT_METHOD;
fi;
return;
end
gap> PrintApplicableMethod( IsCyclic, [ Group((1,2,3),(4,5)) ], 0, 2 );
this method is contained in lines [41,63] of file:
/Applications/gap/gapdev/lib/grp.gi
function ( G )
if HasGeneratorsOfGroup( G ) and Length( GeneratorsOfGroup( G ) ) = 1
then
SetMinimalGeneratingSet( G, GeneratorsOfGroup( G ) );
return true;
elif not IsCommutative( G )  then
return false;
elif IsFinite( G )  then
return ForAll( Set( FactorsInt( Size( G ) ) ), function ( p )
return
Index( G,
SubgroupNC( G,
List( GeneratorsOfGroup( G ), function ( g )
return g ^ p;
end ) ) ) = p;
end );
else
return AbelianInvariants( G ) = [ 0 ];
fi;
return;
end



#### 6.5 Conversion to MAGMA string

##### 6.5-1 ConvertToMagmaInputString
 ‣ ConvertToMagmaInputString( arg ) ( function )

The function ConvertToMagmaInputString( obj [, str] ) attempts to output a string s which can be read into MAGMA [BCP97] so as to produce the same group in that computer algebra system. In the second form the user specifies the name of the resulting object, so that the output string has the form "str := ...". When obj is a permutation group, the operation PermGroupToMagmaFormat(obj) is called. This function has been taken from other.gi in the main library where it was called MagmaInputString. When obj is a pc-group, the operation PcGroupToMagmaFormat(obj) is called. This function was private code of Max Horn. When obj is a matrix group over a finite field, the operation MatrixGroupToMagmaFormat(obj) is called. This function is a modification of private code of Frank Lübeck.

Hopefully code for other types of group will be added in due course.

These functions should be considered experimental, and more testing is desirable.


gap> ConvertToMagmaInputString( Group( (1,2,3,4,5), (3,4,5) ) );
"PermutationGroup<5|(1,2,3,4,5),\n(3,4,5)>;\n"
gap> ConvertToMagmaInputString( Group( (1,2,3,4,5) ), "c5" );
"c5:=PermutationGroup<5|(1,2,3,4,5)>;\n"
gap> ConvertToMagmaInputString( SmallGroup( 24, 12 ) );
"PolycyclicGroup< f1,f2,f3,f4 |\nf1^2,\nf2^3,\nf3^2,\nf4^2,\nf2^f1 = f2^2,\nf3\
^f1 = f4,\nf3^f2 = f4,\nf4^f1 = f3,\nf4^f2 = f3*f4\n>;\n"
gap> ConvertToMagmaInputString( CyclicGroup( IsPcGroup, 7 ), "c7" );
"c7:=PolycyclicGroup< f1 |\nf1^7\n>;\n"
gap> M := GL(2,5);;  Size(M);
480
gap> s1 := ConvertToMagmaInputString( M );
"F := GF(5);\nP := GL(2,F);\ngens := [\nP![2,0,0,1],\nP![4,1,4,0]\n];\nsub<P |\
gens>;\n"
gap> Print( s1 );
F := GF(5);
P := GL(2,F);
gens := [
P![2,0,0,1],
P![4,1,4,0]
];
sub<P | gens>;
gap> n1 := [ [ Z(9)^0, Z(9)^0 ], [ Z(9)^0, Z(9) ] ];;
gap> n2 := [ [ Z(9)^0, Z(9)^3 ], [ Z(9)^4, Z(9)^2 ] ];;
gap> N := Group( n1, n2 );;  Size( N );
5760
gap> s2 := ConvertToMagmaInputString( N, "gpN" );;
gap> Print( s2 );
F := GF(3^2);
P := GL(2,F);
w := PrimitiveElement(F);
gens := [
P![ 1, 1, 1,w^1],
P![ 1,w^3, 2,w^2]
];
gpN := sub<P | gens>;


Goto Chapter: Top 1 2 3 4 5 6 7 Bib Ind

generated by GAPDoc2HTML