Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563641 views
1
#include "typedef.h"
2
#include "gmp.h"
3
/* #include "gmp-impl.h" */
4
#include "longtools.h"
5
#include "matrix.h"
6
/**************************************************************************\
7
@---------------------------------------------------------------------------
8
@---------------------------------------------------------------------------
9
@ FILE: long_qbase.c
10
@---------------------------------------------------------------------------
11
@---------------------------------------------------------------------------
12
@
13
\**************************************************************************/
14
15
16
/**************************************************************************\
17
@---------------------------------------------------------------------------
18
@ matrix_TYP *long_qbase(Mat)
19
@ matrix_TYP *Mat;
20
@
21
@ long_qbase calculetes a matrix M1 with rows from Mat, such that
22
@ the rows of M1 form a qbase of the vectorspace generated by
23
@ the rows of Mat.
24
@---------------------------------------------------------------------------
25
@
26
\**************************************************************************/
27
matrix_TYP *long_qbase(Mat)
28
matrix_TYP *Mat;
29
{
30
int i,j, rang, neurang, n;
31
MP_INT **M;
32
matrix_TYP *erg;
33
34
n = Mat->cols;
35
if(Mat->rows < Mat->cols)
36
n = Mat->rows;
37
M = init_MP_mat(n, Mat->cols);
38
erg = init_mat(n, Mat->cols, "");
39
rang = 0;
40
for(i=0;i<Mat->rows && rang < n;i++)
41
{
42
for(j=0;j<Mat->cols;j++)
43
mpz_set_si(&M[rang][j], Mat->array.SZ[i][j]);
44
neurang = MP_row_gauss(M, rang+1, Mat->cols);
45
if(neurang != rang)
46
{
47
for(j=0;j<Mat->cols;j++)
48
erg->array.SZ[rang][j] = Mat->array.SZ[i][j];
49
rang++;
50
}
51
}
52
if(rang != n)
53
real_mat(erg, rang, Mat->cols);
54
free_MP_mat(M,n, Mat->cols);
55
free(M);
56
return(erg);
57
}
58
59