47 Array2D(
const size_t m,
const size_t n,
const double v=0.0);
59 Array2D(
const size_t m,
const size_t n,
const double* values);
73 virtual void resize(
size_t n,
size_t m,
double v=0.0);
98 void setRow(
size_t n,
const double*
const rw);
106 void getRow(
size_t n,
double*
const rw);
115 void setColumn(
size_t m,
double*
const col);
124 void getColumn(
size_t m,
double*
const col);
171 double value(
size_t i,
size_t j)
const {
191 const vector<double>&
data()
const {
195 void operator*=(
double a);
A class for 2D arrays stored in column-major (Fortran-compatible) form.
vector< double > m_data
Data stored in a single array.
void zero()
Set all of the entries to zero.
Array2D()=default
Default constructor.
size_t m_nrows
Number of rows.
void getColumn(size_t m, double *const col)
Get the values in column m.
void setColumn(size_t m, double *const col)
Set the values in column m to those in array col.
size_t nRows() const
Number of rows.
size_t m_ncols
Number of columns.
double value(size_t i, size_t j) const
Returns the value of a single matrix entry.
double & operator()(size_t i, size_t j)
Allows setting elements using the syntax A(i,j) = x.
size_t nColumns() const
Number of columns.
const vector< double > & data() const
Return a const reference to the data vector.
const double * ptrColumn(size_t j) const
Return a const pointer to the top of column j, columns are contiguous in memory.
void appendColumn(const vector< double > &c)
Append a column to the existing matrix using a std vector.
double * ptrColumn(size_t j)
Return a pointer to the top of column j, columns are contiguous in memory.
void setRow(size_t n, const double *const rw)
Set the nth row to array rw.
void getRow(size_t n, double *const rw)
Get the nth row and return it in a vector.
vector< double > & data()
Return a reference to the data vector.
double & value(size_t i, size_t j)
Returns a changeable reference to position in the matrix.
double operator()(size_t i, size_t j) const
Allows retrieving elements using the syntax x = A(i,j).
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
void operator*=(Array2D &m, double a)
Overload the times equals operator for multiplication of a matrix and a scalar.
std::ostream & operator<<(std::ostream &s, const Array2D &m)
Output the current contents of the Array2D object.