56 #define swap(_i, _j) \
57 int __i = (_i), __j=(_j); \
62 for (
int i=0;
i< nm;
i++)
63 for (
int j=
i+1;
j< nm;
j++) {
67 for (
int i=nm;
i<
m;
i++)
68 for(
int j=0;
j<
n;
j++) {
72 for (
int i=nm;
i<
n;
i++)
73 for(
int j=0;
j<
m;
j++) {
120 return get(
index(i, j));
125 assume (i >= 0 && j >= 0);
147 for (
int i=0;
i <
l;
i++)
157 if (&lhr == &rhr) {
return true; }
158 if (lhr.
cols() != rhr.
cols()) {
return false; }
159 if (lhr.
rows() != rhr.
rows()) {
return false; }
164 for (
int i=0;
i <
l;
i++)
190 for (i=a->
rows()*a->
cols()-1;i>=0; i--)
191 bim->
rawset(i,
n_Add((*a)[i], (*b)[i], basecoeffs), basecoeffs);
201 number bb=
n_Init(b,basecoeffs);
208 bim->
rawset(i,
n_Add((*a)[i], bb, basecoeffs), basecoeffs);
226 for (i=a->
rows()*a->
cols()-1;i>=0; i--)
227 bim->
rawset(i,
n_Sub((*a)[i], (*b)[i], basecoeffs), basecoeffs);
237 number bb=
n_Init(b,basecoeffs);
244 bim->
rawset(i,
n_Sub((*a)[i], bb, basecoeffs), basecoeffs);
253 const int ca = a->
cols();
254 const int cb = b->
cols();
256 const int ra = a->
rows();
257 const int rb = b->
rows();
262 Werror(
"wrong bigintmat sizes at multiplication a * b: acols: %d != brows: %d\n", ca, rb);
279 for (i=1; i<=ra; i++)
280 for (j=1; j<=cb; j++)
282 sum =
n_Init(0, basecoeffs);
284 for (k=1; k<=ca; k++)
288 number sum2 =
n_Add(sum, prod, basecoeffs);
294 bim->
rawset(i, j, sum, basecoeffs);
305 number bb=
n_Init(b,basecoeffs);
312 bim->
rawset(i,
n_Mult((*a)[i], bb, basecoeffs), basecoeffs);
331 bim->
rawset(i,
n_Mult((*a)[i], b, basecoeffs), basecoeffs);
352 for (
int i=0;
i <
l;
i++)
366 WerrorS(
"wrong bigintmat comparison: different basecoeffs!\n");
369 if ((
col!=1) ||(op->
cols()!=1))
392 for (; i<op->
rows(); i++)
416 for(
int i=1;
i<=
m;
i++) {
418 for(
int j=1;
j<
n;
j++) {
452 int * colwid =
getwid(80);
455 WerrorS(
"not enough space to print bigintmat");
456 WerrorS(
"try string(...) for a unformatted output");
462 slength += colwid[
j]*
row;
464 ps = (
char*)
omAlloc0(
sizeof(
char)*(slength));
466 for (
int i=0;
i<col*
row;
i++)
471 const int _nl = strlen(ts);
473 if (_nl > colwid[cj])
479 int phl = strlen(ph);
480 if (phl > colwid[cj])
482 for (
int j=0;
j<colwid[cj]-1;
j++)
484 ps[pos+colwid[cj]-1] =
'*';
488 for (
int j=0;
j<colwid[cj]-phl;
j++)
490 for (
int j=0;
j<phl;
j++)
491 ps[pos+colwid[cj]-phl+
j] = ph[
j];
497 for (
int j=0;
j<(colwid[cj]-_nl);
j++)
499 for (
int j=0;
j<_nl;
j++)
500 ps[pos+colwid[cj]-_nl+
j] = ts[
j];
507 ps[pos+colwid[cj]] =
',';
508 ps[pos+colwid[cj]+1] =
'\n';
514 ps[pos+colwid[cj]] =
',';
528 for (
int i=0;
i<length;
i++)
537 for (
int i=0;
i<length;
i++)
552 for (
int i=0;
i<rows;
i++)
555 if ((a[index] > sndlong) && (a[index] < l))
557 min = floor(log10((
double)cols))+floor(log10((
double)rows))+5;
558 if ((a[index] < min) && (min < l))
566 min = floor(log10((
double)cols))+floor(log10((
double)rows))+5;
578 int const c = (
col-1)+1;
579 if (
col + c > maxwid-1)
return NULL;
590 const int _nl = strlen(tmp);
614 int * colwid =
getwid(maxwid);
617 WerrorS(
"not enough space to print bigintmat");
623 slength += colwid[
j]*
row;
625 ps = (
char*)
omAlloc0(
sizeof(
char)*(slength));
627 for (
int i=0;
i<col*
row;
i++)
632 const int _nl = strlen(ts);
634 if (_nl > colwid[cj])
640 int phl = strlen(ph);
641 if (phl > colwid[cj])
643 for (
int j=0;
j<colwid[cj]-1;
j++)
645 ps[pos+colwid[cj]-1] =
'*';
649 for (
int j=0;
j<colwid[cj]-phl;
j++)
651 for (
int j=0;
j<phl;
j++)
652 ps[pos+colwid[cj]-phl+
j] = ph[
j];
658 for (
int j=0;
j<colwid[cj]-_nl;
j++)
660 for (
int j=0;
j<_nl;
j++)
661 ps[pos+colwid[cj]-_nl+
j] = ts[
j];
668 ps[pos+colwid[cj]] =
',';
669 ps[pos+colwid[cj]+1] =
'\n';
675 ps[pos+colwid[cj]] =
',';
689 if ((i <=
col) && (j <=
col) && (i>0) && (j>0)) {
692 for (
int k=1;
k<=
row;
k++) {
704 if ((i <=
row) && (j <=
row) && (i>0) && (j>0)) {
707 for (
int k=1;
k<=
col;
k++) {
716 Werror(
"Error in swaprow");
721 for (
int j=1;
j<=
col;
j++) {
732 for (
int i=
row;
i>=1;
i--) {
746 Werror(
"Error in getcol. Dimensions must agree!");
752 for (
int i=1;
i<=
row;
i++) {
762 for (
int i=1;
i<=
row;
i++) {
771 for(
int ii=0; ii< no; ii++) {
772 for (
int i=1;
i<=
row;
i++) {
781 if ((i>
row) || (i<1)) {
782 Werror(
"Error in getrow: Index out of range!");
786 Werror(
"Error in getrow. Dimensions must agree!");
792 for (
int j=1;
j<=
col;
j++) {
802 for (
int j=1;
j<=
col;
j++) {
812 if ((j>
col) || (j<1)) {
813 Werror(
"Error in setcol: Index out of range!");
817 Werror(
"Error in setcol. Dimensions must agree!");
823 for (
int i=1;
i<=
row;
i++) {
833 for (
int i=1;
i<=
row;
i++) {
840 if ((j>
row) || (j<1)) {
841 Werror(
"Error in setrow: Index out of range!");
845 Werror(
"Error in setrow. Dimensions must agree!");
851 for (
int i=1;
i<=
col;
i++) {
861 for (
int i=1;
i<=
col;
i++) {
871 Werror(
"Error in bigintmat::add. Dimensions do not agree!");
875 Werror(
"Error in bigintmat::add. coeffs do not agree!");
878 for (
int i=1;
i<=
row;
i++) {
879 for (
int j=1;
j<=
col;
j++) {
889 Werror(
"Error in bigintmat::sub. Dimensions do not agree!");
893 Werror(
"Error in bigintmat::sub. coeffs do not agree!");
896 for (
int i=1;
i<=
row;
i++) {
897 for (
int j=1;
j<=
col;
j++) {
912 if (
n_IsOne(b,c))
return true;
913 for (
int i=1;
i<=
row;
i++)
915 for (
int j=1;
j<=
col;
j++)
927 if ((i>
col) || (j>
col) || (i<1) || (j<1)) {
928 Werror(
"Error in addcol: Index out of range!");
932 Werror(
"Error in addcol: coeffs do not agree!");
935 number t1, t2, t3, t4;
936 for (
int k=1;
k<=
row;
k++)
950 if ((i>
row) || (j>
row) || (i<1) || (j<1)) {
951 Werror(
"Error in addrow: Index out of range!");
955 Werror(
"Error in addrow: coeffs do not agree!");
958 number t1, t2, t3, t4;
959 for (
int k=1;
k<=
col;
k++)
974 for (
int j=1;
j<=
row;
j++) {
981 Werror(
"Error in colskalmult");
987 for (
int j=1;
j<=
col;
j++) {
994 Werror(
"Error in rowskalmult");
1003 if (!((
col == ay) && (
col == by) && (ax+bx ==
row))) {
1004 Werror(
"Error in concatrow. Dimensions must agree!");
1008 Werror(
"Error in concatrow. coeffs do not agree!");
1011 for (
int i=1;
i<=ax;
i++) {
1012 for (
int j=1;
j<=ay;
j++) {
1018 for (
int i=1;
i<=bx;
i++) {
1019 for (
int j=1;
j<=by;
j++) {
1058 for (
int i=1;
i<=ax;
i++) {
1059 for (
int j=1;
j<=ay;
j++) {
1064 for (
int i=1;
i<=bx;
i++) {
1065 for (
int j=1;
j<=by;
j++) {
1078 if (!(ax + bx ==
row)) {
1079 Werror(
"Error in splitrow. Dimensions must agree!");
1081 else if (!((
col == ay) && (
col == by))) {
1082 Werror(
"Error in splitrow. Dimensions must agree!");
1085 Werror(
"Error in splitrow. coeffs do not agree!");
1088 for(
int i = 1;
i<=ax;
i++) {
1089 for(
int j = 1;
j<=ay;
j++) {
1095 for (
int i =1;
i<=bx;
i++) {
1096 for (
int j=1;
j<=
col;
j++) {
1111 if (!((
row == ax) && (
row == bx))) {
1112 Werror(
"Error in splitcol. Dimensions must agree!");
1114 else if (!(ay+by ==
col)) {
1115 Werror(
"Error in splitcol. Dimensions must agree!");
1118 Werror(
"Error in splitcol. coeffs do not agree!");
1121 for (
int i=1;
i<=ax;
i++) {
1122 for (
int j=1;
j<=ay;
j++) {
1127 for (
int i=1;
i<=bx;
i++) {
1128 for (
int j=1;
j<=by;
j++) {
1139 Werror(
"Error in splitcol. Dimensions must agree!");
1143 Werror(
"Error in splitcol. coeffs do not agree!");
1146 int width = a->
cols();
1147 for (
int j=1;
j<=width;
j++) {
1148 for (
int k=1;
k<=
row;
k++) {
1149 tmp =
get(
k,
j+i-1);
1159 Werror(
"Error in Marco-splitrow");
1164 Werror(
"Error in splitrow. coeffs do not agree!");
1167 int height = a->
rows();
1168 for (
int j=1;
j<=height;
j++) {
1169 for (
int k=1;
k<=
col;
k++) {
1179 Werror(
"Error in bigintmat::copy. Dimensions do not agree!");
1183 Werror(
"Error in bigintmat::copy. coeffs do not agree!");
1187 for (
int i=1;
i<=
row;
i++)
1189 for (
int j=1;
j<=
col;
j++)
1205 for (
int i=1;
i<=
n;
i++)
1207 for (
int j=1;
j<=
m;
j++)
1209 t1 = B->
view(a+
i-1, b+
j-1);
1210 set(c+
i-1, d+
j-1, t1);
1219 for (
int i=1;
i<=
row;
i++) {
1220 for (
int j=1;
j<=
col;
j++) {
1240 for (
int i=1;
i<=
row;
i++) {
1241 for (
int j=1;
j<=
col;
j++) {
1256 for (
int i=1;
i<=
row;
i++) {
1257 for (
int j=1;
j<=
col;
j++) {
1265 for (
int i=1;
i<=
row;
i++) {
1266 for (
int j=1;
j<=
col;
j++) {
1283 if ((i<=0) || (i>
row) || (j<=0) || (j>
col))
1290 for (
int k=1;
k<=
row;
k++) {
1294 for (
int l=1;
l<=
col;
l++)
1320 number
det = this->
det();
1333 for (
int i=1;
i<=
col;
i++) {
1335 for (
int j=
i+1;
j<=
col;
j++) {
1348 for (
int j=1;
j<=
col;
j++) {
1350 for (
int i=1;
i<=2*
row;
i++) {
1367 for (
int i=1;
i<=
col;
i++) {
1381 for (
int j=1;
j<=
col;
j++) {
1391 number divisor = m->
get(
row+1, 1);
1401 number t =
get(1,1),
1404 for(
int i=2;
i<=
col;
i++) {
1424 number t1, t2, t3, t4;
1426 for (
int i=1;
i<=
row;
i++) {
1433 if ((
i+1)>>1<<1==(
i+1))
1455 for (
int i=1;
i<=
col;
i++) {
1456 temp = m->
get(
i,
i);
1510 int last_zero_col =
i-1;
1511 for (
int c =
cols(); c>0; c--) {
1517 addcol(last_zero_col, c, a, R);
1519 for(j = c-1; j>last_zero_col; j--) {
1520 for(k=
rows(); k>0; k--) {
1526 number
gcd, co1, co2, co3, co4;
1529 number q =
n_Div(
view(k, last_zero_col), gcd, R);
1531 addcol(last_zero_col, j, q, R);
1533 }
else if (
n_Equal(gcd,
view(k, last_zero_col), R)) {
1534 swap(last_zero_col, k);
1535 number q =
n_Div(
view(k, last_zero_col), gcd, R);
1537 addcol(last_zero_col, j, q, R);
1549 for(k=
rows(); k>0; k--) {
1552 if (k) last_zero_col--;
1583 number co1, co2, co3, co4;
1586 while ((i>0) && (j>0)) {
1592 for (
int l=1;
l<=j-1;
l++) {
1663 for (
int l=j+1;
l<=
col;
l++) {
1697 for (
int i=1;
i<=a->
rows();
i++)
1699 for (
int j=1;
j<=a->
cols();
j++)
1702 t2 =
f(t1, cold, cnew);
1726 C->
set(piv, piv, p, R);
1742 for (
int i=1;
i<=
row;
i++)
1744 for (
int j=1;
j<=
col;
j++)
1757 for (
int i=1;
i<=
row;
i++)
1770 for (
int i=1;
i<=
row;
i++)
1802 for (
int i=1;
i<=
row;
i++)
1804 for (
int j=1;
j<=
col;
j++)
1821 Werror(
"Error in bimMult. Coeffs do not agree!");
1825 Werror(
"Error in bimMult. Dimensions do not agree!");
1840 Print(
"reduce_mod_howell: A:\n");
1859 Print(
"\n****************************************\n");
1865 for(
int i=1;
i<= b->
cols();
i++) {
1866 int A_col = A->
cols();
1868 for(
int j = B->
rows();
j>0;
j--) {
1880 number Bj = B->
view(
j, 1);
1881 number q =
n_Div(Bj, Ai, R);
1903 Print(
"\n****************************************\n");
1912 number one =
n_Init(1, R);
1913 for(
int i=1;
i<= A->
cols();
i++)
1925 for(
int i=1;
i<= A->
rows();
i++) {
1926 for(
int j=1;
j<= A->
cols();
j++) {
1943 number dz =
f(d,
Q, Z),
1952 Print(
"den increasing to ");
1963 Print(
"bimFarey worked\n");
1978 number
p =
n_Init(536870909, R);
1993 for(i=1; i<= A->
cols(); i++) {
1994 for(j=
m->rows(); j>A->
cols(); j--) {
1995 if (!
n_IsZero(
m->view(j, i), Rp))
break;
1997 if (j>A->
cols())
break;
2016 number zero =
n_Init(0, R);
2029 Print(
"no solution, since no modular solution\n");
2071 fps_p->extendCols(kp->
cols());
2177 for(
int i=1;
i<= b->
cols();
i++) {
2178 int A_col = A->
cols();
2181 for(
int j = B->
rows();
j>0;
j--) {
2197 number Bj = B->
view(
j, 1);
2198 number
g =
n_Gcd(Bj, Ai, R);
2201 xi =
n_Div(Bj, Ai, R);
2203 number inc_d =
n_Div(Ai, g, R);
2207 xi =
n_Div(Bj, g, R);
2211 for(
int k=
j;
k>0;
k--) {
2236 for(i=1; i<= A->
cols(); i++) {
2237 for(j=m->
rows(); j>A->
cols(); j--) {
2240 if (j>A->
cols())
break;
2242 Print(
"Found nullity (kern dim) of %d\n", i-1);
2265 Print(
"Solve Ax=b for A=\n");
2291 Warn(
"have field, should use Gauss or better");
2293 if (R->cfXExtGcd && R->cfAnn) {
2296 Werror(
"have no solve algorithm");
2336 for(
int i=0;
i<a->
cols();
i++) {
2340 for (
int i=0;
i<a->
rows();
i++) {
2345 for(
int i=0;
i<a->
cols();
i++) {
2349 for(
int i=0;
i<a->
rows();
i++) {
2357 Print(
"X: %ld\n", X);
2359 Print(
"\nx: %ld\n", x);
2364 Print(
"\n2:X: %ld %ld %ld\n", X, *S, *T);
2366 Print(
"\n2:x: %ld\n", x);
2375 for(
int i=a->
rows(); diag &&
i>0; i--) {
2376 for(
int j=a->
cols();
j>0;
j--) {
2384 Print(
"Diag ? %d\n", diag);
2407 Print(
"Kernel of ");
2418 Print(
"\ndiag form: ");
2429 #define MIN(a,b) (a < b ? a : b)
2433 #define MAX(a,b) (a > b ? a : b)
2435 for(
int i=0;
i<rg;
i++) {
2440 for(
int i=rg;
i<m->
cols();
i++) {
2477 number
g =
get(1,1),
h;
2496 *d =
n_Div(*d, g, r);
void operator*=(int intop)
UEberladener *=-Operator (fuer int und bigint) Frage hier: *= verwenden oder lieber = und * einzeln...
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
void concatcol(bigintmat *a, bigintmat *b)
void skaldiv(number b)
Macht Ganzzahldivision aller Matrixeinträge mit b.
number view(int i, int j) const
view an entry an entry. NOTE: starts at [1,1]
static number solveAx_dixon(bigintmat *A, bigintmat *B, bigintmat *x, bigintmat *kern)
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
static int findLongest(int *a, int length)
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n) ...
int compare(const bigintmat *op) const
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
void splitcol(bigintmat *a, bigintmat *b)
... linken ... rechten ...
const CanonicalForm int s
void concatrow(bigintmat *a, bigintmat *b)
Fügt zwei Matrixen untereinander/nebeneinander in gegebene Matrix ein, bzw spaltet gegebenen Matrix a...
const CanonicalForm int const CFList const Variable & y
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
only used if HAVE_RINGS is defined: ?
void swaprow(int i, int j)
swap rows i and j
bigintmat * bimSub(bigintmat *a, bigintmat *b)
static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
number det()
det (via LaPlace in general, hnf for euc. rings)
static bigintmat * prependIdentity(bigintmat *A)
bool addcol(int i, int j, number a, coeffs c)
addiert a-faches der j-ten Spalte zur i-ten dazu
void colskaldiv(int j, number b)
Macht Ganzzahldivision aller j-ten Spalteneinträge mit b.
void getrow(int i, bigintmat *a)
Schreibt i-te Zeile in Vektor (Matrix) a.
only used if HAVE_RINGS is defined: ?
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static int min(int a, int b)
static int si_min(const int a, const int b)
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of 'a' and 'b'; replacement of 'a' by the product a*b
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
void inpTranspose()
transpose in place
void setcol(int j, bigintmat *m)
Setzt j-te Spalte gleich übergebenem Vektor (Matrix) m.
bigintmat * iv2bim(intvec *b, const coeffs C)
void appendCol(bigintmat *a)
horizontally join the matrices, m <- m|a
bool sub(bigintmat *b)
Subtrahiert ...
int isOne()
is matrix is identity
void rowskalmult(int i, number a, coeffs c)
... Zeile ...
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
const CanonicalForm CFMap CFMap int &both_non_zero int n
bigintmat * bimAdd(bigintmat *a, bigintmat *b)
Matrix-Add/-Sub/-Mult so oder mit operator+/-/* ? : NULL as a result means an error (non-compatible m...
void zero()
Setzt alle Einträge auf 0.
int findnonzero(int i)
find index of 1st non-zero entry in row i
char * StringAsPrinted()
Returns a string as it would have been printed in the interpreter.
number solveAx(bigintmat *A, bigintmat *b, bigintmat *x)
solve Ax=b*d. x needs to be pre-allocated to the same number of columns as b. the minimal denominator...
void getColRange(int j, int no, bigintmat *a)
copies the no-columns staring by j (so j...j+no-1) into the pre-allocated a
void setrow(int i, bigintmat *m)
Setzt i-te Zeile gleich übergebenem Vektor (Matrix) m.
void WerrorS(const char *s)
static int intArrSum(int *a, int length)
int findcolnonzero(int j)
find index of 1st non-zero entry in column j
static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
addition of 'a' and 'b'; replacement of 'a' by the sum a+b
static FORCE_INLINE void number2mpz(number n, coeffs c, mpz_t m)
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL ...
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
void Write()
IO: writes the matrix into the current internal string buffer which must be started/ allocated before...
int kernbase(bigintmat *a, bigintmat *c, number p, coeffs q)
a basis for the nullspace of a mod p: only used internally in Round2. Don't use it.
void rawset(int i, number n, const coeffs C=NULL)
replace an entry with the given number n (only delete old). NOTE: starts at [0]. Should be named set_...
int index(int r, int c) const
helper function to map from 2-dim coordinates, starting by 1 to 1-dim coordinate, starting by 0 ...
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
static coeffs numbercoeffs(number n, coeffs c)
create Z/nA of type n_Zn
intvec * bim2iv(bigintmat *b)
static int getShorter(int *a, int l, int j, int cols, int rows)
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ...
const CanonicalForm CFMap CFMap & N
void copySubmatInto(bigintmat *, int sr, int sc, int nr, int nc, int tr, int tc)
copy the submatrix of b, staring at (a,b) having n rows, m cols into the given matrix at pos...
bool addrow(int i, int j, number a, coeffs c)
... Zeile ...
only used if HAVE_RINGS is defined: ?
bigintmat * bimCopy(const bigintmat *b)
same as copy constructor - apart from it being able to accept NULL as input
bigintmat * bimMult(bigintmat *a, bigintmat *b)
static number bimFarey(bigintmat *A, number N, bigintmat *L)
static void reduce_mod_howell(bigintmat *A, bigintmat *b, bigintmat *eps, bigintmat *x)
void extendCols(int i)
append i zero-columns to the matrix
void swapMatrix(bigintmat *a)
The main handler for Singular numbers which are suitable for Singular polynomials.
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
void StringSetS(const char *st)
void StringAppendS(const char *st)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
void swap(int i, int j)
swap columns i and j
bool operator==(const bigintmat &lhr, const bigintmat &rhr)
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
void hnf()
transforms INPLACE to HNF
only used if HAVE_RINGS is defined: ?
void PrintS(const char *s)
static number solveAx_howell(bigintmat *A, bigintmat *b, bigintmat *x, bigintmat *kern)
void mod(number p, coeffs c)
Reduziert komplette Matrix modulo p.
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
bigintmat * bimChangeCoeff(bigintmat *a, coeffs cnew)
Liefert Kopier von Matrix a zurück, mit coeffs cnew statt den ursprünglichen.
void diagonalForm(bigintmat *A, bigintmat **S, bigintmat **T)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
void Print()
IO: simply prints the matrix to the current output (screen?)
static int index(p_Length length, p_Ord ord)
#define BIMATELEM(M, I, J)
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
number content()
the content, the gcd of all entries. Only makes sense for Euclidean rings (or possibly constructive P...
std::pair< ideal, ring > flip(const ideal I, const ring r, const gfan::ZVector interiorPoint, const gfan::ZVector facetNormal, const gfan::ZVector adjustedInteriorPoint, const gfan::ZVector adjustedFacetNormal)
bool operator!=(const bigintmat &lhr, const bigintmat &rhr)
void getcol(int j, bigintmat *a)
copies the j-th column into the matrix a - which needs to be pre-allocated with the correct size...
bigintmat * modhnf(number p, coeffs c)
computes HNF(this | p*I)
number trace()
the trace ....
void colskalmult(int i, number a, coeffs c)
Multipliziert zur i-ten Spalte den Skalar a hinzu.
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
coeffs basecoeffs() const
bool copy(bigintmat *b)
Kopiert Einträge von b auf Bigintmat.
void inpMult(number bintop, const coeffs C=NULL)
inplace versio of skalar mult. CHANGES input.
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1) ...
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
number hnfdet()
det via HNF Primzahlen als long long int, müssen noch in number umgewandelt werden?
bigintmat * elim(int i, int j)
Liefert Streichungsmatrix (i-te Zeile und j-te Spalte gestrichen) zurück.
void coltransform(int i, int j, number a, number b, number c, number d)
transforms cols (i,j) using the 2x2 matrix ((a,b)(c,d)) (hopefully)
void splitrow(bigintmat *a, bigintmat *b)
Speichert in Matrix a den oberen, in b den unteren Teil der Matrix, vorausgesetzt die Dimensionen sti...
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/
: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
number pseudoinv(bigintmat *a)
Speichert in Matrix a die Pseudoinverse, liefert den Nenner zurück.
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
void howell()
dito, but Howell form (only different for zero-divsors)
void nKillChar(coeffs r)
undo all initialisations
bool add(bigintmat *b)
Addiert zur Matrix die Matrix b dazu. Return false => an error occured.
void Werror(const char *fmt,...)
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
bool nCoeffs_are_equal(coeffs r, coeffs s)