65 Array2D(
const size_t m,
const size_t n,
const doublereal v = 0.0)
80 Array2D(
const size_t m,
const size_t n,
const doublereal* values)
82 m_data.assign(values, values + n*m);
112 void resize(
size_t n,
size_t m, doublereal v = 0.0) {
128 for (
size_t m = 0; m <
m_nrows; m++) {
143 for (
size_t m = 0; m <
m_nrows; m++) {
153 void setRow(
size_t n,
const doublereal*
const rw) {
154 for (
size_t j = 0; j <
m_ncols; j++) {
165 void getRow(
size_t n, doublereal*
const rw) {
166 for (
size_t j = 0; j <
m_ncols; j++) {
179 for (
size_t i = 0; i <
m_nrows; i++) {
192 for (
size_t i = 0; i <
m_nrows; i++) {
231 doublereal&
value(
size_t i,
size_t j) {
242 doublereal
value(
size_t i,
size_t j)
const {
326 inline std::ostream& operator<<(std::ostream& s,
const Array2D& m)
328 size_t nr = m.
nRows();
330 for (
size_t i = 0; i < nr; i++) {
332 for (
size_t j = 1; j < nc; j++) {
A class for 2D arrays stored in column-major (Fortran-compatible) form.
void setRow(size_t n, const doublereal *const rw)
Set the nth row to array rw.
Array2D(const size_t m, const size_t n, const doublereal v=0.0)
Constructor.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with 'v'.
void zero()
Set all of the entries to zero.
size_t m_nrows
Number of rows.
vector_fp m_data
Data stored in a single array.
doublereal & value(size_t i, size_t j)
Returns a changeable reference to position in the matrix.
vector_fp & data()
Return a reference to the data vector.
const_iterator begin() const
Return a const iterator pointing to the first element.
void appendColumn(const doublereal *const c)
Append a column to the existing matrix.
const vector_fp & data() const
Return a const reference to the data vector.
Array2D(const size_t m, const size_t n, const doublereal *values)
Constructor.
void setColumn(size_t m, doublereal *const col)
Set the values in column m to those in array col.
size_t nRows() const
Number of rows.
void getColumn(size_t m, doublereal *const col)
Get the values in column m.
size_t m_ncols
Number of columns.
const doublereal * ptrColumn(size_t j) const
Return a const pointer to the top of column j, columns are contiguous in memory.
doublereal & operator()(size_t i, size_t j)
Allows setting elements using the syntax A(i,j) = x.
doublereal * ptrColumn(size_t j)
Return a pointer to the top of column j, columns are contiguous in memory.
size_t nColumns() const
Number of columns.
void getRow(size_t n, doublereal *const rw)
Get the nth row and return it in a vector.
doublereal value(size_t i, size_t j) const
Returns the value of a single matrix entry.
doublereal operator()(size_t i, size_t j) const
Allows retrieving elements using the syntax x = A(i,j).
iterator end()
Return an iterator pointing past the last element.
const_iterator end() const
Return a const iterator pointing to past the last element.
iterator begin()
Return an iterator pointing to the first element.
void appendColumn(const vector_fp &c)
Append a column to the existing matrix using a std vector.
vector_fp::const_iterator const_iterator
Type definition for the const_iterator class that is can be used by Array2D types.
Array2D()
Default constructor.
vector_fp::iterator iterator
Type definition for the iterator class that is can be used by Array2D types.
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.
void operator*=(Array2D &m, doublereal a)
Overload the times equals operator for multiplication of a matrix and a scalar.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
void operator+=(Array2D &x, const Array2D &y)
Overload the plus equals operator for addition of one matrix with another.
void sum_each(OutputIter x_begin, OutputIter x_end, InputIter y_begin)
Increment each entry in x by the corresponding entry in y.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...