# Template Class matrix

- Defined in File matrix.hpp

## Inheritance Relationships

### Base Type

- `public cif::matrix_expression< matrix< float > >` (Template Class matrix_expression)

## Class Documentation

template<typename F = float>
class matrix : public cif::matrix_expression<matrix<float>>

  Storage class implementation of matrix_expression.

  matrix is m x n, addressing i,j is 0 <= i < m and 0 <= j < n element m i,j is mapped to [i * n + j] and thus storage is row major

  Template Parameters:

    F – The type of the stored values

  Public Types

  using value_type = F

    The value type

  Public Functions

  template<typename M2>
  inline matrix(const matrix_expression<M2> &m)

    Copy construct a new matrix object using m.

    Template Parameters:

      M2 – Type of m

    Parameters:

      m – The matrix expression to copy values from

  inline matrix(std::size_t m, std::size_t n, value_type v = 0)

    Construct a new matrix object with dimension m and n setting the values to v.

    Parameters:

      - m – Requested dimension M

      - n – Requested dimension N

      - v – Value to store in each element

  inline std::size_t dim_m() const

    Return dimension m.

  inline std::size_t dim_n() const

    Return dimension n.

  inline value_type operator()(std::size_t i, std::size_t j) const

    Return the value of element [ i, j ]

  inline value_type &operator()(std::size_t i, std::size_t j)

    Return a reference to element [ i, j ]