3 #ifndef DUNE_DYNMATRIX_HH 4 #define DUNE_DYNMATRIX_HH 9 #include <initializer_list> 43 typedef typename container_type::size_type
size_type;
60 std::vector< DynamicVector<K> > _data;
72 DynamicMatrix (size_type r, size_type c, value_type v = value_type() ) :
73 _data(r, row_type(c, v) )
84 typename = std::enable_if_t<!Dune::IsNumber<T>::value && HasDenseMatrixAssigner<DynamicMatrix, T>::value>>
104 void resize (size_type r, size_type c, value_type v = value_type() )
107 _data.resize(r, row_type(c, v) );
112 template <
typename T,
113 typename = std::enable_if_t<!Dune::IsNumber<T>::value>>
115 _data.resize(rhs.N());
116 std::fill(_data.begin(), _data.end(), row_type(rhs.M(), K(0)));
117 Base::operator=(rhs);
122 template <
typename T,
123 typename = std::enable_if_t<Dune::IsNumber<T>::value>>
125 std::fill(_data.begin(), _data.end(), scalar);
130 size_type
mat_rows()
const {
return _data.size(); }
132 assert(this->rows());
133 return _data.front().size();
DynamicMatrix & operator=(T const &rhs)
Definition: dynmatrix.hh:114
Base::size_type size_type
Definition: dynmatrix.hh:63
Traits::value_type value_type
export the type representing the field
Definition: densematrix.hh:168
Implements a matrix constructed from a given type representing a field and a compile-time given numbe...
container_type::size_type size_type
Definition: dynmatrix.hh:43
DynamicMatrix(std::initializer_list< DynamicVector< K >> const &ll)
Constructor initializing the matrix from a list of vector.
Definition: dynmatrix.hh:78
DynamicMatrix(size_type r, size_type c, value_type v=value_type())
Constructor initializing the whole matrix with a scalar.
Definition: dynmatrix.hh:72
const row_type & mat_access(size_type i) const
Definition: dynmatrix.hh:139
DynamicMatrix & operator=(T scalar)
Definition: dynmatrix.hh:124
Construct a matrix with a dynamic size.
Definition: dynmatrix.hh:29
DynamicVector< K > row_type
Definition: dynmatrix.hh:36
K value_type
Definition: dynmatrix.hh:42
Dune namespace.
Definition: alignment.hh:10
Traits for type conversions and type information.
row_type & row_reference
Definition: dynmatrix.hh:38
DynamicMatrix< K > derived_type
Definition: dynmatrix.hh:34
void resize(size_type r, size_type c, value_type v=value_type())
resize matrix to r × c
Definition: dynmatrix.hh:104
A few common exception classes.
Macro for wrapping boundary checks.
std::vector< K > container_type
Definition: dynmatrix.hh:41
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densematrix.hh:177
FieldTraits< K >::field_type field_type
Definition: dynmatrix.hh:49
T real_type
export the type representing the real type of the field
Definition: ftraits.hh:28
size_type mat_cols() const
Definition: dynmatrix.hh:131
Definition: matvectraits.hh:29
row_type & mat_access(size_type i)
Definition: dynmatrix.hh:135
This file implements a dense vector with a dynamic size.
A dense n x m matrix.
Definition: densematrix.hh:25
size_type mat_rows() const
Definition: dynmatrix.hh:130
DynamicMatrix(T const &rhs)
Definition: dynmatrix.hh:85
FieldTraits< K >::real_type real_type
Definition: dynmatrix.hh:50
Base::row_type row_type
Definition: dynmatrix.hh:65
Definition: ftraits.hh:23
DynamicMatrix()
Default constructor.
Definition: dynmatrix.hh:69
const row_type & const_row_reference
Definition: dynmatrix.hh:39
T field_type
export the type representing the field
Definition: ftraits.hh:26
Base::value_type value_type
Definition: dynmatrix.hh:64
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:28