10 #ifndef CT_BANDMATRIX_H
11 #define CT_BANDMATRIX_H
53 BandMatrix(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
76 void resize(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
82 void bfill(doublereal v = 0.0);
85 doublereal
operator()(
size_t i,
size_t j)
const;
97 doublereal&
value(
size_t i,
size_t j);
107 doublereal
value(
size_t i,
size_t j)
const;
116 size_t index(
size_t i,
size_t j)
const;
128 doublereal
_value(
size_t i,
size_t j)
const;
130 virtual size_t nRows()
const;
158 virtual void mult(
const doublereal* b, doublereal* prod)
const;
159 virtual void leftMult(
const doublereal*
const b, doublereal*
const prod)
const;
180 int solve(
const doublereal*
const b, doublereal*
const x);
193 int solve(doublereal* b,
size_t nrhs=1,
size_t ldb=0);
199 virtual vector_fp::iterator
begin();
205 vector_fp::iterator
end();
211 vector_fp::const_iterator
begin()
const;
217 vector_fp::const_iterator
end()
const;
229 virtual doublereal
rcond(doublereal a1norm);
236 virtual doublereal
oneNorm()
const;
271 virtual doublereal*
const*
colPts();
290 virtual size_t checkRows(doublereal& valueSmall)
const;
301 virtual size_t checkColumns(doublereal& valueSmall)
const;
352 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.
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.
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.
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 size_t nRowsAndStruct(size_t *const iStruct=0) const
Return the size and structure of the matrix.
virtual doublereal rcond(doublereal a1norm)
Returns an estimate of the inverse of the condition number for the matrix.
vector_int m_ipiv
Pivot vector.
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 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.
vector_fp::iterator end()
Returns an iterator for the end of the band storage data.
A class for banded matrices, involving matrix inversion processes.