Matrix0 class

A simple matrix class for conjugate gradient calculations.

This class provides basic matrix operations needed for the conjugate gradient method, including matrix-vector multiplication.

Constructors, destructors, conversion operators

Matrix0(size_t rows, size_t cols)
Construct a new Matrix0 object.

Public functions

auto operator[](size_t i) -> std::vector<double>&
Access row i of the matrix.
auto operator[](size_t i) const -> const std::vector<double>&
Access row i of the matrix (const version)
auto rows() const -> size_t
Get the number of rows.
auto cols() const -> size_t
Get the number of columns.
auto dot(const Vector0& v) const -> Vector0
Multiply the matrix by a vector.

Function documentation

Matrix0::Matrix0(size_t rows, size_t cols)

Construct a new Matrix0 object.

Parameters
rows in Number of rows
cols in Number of columns

std::vector<double>& Matrix0::operator[](size_t i)

Access row i of the matrix.

Parameters
in Row index
Returns Reference to the row vector

const std::vector<double>& Matrix0::operator[](size_t i) const

Access row i of the matrix (const version)

Parameters
in Row index
Returns Const reference to the row vector

size_t Matrix0::rows() const

Get the number of rows.

Returns Number of rows

size_t Matrix0::cols() const

Get the number of columns.

Returns Number of columns

Vector0 Matrix0::dot(const Vector0& v) const

Multiply the matrix by a vector.

Parameters
in The vector to multiply
Returns The resulting vector