Added column pointers as a member to this object. This is
needed for linking in sundance more closely.
This commit is contained in:
parent
d2f885acd5
commit
82e194a2b0
2 changed files with 48 additions and 1 deletions
|
|
@ -38,6 +38,10 @@ namespace Cantera {
|
|||
m_printLevel(0)
|
||||
{
|
||||
m_ipiv.resize(max(n, m));
|
||||
m_colPts.resize(m);
|
||||
for (int j = 0; j < m; j++) {
|
||||
m_colPts[j] = &(m_data[m_nrows*j]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Copy constructor
|
||||
|
|
@ -51,6 +55,10 @@ namespace Cantera {
|
|||
m_printLevel(0)
|
||||
{
|
||||
m_ipiv = y.ipiv();
|
||||
m_colPts.resize(m_ncols);
|
||||
for (int j = 0; j < m_ncols; j++) {
|
||||
m_colPts[j] = &(m_data[m_nrows*j]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
// assignment
|
||||
|
|
@ -58,6 +66,10 @@ namespace Cantera {
|
|||
if (&y == this) return *this;
|
||||
Array2D::operator=(y);
|
||||
m_ipiv = y.ipiv();
|
||||
m_colPts.resize(m_ncols);
|
||||
for (int j = 0; j < m_ncols; j++) {
|
||||
m_colPts[j] = &(m_data[m_nrows*j]);
|
||||
}
|
||||
m_useReturnErrorCode = y.m_useReturnErrorCode;
|
||||
m_printLevel = y.m_printLevel;
|
||||
return *this;
|
||||
|
|
@ -71,6 +83,18 @@ namespace Cantera {
|
|||
void DenseMatrix::resize(int n, int m, doublereal v) {
|
||||
Array2D::resize(n,m,v);
|
||||
m_ipiv.resize( max(n,m) );
|
||||
m_colPts.resize(m_ncols);
|
||||
for (int j = 0; j < m_ncols; j++) {
|
||||
m_colPts[j] = &(m_data[m_nrows*j]);
|
||||
}
|
||||
}
|
||||
//====================================================================================================================
|
||||
doublereal * const * DenseMatrix::colPts() {
|
||||
return &(m_colPts[0]);
|
||||
}
|
||||
//====================================================================================================================
|
||||
const doublereal * const * DenseMatrix::const_colPts() const {
|
||||
return &(m_colPts[0]);
|
||||
}
|
||||
//====================================================================================================================
|
||||
void DenseMatrix::mult(const double* b, double* prod) const {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,27 @@ namespace Cantera {
|
|||
* @param m New number of columns
|
||||
* @param v Default fill value. defaults to zero.
|
||||
*/
|
||||
void resize(int n, int m, doublereal v = 0.0);
|
||||
void resize(int n, int m, doublereal v);
|
||||
|
||||
//! Return a vector of const pointers to the columns
|
||||
/*!
|
||||
* Note the value of the pointers are protected by their being const.
|
||||
* However, the value of the matrix is open to being changed.
|
||||
*
|
||||
* @return returns a vector of pointers to the top of the columns
|
||||
* of the matrices.
|
||||
*/
|
||||
doublereal * const * colPts();
|
||||
|
||||
//! Return a const vector of const pointers to the columns
|
||||
/*!
|
||||
* Note, the jacobian can not be altered by this routine, and
|
||||
* therefore the member function is const.
|
||||
*
|
||||
* @return returns a vector of pointers to the top of the columns
|
||||
* of the matrices.
|
||||
*/
|
||||
const doublereal * const * const_colPts() const;
|
||||
|
||||
//! Multiply A*b and write result to \c prod.
|
||||
/*!
|
||||
|
|
@ -150,6 +170,9 @@ namespace Cantera {
|
|||
//! Vector of pivots. Length is equal to the max of m and n.
|
||||
vector_int m_ipiv;
|
||||
|
||||
//! Vector of column pointers
|
||||
std::vector<doublereal *> m_colPts;
|
||||
|
||||
public:
|
||||
|
||||
//! Error Handling Flag
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue