 |
My Project
debian-1:4.1.1-p2+ds-4build3
|
#include <coeffs/bigintmat.h>
|
| bigintmat () |
|
bigintmat * | transpose () |
|
void | inpTranspose () |
| transpose in place More...
|
|
| bigintmat (int r, int c, const coeffs n) |
| constructor: the r times c zero-matrix. Beware that the creation of a large zero matrix is expensive in terms of time and memory. More...
|
|
| bigintmat (const bigintmat *m) |
| copy constructor More...
|
|
number & | operator[] (int i) |
| dubious: 1-dim access to 2-dim array. Entries are read row by row. More...
|
|
const number & | operator[] (int i) const |
|
void | operator*= (int intop) |
| UEberladener *=-Operator (fuer int und bigint) Frage hier: *= verwenden oder lieber = und * einzeln? problem: what about non-commuting rings. Is this from left or right? More...
|
|
void | inpMult (number bintop, const coeffs C=NULL) |
| inplace version of skalar mult. CHANGES input. More...
|
|
int | length () |
|
int | cols () const |
|
int | rows () const |
|
coeffs | basecoeffs () const |
|
| ~bigintmat () |
| canonical destructor. More...
|
|
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 More...
|
|
number | get (int i, int j) const |
| get a copy of an entry. NOTE: starts at [1,1] More...
|
|
number | view (int i, int j) const |
| view an entry an entry. NOTE: starts at [1,1] More...
|
|
number | get (int i) const |
| get a copy of an entry. NOTE: starts at [0] More...
|
|
number | view (int i) const |
| view an entry. NOTE: starts at [0] More...
|
|
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] More...
|
|
void | set (int i, number n, const coeffs C=NULL) |
| replace an entry with a copy (delete old + copy new!). NOTE: starts at [0] More...
|
|
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_transfer More...
|
|
void | rawset (int i, int j, number n, const coeffs C=NULL) |
| as above, but the 2-dim version More...
|
|
char * | String () |
| IO: String returns a singular string containing the matrix, needs freeing afterwards. More...
|
|
void | Write () |
| IO: writes the matrix into the current internal string buffer which must be started/ allocated before (e.g. StringSetS) More...
|
|
void | Print () |
| IO: simply prints the matrix to the current output (screen?) More...
|
|
char * | StringAsPrinted () |
| Returns a string as it would have been printed in the interpreter. More...
|
|
void | pprint (int maxwid) |
|
int | compare (const bigintmat *op) const |
|
int * | getwid (int maxwid) |
|
void | swap (int i, int j) |
| swap columns i and j More...
|
|
void | swaprow (int i, int j) |
| swap rows i and j More...
|
|
int | findnonzero (int i) |
| find index of 1st non-zero entry in row i More...
|
|
int | findcolnonzero (int j) |
| find index of 1st non-zero entry in column j More...
|
|
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. More...
|
|
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 More...
|
|
void | getrow (int i, bigintmat *a) |
| Schreibt i-te Zeile in Vektor (Matrix) a. More...
|
|
void | setcol (int j, bigintmat *m) |
| Setzt j-te Spalte gleich übergebenem Vektor (Matrix) m. More...
|
|
void | setrow (int i, bigintmat *m) |
| Setzt i-te Zeile gleich übergebenem Vektor (Matrix) m. More...
|
|
void | appendCol (bigintmat *a) |
| horizontally join the matrices, m <- m|a More...
|
|
void | extendCols (int i) |
| append i zero-columns to the matrix More...
|
|
bool | add (bigintmat *b) |
| Addiert zur Matrix die Matrix b dazu. Return false => an error occurred. More...
|
|
bool | sub (bigintmat *b) |
| Subtrahiert ... More...
|
|
bool | skalmult (number b, coeffs c) |
| Multipliziert zur Matrix den Skalar b hinzu. More...
|
|
bool | addcol (int i, int j, number a, coeffs c) |
| addiert a-faches der j-ten Spalte zur i-ten dazu More...
|
|
bool | addrow (int i, int j, number a, coeffs c) |
| ... Zeile ... More...
|
|
void | colskalmult (int i, number a, coeffs c) |
| Multipliziert zur i-ten Spalte den Skalar a hinzu. More...
|
|
void | rowskalmult (int i, number a, coeffs c) |
| ... Zeile ... More...
|
|
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) More...
|
|
void | concatrow (bigintmat *a, bigintmat *b) |
| Fügt zwei Matrixen untereinander/nebeneinander in gegebene Matrix ein, bzw spaltet gegebenen Matrix auf. More...
|
|
void | concatcol (bigintmat *a, bigintmat *b) |
|
void | splitrow (bigintmat *a, bigintmat *b) |
| Speichert in Matrix a den oberen, in b den unteren Teil der Matrix, vorausgesetzt die Dimensionen stimmen überein. More...
|
|
void | splitcol (bigintmat *a, bigintmat *b) |
| ... linken ... rechten ... More...
|
|
void | splitcol (bigintmat *a, int i) |
| Speichert die ersten i Spalten als Teilmatrix in a. More...
|
|
void | splitrow (bigintmat *a, int i) |
| ... Zeilen ... More...
|
|
bool | copy (bigintmat *b) |
| Kopiert Einträge von b auf Bigintmat. More...
|
|
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. (c,d) needs c+n, d+m <= rows, cols a+n, b+m <= b.rows(), b.cols() More...
|
|
void | one () |
| Macht Matrix (Falls quadratisch) zu Einheitsmatrix. More...
|
|
int | isOne () |
| is matrix is identity More...
|
|
void | zero () |
| Setzt alle Einträge auf 0. More...
|
|
int | isZero () |
|
int | colIsZero (int i) |
|
bigintmat * | elim (int i, int j) |
| Liefert Streichungsmatrix (i-te Zeile und j-te Spalte gestrichen) zurück. More...
|
|
number | pseudoinv (bigintmat *a) |
| Speichert in Matrix a die Pseudoinverse, liefert den Nenner zurück. More...
|
|
number | trace () |
| the trace .... More...
|
|
number | det () |
| det (via LaPlace in general, hnf for euc. rings) More...
|
|
number | hnfdet () |
| det via HNF Primzahlen als long long int, müssen noch in number umgewandelt werden? More...
|
|
void | hnf () |
| transforms INPLACE to HNF More...
|
|
void | howell () |
| dito, but Howell form (only different for zero-divsors) More...
|
|
void | swapMatrix (bigintmat *a) |
|
bigintmat * | modhnf (number p, coeffs c) |
| computes HNF(this | p*I) More...
|
|
bigintmat * | modgauss (number p, coeffs c) |
|
void | skaldiv (number b) |
| Macht Ganzzahldivision aller Matrixeinträge mit b. More...
|
|
void | colskaldiv (int j, number b) |
| Macht Ganzzahldivision aller j-ten Spalteneinträge mit b. More...
|
|
void | mod (number p) |
| Reduziert komplette Matrix modulo p. More...
|
|
bigintmat * | inpmod (number p, coeffs c) |
| Liefert Kopie der Matrix zurück, allerdings im Ring Z modulo p. More...
|
|
number | content () |
| the content, the gcd of all entries. Only makes sense for Euclidean rings (or possibly constructive PIR) More...
|
|
void | simplifyContentDen (number *den) |
| ensures that Gcd(den, content)=1 enden hier wieder More...
|
|
Matrices of numbers
Matrices are stored as 1-dim c-arrays but interpreted 2-dim as matrices. Both modes of addressing are supported, note however, that the 1-dim adressing starts at 0, the 2-dim at 1.
Matrices are meant to represent column modules, thus the default operations are always by column.
While basic operations are supported over any ring (coeff), some more advanced ones require more special rings: eg. echelon forms, solving of linear equations is only effective over principal ideal or even Euclidean rings.
Be careful with the get/set/view/rawset functions to understand which arguments are copied/ deleted or only assigned.
@Note: no reference counting here!
Definition at line 51 of file bigintmat.h.
◆ bigintmat() [1/3]
◆ bigintmat() [2/3]
constructor: the r times c zero-matrix. Beware that the creation of a large zero matrix is expensive in terms of time and memory.
Definition at line 70 of file bigintmat.h.
82 for (
int i =
l - 1;
i>=0;
i--)
◆ bigintmat() [3/3]
copy constructor
Definition at line 90 of file bigintmat.h.
105 for (
int i =
l-1;
i>=0;
i--)
◆ ~bigintmat()
bigintmat::~bigintmat |
( |
| ) |
|
|
inline |
◆ add()
Addiert zur Matrix die Matrix b dazu. Return false => an error occurred.
Definition at line 895 of file bigintmat.cc.
897 if ((
b->rows() !=
row) || (
b->cols() !=
col))
899 WerrorS(
"Error in bigintmat::add. Dimensions do not agree!");
904 WerrorS(
"Error in bigintmat::add. coeffs do not agree!");
907 for (
int i=1;
i<=
row;
i++)
909 for (
int j=1;
j<=
col;
j++)
◆ addcol()
bool bigintmat::addcol |
( |
int |
i, |
|
|
int |
j, |
|
|
number |
a, |
|
|
coeffs |
c |
|
) |
| |
addiert a-faches der j-ten Spalte zur i-ten dazu
Definition at line 960 of file bigintmat.cc.
964 WerrorS(
"Error in addcol: Index out of range!");
969 WerrorS(
"Error in addcol: coeffs do not agree!");
973 for (
int k=1;
k<=
row;
k++)
◆ addrow()
bool bigintmat::addrow |
( |
int |
i, |
|
|
int |
j, |
|
|
number |
a, |
|
|
coeffs |
c |
|
) |
| |
... Zeile ...
Definition at line 984 of file bigintmat.cc.
988 WerrorS(
"Error in addrow: Index out of range!");
993 WerrorS(
"Error in addrow: coeffs do not agree!");
997 for (
int k=1;
k<=
col;
k++)
◆ appendCol()
horizontally join the matrices, m <- m|a
Definition at line 1084 of file bigintmat.cc.
◆ basecoeffs()
coeffs bigintmat::basecoeffs |
( |
| ) |
const |
|
inline |
◆ colIsZero()
int bigintmat::colIsZero |
( |
int |
i | ) |
|
◆ cols()
int bigintmat::cols |
( |
| ) |
const |
|
inline |
◆ colskaldiv()
void bigintmat::colskaldiv |
( |
int |
j, |
|
|
number |
b |
|
) |
| |
Macht Ganzzahldivision aller j-ten Spalteneinträge mit b.
Definition at line 1877 of file bigintmat.cc.
1880 for (
int i=1;
i<=
row;
i++)
◆ colskalmult()
void bigintmat::colskalmult |
( |
int |
i, |
|
|
number |
a, |
|
|
coeffs |
c |
|
) |
| |
Multipliziert zur i-ten Spalte den Skalar a hinzu.
Definition at line 1008 of file bigintmat.cc.
1013 for (
int j=1;
j<=
row;
j++)
1021 WerrorS(
"Error in colskalmult");
◆ coltransform()
void bigintmat::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)
Definition at line 1890 of file bigintmat.cc.
1893 for (
int i=1;
i<=
row;
i++)
◆ compare()
Definition at line 362 of file bigintmat.cc.
368 WerrorS(
"wrong bigintmat comparison: different basecoeffs!\n");
371 if ((
col!=1) ||(op->
cols()!=1))
◆ concatcol()
Definition at line 1099 of file bigintmat.cc.
1110 for (
int i=1;
i<=ax;
i++)
1112 for (
int j=1;
j<=ay;
j++)
1118 for (
int i=1;
i<=bx;
i++)
1120 for (
int j=1;
j<=by;
j++)
◆ concatrow()
Fügt zwei Matrixen untereinander/nebeneinander in gegebene Matrix ein, bzw spaltet gegebenen Matrix auf.
Definition at line 1040 of file bigintmat.cc.
1047 if (!((
col == ay) && (
col == by) && (ax+bx ==
row)))
1049 WerrorS(
"Error in concatrow. Dimensions must agree!");
1054 WerrorS(
"Error in concatrow. coeffs do not agree!");
1057 for (
int i=1;
i<=ax;
i++)
1059 for (
int j=1;
j<=ay;
j++)
1066 for (
int i=1;
i<=bx;
i++)
1068 for (
int j=1;
j<=by;
j++)
◆ content()
number bigintmat::content |
( |
| ) |
|
the content, the gcd of all entries. Only makes sense for Euclidean rings (or possibly constructive PIR)
Definition at line 2676 of file bigintmat.cc.
2679 number
g =
get(1,1),
h;
◆ copy()
Kopiert Einträge von b auf Bigintmat.
Definition at line 1260 of file bigintmat.cc.
1262 if ((
b->rows() !=
row) || (
b->cols() !=
col))
1264 WerrorS(
"Error in bigintmat::copy. Dimensions do not agree!");
1269 WerrorS(
"Error in bigintmat::copy. coeffs do not agree!");
1273 for (
int i=1;
i<=
row;
i++)
1275 for (
int j=1;
j<=
col;
j++)
◆ copySubmatInto()
void bigintmat::copySubmatInto |
( |
bigintmat * |
B, |
|
|
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. (c,d) needs c+n, d+m <= rows, cols a+n, b+m <= b.rows(), b.cols()
Definition at line 1288 of file bigintmat.cc.
1291 for (
int i=1;
i<=n;
i++)
1293 for (
int j=1;
j<=
m;
j++)
1295 t1 =
B->view(a+
i-1,
b+
j-1);
1296 set(c+
i-1, d+
j-1, t1);
◆ det()
number bigintmat::det |
( |
| ) |
|
det (via LaPlace in general, hnf for euc. rings)
Definition at line 1513 of file bigintmat.cc.
1525 number t1, t2, t3, t4;
1527 for (
int i=1;
i<=
row;
i++) {
1534 if ((
i+1)>>1<<1==(
i+1))
◆ elim()
Liefert Streichungsmatrix (i-te Zeile und j-te Spalte gestrichen) zurück.
Definition at line 1382 of file bigintmat.cc.
1391 for (
int k=1;
k<=
row;
k++) {
1395 for (
int l=1;
l<=
col;
l++)
◆ extendCols()
void bigintmat::extendCols |
( |
int |
i | ) |
|
append i zero-columns to the matrix
Definition at line 1077 of file bigintmat.cc.
◆ findcolnonzero()
int bigintmat::findcolnonzero |
( |
int |
j | ) |
|
find index of 1st non-zero entry in column j
Definition at line 736 of file bigintmat.cc.
738 for (
int i=
row;
i>=1;
i--)
◆ findnonzero()
int bigintmat::findnonzero |
( |
int |
i | ) |
|
find index of 1st non-zero entry in row i
Definition at line 724 of file bigintmat.cc.
726 for (
int j=1;
j<=
col;
j++)
◆ get() [1/2]
number bigintmat::get |
( |
int |
i | ) |
const |
get a copy of an entry. NOTE: starts at [0]
Definition at line 103 of file bigintmat.cc.
◆ get() [2/2]
number bigintmat::get |
( |
int |
i, |
|
|
int |
j |
|
) |
| const |
get a copy of an entry. NOTE: starts at [1,1]
Definition at line 119 of file bigintmat.cc.
◆ getcol()
void bigintmat::getcol |
( |
int |
j, |
|
|
bigintmat * |
a |
|
) |
| |
copies the j-th column into the matrix a - which needs to be pre-allocated with the correct size.
Definition at line 748 of file bigintmat.cc.
754 WerrorS(
"Error in getcol. Dimensions must agree!");
◆ getColRange()
void bigintmat::getColRange |
( |
int |
j, |
|
|
int |
no, |
|
|
bigintmat * |
a |
|
) |
| |
copies the no-columns staring by j (so j...j+no-1) into the pre-allocated a
Definition at line 779 of file bigintmat.cc.
782 for(
int ii=0; ii< no; ii++)
◆ getrow()
void bigintmat::getrow |
( |
int |
i, |
|
|
bigintmat * |
a |
|
) |
| |
Schreibt i-te Zeile in Vektor (Matrix) a.
Definition at line 792 of file bigintmat.cc.
794 if ((
i>
row) || (
i<1))
796 WerrorS(
"Error in getrow: Index out of range!");
801 WerrorS(
"Error in getrow. Dimensions must agree!");
◆ getwid()
int * bigintmat::getwid |
( |
int |
maxwid | ) |
|
Definition at line 580 of file bigintmat.cc.
582 int const c = (
col-1)+1;
593 const int _nl = strlen(tmp);
◆ hnf()
transforms INPLACE to HNF
Definition at line 1661 of file bigintmat.cc.
1684 number co1, co2, co3, co4;
1687 while ((
i>0) && (
j>0))
1697 for (
int l=1;
l<=
j-1;
l++)
◆ hnfdet()
number bigintmat::hnfdet |
( |
| ) |
|
det via HNF Primzahlen als long long int, müssen noch in number umgewandelt werden?
Definition at line 1546 of file bigintmat.cc.
1556 for (
int i=1;
i<=
col;
i++) {
1557 temp =
m->get(
i,
i);
◆ howell()
void bigintmat::howell |
( |
| ) |
|
dito, but Howell form (only different for zero-divsors)
Definition at line 1586 of file bigintmat.cc.
1611 int last_zero_col =
i-1;
1612 for (
int c =
cols(); c>0; c--) {
1618 addcol(last_zero_col, c, a,
R);
1620 for(
j = c-1;
j>last_zero_col;
j--) {
1627 number
gcd, co1, co2, co3, co4;
1635 swap(last_zero_col,
k);
1653 if (
k) last_zero_col--;
◆ index()
int bigintmat::index |
( |
int |
r, |
|
|
int |
c |
|
) |
| const |
|
inline |
helper function to map from 2-dim coordinates, starting by 1 to 1-dim coordinate, starting by 0
Definition at line 162 of file bigintmat.h.
169 const int index = ((r-1)*
cols() + (c-1));
◆ inpmod()
Liefert Kopie der Matrix zurück, allerdings im Ring Z modulo p.
◆ inpMult()
inplace version of skalar mult. CHANGES input.
Definition at line 145 of file bigintmat.cc.
151 for (
int i=0;
i <
l;
i++)
◆ inpTranspose()
void bigintmat::inpTranspose |
( |
| ) |
|
transpose in place
Definition at line 50 of file bigintmat.cc.
57 #define swap(_i, _j) \
58 int __i = (_i), __j=(_j); \
63 for (
int i=0;
i< nm;
i++)
64 for (
int j=
i+1;
j< nm;
j++)
69 for (
int i=nm;
i<
m;
i++)
70 for(
int j=0;
j<n;
j++)
75 for (
int i=nm;
i<n;
i++)
76 for(
int j=0;
j<
m;
j++)
◆ isOne()
◆ isZero()
int bigintmat::isZero |
( |
| ) |
|
◆ length()
int bigintmat::length |
( |
| ) |
|
|
inline |
◆ mod()
void bigintmat::mod |
( |
number |
p | ) |
|
◆ modgauss()
◆ modhnf()
◆ one()
◆ operator*=()
void bigintmat::operator*= |
( |
int |
intop | ) |
|
UEberladener *=-Operator (fuer int und bigint) Frage hier: *= verwenden oder lieber = und * einzeln? problem: what about non-commuting rings. Is this from left or right?
Definition at line 136 of file bigintmat.cc.
◆ operator[]() [1/2]
number& bigintmat::operator[] |
( |
int |
i | ) |
|
|
inline |
dubious: 1-dim access to 2-dim array. Entries are read row by row.
Definition at line 112 of file bigintmat.h.
117 Werror(
"wrong bigintmat index:%d\n",
i);
◆ operator[]() [2/2]
const number& bigintmat::operator[] |
( |
int |
i | ) |
const |
|
inline |
◆ pprint()
void bigintmat::pprint |
( |
int |
maxwid | ) |
|
Definition at line 611 of file bigintmat.cc.
617 int * colwid =
getwid(maxwid);
621 slength += colwid[
j]*
row;
623 ps = (
char*)
omAlloc0(
sizeof(
char)*(slength));
630 const int _nl = strlen(ts);
632 if (_nl > colwid[cj])
638 int phl = strlen(ph);
639 if (phl > colwid[cj])
641 for (
int j=0;
j<colwid[cj]-1;
j++)
643 ps[pos+colwid[cj]-1] =
'*';
647 for (
int j=0;
j<colwid[cj]-phl;
j++)
649 for (
int j=0;
j<phl;
j++)
650 ps[pos+colwid[cj]-phl+
j] = ph[
j];
656 for (
int j=0;
j<colwid[cj]-_nl;
j++)
658 for (
int j=0;
j<_nl;
j++)
659 ps[pos+colwid[cj]-_nl+
j] = ts[
j];
666 ps[pos+colwid[cj]] =
',';
667 ps[pos+colwid[cj]+1] =
'\n';
673 ps[pos+colwid[cj]] =
',';
◆ Print()
void bigintmat::Print |
( |
| ) |
|
IO: simply prints the matrix to the current output (screen?)
Definition at line 443 of file bigintmat.cc.
◆ pseudoinv()
Speichert in Matrix a die Pseudoinverse, liefert den Nenner zurück.
Definition at line 1416 of file bigintmat.cc.
1421 number
det = this->
det();
1428 m->concatrow(a,
this);
1434 for (
int i=1;
i<=
col;
i++) {
1436 for (
int j=
i+1;
j<=
col;
j++) {
1449 for (
int j=1;
j<=
col;
j++) {
1451 for (
int i=1;
i<=2*
row;
i++) {
1460 m->colskaldiv(
j,
g);
1468 for (
int i=1;
i<=
col;
i++) {
1482 for (
int j=1;
j<=
col;
j++) {
1492 number divisor =
m->get(
row+1, 1);
◆ rawset() [1/2]
as above, but the 2-dim version
Definition at line 217 of file bigintmat.h.
◆ rawset() [2/2]
replace an entry with the given number n (only delete old). NOTE: starts at [0]. Should be named set_transfer
Definition at line 197 of file bigintmat.h.
211 Werror(
"wrong bigintmat index:%d\n",
i);
◆ rows()
int bigintmat::rows |
( |
| ) |
const |
|
inline |
◆ rowskalmult()
void bigintmat::rowskalmult |
( |
int |
i, |
|
|
number |
a, |
|
|
coeffs |
c |
|
) |
| |
◆ set() [1/2]
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition at line 95 of file bigintmat.cc.
◆ set() [2/2]
replace an entry with a copy (delete old + copy new!). NOTE: starts at [0]
Definition at line 87 of file bigintmat.cc.
◆ setcol()
void bigintmat::setcol |
( |
int |
j, |
|
|
bigintmat * |
m |
|
) |
| |
Setzt j-te Spalte gleich übergebenem Vektor (Matrix) m.
Definition at line 827 of file bigintmat.cc.
829 if ((
j>
col) || (
j<1))
831 WerrorS(
"Error in setcol: Index out of range!");
834 if (((
m->rows() !=
row) || (
m->cols() != 1)) && ((
m->rows() != 1) || (
m->cols() !=
row)))
836 WerrorS(
"Error in setcol. Dimensions must agree!");
843 for (
int i=1;
i<=
row;
i++)
854 for (
int i=1;
i<=
row;
i++)
◆ setrow()
void bigintmat::setrow |
( |
int |
i, |
|
|
bigintmat * |
m |
|
) |
| |
Setzt i-te Zeile gleich übergebenem Vektor (Matrix) m.
Definition at line 861 of file bigintmat.cc.
863 if ((
j>
row) || (
j<1))
865 WerrorS(
"Error in setrow: Index out of range!");
868 if (((
m->rows() != 1) || (
m->cols() !=
col)) && ((
m->rows() !=
col) || (
m->cols() != 1)))
870 WerrorS(
"Error in setrow. Dimensions must agree!");
877 for (
int i=1;
i<=
col;
i++)
888 for (
int i=1;
i<=
col;
i++)
◆ simplifyContentDen()
void bigintmat::simplifyContentDen |
( |
number * |
den | ) |
|
ensures that Gcd(den, content)=1 enden hier wieder
Definition at line 2689 of file bigintmat.cc.
◆ skaldiv()
void bigintmat::skaldiv |
( |
number |
b | ) |
|
Macht Ganzzahldivision aller Matrixeinträge mit b.
Definition at line 1862 of file bigintmat.cc.
1865 for (
int i=1;
i<=
row;
i++)
1867 for (
int j=1;
j<=
col;
j++)
◆ skalmult()
bool bigintmat::skalmult |
( |
number |
b, |
|
|
coeffs |
c |
|
) |
| |
◆ splitcol() [1/2]
... linken ... rechten ...
Definition at line 1170 of file bigintmat.cc.
1177 if (!((
row == ax) && (
row == bx)))
1179 WerrorS(
"Error in splitcol. Dimensions must agree!");
1181 else if (!(ay+by ==
col))
1183 WerrorS(
"Error in splitcol. Dimensions must agree!");
1187 WerrorS(
"Error in splitcol. coeffs do not agree!");
1191 for (
int i=1;
i<=ax;
i++)
1193 for (
int j=1;
j<=ay;
j++)
1199 for (
int i=1;
i<=bx;
i++)
1201 for (
int j=1;
j<=by;
j++)
◆ splitcol() [2/2]
void bigintmat::splitcol |
( |
bigintmat * |
a, |
|
|
int |
i |
|
) |
| |
Speichert die ersten i Spalten als Teilmatrix in a.
Definition at line 1210 of file bigintmat.cc.
1215 WerrorS(
"Error in splitcol. Dimensions must agree!");
1220 WerrorS(
"Error in splitcol. coeffs do not agree!");
1223 int width = a->
cols();
1224 for (
int j=1;
j<=width;
j++)
1226 for (
int k=1;
k<=
row;
k++)
◆ splitrow() [1/2]
Speichert in Matrix a den oberen, in b den unteren Teil der Matrix, vorausgesetzt die Dimensionen stimmen überein.
Definition at line 1128 of file bigintmat.cc.
1135 if (!(ax + bx ==
row))
1137 WerrorS(
"Error in splitrow. Dimensions must agree!");
1139 else if (!((
col == ay) && (
col == by)))
1141 WerrorS(
"Error in splitrow. Dimensions must agree!");
1145 WerrorS(
"Error in splitrow. coeffs do not agree!");
1149 for(
int i = 1;
i<=ax;
i++)
1151 for(
int j = 1;
j<=ay;
j++)
1158 for (
int i =1;
i<=bx;
i++)
◆ splitrow() [2/2]
void bigintmat::splitrow |
( |
bigintmat * |
a, |
|
|
int |
i |
|
) |
| |
... Zeilen ...
Definition at line 1235 of file bigintmat.cc.
1240 WerrorS(
"Error in Marco-splitrow");
1246 WerrorS(
"Error in splitrow. coeffs do not agree!");
1249 int height = a->
rows();
1250 for (
int j=1;
j<=height;
j++)
1252 for (
int k=1;
k<=
col;
k++)
◆ String()
char * bigintmat::String |
( |
| ) |
|
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition at line 436 of file bigintmat.cc.
◆ StringAsPrinted()
char * bigintmat::StringAsPrinted |
( |
| ) |
|
Returns a string as it would have been printed in the interpreter.
Used e.g. in print functions of various blackbox types.
Definition at line 451 of file bigintmat.cc.
457 int * colwid =
getwid(80);
460 WerrorS(
"not enough space to print bigintmat");
461 WerrorS(
"try string(...) for a unformatted output");
467 slength += colwid[
j]*
row;
469 ps = (
char*)
omAlloc0(
sizeof(
char)*(slength));
476 const int _nl = strlen(ts);
478 if (_nl > colwid[cj])
484 int phl = strlen(ph);
485 if (phl > colwid[cj])
487 for (
int j=0;
j<colwid[cj]-1;
j++)
489 ps[pos+colwid[cj]-1] =
'*';
493 for (
int j=0;
j<colwid[cj]-phl;
j++)
495 for (
int j=0;
j<phl;
j++)
496 ps[pos+colwid[cj]-phl+
j] = ph[
j];
502 for (
int j=0;
j<(colwid[cj]-_nl);
j++)
504 for (
int j=0;
j<_nl;
j++)
505 ps[pos+colwid[cj]-_nl+
j] = ts[
j];
512 ps[pos+colwid[cj]] =
',';
513 ps[pos+colwid[cj]+1] =
'\n';
519 ps[pos+colwid[cj]] =
',';
◆ sub()
Subtrahiert ...
Definition at line 917 of file bigintmat.cc.
919 if ((
b->rows() !=
row) || (
b->cols() !=
col))
921 WerrorS(
"Error in bigintmat::sub. Dimensions do not agree!");
926 WerrorS(
"Error in bigintmat::sub. coeffs do not agree!");
929 for (
int i=1;
i<=
row;
i++)
931 for (
int j=1;
j<=
col;
j++)
◆ swap()
void bigintmat::swap |
( |
int |
i, |
|
|
int |
j |
|
) |
| |
◆ swapMatrix()
◆ swaprow()
void bigintmat::swaprow |
( |
int |
i, |
|
|
int |
j |
|
) |
| |
◆ trace()
number bigintmat::trace |
( |
| ) |
|
◆ transpose()
◆ view() [1/2]
number bigintmat::view |
( |
int |
i | ) |
const |
view an entry. NOTE: starts at [0]
Definition at line 111 of file bigintmat.cc.
◆ view() [2/2]
number bigintmat::view |
( |
int |
i, |
|
|
int |
j |
|
) |
| const |
view an entry an entry. NOTE: starts at [1,1]
Definition at line 127 of file bigintmat.cc.
◆ Write()
void bigintmat::Write |
( |
| ) |
|
IO: writes the matrix into the current internal string buffer which must be started/ allocated before (e.g. StringSetS)
Definition at line 413 of file bigintmat.cc.
418 for(
int i=1;
i<=
m;
i++)
421 for(
int j=1;
j< n;
j++)
◆ zero()
◆ col
◆ m_coeffs
◆ row
The documentation for this class was generated from the following files:
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
void appendCol(bigintmat *a)
horizontally join the matrices, m <- m|a
static int si_min(const int a, const int b)
static int findLongest(int *a, int length)
@ n_Zn
only used if HAVE_RINGS is defined
bigintmat * elim(int i, int j)
Liefert Streichungsmatrix (i-te Zeile und j-te Spalte gestrichen) zurück.
void StringAppendS(const char *st)
bool addcol(int i, int j, number a, coeffs c)
addiert a-faches der j-ten Spalte zur i-ten dazu
static FORCE_INLINE number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
void concatcol(bigintmat *a, bigintmat *b)
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
void Write()
IO: writes the matrix into the current internal string buffer which must be started/ allocated before...
static int intArrSum(int *a, int length)
void zero()
Setzt alle Einträge auf 0.
void inpMult(number bintop, const coeffs C=NULL)
inplace version of skalar mult. CHANGES input.
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
number view(int i, int j) const
view an entry an entry. NOTE: starts at [1,1]
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
coeffs basecoeffs() const
bool nCoeffs_are_equal(coeffs r, coeffs s)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
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 FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
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...
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
void colskalmult(int i, number a, coeffs c)
Multipliziert zur i-ten Spalte den Skalar a hinzu.
number det()
det (via LaPlace in general, hnf for euc. rings)
void hnf()
transforms INPLACE to HNF
void skaldiv(number b)
Macht Ganzzahldivision aller Matrixeinträge mit b.
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
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 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
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
int findnonzero(int i)
find index of 1st non-zero entry in row i
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
void PrintS(const char *s)
#define omFreeSize(addr, size)
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]
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
@ n_Z
only used if HAVE_RINGS is defined
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 FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
void Print()
IO: simply prints the matrix to the current output (screen?)
static coeffs numbercoeffs(number n, coeffs c)
create Z/nA of type n_Zn
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)
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
void StringSetS(const char *st)
static int getShorter(int *a, int l, int j, int cols, int rows)
void colskaldiv(int j, number b)
Macht Ganzzahldivision aller j-ten Spalteneinträge mit b.
void Werror(const char *fmt,...)
void swap(int i, int j)
swap columns i and j
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_...
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),...
number hnfdet()
det via HNF Primzahlen als long long int, müssen noch in number umgewandelt werden?
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
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 WerrorS(const char *s)
#define BIMATELEM(M, I, J)
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....
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
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)
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.
const CanonicalForm int s
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...
bigintmat * bimChangeCoeff(bigintmat *a, coeffs cnew)
Liefert Kopier von Matrix a zurück, mit coeffs cnew statt den ursprünglichen.
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
void swapMatrix(bigintmat *a)