23#ifndef MORPHEUS_MATRIXBASE_HPP
24#define MORPHEUS_MATRIXBASE_HPP
26#include <Morpheus_MatrixOptions.hpp>
27#include <Morpheus_ContainerTraits.hpp>
68template <
template <
class,
class...>
class Container,
class ValueType,
83 : _m(0), _n(0), _nnz(0), _structure(MATSTR_NONE), _options(MATOPT_NONE) {}
93 MatrixBase(size_type rows, size_type cols, size_type entries = 0)
97 _structure(MATSTR_NONE),
98 _options(MATOPT_NONE) {}
108 void resize(size_type rows, size_type cols, size_type entries) {
119 inline size_type
nrows()
const {
return _m; }
126 inline size_type
ncols()
const {
return _n; }
133 inline size_type
nnnz()
const {
return _nnz; }
140 inline void set_nrows(
const size_type rows) { _m = rows; }
147 inline void set_ncols(
const size_type cols) { _n = cols; }
154 inline void set_nnnz(
const size_type nnz) { _nnz = nnz; }
161 inline MatrixStructure
structure()
const {
return _structure; }
168 inline MatrixOptions
options()
const {
return _options; }
185 size_type _m, _n, _nnz;
186 MatrixStructure _structure;
187 MatrixOptions _options;
Base class used to derive new matrices.
Definition: Morpheus_MatrixBase.hpp:70
void set_options(MatrixOptions op)
Set the characteristics of the matrix.
Definition: Morpheus_MatrixBase.hpp:182
void set_ncols(const size_type cols)
Set the number of columns of the matrix.
Definition: Morpheus_MatrixBase.hpp:147
MatrixBase(size_type rows, size_type cols, size_type entries=0)
Construct a MatrixBase object with shape (num_rows, num_cols) and number of non-zeros equal to num_en...
Definition: Morpheus_MatrixBase.hpp:93
void set_structure(MatrixStructure op)
Set the structure of the matrix.
Definition: Morpheus_MatrixBase.hpp:175
void resize(size_type rows, size_type cols, size_type entries)
Resizes MatrixBase with shape of (num_rows, num_cols) and sets number of non-zero entries to num_entr...
Definition: Morpheus_MatrixBase.hpp:108
size_type nnnz() const
Number of non-zeros of the matrix.
Definition: Morpheus_MatrixBase.hpp:133
void set_nrows(const size_type rows)
Set the number of rows of the matrix.
Definition: Morpheus_MatrixBase.hpp:140
size_type nrows() const
Number of rows of the matrix.
Definition: Morpheus_MatrixBase.hpp:119
size_type ncols() const
Number of columns of the matrix.
Definition: Morpheus_MatrixBase.hpp:126
void set_nnnz(const size_type nnz)
Set the number of non-zeros of the matrix.
Definition: Morpheus_MatrixBase.hpp:154
MatrixStructure structure() const
The specialized structure of the matrix e.g Symmetric.
Definition: Morpheus_MatrixBase.hpp:161
MatrixOptions options() const
Information about specific characteristics of the matrix e.g has short rows.
Definition: Morpheus_MatrixBase.hpp:168
MatrixBase()
Default constructor.
Definition: Morpheus_MatrixBase.hpp:82
Generic Morpheus interfaces.
Definition: dummy.cpp:24
Traits class for accessing attributes of a Container (Matrix or Vector)
Definition: Morpheus_ContainerTraits.hpp:54
size_t size_type
The size type of the container.
Definition: Morpheus_ContainerTraits.hpp:103
A wrapper that checks if the provided type is a scalar type.
Definition: Morpheus_TypeTraits.hpp:85