eckit::linalg::Matrix class

Dense matrix in column major storage order.

Public types

using Size = linalg::Size

Constructors, destructors, conversion operators

Matrix()
Default constructor (empty matrix)
Matrix(Size rows, Size cols)
Construct matrix with given rows and columns (allocates memory, not initialised)
Matrix(const Scalar* array, Size rows, Size cols)
Construct matrix from existing data (does NOT take ownership)
Matrix(Stream&)
Constructor from Stream.
Matrix(const Matrix&)
Copy constructor.
~Matrix()
Destructor.

Public functions

auto operator=(const Matrix&) -> Matrix&
void swap(Matrix&)
Swap this matrix with another.
void resize(Size rows, Size cols)
Resize matrix to given number of rows/columns (invalidates data)
void setZero()
Set data to zero.
void fill(Scalar)
Fill vector with given scalar.
void encode(Stream&) const
Serialise to a Stream.
auto size() const -> Size
auto rows() const -> Size
auto cols() const -> Size
auto operator()(Size row, Size col) -> Scalar&
auto operator()(Size row, Size col) const -> const Scalar&
auto operator[](Size i) -> Scalar&
Access to linearised storage.
auto operator[](Size i) const -> const Scalar&
auto data() -> Scalar*
auto data() const -> const Scalar*
auto begin() -> Scalar*
auto begin() const -> const Scalar*
auto end() -> Scalar*
auto end() const -> const Scalar*

Function documentation

Size eckit::linalg::Matrix::size() const

Returns size (rows * cols)

Size eckit::linalg::Matrix::rows() const

Returns number of rows

Size eckit::linalg::Matrix::cols() const

Returns number of columns

Scalar& eckit::linalg::Matrix::operator()(Size row, Size col)

Access by row and column

Scalar* eckit::linalg::Matrix::data()

Returns modifiable view of the data

const Scalar* eckit::linalg::Matrix::data() const

Returns read-only view of the data

Scalar* eckit::linalg::Matrix::begin()

Returns iterator to beginning of the data

const Scalar* eckit::linalg::Matrix::begin() const

Returns const iterator to beginning of the data

Scalar* eckit::linalg::Matrix::end()

Returns iterator to end of the data

const Scalar* eckit::linalg::Matrix::end() const

Returns const iterator to end of the data