Cantera
2.1.2
|
Generic matrix. More...
#include <GeneralMatrix.h>
Public Member Functions | |
GeneralMatrix (int matType) | |
Base Constructor. More... | |
GeneralMatrix (const GeneralMatrix &right) | |
Copy Constructor. More... | |
GeneralMatrix & | operator= (const GeneralMatrix &right) |
Assignment operator. More... | |
virtual | ~GeneralMatrix () |
Destructor. Does nothing. More... | |
virtual GeneralMatrix * | duplMyselfAsGeneralMatrix () const =0 |
Duplicator member function. More... | |
virtual void | zero ()=0 |
Zero the matrix elements. More... | |
virtual void | mult (const doublereal *b, doublereal *prod) const =0 |
Multiply A*b and write result to prod. More... | |
virtual void | leftMult (const doublereal *const b, doublereal *const prod) const =0 |
Multiply b*A and write result to prod. More... | |
virtual int | factor ()=0 |
Factors the A matrix, overwriting A. More... | |
virtual int | factorQR ()=0 |
Factors the A matrix using the QR algorithm, overwriting A. More... | |
virtual doublereal | rcondQR ()=0 |
Returns an estimate of the inverse of the condition number for the matrix. More... | |
virtual doublereal | rcond (doublereal a1norm)=0 |
Returns an estimate of the inverse of the condition number for the matrix. More... | |
virtual void | useFactorAlgorithm (int fAlgorithm)=0 |
Change the way the matrix is factored. More... | |
virtual int | factorAlgorithm () const =0 |
Return the factor algorithm used. More... | |
virtual doublereal | oneNorm () const =0 |
Calculate the one norm of the matrix. More... | |
virtual size_t | nRows () const =0 |
Return the number of rows in the matrix. More... | |
virtual size_t | nRowsAndStruct (size_t *const iStruct=0) const =0 |
Return the size and structure of the matrix. More... | |
virtual void | clearFactorFlag ()=0 |
clear the factored flag More... | |
virtual int | solve (doublereal *b)=0 |
Solves the Ax = b system returning x in the b spot. More... | |
virtual bool | factored () const =0 |
true if the current factorization is up to date with the matrix More... | |
virtual doublereal * | ptrColumn (size_t j)=0 |
Return a pointer to the top of column j, columns are assumed to be contiguous in memory. More... | |
virtual doublereal & | operator() (size_t i, size_t j)=0 |
Index into the (i,j) element. More... | |
virtual doublereal | operator() (size_t i, size_t j) const =0 |
Constant Index into the (i,j) element. More... | |
virtual void | copyData (const GeneralMatrix &y)=0 |
Copy the data from one array into another without doing any checking. More... | |
virtual vector_fp::iterator | begin ()=0 |
Return an iterator pointing to the first element. More... | |
virtual vector_fp::const_iterator | begin () const =0 |
Return a const iterator pointing to the first element. More... | |
virtual doublereal *const * | colPts ()=0 |
Return a vector of const pointers to the columns. More... | |
virtual size_t | checkRows (doublereal &valueSmall) const =0 |
Check to see if we have any zero rows in the jacobian. More... | |
virtual size_t | checkColumns (doublereal &valueSmall) const =0 |
Check to see if we have any zero columns in the jacobian. More... | |
Public Attributes | |
int | matrixType_ |
Matrix type. More... | |
Generic matrix.
Definition at line 23 of file GeneralMatrix.h.
GeneralMatrix | ( | int | matType | ) |
Base Constructor.
matType | Matrix type 0 full 1 banded |
Definition at line 18 of file GeneralMatrix.cpp.
GeneralMatrix | ( | const GeneralMatrix & | right | ) |
Copy Constructor.
Definition at line 23 of file GeneralMatrix.cpp.
|
virtual |
Destructor. Does nothing.
Definition at line 37 of file GeneralMatrix.cpp.
GeneralMatrix & operator= | ( | const GeneralMatrix & | right | ) |
Assignment operator.
Definition at line 28 of file GeneralMatrix.cpp.
References GeneralMatrix::matrixType_.
Referenced by SquareMatrix::operator=(), and BandMatrix::operator=().
|
pure virtual |
Duplicator member function.
This function will duplicate the matrix given a generic GeneralMatrix
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve(), and NonlinearSolver::solve_nonlinear_problem().
|
pure virtual |
Zero the matrix elements.
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Multiply A*b and write result to prod.
b | Vector to do the rh multiplication |
prod | OUTPUT vector to receive the result |
Implemented in BandMatrix.
|
pure virtual |
Multiply b*A and write result to prod.
b | Vector to do the lh multiplication |
prod | OUTPUT vector to receive the result |
Implemented in BandMatrix, and SquareMatrix.
|
pure virtual |
Factors the A matrix, overwriting A.
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Factors the A matrix using the QR algorithm, overwriting A.
we set m_factored to 2 to indicate the matrix is now QR factored
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Returns an estimate of the inverse of the condition number for the matrix.
The matrix must have been previously factored using the QR algorithm
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
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
a1norm | Norm of the matrix |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Change the way the matrix is factored.
fAlgorithm | integer 0 LU factorization 1 QR factorization |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Return the factor algorithm used.
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Calculate the one norm of the matrix.
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve().
|
pure virtual |
Return the number of rows in the matrix.
Implemented in BandMatrix, and SquareMatrix.
|
pure virtual |
Return the size and structure of the matrix.
iStruct | OUTPUT Pointer to a vector of ints that describe the structure of the matrix. |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::beuler_jac(), and NonlinearSolver::scaleMatrix().
|
pure virtual |
clear the factored flag
Implemented in BandMatrix, and SquareMatrix.
Referenced by BEulerInt::beuler_jac(), and NonlinearSolver::beuler_jac().
|
pure virtual |
Solves the Ax = b system returning x in the b spot.
b | Vector for the rhs of the equation system |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::doAffineNewtonSolve(), NonlinearSolver::doNewtonSolve(), and BEulerInt::doNewtonSolve().
|
pure virtual |
true if the current factorization is up to date with the matrix
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::calcSolnToResNormVector(), NonlinearSolver::doAffineNewtonSolve(), BEulerInt::doNewtonSolve(), and NonlinearSolver::scaleMatrix().
|
pure virtual |
Return a pointer to the top of column j, columns are assumed to be contiguous in memory.
j | Value of the column |
Implemented in BandMatrix, and SquareMatrix.
Referenced by BEulerInt::beuler_jac(), NonlinearSolver::beuler_jac(), BandMatrix::copyData(), and NonlinearSolver::scaleMatrix().
|
pure virtual |
Index into the (i,j) element.
i | row |
j | column |
Returns a changeable reference to the matrix entry
Implemented in SquareMatrix, and BandMatrix.
|
pure virtual |
Constant Index into the (i,j) element.
i | row |
j | column |
Returns an unchangeable reference to the matrix entry
Implemented in SquareMatrix, and BandMatrix.
|
pure virtual |
Copy the data from one array into another without doing any checking.
This differs from the assignment operator as no resizing is done and memcpy() is used.
y | Array to be copied |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::beuler_jac().
|
pure virtual |
Return an iterator pointing to the first element.
We might drop this later
Implemented in BandMatrix, and SquareMatrix.
Referenced by BEulerInt::computeResidWts(), NonlinearSolver::doAffineNewtonSolve(), BEulerInt::doNewtonSolve(), and NonlinearSolver::scaleMatrix().
|
pure virtual |
Return a const iterator pointing to the first element.
We might drop this later
Implemented in BandMatrix, and SquareMatrix.
|
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.
Implemented in BandMatrix.
Referenced by ResidJacEval::evalJacobian().
|
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
valueSmall | OUTPUT value of the largest coefficient in the smallest row |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::beuler_jac().
|
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
valueSmall | OUTPUT value of the largest coefficient in the smallest column |
Implemented in BandMatrix, and SquareMatrix.
Referenced by NonlinearSolver::beuler_jac().
int matrixType_ |
Matrix type.
0 Square 1 Banded
Definition at line 219 of file GeneralMatrix.h.
Referenced by NonlinearSolver::beuler_jac(), NonlinearSolver::doAffineNewtonSolve(), GeneralMatrix::operator=(), and NonlinearSolver::scaleMatrix().