GeneralMatrix Class Reference#
Generic matrix. More...
#include <GeneralMatrix.h>
Detailed Description
Generic matrix.
Definition at line 22 of file GeneralMatrix.h.
Public Member Functions | |
GeneralMatrix ()=default | |
Base Constructor. | |
virtual void | zero ()=0 |
Zero the matrix elements. | |
virtual void | mult (const double *b, double *prod) const =0 |
Multiply A*b and write result to prod. | |
virtual void | leftMult (const double *const b, double *const prod) const =0 |
Multiply b*A and write result to prod. | |
virtual int | factor ()=0 |
Factors the A matrix, overwriting A. | |
virtual int | factorQR () |
Factors the A matrix using the QR algorithm, overwriting A. | |
virtual double | rcondQR () |
Returns an estimate of the inverse of the condition number for the matrix. | |
virtual double | rcond (double a1norm)=0 |
Returns an estimate of the inverse of the condition number for the matrix. | |
virtual void | useFactorAlgorithm (int fAlgorithm) |
Change the way the matrix is factored. | |
virtual int | factorAlgorithm () const =0 |
Return the factor algorithm used. | |
virtual double | oneNorm () const =0 |
Calculate the one norm of the matrix. | |
virtual size_t | nRows () const =0 |
Return the number of rows in the matrix. | |
virtual void | clearFactorFlag () |
clear the factored flag | |
virtual int | solve (double *b, size_t nrhs=1, size_t ldb=0)=0 |
Solves the Ax = b system returning x in the b spot. | |
virtual bool | factored () const |
true if the current factorization is up to date with the matrix | |
virtual double * | ptrColumn (size_t j)=0 |
Return a pointer to the top of column j, columns are assumed to be contiguous in memory. | |
virtual double & | operator() (size_t i, size_t j)=0 |
Index into the (i,j) element. | |
virtual double | operator() (size_t i, size_t j) const =0 |
Constant Index into the (i,j) element. | |
virtual double *const * | colPts ()=0 |
Return a vector of const pointers to the columns. | |
virtual size_t | checkRows (double &valueSmall) const =0 |
Check to see if we have any zero rows in the Jacobian. | |
virtual size_t | checkColumns (double &valueSmall) const =0 |
Check to see if we have any zero columns in the Jacobian. | |
Protected Attributes | |
int | m_factored = false |
Indicates whether the matrix is factored. | |
Constructor & Destructor Documentation
◆ GeneralMatrix()
|
default |
Base Constructor.
Member Function Documentation
◆ zero()
|
pure virtual |
Zero the matrix elements.
Implemented in BandMatrix.
◆ mult()
|
pure virtual |
Multiply A*b and write result to prod.
- Parameters
-
b Vector to do the rh multiplication prod OUTPUT vector to receive the result
Implemented in BandMatrix.
◆ leftMult()
|
pure virtual |
Multiply b*A and write result to prod.
- Parameters
-
b Vector to do the lh multiplication prod OUTPUT vector to receive the result
Implemented in BandMatrix.
◆ factor()
|
pure virtual |
Factors the A matrix, overwriting A.
We flip m_factored boolean to indicate that the matrix is now A-1.
Implemented in BandMatrix.
◆ factorQR()
|
inlinevirtual |
Factors the A matrix using the QR algorithm, overwriting A.
we set m_factored to 2 to indicate the matrix is now QR factored
- Returns
- the info variable from LAPACK
Definition at line 59 of file GeneralMatrix.h.
◆ rcondQR()
|
inlinevirtual |
Returns an estimate of the inverse of the condition number for the matrix.
The matrix must have been previously factored using the QR algorithm
- Returns
- the inverse of the condition number
Definition at line 69 of file GeneralMatrix.h.
◆ rcond()
|
pure virtual |
Returns an estimate of the inverse of the condition number for the matrix.
The matrix must have been previously factored using the LU algorithm
- Parameters
-
a1norm Norm of the matrix
- Returns
- the inverse of the condition number
Implemented in BandMatrix.
◆ useFactorAlgorithm()
|
inlinevirtual |
Change the way the matrix is factored.
- Parameters
-
fAlgorithm integer 0 LU factorization 1 QR factorization
Definition at line 88 of file GeneralMatrix.h.
◆ factorAlgorithm()
|
pure virtual |
Return the factor algorithm used.
Implemented in BandMatrix.
◆ oneNorm()
|
pure virtual |
Calculate the one norm of the matrix.
Implemented in BandMatrix.
◆ nRows()
|
pure virtual |
Return the number of rows in the matrix.
Implemented in BandMatrix.
◆ clearFactorFlag()
|
inlinevirtual |
clear the factored flag
Definition at line 102 of file GeneralMatrix.h.
◆ solve()
|
pure virtual |
Solves the Ax = b system returning x in the b spot.
- Parameters
-
b Vector for the RHS of the equation system nrhs Number of right-hand sides to solve, default 1 ldb Leading dimension of the right-hand side array. Defaults to nRows()
Implemented in BandMatrix.
◆ factored()
|
inlinevirtual |
true if the current factorization is up to date with the matrix
Definition at line 116 of file GeneralMatrix.h.
◆ ptrColumn()
|
pure virtual |
Return a pointer to the top of column j, columns are assumed to be contiguous in memory.
- Parameters
-
j Value of the column
- Returns
- a pointer to the top of the column
Implemented in BandMatrix.
◆ operator()() [1/2]
|
pure virtual |
Index into the (i,j) element.
- Parameters
-
i row j column
- Returns
- a changeable reference to the matrix entry
Implemented in BandMatrix.
◆ operator()() [2/2]
|
pure virtual |
Constant Index into the (i,j) element.
- Parameters
-
i row j column
- Returns
- an unchangeable reference to the matrix entry
Implemented in BandMatrix.
◆ colPts()
|
pure virtual |
Return a vector of const pointers to the columns.
Note the value of the pointers are protected by their being const. However, the value of the matrix is open to being changed.
- Returns
- a vector of pointers to the top of the columns of the matrices.
Implemented in BandMatrix.
◆ checkRows()
|
pure virtual |
Check to see if we have any zero rows in the Jacobian.
This utility routine checks to see if any rows are zero. The smallest row is returned along with the largest coefficient in that row
- Parameters
-
valueSmall OUTPUT value of the largest coefficient in the smallest row
- Returns
- index of the row that is most nearly zero
Implemented in BandMatrix.
◆ checkColumns()
|
pure virtual |
Check to see if we have any zero columns in the Jacobian.
This utility routine checks to see if any columns are zero. The smallest column is returned along with the largest coefficient in that column
- Parameters
-
valueSmall OUTPUT value of the largest coefficient in the smallest column
- Returns
- index of the column that is most nearly zero
Implemented in BandMatrix.
Member Data Documentation
◆ m_factored
|
protected |
Indicates whether the matrix is factored.
0 for unfactored; Non-zero values indicate a particular factorization (LU=1, QR=2).
Definition at line 176 of file GeneralMatrix.h.
The documentation for this class was generated from the following file:
Generated by 1.9.7