GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
@--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: add_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *imat_add (L_mat, R_mat, Lc, Rc) @ matrix_TYP *L_mat, *R_mat ; @ int Lc, Rc; @ @ calculates Lc * L_mat + Rc * R_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *imat_addeq (L_mat, R_mat, Lc, Rc) @ matrix_TYP *L_mat, *R_mat ; @ int Lc, Rc; @ @ calculates L_mat = Lc*L_mat + Rc*R_mat @ @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *rmat_add (L_mat, R_mat, L_coeff, R_coeff) @ matrix_TYP *L_mat, *R_mat ; @ rational L_coeff, R_coeff; @ @ calculates L_coeff * L_mat + R_coeff * R_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *rmat_addeq(L_mat, R_mat, L_coeff, R_coeff) @ matrix_TYP *L_mat, *R_mat ; @ rational L_coeff, R_coeff; @ @ calculates L_coeff = L_coeff * L_mat + R_coeff * R_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *pmat_add (L_mat, R_mat, L_coeff, R_coeff) @ matrix_TYP *L_mat, *R_mat ; @ int L_coeff, R_coeff; @ @ calculates L_coeff * L_mat + R_coeff * R_mat modulo L_mat->prime @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *pmat_addeq (L_mat, R_mat, L_coeff, R_coeff) @ matrix_TYP *L_mat, *R_mat ; @ int L_coeff, R_coeff; @ @ calculates L_mat = L_coeff * L_mat + R_coeff * R_mat modulo L_mat->prime @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_add (L_mat, R_mat, L_coeff, R_coeff) @ matrix_TYP *L_mat, *R_mat ; @ rational L_coeff, R_coeff; @ @ calculates L_coeff * L_mat + R_coeff * R_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_addeq (L_mat, R_mat, L_coeff, R_coeff) @ matrix_TYP *L_mat, *R_mat ; @ rational L_coeff, R_coeff; @ @ calculates L_mat = L_coeff * L_mat + R_coeff * R_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: col_row_ops_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------- @ void row_per( M, i, j ); @ matrix_TYP *M; @ int i , j; @ @ swaps the i. and j. row by swapping the pointers of the 2-dim. array @--------------------------------------------------------------------- @------------------------------------------------------------------------ @ void col_per(M, i, j); @ @ same as row_per() for columns. @------------------------------------------------------------------------ @--------------------------------------------------------------------------- @ void row_add(M, i, j, fac) @ matrix_TYP *M; @ int i, j, fac; @ @ adds fac times the i-th row the the j-th @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ void row_col(M, i, j, fac) @ matrix_TYP *M; @ int i, j, fac; @ @ adds fac times the i-th col the the j-th @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ void row_mul(M, i, fac) @ matrix_TYP *M; @ int i, fac; @ @ multiplies the i-th row with fac @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ void col_mul(M, i, fac) @ matrix_TYP *M; @ int i, fac; @ @ multiplies the i-th col with fac @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: comp_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ @ compares the matrices A and B @ if the first nonzero entry of A-B is positive (A>B) the result is 1 @ if the first nonzero entry of A-B is negative (A<B) the result is -1 @ if A == B the result is 0. @ @ (the entries are assumed to be ordered in the following way: @ (i,j)< (k,l) iff i<k or i==k and j<l @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: construct_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ @ FILE: divide_by_gcd.c @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @ int divide_by_gcd(matrix_TYP *A) @ @ divides the entries of A->array.SZ by the positive gcd of it's entries, @ and returns this gcd. @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: elt_div_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @----------------------------------------------------------------- @ matrix_TYP *elt_div(Mat) @ matrix_TYP *Mat; @ @ computes elementary divisors of Mat. @ Result is a matrix with a single row that contains the @ divisors. @----------------------------------------------------------------- @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: find_max_entry.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int find_max_entry(mat) @ matrix_TYP *mat; @ @ calculates the maximal entry of mat->array.SZ @ if mat->array.Z != 0 or mat->prime != 0 the functions return 0. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: gauss_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @------------------------------------------------------------------- @ int tgauss(mat) @ @ Integral Gauss-algorithm where the matrix itself is changed @ The Return-value is the rank of the matrix. The matrix is not @ shrinked to its rank-size. @------------------------------------------------------------------- @--------------------------------------------------------------------------- @ int row_gauss(M) @ matrix_TYP *M; @ @ integral gauss applied to the rows of M, @ M is changed! @--------------------------------------------------------------------------- @ @------------------------------------------------------------------- @ matrix_TYP *ggauss(mat) @ matrix_TYP *mat; @ @ Integral Gauss-algorithm where a copy of mat is changed @ and the number of rows is shrinked to the rank of the matrix. @------------------------------------------------------------------- @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: inv_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *pmat_inv (mat) @ matrix_TYP *mat; @ @ calculates the inverse of mat modulo mat->prime @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_inv (mat) @ matrix_TYP *mat; @ @ calculates the inverse of mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: kgv2rat. @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ result = kgv2rat( matrix_TYP *mat ); @ @ changes an integral matrix or a matrix with mat->kgv != 1 @ to an rational matrix with allocated mat->array.N @ the integer 'result' is 0, if this worked, @ -1, if no storage for the matrix could be alloceted @ -2, if mat->prime != 0 @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ result = rat2kgv( matrix_TYP *mat ); @ @ changes a matrix with mat->array.N != NULL to a matrix @ with mat->kgv != 0 and mat->array.N = NULL @ The result is 0, if it worked and -2, if mat->prime != 0 @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: kron_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *kron_mat(A,B) @ matrix_TYP *A, *B; @ @ calculates the Kronecker product of the matrices A and B. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: modp_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ void modp_mat(M, p) @ matrix_TYP *M; @ int p; @ @ reduces the entries of M modulo p such -|p/2| < x < |p/2| @ for every entry x of M. @ if p = 2 or p = -2, the entries are 0 or 1. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: mul_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *pmat_mul (L_mat, R_mat) @ matrix_TYP *L_mat, *R_mat ; @ @ calculates L_mat * R_mat modulo L_mat->prime @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_mul (L_mat, R_mat) @ matrix_TYP *L_mat, *R_mat ; @ @ calculates L_mat * R_mat. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_muleq(L_mat,R_mat) @ matrix_TYP *L_mat, *R_mat; @ @ calculates L_mat = L_mat * R_mat. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_kon(L_mat,M_mat,R_mat) @ matrix_TYP *L_mat, *M_mat, *R_mat; @ @ calculates L_mat * M_mat * R_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: null_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int null_mat(mat) @ matrix_TYP *mat; @ @ Checks if the matrix has only 0 as entry. @ return 1 if yes, 0 otherwise. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int save_null_mat(mat) @ matrix_TYP *mat; @ @ The same as null_mat @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int quick_null_mat(mat) @ matrix_TYP *mat; @ @ Checks if the matrix has only 0 as entry using mat->flags. @ If for example mat->flags.Diagonal = 1 only the diagonal entries @ are checked to be 0. @ return 1 if yes, 0 otherwise. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: p_gauss_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int p_gauss (L_mat) @ matrix_TYP *L_mat ; @ @ applies a gauss algorithm to the rows of L_mat modulo L_mat->prime. @ The entries of the matrix are changed. @ The return is the rank of L_mat modulo L_mat->prime. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: p_lse_solve.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @ The function 'matrix_TYP **p_lse_solve(A, B, anz, p)' @ calculates for given matrices A and B the solutions of @ A * X = B (modulo p) @ where A is a (n x m)- matrix and B a (n x r) matrix with integral @ entries (treated as elements of the field with p elements). @ The number of the returned matrices is given back by the pointer 'anz'. @ @ If no solution exists a NULL-pointer is returned, and 'anz' is @ set to 0. @ @ If a solution of the inhomogenous equation exists, it is @ returned via the (m x r)-matrix X[0] ( X is the matrix_TYP ** returned by @ the functions. @ The (1 x m)-matrices X[1],...,X[anz-1] form a basis of the solutions of @ the transposed homogenous equation X * A^{tr} = 0. @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: p_mat_det.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int p_mat_det(Mat, prime) @ matrix_TYP *Mat; @ int prime; @ @ Calculates the determinant of Mat modulo prime. @ The entries of Mat are not changed. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: p_solve.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP **p_solve (anz, L_mat, R_mat, option) @ int *anz; @ matrix_TYP **L_mat, **R_mat ; @ int option; @ @ Solves L_mat[i] * X = X * R_mat[i] modulo act_prime simultaneous @ for 0 <= i<= anz. @ The return is a basis of the space of solution. @ the dimension of this space is returned by the pointer anz. @ @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: real_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @------------------------------------------------------------------------- @ void real_mat( mat, rows, cols); @ matrix_TYP *mat; @ int rows, cols; @ @ Generates form mat a matrix with 'rows' rows and 'cols' columns @ Therefore the matrix is shrinked or enlarged and filled up with zeros. @ @------------------------------------------------------------------------- @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: red_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @ @ boolean extension(Mat,Trf); @ @ Zusatzprogramm zu mat_red(): Ueberprueft bei M[i][i] = 2*M[i][j], ob @ eine Addition zu weiterer Reduzierung fuehren kann. @ @--------------------------------------------------------------------------- @ matrix_TYP *mat_red(Mat) @ matrix_TYP *Mat; @ @ applies a pair_reduction to the symmetric matrix Mat @ and returns the transformation matrix @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: scal_pr_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @------------------------------------------------------------------------- @ matrix_TYP *scal_pr ( vectors, form, truth ) @ matrix_TYP *vectors, *form ; @ boolean truth; @ @ Calculates: tr @ vectors * form * vectors @ vectors is supposed to be a matrix of row-vectors. @ form is supposed to be a symmetric bilinear form; if @ form == NULL, the standard scalar product is used. @ @ truth is an option to simplify the scalar-products for lattices @------------------------------------------------------------------------- @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: tools_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------- @ boolean iset_entry(mat, r, c, v); @ matrix_TYP *mat; @ int r,c; @ int v; @ @ Set an integer entry in the r-th row and c-th column of mat to v. @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ @ boolean rset_entry(mat, r, c, v); @ matrix_TYP *mat; @ int r, c; @ rational v; @ @ Set an rational entry in the r-th row and c-th column of mat to v @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ @ void iscal_mul(mat, v); @ matrix_TYP *mat; @ int v; @ @ Multiply matrix with integer scalar @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ @ void rscal_mul(mat,v); @ matrix_TYP *mat; @ rational v; @ @ Multiply matrix with rational scalar @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ @ boolean kill_row(mat, row); @ matrix_TYP *mat; @ int row; @ @ Kill one row in the matrix @ The argument 'row' must use the indexing of the matrix, ie. @ the rows are numbered from 0 to n-1. @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ @ boolean kill_col(mat, col); @ matrix_TYP *mat; @ int col; @ @ Kill one column in the matrix @ The argument 'col' must use the indexing of the matrix, ie. @ the cols are numbered from 0 to n-1. @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean ins_row(mat, row); @ matrix_TYP *mat; @ int row; @ @ Insert one row in the matrix @ The argument 'row' must use the indexing of the matrix, ie. @ the rows are numbered from 0 to n-1. @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean ins_col(mat, col); @ matrix_TYP *mat; @ int col; @ @ Insert one column in the matrix @ The argument 'col' must use the indexing of the matrix, ie. @ the cols are numbered from 0 to n-1. @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean imul_row(mat, row, v); @ matrix_TYP *mat; @ int row, v; @ @ Multiply row with an integer @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean rmul_row(mat, row, v); @ matrix_TYP *mat; @ int row; @ rational v; @ @ Multiply row with a rational @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @boolean imul_col(mat, col, v) @ matrix_TYP *mat; @ int col, v; @ @ Multiply col with an integer @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean rmul_col(mat, col, v); @ matrix_TYP *mat; @ int col; @ rational v; @ @ Multiply column with a rational @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean iadd_row(mat,t_row, d_row, v) @ matrix_TYP *mat; @ int t_row, d_row, v; @ @ Add v-times t_row to d_row of mat, where v is an integer @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean radd_row(mat,t_row, d_row, v) @ matrix_TYP *mat; @ int t_row, d_row; @ rational v; @ @ Add v-times t_row to d_row of mat, where v is a rational @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean iadd_col(mat,t_col, d_col, v) @ matrix_TYP *mat; @ int t_col, d_col, v; @ @ Add v-times t_col to d_col of mat, where v is an integer @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ boolean radd_col(mat,t_col, d_col, v) @ matrix_TYP *mat; @ int t_col, d_col; @ rational v; @ @ Add v-times t_col to d_col of mat, where v is a rational @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ void normal_rows(mat); @ matrix_TYP *mat; @ @ Tool for integral Gauss-elimination: the entries of the @ rows of mat are divided by their row-gcd. @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ void normal_cols(mat) @ @ Analogue to normal_rows() function for cols @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ matrix_TYP *mat_to_line(gen, num); @ matrix_TYP **gen; @ int num; @ @ matrix_TYP **gen; @ int num; @ @ converts each matrix of gen into a row-vector, forgets the kgv. @ the i-th matrix is converted to the i-th row of the result. @ Tool for determine a basis of a vector space of matrices @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ matrix_TYP **line_to_mat(mat,row,col) @ matrix_TYP *mat; @ int row, col; @ @ Inverse function to mat_to_line @ @------------------------------------------------------------------------- @------------------------------------------------------------------------- @ int normal_mat(mat); @ matrix_TYP *mat; @ @ Calculate ggt of mat-entries and divide matrix by it @ Return value is the ggt @ @------------------------------------------------------------------------- @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: tr_pose_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *tr_pose(mat) @ matrix_TYP *mat; @ @ calculates the tansposed of mat. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: trace_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ int trace(mat) @ matrix_TYP *mat; @ @ calculates the trace of mat. @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ FILE: unity_mat.c @--------------------------------------------------------------------------- @--------------------------------------------------------------------------- @ @--------------------------------------------------------------------------- @ matrix_TYP *einheitsmatrix(n) @ int n; @ @ returns the unity-matrix of rank n @--------------------------------------------------------------------------- @