![]() |
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 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... | |
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 51 of file bigintmat.h.
|
inline |
Definition at line 60 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 70 of file bigintmat.h.
copy constructor
Definition at line 90 of file bigintmat.h.
|
inline |
canonical destructor.
Definition at line 150 of file bigintmat.h.
bool bigintmat::add | ( | bigintmat * | b | ) |
Addiert zur Matrix die Matrix b dazu. Return false => an error occurred.
Definition at line 902 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 967 of file bigintmat.cc.
bool bigintmat::addrow | ( | int | i, |
int | j, | ||
number | a, | ||
coeffs | c | ||
) |
... Zeile ...
Definition at line 991 of file bigintmat.cc.
void bigintmat::appendCol | ( | bigintmat * | a | ) |
horizontally join the matrices, m <- m|a
Definition at line 1091 of file bigintmat.cc.
|
inline |
Definition at line 147 of file bigintmat.h.
int bigintmat::colIsZero | ( | int | i | ) |
Definition at line 1585 of file bigintmat.cc.
|
inline |
Definition at line 145 of file bigintmat.h.
void bigintmat::colskaldiv | ( | int | j, |
number | b | ||
) |
Macht Ganzzahldivision aller j-ten Spalteneinträge mit b.
Definition at line 1884 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 1015 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 1897 of file bigintmat.cc.
Definition at line 363 of file bigintmat.cc.
Definition at line 1106 of file bigintmat.cc.
Fügt zwei Matrixen untereinander/nebeneinander in gegebene Matrix ein, bzw spaltet gegebenen Matrix auf.
Definition at line 1047 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 2683 of file bigintmat.cc.
bool bigintmat::copy | ( | bigintmat * | b | ) |
Kopiert Einträge von b auf Bigintmat.
Definition at line 1267 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 1295 of file bigintmat.cc.
number bigintmat::det | ( | ) |
det (via LaPlace in general, hnf for euc. rings)
Definition at line 1520 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 1389 of file bigintmat.cc.
void bigintmat::extendCols | ( | int | i | ) |
append i zero-columns to the matrix
Definition at line 1084 of file bigintmat.cc.
int bigintmat::findcolnonzero | ( | int | j | ) |
find index of 1st non-zero entry in column j
Definition at line 743 of file bigintmat.cc.
int bigintmat::findnonzero | ( | int | i | ) |
find index of 1st non-zero entry in row i
Definition at line 731 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 120 of file bigintmat.cc.
number bigintmat::get | ( | int | i | ) | const |
get a copy of an entry. NOTE: starts at [0]
Definition at line 104 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 755 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 786 of file bigintmat.cc.
void bigintmat::getrow | ( | int | i, |
bigintmat * | a | ||
) |
Schreibt i-te Zeile in Vektor (Matrix) a.
Definition at line 799 of file bigintmat.cc.
int * bigintmat::getwid | ( | int | maxwid | ) |
Definition at line 581 of file bigintmat.cc.
void bigintmat::hnf | ( | ) |
transforms INPLACE to HNF
Definition at line 1668 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 1553 of file bigintmat.cc.
void bigintmat::howell | ( | ) |
dito, but Howell form (only different for zero-divsors)
Definition at line 1593 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 162 of file bigintmat.h.
inplace version of skalar mult. CHANGES input.
Definition at line 146 of file bigintmat.cc.
void bigintmat::inpTranspose | ( | ) |
int bigintmat::isOne | ( | ) |
is matrix is identity
Definition at line 1308 of file bigintmat.cc.
int bigintmat::isZero | ( | ) |
Definition at line 1371 of file bigintmat.cc.
|
inline |
Definition at line 144 of file bigintmat.h.
void bigintmat::mod | ( | number | p | ) |
Reduziert komplette Matrix modulo p.
Definition at line 1924 of file bigintmat.cc.
computes HNF(this | p*I)
Definition at line 1840 of file bigintmat.cc.
void bigintmat::one | ( | ) |
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
Definition at line 1333 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 137 of file bigintmat.cc.
|
inline |
dubious: 1-dim access to 2-dim array. Entries are read row by row.
Definition at line 112 of file bigintmat.h.
|
inline |
Definition at line 123 of file bigintmat.h.
void bigintmat::pprint | ( | int | maxwid | ) |
Definition at line 613 of file bigintmat.cc.
void bigintmat::Print | ( | ) |
IO: simply prints the matrix to the current output (screen?)
Definition at line 444 of file bigintmat.cc.
number bigintmat::pseudoinv | ( | bigintmat * | a | ) |
Speichert in Matrix a die Pseudoinverse, liefert den Nenner zurück.
Definition at line 1423 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 197 of file bigintmat.h.
as above, but the 2-dim version
Definition at line 217 of file bigintmat.h.
|
inline |
Definition at line 146 of file bigintmat.h.
void bigintmat::rowskalmult | ( | int | i, |
number | a, | ||
coeffs | c | ||
) |
... Zeile ...
Definition at line 1031 of file bigintmat.cc.
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition at line 96 of file bigintmat.cc.
replace an entry with a copy (delete old + copy new!). NOTE: starts at [0]
Definition at line 88 of file bigintmat.cc.
void bigintmat::setcol | ( | int | j, |
bigintmat * | m | ||
) |
Setzt j-te Spalte gleich übergebenem Vektor (Matrix) m.
Definition at line 834 of file bigintmat.cc.
void bigintmat::setrow | ( | int | i, |
bigintmat * | m | ||
) |
Setzt i-te Zeile gleich übergebenem Vektor (Matrix) m.
Definition at line 868 of file bigintmat.cc.
void bigintmat::simplifyContentDen | ( | number * | den | ) |
ensures that Gcd(den, content)=1 enden hier wieder
Definition at line 2696 of file bigintmat.cc.
void bigintmat::skaldiv | ( | number | b | ) |
Macht Ganzzahldivision aller Matrixeinträge mit b.
Definition at line 1869 of file bigintmat.cc.
bool bigintmat::skalmult | ( | number | b, |
coeffs | c | ||
) |
Multipliziert zur Matrix den Skalar b hinzu.
Definition at line 946 of file bigintmat.cc.
... linken ... rechten ...
Definition at line 1177 of file bigintmat.cc.
void bigintmat::splitcol | ( | bigintmat * | a, |
int | i | ||
) |
Speichert die ersten i Spalten als Teilmatrix in a.
Definition at line 1217 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 1135 of file bigintmat.cc.
void bigintmat::splitrow | ( | bigintmat * | a, |
int | i | ||
) |
... Zeilen ...
Definition at line 1242 of file bigintmat.cc.
char * bigintmat::String | ( | ) |
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition at line 437 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 452 of file bigintmat.cc.
bool bigintmat::sub | ( | bigintmat * | b | ) |
Subtrahiert ...
Definition at line 924 of file bigintmat.cc.
void bigintmat::swap | ( | int | i, |
int | j | ||
) |
swap columns i and j
Definition at line 693 of file bigintmat.cc.
void bigintmat::swapMatrix | ( | bigintmat * | a | ) |
Definition at line 1574 of file bigintmat.cc.
void bigintmat::swaprow | ( | int | i, |
int | j | ||
) |
swap rows i and j
Definition at line 712 of file bigintmat.cc.
number bigintmat::trace | ( | ) |
the trace ....
Definition at line 1506 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 128 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 414 of file bigintmat.cc.
void bigintmat::zero | ( | ) |
Setzt alle Einträge auf 0.
Definition at line 1358 of file bigintmat.cc.
|
private |
Definition at line 57 of file bigintmat.h.
|
private |
Definition at line 54 of file bigintmat.h.
|
private |
Definition at line 56 of file bigintmat.h.
|
private |
Definition at line 55 of file bigintmat.h.