GAP
|
Main BranchesDownloads Installation Overview Data Libraries Packages Documentation Contacts FAQ GAP 3 |
||||||||||||||||||||||
Find us on GitHubNavigation Tree |
1999 Linz Workshop on Advanced Programming in GAP 4In collaboration with the Applied Algebra Group in Linz we held a workshop on advanced programming in GAP 4 from 6th-10th of April 1999 in Linz, Austria. This page gives copies of the slides used by some of the speakers. They are probably not self-contained and might be insufficient without having heard the actual talks. It also contains an adapted text from the talk by Alexander Hulpke about the GAP library. Thomas BreuerBettina Eick
Willem de Graaf
Alexander Hulpke
Stefan KohlInteger factorization (zoo archive with several files) Steve LintonWerner Nickel
Andrew Solomon
(If your talk is not listed here but you want it here, please tell us) How to find your way through the GAP Library?The following text is an adapted version of the talk by Alexander Hulpke at this Summer School. Finding your way through the GAP LibraryFilesThe library contains three types of files:
A few representation declarations are in .gi files. Dynamic family declarations are in functions and thus in .gi files. First the .g files, then the .gd files and finally the .gi files are read. (There are few exceptions.) DependenciesForward references become almost obsolete by first reading all declarations and then the implementations.Everything that is not just used locally within a well defined group of files should be declared In the few situations when a forward declaration is still needed, usually the variable is assigned to the string "2bdefined". Within declarations or implementations the reading order becomes mostly harmless. Exceptions concern mostly declarations of "general" things such as lists, collections and arithmetic. LaunchThe main library is contained in the lib directory. Operations that construct groups are contained in the grp directory, as well as trans (transitive groups) prim (primitive groups), small (small groups). The startup process also loads those packages that are marked as autoloadable. All reading is triggered by init.g. It in turn reads files read1.g to read8.g that read the whole library.
If completion files are present they are read instead of
read2.g ff..
In this case function bodies are left for completion.
The components: libraries of small, primitive, transitive groups
are read in if present. Reading depends on the
first file in the bunch to read properly. This file must call
DeclareComponent to tell that the component will be available.
Global variables Finally the init.g files of those packages in pkg are read that are not explicitly indicated for being omitted. As the last step GAP prints version number (set in system.g) and architecture (set in the kernel), loaded components and packages and displays the prompt. The read files
FutureWe aim (if we have lots of time ...) to split the library into separate modules, similar to components and packages. Modules would interface only via clean declaration interfaces and it would be possible to update a single module separately. A Library FileThe file format may look fussy, but most of it is not compulsory. The main areas are
Revision.arith_gd := "@(#)$Id$";
Declaration functions and variable bindersUsually the library does not call NewSomething: MyFamily:=NewFamily("MyFamily",Filter); MyCategory:=NewCategory("MyCategory",IsObject); MyOp:=NewOperation("MyOp",[IsObject1,IsObject2]); but constructor functions that will use the name string as the variable identifier: DeclareFamily("MyFamily",Filter); DeclareCategory("MyCategory",IsObject); DeclareOperation("MyOp",[IsObject1,IsObject2]);Advantages are:
BindGlobal("MyVariable",value);
A few special constructsFor several operations stores the value relative to a subgroups parent as an attribute. The library declaration InParentFOA("Normalizer",IsGroup,IsGroup, NewAttribute)may be considered a shorthand for: DeclareOperation("NormalizerOp",IsGroup, IsGroup);DeclareAttribute("NormalizerInParent",IsGroup); InstallMethod(NormalizerInParent,true,[IsGroup],0, function(G) return NormalizerOp(Parent(G),G);end); Normalizer:=function(G,U) if G=Parent(U) then return NormalizerInParent(U); else return NormalizerOp(G,U);fi;end; Similarly there is KeyDependentFOA that creates a user function like SylowSubgroup, an operation SylowSubgroupOp to compute values and a (mutable) attribute which stores computed values for the different keys. Consequently methods are installed for operations like NormalizerOp. A similar phenomenon occurs with functions calling a NC operation. Finding code in the libraryThe easiest way is to use a tool like grep.For declarations search the .gd or .g files. For methods search the .gi files for the operation and InstallMethod or for the installation string. Filenames try to give an idea what the file does but are truncated to 8+3 characters for neolithic operating systems:
Functions and VariablesThe following rules are very rough guidelines. Certainly they are violated all over the library. Function names are composed roughly from right to left explaining what input produces what output: PcgsByPcSequence, GeneratorsOfGroup (while GroupByGenerators does the opposite). XOfY returns the "attribute" X of an object of kind Y. XByY creates a new X from parameters that will be its Y. Composita that are used in the literature are kept together (SylowSubgroup). Further specifications (IsSolvableGroup) are appended.
Arguments are arranged from larger to smaller.
So the argument ordering is
"System" variables are
Unless these features are to be worked with these variables should not be used. All library identifiers should be protected against overwriting, many are. "Technical" properties (i.e. properties of objects that might depend on certain knowledge about an object and be used to improve performance but are not mathematical properties) are not declared as Property but as simple Filter. Modifying the LibraryOne can keep several root paths, trying them all in order to find a file. This permits to override library files with private versions:
gap4 -l "/home/ahulpke/mygap4;/usr/local/gap4"
You cannot Read in again a library file, use Reread instead. Ceterum ...
The impious maintain that
nonsense is normal in the Library and that the reasonable (and even humble and pure coherence) is an almost miraculous exception. JORGE LUIS BORGES: The Library of Babel |