71 Array2D(
const size_t m,
const size_t n,
const doublereal v = 0.0)
87 Array2D(
const size_t m,
const size_t n,
const doublereal* values)
128 void resize(
size_t n,
size_t m, doublereal v = 0.0) {
156 for (m = 0; m <
m_nrows; m++) {
157 value(m_ncols, m) = c[m];
173 for (m = 0; m <
m_nrows; m++) {
174 value(m_ncols, m) = c[m];
183 void setRow(
size_t n,
const doublereal*
const rw) {
184 for (
size_t j = 0; j <
m_ncols; j++) {
195 void getRow(
size_t n, doublereal*
const rw) {
196 for (
size_t j = 0; j <
m_ncols; j++) {
210 for (
size_t i = 0; i <
m_nrows; i++) {
211 m_data[m_nrows*m + i] = col[i];
223 for (
size_t i = 0; i <
m_nrows; i++) {
224 col[i] =
m_data[m_nrows*m + i];
250 for (; b !=
end(); ++b, ++xb, ++yb) {
263 (void) memset((
void*) &
m_data[0], 0, nn *
sizeof(doublereal));
300 doublereal&
value(
size_t i,
size_t j) {
312 doublereal
value(
size_t i,
size_t j)
const {
400 inline std::ostream& operator<<(std::ostream& s,
const Array2D& m)
402 size_t nr = m.
nRows();
405 for (i = 0; i < nr; i++) {
406 for (j = 0; j < nc; j++) {
Array2D(const Array2D &y)
Copy constructor.
size_t nRows() const
Number of rows.
const vector_fp & data() const
Return a const reference to the data vector.
vector_fp m_data
Data stored in a single array.
Array2D()
Default constructor.
void resize(size_t n, size_t m, doublereal v=0.0)
Resize the array, and fill the new entries with 'v'.
Various templated functions that carry out common vector operations (see Templated Utility Functions)...
Array2D & operator=(const Array2D &y)
assignment operator
void appendColumn(const vector_fp &c)
Append a column to the existing matrix using a std vector.
void operator*=(Array2D &m, doublereal a)
Overload the times equals operator for multiplication of a matrix and a scalar.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
iterator end()
Return an iterator pointing past the last element.
void copyData(const Array2D &y)
Copy the data from one array into another without doing any checking.
doublereal value(size_t i, size_t j) const
Returns the value of a single matrix entry.
doublereal * ptrColumn(size_t j)
Return a pointer to the top of column j, columns are contiguous in memory.
void setRow(size_t n, const doublereal *const rw)
Set the nth row to array rw.
void axpy(doublereal a, const Array2D &x, const Array2D &y)
Evaluate z = a*x + y.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
void appendColumn(const doublereal *const c)
Append a column to the existing matrix.
void getColumn(size_t m, doublereal *const col)
Get the values in column m.
vector_fp::iterator iterator
Type definition for the iterator class that is can be used by Array2D types.
Array2D(const size_t m, const size_t n, const doublereal v=0.0)
Constructor.
size_t nColumns() const
Number of columns.
doublereal operator()(size_t i, size_t j) const
Allows retrieving elements using the syntax x = A(i,j).
size_t m_ncols
Number of columns.
size_t m_nrows
Number of rows.
Array2D(const size_t m, const size_t n, const doublereal *values)
Constructor.
vector_fp & data()
Return a reference to the data vector.
vector_fp::const_iterator const_iterator
Type definition for the const_iterator class that is can be used by Array2D types.
doublereal & value(size_t i, size_t j)
Returns a changeable reference to position in the matrix.
void operator+=(Array2D &x, const Array2D &y)
Overload the plus equals operator for addition of one matrix with another.
doublereal & operator()(size_t i, size_t j)
Allows setting elements using the syntax A(i,j) = x.
void sum_each(OutputIter x_begin, OutputIter x_end, InputIter y_begin)
Increment each entry in x by the corresponding entry in y.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
const doublereal * ptrColumn(size_t j) const
Return a const pointer to the top of column j, columns are contiguous in memory.
const_iterator begin() const
Return a const iterator pointing to the first element.
iterator begin()
Return an iterator pointing to the first element.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
void getRow(size_t n, doublereal *const rw)
Get the nth row and return it in a vector.
void zero()
Set all of the entries to zero.
virtual ~Array2D()
Destructor.
const_iterator end() const
Return a const iterator pointing to past the last element.
void setColumn(size_t m, doublereal *const col)
Set the values in column m to those in array col.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...