11 #ifndef CT_BANDMATRIX_H
12 #define CT_BANDMATRIX_H
55 BandMatrix(
size_t n,
size_t kl,
size_t ku,
double v = 0.0);
69 void resize(
size_t n,
size_t kl,
size_t ku,
double v = 0.0);
75 void bfill(
double v = 0.0);
77 double&
operator()(
size_t i,
size_t j)
override;
78 double operator()(
size_t i,
size_t j)
const override;
89 double&
value(
size_t i,
size_t j);
98 double value(
size_t i,
size_t j)
const;
107 size_t index(
size_t i,
size_t j)
const;
118 double _value(
size_t i,
size_t j)
const;
120 size_t nRows()
const override;
135 void mult(
const double* b,
double* prod)
const override;
136 void leftMult(
const double*
const b,
double*
const prod)
const override;
154 int solve(
const double*
const b,
double*
const x);
165 int solve(
double* b,
size_t nrhs=1,
size_t ldb=0)
override;
167 void zero()
override;
176 double rcond(
double a1norm)
override;
183 double oneNorm()
const override;
216 double*
const*
colPts()
override;
226 size_t checkRows(
double& valueSmall)
const override;
239 int info()
const {
return m_info; };
267 vector<double*> m_lu_col_ptrs;
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.
void leftMult(const double *const b, double *const prod) const override
Multiply b*A and write result to prod.
double *const * colPts() override
Return a vector of const pointers to the columns.
double & operator()(size_t i, size_t j) override
Index into the (i,j) element.
vector< double > ludata
Factorized data.
size_t m_ku
Number of super diagonals of the matrix.
size_t m_kl
Number of subdiagonals of the matrix.
double m_zero
value of zero
double rcond(double a1norm) override
Returns an estimate of the inverse of the condition number for the matrix.
size_t nSubDiagonals() const
Number of subdiagonals.
void resize(size_t n, size_t kl, size_t ku, double v=0.0)
Resize the matrix problem.
size_t ldim() const
Return the number of rows of storage needed for the band storage.
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.
void bfill(double v=0.0)
Fill or zero the matrix.
BandMatrix()
Base Constructor.
size_t checkColumns(double &valueSmall) const override
Check to see if we have any zero columns in the Jacobian.
vector< double * > m_colPtrs
Vector of column pointers.
double * ptrColumn(size_t j) override
Return a pointer to the top of column j.
vector< double > work_
Extra dp work array needed - size = 3n.
int factor() override
Perform an LU decomposition, the LAPACK routine DGBTRF is used.
unique_ptr< PivData > m_ipiv
Pivot vector.
size_t nColumns() const
Number of columns.
void mult(const double *b, double *prod) const override
Multiply A*b and write result to prod.
size_t checkRows(double &valueSmall) const override
Check to see if we have any zero rows in the Jacobian.
size_t nSuperDiagonals() const
Number of superdiagonals.
size_t nRows() const override
Return the number of rows in the matrix.
vector< int > iwork_
Extra work array needed - size = n.
vector< double > data
Matrix data.
int info() const
LAPACK "info" flag after last factor/solve operation.
int solve(const double *const b, double *const x)
Solve the matrix problem Ax = b.
void zero() override
Zero the matrix elements.
size_t m_n
Number of rows and columns of the matrix.
double oneNorm() const override
Returns the one norm of the matrix.
double _value(size_t i, size_t j) const
Return the value of the (i,j) element for (i,j) within the bandwidth.
double & value(size_t i, size_t j)
Return a changeable reference to element (i,j).
int factorAlgorithm() const override
Returns the factor algorithm used.
Namespace for the Cantera kernel.
std::ostream & operator<<(std::ostream &s, const Array2D &m)
Output the current contents of the Array2D object.