GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
#ifndef ARITH_TYPEDEF1#define ARITH_TYPEDEF 123/*============================================================*\4|| ||5|| Enthaelt die noetigen Typendeklaraionen fuer Langzahl- ||6|| arithmetik, Arithmetik in Fp, Fq, abelschen Zahlkoerpern ||7|| und p_adische Koerper. ||8|| ||9\*============================================================*/1011typedef long polynom_Fp;12typedef long padic;13typedef long Fq;14typedef unsigned long lang;15typedef int boolean;16typedef struct { unsigned long low, hi; } prod;17typedef struct { lang st, nd, rd; } hipos;18typedef struct { int z; int n; } bruch;19typedef struct { lang z; lang n; } rational;20typedef struct { lang f1, f2, g1, g2; } pair;21typedef struct { int f1, f2, g1, g2; } spair;2223typedef struct { int len; char *string; } padicchar;24typedef struct { int len; char *string; } langchar;25typedef struct { int len; char *string; } Fqchar;2627/*============================================================*\28|| ||29|| Definition und Deklaration der Additions- und Multiplika- ||30|| tionstabelle der Fp-Arithmetik. ||31|| (schneller, aber nicht kompatibel zur Fq-Arithmetik) ||32|| ||33\*============================================================*/3435#define SHORTPRIME_LIMIT 300 /* Grenze fuer Rechnen mit Tabelle */36#define MIDDLEPRIME_LIMIT 8192 /* Grenze fuer Cech-Logarithmen */37#define LONGPRIME_LIMIT 1000000000 /* Obergrenze fuer Arithmetik */3839typedef struct {40int s_number, *s_primes; /* Anzahl kleiner Pz; Liste der ... */41int l_number, *l_primes; /* Anzahl grosser Pz; Liste der ... */42int *s_kind, *l_kind; /* Art der Pz: -1 : Primzahl,431 : Primzahlpotenz, 0 sonst */44int ***ADD, ***MUL; /* Rechen-Tabellen fuer kleine Pz. */45int **LOG, **EXP; /* p-Logarithmen fuer grosse Pz. */46} table;4748table *prime_table;4950int **P_ADD, **P_MUL; /* aktuelle Rechen_Tabelle */51int *P_LOG, *P_EXP; /* aktuelle p-Logarithmen */52int (*S)(int, int), (*P)(int, int); /* aktuelle Funktion */53int (*min_mod_factor)(int, int); /* Verallgemeinerung von a/b */54int act_prime; /* aktuelle Primzahl */55int act_prime_code; /* Aktuelle Kodierung (s.o.) */5657/*============================================================*\58|| ||59|| Definition der Typen fuer die p_adische Arithmetik. ||60|| ||61\*============================================================*/6263typedef struct {64boolean init_done;65char *name;66long list_num; /* die eigene Koerperkennung */67long padic_p, p_halbe;68long padic_e, padic_f;69long padic_ef; /* erspart die Rechnung von e*f */70long padic_ef_plus1; /* e*f+1 */71long padic_f_plus1; /* f+1 */72long padic_2f; /* 2*f */73long padic_2f_1; /* 2*f+1 */74long padic_2e_1; /* 2*e+1 */75long padic_e2f_1; /* e*(2*f-1) */76long padic_2e_12f_1; /* (2*e-1)*(2*f-1) */77long padic_cd; /* cd = Rechentiefe */78long padic_cd_plus1; /* cd+1 */79polynom_Fp f_poly; /* unverzweigtes Polynom */80polynom_Fp e_poly; /* Eisensteinpolynom */81boolean f_poly_is_Conway; /* Polynom automatisch bestimmt */82long **f_mat; /* Reduktionsmatrix der unv. Erweiterung */83long **e_mat; /* Reduktionsmatrix der verzw. Erweiterung */84long **mult_mat; /* e_mat (x) f_mat , d. h. Kroneckerprodukt */85padic *padicmulvec;86long ***diag_f_mat; /*Blockdiagonalmatrix zum Invert. unv. Ausdr. */87long **inv_mat; /*Diese Matrix wird beim Invertieren gebraucht */88long **inv_mat_inv; /* Die invertierte inv_mat_matrix */89long *a_inv_vec; /* Zum Invertieren,falls padic_e>1 */90long *b_inv_vec; /* " */91long *c_inv_vec; /* " */92long *a_vec; /* Zum Invertieren, falls padic_f>1 */93long *b_vec; /* " */94long *c_vec; /* " */95long *cb0_vec; /* " */96long **a_mat; /* Zum Invertieren, falls f>1 und e>1 */97long **b_mat; /* " */98long **c_mat; /* " */99long *sum_vec; /* " */100padic y_inversp; /* wird zum schiften bei div gebraucht, falls e>1101y_inversp erhaelt den Wert y^(-1)*p */102padic ypsilon;103lang *modvec;104boolean GEMISCHT; /* Flag: TRUE = echt gemischte Erweiterung, d. h.105das Eisensteinpolynom steht in eisen_mat106da es verzweigte Koeffizienten hat */107long **eisen_mat; /* Das Eisensteinpolynom im gemischten Fall108Der Matrixeintrag eisen_mat[i][j] ist der109Koeffizient e_{i,j}*x^j*y^i des Eisensteinpolys */110} padic_field_TYP;111112/*============================================================*\113|| ||114|| Typendefinition fuer die Arithmetik in endlichen Koerpern. ||115|| ||116\*============================================================*/117118typedef struct {119char *name; /* Der eigene Name als Matrixkopf: F[p,f,...] */120long list_num; /* die eigene Koerperkennung */121boolean init_done_Fq;122long Fq_p, Fq_p_halbe;123long Fq_f, Fq_f_plus1;124long Fq_2f, Fq_2f_1;125long Fq_q, Fq_q_1; /* Anzahl der Elemante, -1 in Fq */126Fq Fqmulvec;127long **f_mat_Fq;128long ***diag_f_mat_Fq;129long *a_vec_Fq;130long **inv_mat_Fq; /*Diese Matrix muss beim Invert.invert. werden */131long **inv_mat_inv_Fq; /* Die invertierte inv_mat_matrix */132polynom_Fp f_poly_Fq;133boolean listtyp; /* Flag ueber Art der Multiplikation */134boolean f_poly_is_Conway; /* Polynom automatisch bestimmt */135Fq *Fq_list_etoz; /* speichert n -> a fuer Fq_pr^n=a */136long *Fq_list_ztoe; /* speichert lex(a) -> n fuer Fq_pr^n=a */137Fq Fq_pr; /* Ein primitives Element */138} finite_field_TYP;139140141/*============================================================*\142|| ||143|| Typedefinitions for the cyclotomic fields and the Galois- ||144|| groups of those (sub-)fields. ||145|| ||146|| There is no special type-definition for the elements of a ||147|| cyclotomic field, and the cyclotomic numbers which are ||148|| integers are represented as 'lang'. The others are vectors ||149|| of integers with the following structure: ||150|| ||151|| /------------------------------------------\ ||152|| | Code | field+base| kgv | c_1 | ... | c_n | ||153|| \------------------------------------------/ ||154|| ^identification ^ ||155|| number for coefficients for basis ||156|| field & base vectors. ||157|| ||158|| The code number has the following structure: ||159|| code-bits from long-integer code \ ||160|| | ||161|| identifier for cyclotomics | | ||162|| /------------------------------------------------\ ||163|| | length | 0 s | 1 0 | 0 0| ||164|| \------------------------------------------------/ ||165|| vector length = rank of field | ||166|| s = 1: coefficients are integers --/ ||167|| ||168\*============================================================*/169170/*============================================================*\171|| Typedefinition for elements of a Galoisgroup. The elements ||172|| are given by the image (= exponent) of e_n, and the order ||173|| of the automorphism. ||174\*============================================================*/175176typedef struct { int image, order; } Galois_element;177178/*============================================================*\179|| Typedefinition for a abelian Galoisgroup. It contains the ||180|| order, the order of the cyclotomic field, and the genera- ||181|| tors in normal form. ||182\*============================================================*/183184typedef struct { int group_order, field_order;185int gen_num;186Galois_element *gen; } Galois_group;187188/*============================================================*\189|| Typedefinition for the equivalence-classes Ci in [TB]. ||190|| It contains the number of classes, the classes, sorted in ||191|| ascending order of d_i, and for each d_i the standard ||192|| primitive roots (indexed). ||193\*============================================================*/194195typedef struct { int num_class;196int **classes; } Ci_class;197198/*============================================================*\199|| Summand of a base element, contains exponent and ||200|| coefficient of the root. ||201\*============================================================*/202203typedef struct s_summand summand;204struct s_summand { int exponent;205lang coeff;206summand *next;};207208/*============================================================*\209|| Entry of a multiplication table, contains the row, col and ||210|| coefficient. The definition is recursiv, so the muliplica- ||211|| tion matrix can be stored as a recursiv list. ||212\*============================================================*/213typedef struct s_entry table_entry;214struct s_entry { int col;215lang coeff;216table_entry *next;} ;217218/*============================================================*\219|| Typedefinition for a subfield-base. It contains the order ||220|| of a primitive root, the number and the list of base- ||221|| vectors, given as linear combinations of the roots, and ||222|| the multiplication tables for this base. The coefficients ||223|| in the base and in the tables can be cyclotomic numbers. ||224|| In the list substitute the linear combinations for those ||225|| roots which are not basic elements are given (if possible).||226|| Here the exponents refers to the basic vectors, not to the ||227|| root exponents. ||228|| The i-th entry in the multiplication table points to the ||229|| multiplication table for the i-th coefficient of the ||230|| product. ||231\*============================================================*/232233typedef struct { int root_order, rank;234prod *order_primes;235summand *base, *substitute;236table_entry **mult_table; } field_BASE;237238typedef struct s_field cyclo_field_TYP;239240/*============================================================*\241|| Allgemeiner Typ fuer Koerper; dient zur globalen Verwaltung||242\*============================================================*/243244typedef struct {245int Typ, list_num;246char *name;247cyclo_field_TYP *CF;248padic_field_TYP *PF;249finite_field_TYP *FF;250} field_TYP;251252/*============================================================*\253|| Weitere aufbauende Definitionen: ||254|| Definition des matrix_TYP`s, ||255|| ||256\*============================================================*/257typedef struct {258lang **Z, **N;259int **SZ, **SN;260table_entry **ZC;261} array_TYP;262263typedef struct {264boolean Typ ,265Integral ,266Symmetric,267Diagonal ,268Scalar ,269Sparse,270Permutation,271Monomial;272int Max_Entry ; /* Maximaler Eintrag in short-integer-Matrizen*/273} flag_TYP;274275typedef struct {276flag_TYP flags;277int cols, rows, prime;278lang kgv;279char *name; /* Name des Koerpers */280int field_num; /* Nummer des Koerpers in allgemeiner Liste */281array_TYP array;282} matrix_TYP;283284/*============================================================*\285|| Typedefinition for a cyclotomic field. It contains vectors ||286|| for bases, subfields, supfields and those created field ||287|| which are not sub/sup-field. Furthermore it contains the ||288|| Galoisgroup, and, if the field is a subfield of a cyclo- ||289|| tomic field, it contains a pointer to the cyclotomic field ||290|| (conductor), and the group which fixes this field. ||291|| Often the conductor field is not need arithmetically, so ||292|| there is also a pointer to the conductor_base. ||293|| ||294|| The matrix (m)_{ij} contains the base-change coefficient ||295|| from the i-th base to the j-th base. ||296|| ||297|| There is also space for various flags. ||298|| ||299\*============================================================*/300301struct s_field { int list_num, base_num;302int supfield_num, subfield_num, parfield_num;303int root_order, rank, flags;304char *name;305field_BASE **bases, *con_base;306field_BASE **rel_bases;307matrix_TYP **base_change;308matrix_TYP **norms;309Ci_class *base_classes;310field_TYP **supfields, **subfields, **parfields;311field_TYP *conductor;312Galois_group *Act_group, *Fix_group;313};314315/*============================================================*\316|| ||317|| Typendefinition fuer Polynome. ||318|| fac_num enthaelt die Anzahl der gefundenen Faktoren. ||319|| Diese werden in factors abgelegt. ||320|| *.hi enthealt jeweils den Exponenten, *.low den entspre- ||321|| chenden Koeffizienten. ||322|| Die Exponenten sind absteigend geordnet. ||323|| 'factorize' ist 'TRUE', falls alle Faktoren irreduzibel ||324|| sind, also das Polynom vollstaendig faktorisiert ist. ||325|| ||326\*============================================================*/327typedef struct {328int fac_num, grad;329boolean factorize;330prod **factors;331} polynom;332333typedef struct {334long deg; /* Grad des Polynoms */335padic *kof; /* Die Koeffizenten des Polynoms, wobei336kof[0] den x^0-Term usw. beinhaltet */337} padicpoly;338339/* Definition fuer das Arbeiten mit Worten */340typedef struct s_wordchain word_chain;341342struct s_wordchain { word_chain *prev, *next;343int name, coeff;};344#endif345346347