Temlate block matrix data. The matrix is composed by submatrix blocks. These blocks are stored line by line. The data in submatrices is also stored line-by-line. Matrixsize is shrinked to 'int'. More...
#include <BlockMatrix.h>
Public Types | |
typedef TRing::ElementType | TNum |
Public Member Functions | |
virtual | ~BlockMatrix () |
Constructors | |
BlockMatrix (int _rowBlockSize, int _colBlockSize, int _rows, int _cols, const TRing *_ring, string _name="unnamedMatrix") | |
BlockMatrix (const BlockMatrix &mat) | |
init | |
void | fillZero () |
void | randomInit (long *randomSeed) |
properties | |
int | getColNum () const |
int | getRowNum () const |
int | getBlocksPerRow () const |
x-axis | |
int | getBlocksPerCol () const |
y-axis | |
int | getRowBlockSize () const |
int | getColBlockSize () const |
int | getBlockNum () const |
int | getBlockSize () const |
size_t | getSize () const |
bool | blocksAreSquare () const |
std::string | getName () const |
void | setName (string _name) |
safety | |
void | checkBounds (int row, int col) const |
void | checkBlockBounds (int _blockNum, int _blockPos) const |
position transformation | |
tBlockPos | computeBlockPos (int _row, int _col) const |
tPos | computeNormalPos (int _blockNr, int _blockPos) const |
data access | |
void | setVal (const int row, const int col, const TNum z) |
TNum | getVal (const int row, const int col) const |
TNum & | getValRef (const int row, const int col) |
const TNum & | getConstValRef (const int row, const int col) const |
void | setBlockVal (const int blockNr, const int blockPos, const TNum z) |
TNum | getBlockVal (const int blockNr, const int blockPos) |
TNum * | getBlockValAddr (const int blockNr, const int blockPos) |
operators | |
bool | isZero () |
geht davon aus, das setVal sicher durchgefuehrt wird. | |
template<class TemplateMatrix > | |
bool | operator== (const TemplateMatrix &mat) const |
BlockMatrix & | operator= (const BlockMatrix &mat) |
convert | |
TMatrix< TRing > * | unblock () |
IO | |
void | outputMatrix (ostream &os) const |
output matrix in Macaulay style | |
void | printValue (ostream &os) const |
Static Public Member Functions | |
static int | refit (int number, int multipleTo) |
Protected Attributes | |
Block Matrix Data | |
int | rows |
number of rows, | |
int | cols |
number of columns | |
int | rowBlockSize |
number of rows in a block submatrix | |
int | colBlockSize |
number of cols in a block submatrix | |
const TRing * | ring |
pointer to an object with operations on TRing elements TNum. | |
TNum * | data |
matrix data | |
string | name |
matrix name | |
redundand information | |
int | extendedRowNum |
Anzahl der Zeilen, auf Vielfaches der Zeilenblockgroesse aufgefuellt. | |
int | extendedColNum |
Anzahl der spalten, auf Vielfaches der Spaltenblockgroesse aufgefuellt. |
Definition at line 43 of file BlockMatrix.h.
typedef TRing::ElementType BlockMatrix< TRing >::TNum |
Definition at line 49 of file BlockMatrix.h.
BlockMatrix< TRing >::BlockMatrix | ( | int | _rowBlockSize, | |
int | _colBlockSize, | |||
int | _rows, | |||
int | _cols, | |||
const TRing * | _ring, | |||
string | _name = "unnamedMatrix" | |||
) | [inline] |
Definition at line 19 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::cols, BlockMatrix< TRing >::data, BlockMatrix< TRing >::fillZero(), BlockMatrix< TRing >::getBlockNum(), BlockMatrix< TRing >::getBlockSize(), and BlockMatrix< TRing >::rows.
BlockMatrix< TRing >::BlockMatrix | ( | const BlockMatrix< TRing > & | mat | ) | [inline] |
copy data:
Definition at line 51 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::data, BlockMatrix< TRing >::getBlockNum(), BlockMatrix< TRing >::getBlockSize(), and BlockMatrix< TRing >::getSize().
BlockMatrix< TRing >::~BlockMatrix | ( | ) | [inline, virtual] |
Definition at line 81 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::data.
bool BlockMatrix< TRing >::blocksAreSquare | ( | ) | const [inline] |
Definition at line 131 of file BlockMatrix.h.
References BlockMatrix< TRing >::colBlockSize, and BlockMatrix< TRing >::rowBlockSize.
void BlockMatrix< TRing >::checkBlockBounds | ( | int | _blockNum, | |
int | _blockPos | |||
) | const [inline] |
Definition at line 103 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::getBlockNum(), and BlockMatrix< TRing >::getBlockSize().
Referenced by BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::getBlockVal(), BlockMatrix< TRing >::getBlockValAddr(), and BlockMatrix< TRing >::setBlockVal().
void BlockMatrix< TRing >::checkBounds | ( | int | row, | |
int | col | |||
) | const [inline] |
Definition at line 90 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::cols, and BlockMatrix< TRing >::rows.
Referenced by BlockMatrix< TRing >::computeNormalPos(), BlockMatrix< TRing >::getConstValRef(), BlockMatrix< TRing >::getVal(), BlockMatrix< TRing >::getValRef(), and BlockMatrix< TRing >::setVal().
tBlockPos BlockMatrix< TRing >::computeBlockPos | ( | int | _row, | |
int | _col | |||
) | const [inline] |
Definition at line 138 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::checkBlockBounds(), BlockMatrix< TRing >::colBlockSize, BlockMatrix< TRing >::getBlocksPerRow(), BlockMatrix< TRing >::getColBlockSize(), and BlockMatrix< TRing >::getRowBlockSize().
Referenced by BlockMatrix< TRing >::getConstValRef(), BlockMatrix< TRing >::getVal(), BlockMatrix< TRing >::getValRef(), and BlockMatrix< TRing >::setVal().
tPos BlockMatrix< TRing >::computeNormalPos | ( | int | _blockNr, | |
int | _blockPos | |||
) | const [inline] |
Definition at line 160 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::colBlockSize, BlockMatrix< TRing >::getBlocksPerRow(), BlockMatrix< TRing >::getColBlockSize(), and BlockMatrix< TRing >::getRowBlockSize().
void BlockMatrix< TRing >::fillZero | ( | ) | [inline] |
Definition at line 118 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getSize().
Referenced by BlockMatrix< TRing >::BlockMatrix().
int BlockMatrix< TRing >::getBlockNum | ( | ) | const [inline] |
Definition at line 126 of file BlockMatrix.h.
References BlockMatrix< TRing >::getBlocksPerCol(), and BlockMatrix< TRing >::getBlocksPerRow().
Referenced by BlockMatrix< TRing >::BlockMatrix(), BlockMatrix< TRing >::checkBlockBounds(), and BlockMatrix< TRing >::operator=().
int BlockMatrix< TRing >::getBlockSize | ( | ) | const [inline] |
Definition at line 127 of file BlockMatrix.h.
References BlockMatrix< TRing >::colBlockSize, and BlockMatrix< TRing >::rowBlockSize.
Referenced by BlockMatrix< TRing >::BlockMatrix(), BlockMatrix< TRing >::checkBlockBounds(), BlockMatrix< TRing >::getBlockVal(), BlockMatrix< TRing >::getBlockValAddr(), BlockMatrix< TRing >::getConstValRef(), BlockMatrix< TRing >::getVal(), BlockMatrix< TRing >::getValRef(), BlockMatrix< TRing >::operator=(), BlockMatrix< TRing >::setBlockVal(), and BlockMatrix< TRing >::setVal().
int BlockMatrix< TRing >::getBlocksPerCol | ( | ) | const [inline] |
Definition at line 120 of file BlockMatrix.h.
References BlockMatrix< TRing >::colBlockSize, and BlockMatrix< TRing >::extendedColNum.
Referenced by TMatrix< TRing >::getBlocked(), and BlockMatrix< TRing >::getBlockNum().
int BlockMatrix< TRing >::getBlocksPerRow | ( | ) | const [inline] |
Definition at line 118 of file BlockMatrix.h.
References BlockMatrix< TRing >::extendedRowNum, and BlockMatrix< TRing >::rowBlockSize.
Referenced by BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::computeNormalPos(), TMatrix< TRing >::getBlocked(), and BlockMatrix< TRing >::getBlockNum().
TRing::ElementType BlockMatrix< TRing >::getBlockVal | ( | const int | blockNr, | |
const int | blockPos | |||
) | [inline] |
Definition at line 251 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::checkBlockBounds(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
TRing::ElementType * BlockMatrix< TRing >::getBlockValAddr | ( | const int | blockNr, | |
const int | blockPos | |||
) | [inline] |
Definition at line 242 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::checkBlockBounds(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
int BlockMatrix< TRing >::getColBlockSize | ( | ) | const [inline] |
Definition at line 124 of file BlockMatrix.h.
References BlockMatrix< TRing >::colBlockSize.
Referenced by BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::computeNormalPos(), and TMatrix< TRing >::getBlocked().
int BlockMatrix< TRing >::getColNum | ( | ) | const [inline] |
Definition at line 114 of file BlockMatrix.h.
References BlockMatrix< TRing >::cols.
const TRing::ElementType & BlockMatrix< TRing >::getConstValRef | ( | const int | row, | |
const int | col | |||
) | const [inline] |
Definition at line 219 of file BlockMatrix.cpp.
References tBlockPos::blockNr, tBlockPos::blockPos, BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
std::string BlockMatrix< TRing >::getName | ( | ) | const [inline] |
Definition at line 133 of file BlockMatrix.h.
References BlockMatrix< TRing >::name.
int BlockMatrix< TRing >::getRowBlockSize | ( | ) | const [inline] |
Definition at line 123 of file BlockMatrix.h.
References BlockMatrix< TRing >::rowBlockSize.
Referenced by BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::computeNormalPos(), and TMatrix< TRing >::getBlocked().
int BlockMatrix< TRing >::getRowNum | ( | ) | const [inline] |
Definition at line 115 of file BlockMatrix.h.
References BlockMatrix< TRing >::rows.
size_t BlockMatrix< TRing >::getSize | ( | ) | const [inline] |
Definition at line 129 of file BlockMatrix.h.
References BlockMatrix< TRing >::extendedColNum, and BlockMatrix< TRing >::extendedRowNum.
Referenced by BlockMatrix< TRing >::BlockMatrix(), BlockMatrix< TRing >::fillZero(), BlockMatrix< TRing >::isZero(), BlockMatrix< TRing >::operator=(), and BlockMatrix< TRing >::randomInit().
TRing::ElementType BlockMatrix< TRing >::getVal | ( | const int | row, | |
const int | col | |||
) | const [inline] |
Definition at line 207 of file BlockMatrix.cpp.
References tBlockPos::blockNr, tBlockPos::blockPos, BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
Referenced by BlockMatrix< TRing >::operator==(), BlockMatrix< TRing >::outputMatrix(), BlockMatrix< TRing >::printValue(), and BlockMatrix< TRing >::unblock().
TRing::ElementType & BlockMatrix< TRing >::getValRef | ( | const int | row, | |
const int | col | |||
) | [inline] |
Definition at line 231 of file BlockMatrix.cpp.
References tBlockPos::blockNr, tBlockPos::blockPos, BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
bool BlockMatrix< TRing >::isZero | ( | ) | [inline] |
Definition at line 374 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getSize().
BlockMatrix< TRing > & BlockMatrix< TRing >::operator= | ( | const BlockMatrix< TRing > & | mat | ) | [inline] |
copy data:
Definition at line 294 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::colBlockSize, BlockMatrix< TRing >::cols, BlockMatrix< TRing >::data, BlockMatrix< TRing >::extendedColNum, BlockMatrix< TRing >::extendedRowNum, BlockMatrix< TRing >::getBlockNum(), BlockMatrix< TRing >::getBlockSize(), BlockMatrix< TRing >::getSize(), BlockMatrix< TRing >::name, BlockMatrix< TRing >::ring, BlockMatrix< TRing >::rowBlockSize, and BlockMatrix< TRing >::rows.
bool BlockMatrix< TRing >::operator== | ( | const TemplateMatrix & | mat | ) | const [inline] |
Definition at line 274 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::cols, BlockMatrix< TRing >::getVal(), and BlockMatrix< TRing >::rows.
void BlockMatrix< TRing >::outputMatrix | ( | ostream & | os | ) | const [inline] |
output Matrix in Macaulay style
Definition at line 415 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::cols, BlockMatrix< TRing >::getVal(), BlockMatrix< TRing >::name, and BlockMatrix< TRing >::rows.
void BlockMatrix< TRing >::printValue | ( | ostream & | os | ) | const [inline] |
Definition at line 387 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::cols, BlockMatrix< TRing >::getVal(), and BlockMatrix< TRing >::rows.
void BlockMatrix< TRing >::randomInit | ( | long * | randomSeed | ) | [inline] |
Definition at line 128 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::data, BlockMatrix< TRing >::getSize(), random(), and BlockMatrix< TRing >::ring.
int BlockMatrix< TRing >::refit | ( | int | number, | |
int | multipleTo | |||
) | [inline, static] |
Definition at line 6 of file BlockMatrix.cpp.
void BlockMatrix< TRing >::setBlockVal | ( | const int | blockNr, | |
const int | blockPos, | |||
const TNum | z | |||
) | [inline] |
Definition at line 260 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::checkBlockBounds(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
Referenced by TMatrix< TRing >::getBlocked().
void BlockMatrix< TRing >::setName | ( | string | _name | ) | [inline] |
Definition at line 134 of file BlockMatrix.h.
References BlockMatrix< TRing >::name.
void BlockMatrix< TRing >::setVal | ( | const int | row, | |
const int | col, | |||
const TNum | z | |||
) | [inline] |
Definition at line 191 of file BlockMatrix.cpp.
References tBlockPos::blockNr, tBlockPos::blockPos, BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::data, and BlockMatrix< TRing >::getBlockSize().
TMatrix< TRing > * BlockMatrix< TRing >::unblock | ( | ) | [inline] |
Definition at line 331 of file BlockMatrix.cpp.
References BlockMatrix< TRing >::cols, BlockMatrix< TRing >::getVal(), BlockMatrix< TRing >::ring, BlockMatrix< TRing >::rows, and TMatrix< TRing >::setVal().
int BlockMatrix< TRing >::colBlockSize [protected] |
Definition at line 62 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::blocksAreSquare(), BlockMatrix< TRing >::computeBlockPos(), BlockMatrix< TRing >::computeNormalPos(), BlockMatrix< TRing >::getBlockSize(), BlockMatrix< TRing >::getBlocksPerCol(), BlockMatrix< TRing >::getColBlockSize(), and BlockMatrix< TRing >::operator=().
int BlockMatrix< TRing >::cols [protected] |
Definition at line 59 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::BlockMatrix(), BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::getColNum(), BlockMatrix< TRing >::operator=(), BlockMatrix< TRing >::operator==(), BlockMatrix< TRing >::outputMatrix(), BlockMatrix< TRing >::printValue(), and BlockMatrix< TRing >::unblock().
TNum* BlockMatrix< TRing >::data [protected] |
Definition at line 67 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::BlockMatrix(), BlockMatrix< TRing >::fillZero(), BlockMatrix< TRing >::getBlockVal(), BlockMatrix< TRing >::getBlockValAddr(), BlockMatrix< TRing >::getConstValRef(), BlockMatrix< TRing >::getVal(), BlockMatrix< TRing >::getValRef(), BlockMatrix< TRing >::isZero(), BlockMatrix< TRing >::operator=(), BlockMatrix< TRing >::randomInit(), BlockMatrix< TRing >::setBlockVal(), BlockMatrix< TRing >::setVal(), and BlockMatrix< TRing >::~BlockMatrix().
int BlockMatrix< TRing >::extendedColNum [protected] |
Definition at line 76 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::getBlocksPerCol(), BlockMatrix< TRing >::getSize(), and BlockMatrix< TRing >::operator=().
int BlockMatrix< TRing >::extendedRowNum [protected] |
Definition at line 75 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::getBlocksPerRow(), BlockMatrix< TRing >::getSize(), and BlockMatrix< TRing >::operator=().
string BlockMatrix< TRing >::name [protected] |
Definition at line 68 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::getName(), BlockMatrix< TRing >::operator=(), BlockMatrix< TRing >::outputMatrix(), and BlockMatrix< TRing >::setName().
const TRing* BlockMatrix< TRing >::ring [protected] |
Definition at line 64 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::operator=(), BlockMatrix< TRing >::randomInit(), and BlockMatrix< TRing >::unblock().
int BlockMatrix< TRing >::rowBlockSize [protected] |
Definition at line 61 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::blocksAreSquare(), BlockMatrix< TRing >::getBlockSize(), BlockMatrix< TRing >::getBlocksPerRow(), BlockMatrix< TRing >::getRowBlockSize(), and BlockMatrix< TRing >::operator=().
int BlockMatrix< TRing >::rows [protected] |
Definition at line 58 of file BlockMatrix.h.
Referenced by BlockMatrix< TRing >::BlockMatrix(), BlockMatrix< TRing >::checkBounds(), BlockMatrix< TRing >::getRowNum(), BlockMatrix< TRing >::operator=(), BlockMatrix< TRing >::operator==(), BlockMatrix< TRing >::outputMatrix(), BlockMatrix< TRing >::printValue(), and BlockMatrix< TRing >::unblock().