![]() |
Matrices of numbers. More...
#include <coeffs/bigintmat.h>
Public Member Functions | |
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 versio 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 occured. 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... | |
Private Attributes | |
coeffs | m_coeffs |
number * | v |
int | row |
int | col |
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.
: no reference counting here!
Definition at line 32 of file bigintmat.h.
|
inline |
Definition at line 41 of file bigintmat.h.
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 51 of file bigintmat.h.
copy constructor
Definition at line 71 of file bigintmat.h.
|
inline |
canonical destructor.
Definition at line 133 of file bigintmat.h.
bool bigintmat::add | ( | bigintmat * | b | ) |
Addiert zur Matrix die Matrix b dazu. Return false => an error occured.
Definition at line 870 of file bigintmat.cc.
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 927 of file bigintmat.cc.
bool bigintmat::addrow | ( | int | i, |
int | j, | ||
number | a, | ||
coeffs | c | ||
) |
... Zeile ...
Definition at line 950 of file bigintmat.cc.
void bigintmat::appendCol | ( | bigintmat * | a | ) |
horizontally join the matrices, m <- m|a
Definition at line 1034 of file bigintmat.cc.
|
inline |
Definition at line 130 of file bigintmat.h.
int bigintmat::colIsZero | ( | int | i | ) |
Definition at line 1479 of file bigintmat.cc.
|
inline |
Definition at line 128 of file bigintmat.h.
void bigintmat::colskaldiv | ( | int | j, |
number | b | ||
) |
Macht Ganzzahldivision aller j-ten Spalteneinträge mit b.
Definition at line 1778 of file bigintmat.cc.
void bigintmat::colskalmult | ( | int | i, |
number | a, | ||
coeffs | c | ||
) |
Multipliziert zur i-ten Spalte den Skalar a hinzu.
Definition at line 973 of file bigintmat.cc.
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 1791 of file bigintmat.cc.
Definition at line 362 of file bigintmat.cc.
: 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
Definition at line 1049 of file bigintmat.cc.
Fügt zwei Matrixen untereinander/nebeneinander in gegebene Matrix ein, bzw spaltet gegebenen Matrix auf.
Definition at line 999 of file bigintmat.cc.
number bigintmat::content | ( | ) |
the content, the gcd of all entries. Only makes sense for Euclidean rings (or possibly constructive PIR)
Definition at line 2498 of file bigintmat.cc.
bool bigintmat::copy | ( | bigintmat * | b | ) |
Kopiert Einträge von b auf Bigintmat.
Definition at line 1178 of file bigintmat.cc.
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 1204 of file bigintmat.cc.
number bigintmat::det | ( | ) |
det (via LaPlace in general, hnf for euc. rings)
Definition at line 1414 of file bigintmat.cc.
bigintmat * bigintmat::elim | ( | int | i, |
int | j | ||
) |
Liefert Streichungsmatrix (i-te Zeile und j-te Spalte gestrichen) zurück.
Definition at line 1283 of file bigintmat.cc.
void bigintmat::extendCols | ( | int | i | ) |
append i zero-columns to the matrix
Definition at line 1029 of file bigintmat.cc.
int bigintmat::findcolnonzero | ( | int | j | ) |
find index of 1st non-zero entry in column j
Definition at line 732 of file bigintmat.cc.
int bigintmat::findnonzero | ( | int | i | ) |
find index of 1st non-zero entry in row i
Definition at line 721 of file bigintmat.cc.
number bigintmat::get | ( | int | i, |
int | j | ||
) | const |
get a copy of an entry. NOTE: starts at [1,1]
Definition at line 117 of file bigintmat.cc.
number bigintmat::get | ( | int | i | ) | const |
get a copy of an entry. NOTE: starts at [0]
Definition at line 101 of file bigintmat.cc.
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 743 of file bigintmat.cc.
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 770 of file bigintmat.cc.
void bigintmat::getrow | ( | int | i, |
bigintmat * | a | ||
) |
Schreibt i-te Zeile in Vektor (Matrix) a.
Definition at line 781 of file bigintmat.cc.
int * bigintmat::getwid | ( | int | maxwid | ) |
Definition at line 578 of file bigintmat.cc.
void bigintmat::hnf | ( | ) |
transforms INPLACE to HNF
Definition at line 1562 of file bigintmat.cc.
number bigintmat::hnfdet | ( | ) |
det via HNF Primzahlen als long long int, müssen noch in number umgewandelt werden?
Definition at line 1447 of file bigintmat.cc.
void bigintmat::howell | ( | ) |
dito, but Howell form (only different for zero-divsors)
Definition at line 1487 of file bigintmat.cc.
|
inline |
helper function to map from 2-dim coordinates, starting by 1 to 1-dim coordinate, starting by 0
Definition at line 145 of file bigintmat.h.
Liefert Kopie der Matrix zurück, allerdings im Ring Z modulo p.
inplace versio of skalar mult. CHANGES input.
Definition at line 143 of file bigintmat.cc.
void bigintmat::inpTranspose | ( | ) |
int bigintmat::isOne | ( | ) |
is matrix is identity
Definition at line 1218 of file bigintmat.cc.
int bigintmat::isZero | ( | ) |
Definition at line 1266 of file bigintmat.cc.
|
inline |
Definition at line 127 of file bigintmat.h.
void bigintmat::mod | ( | number | p | ) |
Reduziert komplette Matrix modulo p.
Definition at line 1818 of file bigintmat.cc.
computes HNF(this | p*I)
Definition at line 1734 of file bigintmat.cc.
void bigintmat::one | ( | ) |
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
Definition at line 1238 of file bigintmat.cc.
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 134 of file bigintmat.cc.
|
inline |
dubious: 1-dim access to 2-dim array. Entries are read row by row.
Definition at line 93 of file bigintmat.h.
|
inline |
Definition at line 105 of file bigintmat.h.
void bigintmat::pprint | ( | int | maxwid | ) |
Definition at line 610 of file bigintmat.cc.
void bigintmat::Print | ( | ) |
IO: simply prints the matrix to the current output (screen?)
Definition at line 440 of file bigintmat.cc.
number bigintmat::pseudoinv | ( | bigintmat * | a | ) |
Speichert in Matrix a die Pseudoinverse, liefert den Nenner zurück.
Definition at line 1317 of file bigintmat.cc.
replace an entry with the given number n (only delete old). NOTE: starts at [0]. Should be named set_transfer
Definition at line 180 of file bigintmat.h.
as above, but the 2-dim version
Definition at line 200 of file bigintmat.h.
|
inline |
Definition at line 129 of file bigintmat.h.
void bigintmat::rowskalmult | ( | int | i, |
number | a, | ||
coeffs | c | ||
) |
... Zeile ...
Definition at line 986 of file bigintmat.cc.
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition at line 93 of file bigintmat.cc.
replace an entry with a copy (delete old + copy new!). NOTE: starts at [0]
Definition at line 85 of file bigintmat.cc.
void bigintmat::setcol | ( | int | j, |
bigintmat * | m | ||
) |
Setzt j-te Spalte gleich übergebenem Vektor (Matrix) m.
Definition at line 812 of file bigintmat.cc.
void bigintmat::setrow | ( | int | i, |
bigintmat * | m | ||
) |
Setzt i-te Zeile gleich übergebenem Vektor (Matrix) m.
Definition at line 841 of file bigintmat.cc.
void bigintmat::simplifyContentDen | ( | number * | den | ) |
ensures that Gcd(den, content)=1 < enden hier wieder
Definition at line 2510 of file bigintmat.cc.
void bigintmat::skaldiv | ( | number | b | ) |
Macht Ganzzahldivision aller Matrixeinträge mit b.
Definition at line 1763 of file bigintmat.cc.
bool bigintmat::skalmult | ( | number | b, |
coeffs | c | ||
) |
Multipliziert zur Matrix den Skalar b hinzu.
Definition at line 906 of file bigintmat.cc.
... linken ... rechten ...
Definition at line 1107 of file bigintmat.cc.
void bigintmat::splitcol | ( | bigintmat * | a, |
int | i | ||
) |
Speichert die ersten i Spalten als Teilmatrix in a.
Definition at line 1138 of file bigintmat.cc.
Speichert in Matrix a den oberen, in b den unteren Teil der Matrix, vorausgesetzt die Dimensionen stimmen überein.
Definition at line 1074 of file bigintmat.cc.
void bigintmat::splitrow | ( | bigintmat * | a, |
int | i | ||
) |
... Zeilen ...
Definition at line 1158 of file bigintmat.cc.
char * bigintmat::String | ( | ) |
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition at line 433 of file bigintmat.cc.
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 448 of file bigintmat.cc.
bool bigintmat::sub | ( | bigintmat * | b | ) |
Subtrahiert ...
Definition at line 888 of file bigintmat.cc.
void bigintmat::swap | ( | int | i, |
int | j | ||
) |
swap columns i and j
Definition at line 690 of file bigintmat.cc.
void bigintmat::swapMatrix | ( | bigintmat * | a | ) |
Definition at line 1468 of file bigintmat.cc.
void bigintmat::swaprow | ( | int | i, |
int | j | ||
) |
swap rows i and j
Definition at line 705 of file bigintmat.cc.
number bigintmat::trace | ( | ) |
the trace ....
Definition at line 1400 of file bigintmat.cc.
bigintmat * bigintmat::transpose | ( | ) |
Definition at line 38 of file bigintmat.cc.
number bigintmat::view | ( | int | i, |
int | j | ||
) | const |
view an entry an entry. NOTE: starts at [1,1]
Definition at line 125 of file bigintmat.cc.
number bigintmat::view | ( | int | i | ) | const |
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.
void bigintmat::zero | ( | ) |
Setzt alle Einträge auf 0.
Definition at line 1256 of file bigintmat.cc.
|
private |
Definition at line 38 of file bigintmat.h.
|
private |
Definition at line 35 of file bigintmat.h.
|
private |
Definition at line 37 of file bigintmat.h.
|
private |
Definition at line 36 of file bigintmat.h.