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; };
285 std::unique_ptr<PivData>
m_ipiv;
289 std::vector<double*> m_lu_col_ptrs;
306 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.
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.
std::unique_ptr< PivData > m_ipiv
Pivot vector.
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.
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.
Namespace for the Cantera kernel.
virtual void mult(const doublereal *b, doublereal *prod) const
Multiply A*b and write result to prod.
vector_fp::iterator end()
Returns an iterator for the end of the band storage data.
A class for banded matrices, involving matrix inversion processes.