11 #ifndef CT_BANDMATRIX_H
12 #define CT_BANDMATRIX_H
53 BandMatrix(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
67 void resize(
size_t n,
size_t kl,
size_t ku, doublereal v = 0.0);
73 void bfill(doublereal v = 0.0);
76 doublereal
operator()(
size_t i,
size_t j)
const;
87 doublereal&
value(
size_t i,
size_t j);
96 doublereal
value(
size_t i,
size_t j)
const;
105 size_t index(
size_t i,
size_t j)
const;
116 doublereal
_value(
size_t i,
size_t j)
const;
118 virtual size_t nRows()
const;
133 virtual void mult(
const doublereal* b, doublereal* prod)
const;
134 virtual void leftMult(
const doublereal*
const b, doublereal*
const prod)
const;
152 int solve(
const doublereal*
const b, doublereal*
const x);
163 int solve(doublereal* b,
size_t nrhs=1,
size_t ldb=0);
169 virtual vector_fp::iterator
begin();
175 vector_fp::iterator
end();
181 vector_fp::const_iterator
begin()
const;
187 vector_fp::const_iterator
end()
const;
198 virtual doublereal
rcond(doublereal a1norm);
205 virtual doublereal
oneNorm()
const;
238 virtual doublereal*
const*
colPts();
248 virtual size_t checkRows(doublereal& valueSmall)
const;
258 virtual size_t checkColumns(doublereal& valueSmall)
const;
261 int info()
const {
return m_info; };
289 std::vector<double*> m_lu_col_ptrs;
306 std::ostream& operator<<(std::ostream& s,
const BandMatrix& m);
Declarations for the class GeneralMatrix which is a virtual base class for matrices handled by solver...
A class for banded matrices, involving matrix inversion processes.
virtual void zero()
Zero the matrix elements.
virtual doublereal * ptrColumn(size_t j)
Return a pointer to the top of column j.
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 m_ku
Number of super diagonals of the matrix.
size_t m_kl
Number of subdiagonals of the matrix.
vector_fp ludata
Factorized data.
virtual size_t checkRows(doublereal &valueSmall) const
Check to see if we have any zero rows in the Jacobian.
std::vector< doublereal * > m_colPtrs
Vector of column pointers.
size_t nSubDiagonals() const
Number of subdiagonals.
size_t ldim() const
Return the number of rows of storage needed for the band storage.
int factor()
Perform an LU decomposition, the LAPACK routine DGBTRF is 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.
virtual void mult(const doublereal *b, doublereal *prod) const
Multiply A*b and write result to prod.
virtual size_t nRows() const
Return the number of rows in the matrix.
virtual doublereal rcond(doublereal a1norm)
Returns an estimate of the inverse of the condition number for the matrix.
vector_int iwork_
Extra work array needed - size = n.
virtual vector_fp::iterator begin()
Returns an iterator for the start of the band storage data.
std::unique_ptr< PivData > m_ipiv
Pivot vector.
void bfill(doublereal v=0.0)
Fill or zero the matrix.
BandMatrix()
Base Constructor.
size_t nColumns() const
Number of columns.
doublereal m_zero
value of zero
doublereal & operator()(size_t i, size_t j)
Index into the (i,j) element.
size_t nSuperDiagonals() const
Number of superdiagonals.
vector_fp work_
Extra dp work array needed - size = 3n.
int solve(const doublereal *const b, doublereal *const x)
Solve the matrix problem Ax = b.
virtual int factorAlgorithm() const
Returns the factor algorithm used.
vector_fp::iterator end()
Returns an iterator for the end of the band storage data.
int info() const
LAPACK "info" flag after last factor/solve operation.
void resize(size_t n, size_t kl, size_t ku, doublereal v=0.0)
Resize the matrix problem.
virtual size_t checkColumns(doublereal &valueSmall) const
Check to see if we have any zero columns in the Jacobian.
virtual void leftMult(const doublereal *const b, doublereal *const prod) const
Multiply b*A and write result to prod.
virtual doublereal *const * colPts()
Return a vector of const pointers to the columns.
doublereal & value(size_t i, size_t j)
Return a changeable reference to element (i,j).
size_t m_n
Number of rows and columns of the matrix.
vector_fp data
Matrix data.
virtual doublereal oneNorm() const
Returns the one norm of the matrix.
std::vector< int > vector_int
Vector of ints.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Namespace for the Cantera kernel.