Loading [MathJax]/jax/output/NativeMML/config.js
Isis 3 Developer Reference
SparseBlockMatrix.h
Go to the documentation of this file.
1 #ifndef SparseBlockMatrix_h
2 #define SparseBlockMatrix_h
3 
23 // std library
24 #include <iostream>
25 
26 // Qt library
27 #include <QMap>
28 #include <QList>
29 
30 // boost library
31 #include <boost/numeric/ublas/fwd.hpp>
32 
33 // Isis library
34 #include "LinearAlgebra.h"
35 
36 // Qt library
37 class QDebug;
38 
39 namespace Isis {
40 
70  public QMap< int, LinearAlgebra::Matrix * > {
71 
72  public:
73  SparseBlockColumnMatrix(); // default constructor
74  ~SparseBlockColumnMatrix(); // destructor
75 
76  // copy constructor
78 
80 
81  void wipe();
82  void copy(const SparseBlockColumnMatrix& src);
83 
84  void zeroBlocks();
85  bool insertMatrixBlock(int nColumnBlock, int nRows, int nCols);
86 
87  void setStartColumn(int nStartColumn);
88  int startColumn() const;
89  int numberOfElements();
90  int numberOfRows();
91  int numberOfColumns();
92  void print(std::ostream& outstream);
93  void printClean(std::ostream& outstream);
94 
95  protected:
99  };
100 
101  // operators to read/write SparseBlockColumnMatrix to/from binary disk file
102  QDataStream &operator<<(QDataStream &, const SparseBlockColumnMatrix &);
103  QDataStream &operator>>(QDataStream &, SparseBlockColumnMatrix &);
104 
105  // operator to write SparseBlockColumnMatrix to QDebug stream
106  QDebug operator<<(QDebug dbg, const SparseBlockColumnMatrix &sbcm);
107 
108 
137  public QMap< int, LinearAlgebra::Matrix * > {
138 
139  public:
140  SparseBlockRowMatrix(){} // default constructor
142 
143  // copy constructor
145 
147 
148 
149  void wipe();
150  void copy(const SparseBlockRowMatrix& src);
151 
152  void zeroBlocks();
153  bool insertMatrixBlock(int nRowBlock, int nRows, int nCols);
154  void copyToBoost(boost::numeric::ublas::compressed_matrix<double>& B);
155  int getLeadingColumnsForBlock(int nblockColumn);
156  int numberOfElements();
157  void print(std::ostream& outstream);
158  void printClean(std::ostream& outstream);
159  };
160 
161  // operators to read/write SparseBlockRowMatrix to/from binary disk file
162  QDataStream &operator<<(QDataStream &, const SparseBlockRowMatrix &);
163  QDataStream &operator>>(QDataStream &, SparseBlockRowMatrix &);
164 
165  // operator to write SparseBlockRowMatrix to QDebug stream
166  QDebug operator<<(QDebug dbg, const SparseBlockRowMatrix &sbcm);
167 
198  class SparseBlockMatrix : public QList< SparseBlockColumnMatrix* > {
199 
200  public:
201  SparseBlockMatrix() {} // default constructor
203 
204  // copy constructor
206 
208 
209  void wipe();
210  void copy(const SparseBlockMatrix& src);
211 
212  bool setNumberOfColumns( int n );
213  void zeroBlocks();
214  bool insertMatrixBlock(int nColumnBlock, int nRowBlock, int nRows, int nCols);
215  LinearAlgebra::Matrix *getBlock(int column, int row);
216  int numberOfBlocks();
219  int numberOfElements();
220  void print(std::ostream& outstream);
221  void printClean(std::ostream& outstream);
222  bool write(std::ofstream &fp_out, bool binary=true);
223  int getLeadingColumnsForBlock(int nblockColumn);
224  int getLeadingRowsForBlock(int nblockRow);
225  };
226 
227  // operators to read/write SparseBlockMatrix to/from binary disk file
228  QDataStream &operator<<(QDataStream &, const SparseBlockMatrix &);
229  QDataStream &operator>>(QDataStream &, SparseBlockMatrix &);
230 
231  // operator to write SparseBlockMatrix to QDebug stream
232  QDebug operator<<(QDebug dbg, const SparseBlockMatrix &m);
233 }
234 
235 #endif
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 nColu...
Definition: SparseBlockMatrix.cpp:889
void copy(const SparseBlockRowMatrix &src)
Copy method.
Definition: SparseBlockMatrix.cpp:452
SparseBlockMatrix.
Definition: SparseBlockMatrix.h:198
bool write(std::ofstream &fp_out, bool binary=true)
void setStartColumn(int nStartColumn)
Sets starting column for block in full matrix.
Definition: SparseBlockMatrix.cpp:141
SparseBlockColumnMatrix.
Definition: SparseBlockMatrix.h:69
SparseBlockRowMatrix()
Definition: SparseBlockMatrix.h:140
void wipe()
Deletes all pointer elements and removes them from the map.
Definition: SparseBlockMatrix.cpp:431
SparseBlockRowMatrix & operator=(const SparseBlockRowMatrix &src)
"Equals" operator.
Definition: SparseBlockMatrix.cpp:476
void zeroBlocks()
Sets all elements of all matrix blocks to zero.
Definition: SparseBlockMatrix.cpp:605
int numberOfElements()
Returns total number of matrix elements in map (NOTE: NOT the number of matrix blocks).
Definition: SparseBlockMatrix.cpp:524
~SparseBlockColumnMatrix()
Destructor.
Definition: SparseBlockMatrix.cpp:37
int numberOfElements()
Returns total number of matrix elements in map (NOTE: NOT the number of matrix blocks).
Definition: SparseBlockMatrix.cpp:162
SparseBlockColumnMatrix & operator=(const SparseBlockColumnMatrix &src)
"Equals" operator.
Definition: SparseBlockMatrix.cpp:93
boost::numeric::ublas::matrix< double > Matrix
Definition for an Isis::LinearAlgebra::Matrix of doubles.
Definition: LinearAlgebra.h:115
void zeroBlocks()
Sets all elements of all matrix blocks to zero.
Definition: SparseBlockMatrix.cpp:293
void printClean(std::ostream &outstream)
Prints matrix blocks to std output stream out for debugging.
Definition: SparseBlockMatrix.cpp:260
int getLeadingColumnsForBlock(int nblockColumn)
Sums and returns the number of columns in each matrix block prior to nblockColumn.
Definition: SparseBlockMatrix.cpp:655
int m_startColumn
starting column for this Block Column in full matrix e.g.
Definition: SparseBlockMatrix.h:96
int getLeadingRowsForBlock(int nblockRow)
Sums and returns the number of rows in each matrix block prior to nblockRow.
Definition: SparseBlockMatrix.cpp:1082
void wipe()
Deletes all pointer elements and removes them from the map.
Definition: SparseBlockMatrix.cpp:46
int numberOfElements()
Returns number of matrix elements in matrix.
Definition: SparseBlockMatrix.cpp:957
int numberOfRows()
Returns total number of rows in map (this needs to be clarified and maybe rewritten).
Definition: SparseBlockMatrix.cpp:209
~SparseBlockMatrix()
Destructor.
Definition: SparseBlockMatrix.cpp:803
bool insertMatrixBlock(int nRowBlock, int nRows, int nCols)
Inserts a "newed" LinearAlgebra::Matrix pointer of size (nRows, nCols) into the map with the block ro...
Definition: SparseBlockMatrix.cpp:501
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:463
void wipe()
Deletes all pointer elements and removes them from the list.
Definition: SparseBlockMatrix.cpp:812
void printClean(std::ostream &outstream)
Prints matrix blocks to std output stream out for debugging.
Definition: SparseBlockMatrix.cpp:572
~SparseBlockRowMatrix()
Destructor.
Definition: SparseBlockMatrix.cpp:422
void print(std::ostream &outstream)
Prints matrix blocks to std output stream out for debugging.
Definition: SparseBlockMatrix.cpp:999
void print(std::ostream &outstream)
Prints matrix blocks to std output stream out for debugging.
Definition: SparseBlockMatrix.cpp:233
void print(std::ostream &outstream)
Prints matrix blocks to std output stream out for debugging.
Definition: SparseBlockMatrix.cpp:546
void printClean(std::ostream &outstream)
Prints matrix blocks to std output stream out for debugging.
Definition: SparseBlockMatrix.cpp:1023
int numberOfColumns()
Returns total number of columns in map (NOTE: NOT the number of matrix blocks).
Definition: SparseBlockMatrix.cpp:184
int numberOfOffDiagonalBlocks()
Returns number of off-diagonal matrix blocks.
Definition: SparseBlockMatrix.cpp:947
SparseBlockMatrix()
Definition: SparseBlockMatrix.h:201
LinearAlgebra::Matrix * getBlock(int column, int row)
Returns pointer to boost matrix at position (column, row).
Definition: SparseBlockMatrix.cpp:980
void copyToBoost(boost::numeric::ublas::compressed_matrix< double > &B)
Copies a SparseBlockRowMatrix to a Boost compressed_matrix.
Definition: SparseBlockMatrix.cpp:620
int numberOfDiagonalBlocks()
Returns number of diagonal matrix blocks (equivalent to size - there is one per column).
Definition: SparseBlockMatrix.cpp:918
void zeroBlocks()
Sets all elements of all matrix blocks to zero.
Definition: SparseBlockMatrix.cpp:988
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
SparseBlockColumnMatrix()
Default constructor.
Definition: SparseBlockMatrix.cpp:29
bool insertMatrixBlock(int nColumnBlock, int nRows, int nCols)
Inserts a "newed" LinearAlgebra::Matrix pointer of size (nRows, nCols) into the map with the block co...
Definition: SparseBlockMatrix.cpp:115
void copy(const SparseBlockColumnMatrix &src)
Copy method.
Definition: SparseBlockMatrix.cpp:67
bool setNumberOfColumns(int n)
Initializes number of columns (SparseBlockColumnMatrix).
Definition: SparseBlockMatrix.cpp:867
int numberOfBlocks()
Returns total number of blocks in matrix.
Definition: SparseBlockMatrix.cpp:899
int startColumn() const
Sets starting column for block in full matrix.
Definition: SparseBlockMatrix.cpp:151
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:308
SparseBlockMatrix & operator=(const SparseBlockMatrix &src)
"Equals" operator.
Definition: SparseBlockMatrix.cpp:849
SparseBlockRowMatrix.
Definition: SparseBlockMatrix.h:136
void copy(const SparseBlockMatrix &src)
Copy method.
Definition: SparseBlockMatrix.cpp:833
Definition: CubeIoHandler.h:38
int getLeadingColumnsForBlock(int nblockColumn)
Sums and returns the number of columns in each matrix block prior to nblockColumn.
Definition: SparseBlockMatrix.cpp:1048

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/12/2023 23:30:02