Template Class DenseMatrix

Inheritance Relationships

Base Type

Class Documentation

template<typename TYPE>
class DenseMatrix : public opensn::NDArray<TYPE, 2>

Public Functions

inline DenseMatrix()

Create an empty dense matrix.

inline DenseMatrix(size_t rows, size_t cols)

Create a dense matrix with specified number of rows and columns

Parameters:
  • rows – Number of rows

  • cols – Number of columns

inline DenseMatrix(size_t rows, size_t cols, TYPE intitial_value)

Create a dense matrix with specified number of rows and columns and initialize the element to a given value

Parameters:
  • rows – Number of rows

  • cols – Number of columns

  • intitial_value – Value to initialize the matrix elements with

inline size_t Rows() const

Return the number of rows.

inline size_t Columns() const

Return the number of columns.

inline void Set(TYPE val)

Set the elements of the matrix to a specified value.

inline void SetDiagonal(TYPE val)

Set the diagonal of the matrix.

inline void SetRow(int row, const Vector<TYPE> &values)
inline void Add(const DenseMatrix<TYPE> &other)
inline void Subtract(const DenseMatrix<TYPE> &other)
inline Vector<TYPE> Mult(const Vector<TYPE> &x) const

Multiply matrix with a vector and return resulting vector.

inline DenseMatrix<TYPE> Mult(const DenseMatrix<TYPE> &other) const

Multiply by a matrix and return the resulting matrix.

inline DenseMatrix<TYPE> Transposed() const

Returns the transpose of a matrix.

inline void Transpose()

Transpose this matrix.

inline std::string PrintStr() const

Prints the matrix to a string and then returns the string.