Isis 3 Programmer Reference
|
#include <SparseBlockMatrix.h>
Public Member Functions | |
~SparseBlockMatrix () | |
Destructor. More... | |
SparseBlockMatrix (const SparseBlockMatrix &src) | |
Copy constructor. More... | |
SparseBlockMatrix & | operator= (const SparseBlockMatrix &src) |
"Equals" operator. More... | |
void | wipe () |
Deletes all pointer elements and removes them from the list. More... | |
void | copy (const SparseBlockMatrix &src) |
Copy method. More... | |
bool | setNumberOfColumns (int n) |
Initializes number of columns (SparseBlockColumnMatrix). More... | |
void | zeroBlocks () |
Sets all elements of all matrix blocks to zero. More... | |
bool | insertMatrixBlock (int nColumnBlock, int nRowBlock, int nRows, int nCols) |
Inserts a "newed" boost LinearAlgebra::Matrix pointer of size (nRows, nCols) into the matrix at nColumnBlock, nRowBlock. More... | |
LinearAlgebra::Matrix * | getBlock (int column, int row) |
Returns pointer to boost matrix at position (column, row). More... | |
int | numberOfBlocks () |
Returns total number of blocks in matrix. More... | |
int | numberOfDiagonalBlocks () |
Returns number of diagonal matrix blocks (equivalent to size - there is one per column). More... | |
int | numberOfOffDiagonalBlocks () |
Returns number of off-diagonal matrix blocks. More... | |
int | numberOfElements () |
Returns number of matrix elements in matrix. More... | |
void | print (std::ostream &outstream) |
Prints matrix blocks to std output stream out for debugging. More... | |
void | printClean (std::ostream &outstream) |
Prints matrix blocks to std output stream out for debugging. More... | |
bool | write (std::ofstream &fp_out, bool binary=true) |
int | getLeadingColumnsForBlock (int nblockColumn) |
Sums and returns the number of columns in each matrix block prior to nblockColumn. More... | |
int | getLeadingRowsForBlock (int nblockRow) |
Sums and returns the number of rows in each matrix block prior to nblockRow. More... | |
The CHOLMOD (Cholesky decomposition) package uses the compressed column storage (CCS) matrix format which is efficient in memory storage but inefficient to fill in an arbitrary manner because the insertion of every non-zero entry requires that all succeeding entries be shifted.
To build the reduced normal equations matrix, an interim sparse matrix structure is required that can be efficiently populated in a random fashion and can be traversed by column in row order to subsequently construct the CCS matrix required by CHOLMOD. We use a type of Block Compressed Column Storage (BCCS) which consists of an array of map containers (QList of SparseBlockColumnMatrices), each representing a column of square matrix blocks in the reduced normal equations. The key into each column map is the block’s row index.The value at each key is a square dense matrix (Boost matrix) with a dimension equivalent to the number of exterior orientation parameters used for the image. Zero blocks are not stored. The BCCS matrix is created only in the first iteration of the bundle adjustment; in subsequent iterations it need only be repopulated. As the normal equations matrix is symmetric, only the upper triangular portion is stored in memory.
2011-07-29 Ken Edmundson Created
2014-02-25 Ken Edmundson - operators to read/write matrices to binary disk file and to write matrices to QDebug stream.
2015-12-18 Ken Edmundson - 1) added more detailed documentation; 2) brought closer to ISIS coding standards.
Definition at line 198 of file SparseBlockMatrix.h.
Isis::SparseBlockMatrix::~SparseBlockMatrix | ( | ) |
Destructor.
Definition at line 803 of file SparseBlockMatrix.cpp.
Isis::SparseBlockMatrix::SparseBlockMatrix | ( | const SparseBlockMatrix & | src | ) |
Copy constructor.
Calls copy method immediately below.
src | SparseBlockMatrix to copy |
Definition at line 823 of file SparseBlockMatrix.cpp.
void Isis::SparseBlockMatrix::copy | ( | const SparseBlockMatrix & | src | ) |
Copy method.
src | SparseBlockMatrix to copy |
Definition at line 833 of file SparseBlockMatrix.cpp.
LinearAlgebra::Matrix * Isis::SparseBlockMatrix::getBlock | ( | int | column, |
int | row | ||
) |
Returns pointer to boost matrix at position (column, row).
column | block column number |
row | block row number |
Definition at line 980 of file SparseBlockMatrix.cpp.
int Isis::SparseBlockMatrix::getLeadingColumnsForBlock | ( | int | nblockColumn | ) |
Sums and returns the number of columns in each matrix block prior to nblockColumn.
nblockColumn |
Definition at line 1048 of file SparseBlockMatrix.cpp.
int Isis::SparseBlockMatrix::getLeadingRowsForBlock | ( | int | nblockRow | ) |
Sums and returns the number of rows in each matrix block prior to nblockRow.
nblockRow |
Definition at line 1082 of file SparseBlockMatrix.cpp.
bool Isis::SparseBlockMatrix::insertMatrixBlock | ( | int | nColumnBlock, |
int | nRowBlock, | ||
int | nRows, | ||
int | nCols | ||
) |
Inserts a "newed" boost LinearAlgebra::Matrix pointer of size (nRows, nCols) into the matrix at nColumnBlock, nRowBlock.
The inserted matrix elements are initialized to zero. If an entry exists at nColumnBlock, RowBlock, no insertion is made.
nColumnBlock | block column number of inserted matrix (QList index) |
nRowBlock | block row number of inserted matrix (key into map) |
nRows | number of rows in matrix to be inserted |
nCols | number of columns in matrix to be inserted |
Definition at line 889 of file SparseBlockMatrix.cpp.
int Isis::SparseBlockMatrix::numberOfBlocks | ( | ) |
Returns total number of blocks in matrix.
Definition at line 899 of file SparseBlockMatrix.cpp.
int Isis::SparseBlockMatrix::numberOfDiagonalBlocks | ( | ) |
Returns number of diagonal matrix blocks (equivalent to size - there is one per column).
Definition at line 918 of file SparseBlockMatrix.cpp.
int Isis::SparseBlockMatrix::numberOfElements | ( | ) |
Returns number of matrix elements in matrix.
Definition at line 957 of file SparseBlockMatrix.cpp.
int Isis::SparseBlockMatrix::numberOfOffDiagonalBlocks | ( | ) |
Returns number of off-diagonal matrix blocks.
Definition at line 947 of file SparseBlockMatrix.cpp.
SparseBlockMatrix & Isis::SparseBlockMatrix::operator= | ( | const SparseBlockMatrix & | src | ) |
"Equals" operator.
src | SparseBlockMatrix to check against |
Definition at line 849 of file SparseBlockMatrix.cpp.
void Isis::SparseBlockMatrix::print | ( | std::ostream & | outstream | ) |
Prints matrix blocks to std output stream out for debugging.
outstream | output stream |
Definition at line 999 of file SparseBlockMatrix.cpp.
References Isis::SparseBlockColumnMatrix::print().
void Isis::SparseBlockMatrix::printClean | ( | std::ostream & | outstream | ) |
Prints matrix blocks to std output stream out for debugging.
outstream | output stream |
Definition at line 1023 of file SparseBlockMatrix.cpp.
References Isis::SparseBlockColumnMatrix::printClean().
bool Isis::SparseBlockMatrix::setNumberOfColumns | ( | int | n | ) |
Initializes number of columns (SparseBlockColumnMatrix).
n | number of columns to insert |
Definition at line 867 of file SparseBlockMatrix.cpp.
Referenced by Isis::operator>>().
void Isis::SparseBlockMatrix::wipe | ( | ) |
Deletes all pointer elements and removes them from the list.
Effectively, a destructor, and in fact, called by the ~SparseBlockMatrix above.
Definition at line 812 of file SparseBlockMatrix.cpp.
void Isis::SparseBlockMatrix::zeroBlocks | ( | ) |
Sets all elements of all matrix blocks to zero.
Definition at line 988 of file SparseBlockMatrix.cpp.