10 #ifndef CT_BANDMATRIX_H
11 #define CT_BANDMATRIX_H
57 BandMatrix(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
80 void resize(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
86 void bfill(doublereal v = 0.0);
89 doublereal
operator()(
size_t i,
size_t j)
const;
101 doublereal&
value(
size_t i,
size_t j);
111 doublereal
value(
size_t i,
size_t j)
const;
120 size_t index(
size_t i,
size_t j)
const;
132 doublereal
_value(
size_t i,
size_t j)
const;
134 virtual size_t nRows()
const;
161 virtual void mult(
const doublereal* b, doublereal* prod)
const;
162 virtual void leftMult(
const doublereal*
const b, doublereal*
const prod)
const;
183 int solve(
const doublereal*
const b, doublereal*
const x);
194 int solve(doublereal* b);
200 virtual vector_fp::iterator
begin();
206 vector_fp::iterator
end();
212 vector_fp::const_iterator
begin()
const;
218 vector_fp::const_iterator
end()
const;
246 virtual doublereal
rcond(doublereal a1norm);
266 virtual doublereal
oneNorm()
const;
304 virtual doublereal*
const*
colPts();
325 virtual size_t checkRows(doublereal& valueSmall)
const;
336 virtual size_t checkColumns(doublereal& valueSmall)
const;
379 void err(
const std::string& msg)
const;
389 std::ostream& operator<<(std::ostream& s,
const BandMatrix& m);
size_t m_kl
Number of subdiagonals of the matrix.
virtual vector_fp::iterator begin()
Returns an iterator for the start of the band storage data.
vector_int iwork_
Extra work array needed - size = n.
virtual doublereal * ptrColumn(size_t j)
Return a pointer to the top of column j, column values are assumed to be contiguous in memory...
vector_fp work_
Extra dp work array needed - size = 3n.
virtual int factorQR()
Factors the A matrix using the QR algorithm, overwriting A.
BandMatrix()
Base Constructor.
vector_int & ipiv()
Return a reference to the pivot vector.
BandMatrix & operator=(const BandMatrix &y)
assignment operator
doublereal _value(size_t i, size_t j) const
Return the value of the (i,j) element for (i,j) within the bandwidth.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
size_t nSuperDiagonals() const
Number of superdiagonals.
virtual size_t checkRows(doublereal &valueSmall) const
Check to see if we have any zero rows in the jacobian.
int solve(const doublereal *const b, doublereal *const x)
Solve the matrix problem Ax = b.
doublereal & operator()(size_t i, size_t j)
Index into the (i,j) element.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
size_t nColumns() const
Number of columns.
vector_fp data
Matrix data.
size_t m_n
Number of rows and columns of the matrix.
void resize(size_t n, size_t kl, size_t ku, doublereal v=0.0)
Resize the matrix problem.
virtual void leftMult(const doublereal *const b, doublereal *const prod) const
Multiply b*A and write result to prod.
virtual GeneralMatrix * duplMyselfAsGeneralMatrix() const
Duplicator member function.
virtual size_t checkColumns(doublereal &valueSmall) const
Check to see if we have any zero columns in the jacobian.
std::vector< int > vector_int
Vector of ints.
virtual void clearFactorFlag()
Clear the factored flag.
virtual size_t nRowsAndStruct(size_t *const iStruct=0) const
Return the size and structure of the matrix.
virtual doublereal rcondQR()
Returns an estimate of the inverse of the condition number for the matrix.
void err(const std::string &msg) const
Error function that gets called for unhandled cases.
virtual doublereal rcond(doublereal a1norm)
Returns an estimate of the inverse of the condition number for the matrix.
vector_int m_ipiv
Pivot vector.
bool m_factored
Boolean indicating whether the matrix is factored.
doublereal & value(size_t i, size_t j)
Return a changeable reference to element (i,j).
size_t ldim() const
Return the number of rows of storage needed for the band storage.
virtual doublereal *const * colPts()
Return a vector of const pointers to the columns.
virtual void copyData(const GeneralMatrix &y)
Copy the data from one array into another without doing any checking.
virtual size_t nRows() const
Return the number of rows in the matrix.
vector_fp ludata
Factorized data.
virtual int factorAlgorithm() const
Returns the factor algorithm used.
size_t index(size_t i, size_t j) const
Returns the location in the internal 1D array corresponding to the (i,j) element in the banded array...
size_t m_ku
Number of super diagonals of the matrix.
virtual bool factored() const
Report whether the current matrix has been factored.
virtual void useFactorAlgorithm(int fAlgorithm)
Change the way the matrix is factored.
void bfill(doublereal v=0.0)
Fill or zero the matrix.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
doublereal m_zero
value of zero
virtual doublereal oneNorm() const
Returns the one norm of the matrix.
int factor()
Perform an LU decomposition, the LAPACK routine DGBTRF is used.
virtual void mult(const doublereal *b, doublereal *prod) const
Multiply A*b and write result to prod.
Declarations for the class GeneralMatrix which is a virtual base class for matrices handled by solver...
virtual void zero()
Zero the matrix elements.
std::vector< doublereal * > m_colPtrs
Vector of column pointers.
size_t nSubDiagonals() const
Number of subdiagonals.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
vector_fp::iterator end()
Returns an iterator for the end of the band storage data.
A class for banded matrices, involving matrix inversion processes.