27 if (values.size() != n * m) {
29 "Input array has incorrect length. Expected {}, got {}.", n * m, values.size());
31 m_data.assign(values.begin(), values.end());
41Array2D& Array2D::operator=(
const Array2D& y)
64 for (
size_t i = 0; i <
m_nrows; i++) {
72 for (
size_t j = 0; j <
m_ncols; j++) {
80 for (
size_t j = 0; j <
m_ncols; j++) {
88 for (
size_t i = 0; i <
m_nrows; i++) {
96 for (
size_t i = 0; i <
m_nrows; i++) {
103 size_t nr = m.
nRows();
105 for (
size_t i = 0; i < nr; i++) {
107 for (
size_t j = 1; j < nc; j++) {
Header file for class Cantera::Array2D.
A class for 2D arrays stored in column-major (Fortran-compatible) form.
vector< double > m_data
Data stored in a single array.
Array2D()=default
Default constructor.
size_t m_nrows
Number of rows.
void getColumn(size_t m, span< double > col) const
Get the values in column m.
void setRow(size_t n, span< const double > rw)
Set the nth row to array rw.
void appendColumn(span< const double > c)
Append a column to the existing matrix using a std vector.
void getRow(size_t n, span< double > rw) const
Get the nth row and return it in a vector.
size_t nRows() const
Number of rows.
size_t m_ncols
Number of columns.
size_t nColumns() const
Number of columns.
void setColumn(size_t m, span< const double > col)
Set the values in column m to those in array col.
span< double > col(size_t j)
Return a writable span over column j.
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.
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
Base class for exceptions thrown by Cantera classes.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
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.
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.
Various templated functions that carry out common vector and polynomial operations (see Templated Arr...