Isis 3 Programmer Reference
Isis::SparseBlockRowMatrix Class Reference

SparseBlockRowMatrix. More...

#include <SparseBlockMatrix.h>

Inheritance diagram for Isis::SparseBlockRowMatrix:
Inheritance graph
Collaboration diagram for Isis::SparseBlockRowMatrix:
Collaboration graph

Public Member Functions

 ~SparseBlockRowMatrix ()
 Destructor.
 
 SparseBlockRowMatrix (const SparseBlockRowMatrix &src)
 Copy constructor.
 
SparseBlockRowMatrixoperator= (const SparseBlockRowMatrix &src)
 "Equals" operator.
 
void wipe ()
 Deletes all pointer elements and removes them from the map.
 
void copy (const SparseBlockRowMatrix &src)
 Copy method.
 
void zeroBlocks ()
 Sets all elements of all matrix blocks to zero.
 
bool insertMatrixBlock (int nRowBlock, int nRows, int nCols)
 Inserts a "newed" LinearAlgebra::Matrix pointer of size (nRows, nCols) into the map with the block row number as key.
 
void copyToBoost (boost::numeric::ublas::compressed_matrix< double > &B)
 Copies a SparseBlockRowMatrix to a Boost compressed_matrix.
 
int getLeadingColumnsForBlock (int nblockColumn)
 Sums and returns the number of columns in each matrix block prior to nblockColumn.
 
int numberOfElements ()
 Returns total number of matrix elements in map (NOTE: NOT the number of matrix blocks).
 
void print (std::ostream &outstream)
 Prints matrix blocks to std output stream out for debugging.
 
void printClean (std::ostream &outstream)
 Prints matrix blocks to std output stream out for debugging.
 

Detailed Description

SparseBlockRowMatrix.

A SparseBlockRowMatrix is a QMap of square matrix blocks and represents a row of square matrix blocks in the reduced normal equations matrix. The key into each row map is the block’s column 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.

Note that this class is not apparently different than the SparseBlockColumnMatrix. It was implemented for convenience in the BundleAdjustment class for those times when we need to access rows of matrix blocks as opposed to columns of matrix blocks.

TO BE RESOLVED: Do we really need this as a separate class? Can we do everything we need with the SparseBlockColumnMatrix?

Author
2011-07-29 Ken Edmundson
History

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 124 of file SparseBlockMatrix.h.

Constructor & Destructor Documentation

◆ SparseBlockRowMatrix() [1/2]

Isis::SparseBlockRowMatrix::SparseBlockRowMatrix ( )
inline

Definition at line 128 of file SparseBlockMatrix.h.

◆ ~SparseBlockRowMatrix()

Isis::SparseBlockRowMatrix::~SparseBlockRowMatrix ( )

Destructor.

See description of wipe method below.

Definition at line 428 of file SparseBlockMatrix.cpp.

References wipe().

◆ SparseBlockRowMatrix() [2/2]

Isis::SparseBlockRowMatrix::SparseBlockRowMatrix ( const SparseBlockRowMatrix & src)

Copy constructor.

Calls copy method immediately below.

Parameters
srcSparseBlockRowMatrix to copy

Definition at line 448 of file SparseBlockMatrix.cpp.

References copy().

Member Function Documentation

◆ copy()

void Isis::SparseBlockRowMatrix::copy ( const SparseBlockRowMatrix & src)

Copy method.

Parameters
srcSparseBlockRowMatrix to copy

Definition at line 458 of file SparseBlockMatrix.cpp.

References wipe().

Referenced by operator=(), and SparseBlockRowMatrix().

◆ copyToBoost()

void Isis::SparseBlockRowMatrix::copyToBoost ( boost::numeric::ublas::compressed_matrix< double > & B)

Copies a SparseBlockRowMatrix to a Boost compressed_matrix.

This may be a temporary implementation

Parameters
BBoost matrix to copy this SparseBlockRowMatrix to

Definition at line 626 of file SparseBlockMatrix.cpp.

◆ getLeadingColumnsForBlock()

int Isis::SparseBlockRowMatrix::getLeadingColumnsForBlock ( int nblockColumn)

Sums and returns the number of columns in each matrix block prior to nblockColumn.

Parameters
nblockColumn
Returns
int Number of leading columns for block at nblockColumn

Definition at line 661 of file SparseBlockMatrix.cpp.

◆ insertMatrixBlock()

bool Isis::SparseBlockRowMatrix::insertMatrixBlock ( int nRowBlock,
int nRows,
int nCols )

Inserts a "newed" LinearAlgebra::Matrix pointer of size (nRows, nCols) into the map with the block row number as key.

The matrix::clear call initializes the matrix elements to zero. If an entry exists at the key nRowBlock, no insertion is made.

Parameters
nRowBlockblock row number of inserted matrix (key into map)
nRowsnumber of rows in matrix to be inserted
nColsnumber of columns in matrix to be inserted
Returns
bool Returns true if insertion successful Returns false if block already exists at nRowBlock or if allocation of new block fails TODO: we return true in the SparseBlockColumnMatrix if the block already exists, why is it different here?

Definition at line 507 of file SparseBlockMatrix.cpp.

◆ numberOfElements()

int Isis::SparseBlockRowMatrix::numberOfElements ( )

Returns total number of matrix elements in map (NOTE: NOT the number of matrix blocks).

The sum of all the elements of all the matrix blocks.

Returns
int Total number of matrix elements in SparseBlockRowMatrix

Definition at line 530 of file SparseBlockMatrix.cpp.

◆ operator=()

SparseBlockRowMatrix & Isis::SparseBlockRowMatrix::operator= ( const SparseBlockRowMatrix & src)

"Equals" operator.

Parameters
srcSparseBlockRowMatrix to check against

Definition at line 482 of file SparseBlockMatrix.cpp.

References copy().

◆ print()

void Isis::SparseBlockRowMatrix::print ( std::ostream & outstream)

Prints matrix blocks to std output stream out for debugging.

Parameters
outstreamoutput stream

Definition at line 552 of file SparseBlockMatrix.cpp.

◆ printClean()

void Isis::SparseBlockRowMatrix::printClean ( std::ostream & outstream)

Prints matrix blocks to std output stream out for debugging.

Parameters
outstreamoutput stream

Definition at line 578 of file SparseBlockMatrix.cpp.

◆ wipe()

void Isis::SparseBlockRowMatrix::wipe ( )

Deletes all pointer elements and removes them from the map.

Effectively, a destructor, and in fact, called by the ~SparseBlockColumnMatrix above.

Definition at line 437 of file SparseBlockMatrix.cpp.

Referenced by copy(), and ~SparseBlockRowMatrix().

◆ zeroBlocks()

void Isis::SparseBlockRowMatrix::zeroBlocks ( )

Sets all elements of all matrix blocks to zero.

Definition at line 611 of file SparseBlockMatrix.cpp.

Referenced by Isis::BundleAdjust::formLidarPointNormals(), and Isis::BundleAdjust::formPointNormals().


The documentation for this class was generated from the following files: