11 #ifndef CT_BANDMATRIX_H 12 #define CT_BANDMATRIX_H 22 typedef std::vector<long int> pivot_vector_t;
59 BandMatrix(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
73 void resize(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
79 void bfill(doublereal v = 0.0);
82 doublereal
operator()(
size_t i,
size_t j)
const;
93 doublereal&
value(
size_t i,
size_t j);
102 doublereal
value(
size_t i,
size_t j)
const;
111 size_t index(
size_t i,
size_t j)
const;
122 doublereal
_value(
size_t i,
size_t j)
const;
124 virtual size_t nRows()
const;
151 pivot_vector_t&
ipiv();
154 virtual void mult(
const doublereal* b, doublereal* prod)
const;
155 virtual void leftMult(
const doublereal*
const b, doublereal*
const prod)
const;
173 int solve(
const doublereal*
const b, doublereal*
const x);
184 int solve(doublereal* b,
size_t nrhs=1,
size_t ldb=0);
190 virtual vector_fp::iterator
begin();
196 vector_fp::iterator
end();
202 vector_fp::const_iterator
begin()
const;
208 vector_fp::const_iterator
end()
const;
219 virtual doublereal
rcond(doublereal a1norm);
226 virtual doublereal
oneNorm()
const;
261 virtual doublereal*
const*
colPts();
271 virtual size_t checkRows(doublereal& valueSmall)
const;
281 virtual size_t checkColumns(doublereal& valueSmall)
const;
284 int info()
const {
return m_info; };
310 std::vector<double*> m_lu_col_ptrs;
327 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.
vector_fp work_
Extra dp work array needed - size = 3n.
BandMatrix()
Base Constructor.
doublereal _value(size_t i, size_t j) const
Return the value of the (i,j) element for (i,j) within the bandwidth.
virtual size_t checkColumns(doublereal &valueSmall) const
Check to see if we have any zero columns 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.
int info() const
LAPACK "info" flag after last factor/solve operation.
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...
virtual void leftMult(const doublereal *const b, doublereal *const prod) const
Multiply b*A and write result to prod.
vector_fp data
Matrix data.
size_t m_n
Number of rows and columns of the matrix.
size_t nSubDiagonals() const
Number of subdiagonals.
void resize(size_t n, size_t kl, size_t ku, doublereal v=0.0)
Resize the matrix problem.
size_t nColumns() const
Number of columns.
virtual doublereal *const * colPts()
Return a vector of const pointers to the columns.
pivot_vector_t m_ipiv
Pivot vector.
virtual doublereal oneNorm() const
Returns the one norm of the matrix.
virtual int factorAlgorithm() const
Returns the factor algorithm used.
std::vector< int > vector_int
Vector of ints.
size_t nSuperDiagonals() const
Number of superdiagonals.
virtual doublereal rcond(doublereal a1norm)
Returns an estimate of the inverse of the condition number for the matrix.
virtual size_t checkRows(doublereal &valueSmall) const
Check to see if we have any zero rows in the Jacobian.
doublereal & value(size_t i, size_t j)
Return a changeable reference to element (i,j).
vector_fp ludata
Factorized data.
virtual size_t nRowsAndStruct(size_t *const iStruct=0) const
Return the size and structure of the matrix.
size_t m_ku
Number of super diagonals of the matrix.
virtual size_t nRows() const
Return the number of rows in the matrix.
size_t ldim() const
Return the number of rows of storage needed for the band storage.
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
int factor()
Perform an LU decomposition, the LAPACK routine DGBTRF is used.
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.
virtual GeneralMatrix * duplMyselfAsGeneralMatrix() const
Duplicator member function.
Namespace for the Cantera kernel.
virtual void mult(const doublereal *b, doublereal *prod) const
Multiply A*b and write result to prod.
pivot_vector_t & ipiv()
Return a reference to the pivot vector.
vector_fp::iterator end()
Returns an iterator for the end of the band storage data.
A class for banded matrices, involving matrix inversion processes.