3#ifndef DUNE_DENSEMATRIX_HH
4#define DUNE_DENSEMATRIX_HH
25 template<
typename M>
class DenseMatrix;
28 struct FieldTraits< DenseMatrix<M> >
30 typedef const typename FieldTraits< typename DenseMatVecTraits<M>::value_type >::field_type field_type;
31 typedef const typename FieldTraits< typename DenseMatVecTraits<M>::value_type >::real_type real_type;
38 template<
class K,
int N,
int M>
class FieldMatrix;
39 template<
class K,
int N>
class FieldVector;
44 static typename V::size_type size(
const V & v) {
return v.size(); }
47 template<
class K,
int N>
50 typedef FieldVector<K,N> V;
51 static typename V::size_type size(
const V & v) {
return N; }
73 template<
class DenseMatrix,
class RHS >
80 template<
class DenseMatrix,
class RHS,
class =
void >
84 template<
class DenseMatrix,
class RHS >
88 static void apply (
DenseMatrix &denseMatrix,
const RHS &rhs )
91 std::fill( denseMatrix.
begin(), denseMatrix.
end(),
static_cast< field_type
>( rhs ) );
95 template<
class DenseMatrix,
class RHS >
96 class DenseMatrixAssigner< DenseMatrix, RHS,
std::enable_if_t< !std::is_same< typename RHS::const_iterator, void >::value > >
99 static void apply ( DenseMatrix &denseMatrix,
const RHS &rhs )
104 typename RHS::const_iterator sIt = std::begin(rhs);
105 for(; sIt != std::end(rhs); ++tIt, ++sIt)
106 std::copy(std::begin(*sIt), std::end(*sIt), std::begin(*tIt));
114 template<
class DenseMatrix,
class RHS >
115 struct DenseMatrixAssigner
116 :
public Impl::DenseMatrixAssigner< DenseMatrix, RHS >
123 template<
class DenseMatrix,
class RHS >
126 std::false_type hasDenseMatrixAssigner ( ... );
130 template<
class DenseMatrix,
class RHS >
131 struct HasDenseMatrixAssigner
132 :
public decltype( Impl::hasDenseMatrixAssigner( std::declval< DenseMatrix & >(), std::declval< const RHS & >() ) )
152 template<
typename MAT>
155 typedef DenseMatVecTraits<MAT> Traits;
158 MAT & asImp() {
return static_cast<MAT&
>(*this); }
159 const MAT & asImp()
const {
return static_cast<const MAT&
>(*this); }
199 return asImp().mat_access(i);
204 return asImp().mat_access(i);
221 typedef typename std::remove_reference<row_reference>::type::Iterator
ColIterator;
256 typedef typename std::remove_reference<const_row_reference>::type::ConstIterator
ConstColIterator;
286 template< class RHS, class = std::enable_if_t< HasDenseMatrixAssigner< MAT, RHS >::value > >
296 template <
class Other>
306 template <
class Other>
332 template <
class Other>
337 (*
this)[ i ].axpy( k, y[ i ] );
342 template <
class Other>
347 if ((*
this)[i]!=y[i])
352 template <
class Other>
362 template<
class X,
class Y>
363 void mv (
const X& x, Y& y)
const
369 using field_type =
typename FieldTraits<Y>::field_type;
374 y[i] += (*
this)[i][j] * x[j];
379 template<
class X,
class Y >
380 void mtv (
const X &x, Y &y )
const
386 using field_type =
typename FieldTraits<Y>::field_type;
391 y[i] += (*
this)[j][i] * x[j];
396 template<
class X,
class Y>
397 void umv (
const X& x, Y& y)
const
403 y[i] += (*
this)[i][j] * x[j];
407 template<
class X,
class Y>
408 void umtv (
const X& x, Y& y)
const
414 y[j] += (*
this)[i][j]*x[i];
418 template<
class X,
class Y>
419 void umhv (
const X& x, Y& y)
const
429 template<
class X,
class Y>
430 void mmv (
const X& x, Y& y)
const
436 y[i] -= (*
this)[i][j] * x[j];
440 template<
class X,
class Y>
441 void mmtv (
const X& x, Y& y)
const
447 y[j] -= (*
this)[i][j]*x[i];
451 template<
class X,
class Y>
452 void mmhv (
const X& x, Y& y)
const
462 template<
class X,
class Y>
463 void usmv (
const typename FieldTraits<Y>::field_type & alpha,
464 const X& x, Y& y)
const
470 y[i] += alpha * (*
this)[i][j] * x[j];
474 template<
class X,
class Y>
475 void usmtv (
const typename FieldTraits<Y>::field_type & alpha,
476 const X& x, Y& y)
const
482 y[j] += alpha*(*
this)[i][j]*x[i];
486 template<
class X,
class Y>
487 void usmhv (
const typename FieldTraits<Y>::field_type & alpha,
488 const X& x, Y& y)
const
502 typename FieldTraits<value_type>::real_type sum=(0.0);
503 for (
size_type i=0; i<
rows(); ++i) sum += (*
this)[i].two_norm2();
504 return fvmeta::sqrt(sum);
510 typename FieldTraits<value_type>::real_type sum=(0.0);
511 for (
size_type i=0; i<
rows(); ++i) sum += (*
this)[i].two_norm2();
517 typename std::enable_if<!has_nan<vt>::value,
int>::type = 0>
519 using real_type =
typename FieldTraits<vt>::real_type;
523 for (
auto const &x : *
this) {
524 real_type
const a = x.one_norm();
532 typename std::enable_if<!has_nan<vt>::value,
int>::type = 0>
534 using real_type =
typename FieldTraits<vt>::real_type;
538 for (
auto const &x : *
this) {
539 real_type
const a = x.one_norm_real();
547 typename std::enable_if<has_nan<vt>::value,
int>::type = 0>
549 using real_type =
typename FieldTraits<vt>::real_type;
554 for (
auto const &x : *
this) {
555 real_type
const a = x.one_norm();
565 typename std::enable_if<has_nan<vt>::value,
int>::type = 0>
567 using real_type =
typename FieldTraits<vt>::real_type;
572 for (
auto const &x : *
this) {
573 real_type
const a = x.one_norm_real();
588 void solve (V& x,
const V& b)
const;
600 template<
typename M2>
611 (*
this)[i][j] +=
M[i][k]*C[k][j];
618 template<
typename M2>
629 (*
this)[i][j] += C[i][k]*
M[k][j];
645 C[i][j] +=
M[i][k]*(*
this)[k][j];
653 FieldMatrix<K,rows,l> rightmultiplyany (
const FieldMatrix<K,cols,l>&
M)
const
655 FieldMatrix<K,rows,l> C;
661 C[i][j] += (*
this)[i][k]*
M[k][j];
685 return asImp().mat_rows();
691 return asImp().mat_cols();
711 ElimPivot(std::vector<size_type> & pivot);
713 void swap(
int i,
int j);
716 void operator()(
const T&,
int,
int)
719 std::vector<size_type> & pivot_;
727 void swap(
int i,
int j);
729 void operator()(
const typename V::field_type& factor,
int k,
int i);
750 void luDecomposition(DenseMatrix<MAT>& A, Func func)
const;
754 template<
typename MAT>
755 DenseMatrix<MAT>::ElimPivot::ElimPivot(std::vector<size_type> & pivot)
758 typedef typename std::vector<size_type>::size_type
size_type;
759 for(
size_type i=0; i < pivot_.size(); ++i) pivot_[i]=i;
762 template<
typename MAT>
763 void DenseMatrix<MAT>::ElimPivot::swap(
int i,
int j)
768 template<
typename MAT>
770 DenseMatrix<MAT>::Elim<V>::Elim(V& rhs)
774 template<
typename MAT>
776 void DenseMatrix<MAT>::Elim<V>::swap(
int i,
int j)
778 std::swap((*rhs_)[i], (*rhs_)[j]);
781 template<
typename MAT>
783 void DenseMatrix<MAT>::
784 Elim<V>::operator()(
const typename V::field_type& factor,
int k,
int i)
786 (*rhs_)[k] -= factor*(*rhs_)[i];
788 template<
typename MAT>
789 template<
typename Func>
790 inline void DenseMatrix<MAT>::luDecomposition(DenseMatrix<MAT>& A, Func func)
const
792 typedef typename FieldTraits<value_type>::real_type
799 for (size_type i=0; i<rows(); i++)
801 typename FieldTraits<value_type>::real_type pivmax=fvmeta::absreal(A[i][i]);
808 typename FieldTraits<value_type>::real_type abs(0.0);
809 for (size_type k=i+1; k<rows(); k++)
810 if ((abs=fvmeta::absreal(A[k][i]))>pivmax)
812 pivmax = abs; imax = k;
816 for (size_type j=0; j<rows(); j++)
817 std::swap(A[i][j],A[imax][j]);
823 if (pivmax<singthres)
824 DUNE_THROW(FMatrixError,
"matrix is singular");
827 for (size_type k=i+1; k<rows(); k++)
829 field_type factor = A[k][i]/A[i][i];
831 for (size_type j=i+1; j<rows(); j++)
832 A[k][j] -= factor*A[i][j];
838 template<
typename MAT>
844 DUNE_THROW(FMatrixError,
"Can't solve for a " << rows() <<
"x" << cols() <<
" matrix!");
848#ifdef DUNE_FMatrix_WITH_CHECKING
850 DUNE_THROW(FMatrixError,
"matrix is singular");
852 x[0] = b[0]/(*this)[0][0];
855 else if (rows()==2) {
857 field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1][0];
858#ifdef DUNE_FMatrix_WITH_CHECKING
860 DUNE_THROW(FMatrixError,
"matrix is singular");
864 x[0] = detinv*((*this)[1][1]*b[0]-(*this)[0][1]*b[1]);
865 x[1] = detinv*((*this)[0][0]*b[1]-(*this)[1][0]*b[0]);
868 else if (rows()==3) {
870 field_type d = determinant();
871#ifdef DUNE_FMatrix_WITH_CHECKING
873 DUNE_THROW(FMatrixError,
"matrix is singular");
876 x[0] = (b[0]*(*this)[1][1]*(*this)[2][2] - b[0]*(*this)[2][1]*(*this)[1][2]
877 - b[1] *(*this)[0][1]*(*this)[2][2] + b[1]*(*this)[2][1]*(*this)[0][2]
878 + b[2] *(*this)[0][1]*(*this)[1][2] - b[2]*(*this)[1][1]*(*this)[0][2]) / d;
880 x[1] = ((*this)[0][0]*b[1]*(*this)[2][2] - (*this)[0][0]*b[2]*(*this)[1][2]
881 - (*this)[1][0] *b[0]*(*this)[2][2] + (*this)[1][0]*b[2]*(*this)[0][2]
882 + (*this)[2][0] *b[0]*(*this)[1][2] - (*this)[2][0]*b[1]*(*this)[0][2]) / d;
884 x[2] = ((*this)[0][0]*(*this)[1][1]*b[2] - (*this)[0][0]*(*this)[2][1]*b[1]
885 - (*this)[1][0] *(*this)[0][1]*b[2] + (*this)[1][0]*(*this)[2][1]*b[0]
886 + (*this)[2][0] *(*this)[0][1]*b[1] - (*this)[2][0]*(*this)[1][1]*b[0]) / d;
896 luDecomposition(A, elim);
899 for(
int i=rows()-1; i>=0; i--) {
900 for (size_type j=i+1; j<rows(); j++)
901 rhs[i] -= A[i][j]*x[j];
902 x[i] = rhs[i]/A[i][i];
907 template<
typename MAT>
912 DUNE_THROW(FMatrixError,
"Can't invert a " << rows() <<
"x" << cols() <<
" matrix!");
916#ifdef DUNE_FMatrix_WITH_CHECKING
918 DUNE_THROW(FMatrixError,
"matrix is singular");
920 (*this)[0][0] = field_type( 1 ) / (*this)[0][0];
923 else if (rows()==2) {
925 field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1][0];
926#ifdef DUNE_FMatrix_WITH_CHECKING
928 DUNE_THROW(FMatrixError,
"matrix is singular");
930 detinv = field_type( 1 ) / detinv;
932 field_type temp=(*this)[0][0];
933 (*this)[0][0] = (*this)[1][1]*detinv;
934 (*this)[0][1] = -(*this)[0][1]*detinv;
935 (*this)[1][0] = -(*this)[1][0]*detinv;
936 (*this)[1][1] = temp*detinv;
941 using K = field_type;
943 K t4 = (*this)[0][0] * (*this)[1][1];
944 K t6 = (*this)[0][0] * (*this)[1][2];
945 K t8 = (*this)[0][1] * (*this)[1][0];
946 K t10 = (*this)[0][2] * (*this)[1][0];
947 K t12 = (*this)[0][1] * (*this)[2][0];
948 K t14 = (*this)[0][2] * (*this)[2][0];
950 K det = (t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+
951 t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]);
954 K matrix01 = (*this)[0][1];
955 K matrix00 = (*this)[0][0];
956 K matrix10 = (*this)[1][0];
957 K matrix11 = (*this)[1][1];
959 (*this)[0][0] = ((*this)[1][1] * (*this)[2][2] - (*this)[1][2] * (*this)[2][1])*t17;
960 (*this)[0][1] = -((*this)[0][1] * (*this)[2][2] - (*this)[0][2] * (*this)[2][1])*t17;
961 (*this)[0][2] = (matrix01 * (*this)[1][2] - (*this)[0][2] * (*this)[1][1])*t17;
962 (*this)[1][0] = -((*this)[1][0] * (*this)[2][2] - (*this)[1][2] * (*this)[2][0])*t17;
963 (*this)[1][1] = (matrix00 * (*this)[2][2] - t14) * t17;
964 (*this)[1][2] = -(t6-t10) * t17;
965 (*this)[2][0] = (matrix10 * (*this)[2][1] - matrix11 * (*this)[2][0]) * t17;
966 (*this)[2][1] = -(matrix00 * (*this)[2][1] - t12) * t17;
967 (*this)[2][2] = (t4-t8) * t17;
972 std::vector<size_type> pivot(rows());
973 luDecomposition(A, ElimPivot(pivot));
974 DenseMatrix<MAT>& L=A;
975 DenseMatrix<MAT>& U=A;
980 for(size_type i=0; i<rows(); ++i)
984 for (size_type i=0; i<rows(); i++)
985 for (size_type j=0; j<i; j++)
986 for (size_type k=0; k<rows(); k++)
987 (*
this)[i][k] -= L[i][j]*(*this)[j][k];
990 for (size_type i=rows(); i>0;) {
992 for (size_type k=0; k<rows(); k++) {
993 for (size_type j=i+1; j<rows(); j++)
994 (*
this)[i][k] -= U[i][j]*(*this)[j][k];
995 (*this)[i][k] /= U[i][i];
999 for(size_type i=rows(); i>0; ) {
1002 for(size_type j=0; j<rows(); ++j)
1003 std::swap((*
this)[j][pivot[i]], (*this)[j][i]);
1009 template<
typename MAT>
1015 DUNE_THROW(FMatrixError,
"There is no determinant for a " << rows() <<
"x" << cols() <<
" matrix!");
1018 return (*
this)[0][0];
1021 return (*
this)[0][0]*(*this)[1][1] - (*this)[0][1]*(*this)[1][0];
1025 field_type t4 = (*this)[0][0] * (*this)[1][1];
1026 field_type t6 = (*this)[0][0] * (*this)[1][2];
1027 field_type t8 = (*this)[0][1] * (*this)[1][0];
1028 field_type t10 = (*this)[0][2] * (*this)[1][0];
1029 field_type t12 = (*this)[0][1] * (*this)[2][0];
1030 field_type t14 = (*this)[0][2] * (*this)[2][0];
1032 return (t4*(*
this)[2][2]-t6*(*
this)[2][1]-t8*(*
this)[2][2]+
1033 t10*(*
this)[2][1]+t12*(*
this)[1][2]-t14*(*
this)[1][1]);
1041 luDecomposition(A, ElimDet(det));
1043 catch (FMatrixError&)
1047 for (size_type i = 0; i < rows(); ++i)
1054 namespace DenseMatrixHelp {
1057 template <
typename MAT,
typename V1,
typename V2>
1064 for(size_type i=0; i<matrix.
rows(); ++i)
1067 for(size_type j=0; j<matrix.
cols(); ++j)
1069 ret[i] += matrix[i][j]*x[j];
1076 template <
typename K,
int rows,
int cols>
1079 typedef typename FieldMatrix<K,rows,cols>::size_type size_type;
1081 for(size_type i=0; i<cols(); ++i)
1084 for(size_type j=0; j<rows(); ++j)
1085 ret[i] += matrix[j][i]*x[j];
1090 template <
typename K,
int rows,
int cols>
1091 static inline FieldVector<K,rows> mult(
const FieldMatrix<K,rows,cols> &matrix,
const FieldVector<K,cols> & x)
1093 FieldVector<K,rows> ret;
1099 template <
typename K,
int rows,
int cols>
1100 static inline FieldVector<K,cols> multTransposed(
const FieldMatrix<K,rows,cols> &matrix,
const FieldVector<K,rows> & x)
1102 FieldVector<K,cols> ret;
1103 multAssignTransposed( matrix, x, ret );
1111 template<
typename MAT>
1115 s << a[i] << std::endl;
Macro for wrapping boundary checks.
Generic iterator class for dense vector and matrix implementations.
Definition: densevector.hh:128
A dense n x m matrix.
Definition: densematrix.hh:154
DenseMatrix & operator/=(const field_type &k)
vector space division by scalar
Definition: densematrix.hh:324
ConstIterator const_iterator
typedef for stl compliant access
Definition: densematrix.hh:252
bool operator!=(const DenseMatrix< Other > &y) const
Binary matrix incomparison.
Definition: densematrix.hh:353
void mv(const X &x, Y &y) const
y = A x
Definition: densematrix.hh:363
Traits::value_type field_type
export the type representing the field
Definition: densematrix.hh:171
void solve(V &x, const V &b) const
Solve system A x = b.
size_type cols() const
number of columns
Definition: densematrix.hh:689
ConstIterator beforeEnd() const
Definition: densematrix.hh:272
bool operator==(const DenseMatrix< Other > &y) const
Binary matrix comparison.
Definition: densematrix.hh:343
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition: densematrix.hh:441
DenseMatrix & operator+=(const DenseMatrix< Other > &y)
vector space addition
Definition: densematrix.hh:297
FieldTraits< vt >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition: densematrix.hh:533
std::remove_reference< const_row_reference >::type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition: densematrix.hh:256
ConstIterator beforeBegin() const
Definition: densematrix.hh:279
Traits::value_type block_type
export the type representing the components
Definition: densematrix.hh:174
void mtv(const X &x, Y &y) const
y = A^T x
Definition: densematrix.hh:380
DenseMatrix & operator*=(const field_type &k)
vector space multiplication with scalar
Definition: densematrix.hh:316
DenseMatrix & operator-=(const DenseMatrix< Other > &y)
vector space subtraction
Definition: densematrix.hh:307
size_type size() const
size method (number of rows)
Definition: densematrix.hh:208
size_type M() const
number of columns
Definition: densematrix.hh:677
MAT & rightmultiply(const DenseMatrix< M2 > &M)
Multiplies M from the right to this matrix.
Definition: densematrix.hh:619
Iterator end()
end iterator
Definition: densematrix.hh:230
Iterator beforeBegin()
Definition: densematrix.hh:244
Iterator beforeEnd()
Definition: densematrix.hh:237
Traits::value_type value_type
export the type representing the field
Definition: densematrix.hh:168
void usmv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
y += alpha A x
Definition: densematrix.hh:463
void usmhv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition: densematrix.hh:487
size_type rows() const
number of rows
Definition: densematrix.hh:683
void mmv(const X &x, Y &y) const
y -= A x
Definition: densematrix.hh:430
void invert()
Compute inverse.
MAT & leftmultiply(const DenseMatrix< M2 > &M)
Multiplies M from the left to this matrix.
Definition: densematrix.hh:601
void usmtv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition: densematrix.hh:475
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition: densematrix.hh:452
Traits::derived_type derived_type
type of derived matrix class
Definition: densematrix.hh:165
row_reference operator[](size_type i)
random access
Definition: densematrix.hh:197
bool exists(size_type i, size_type j) const
return true when (i,j) is in pattern
Definition: densematrix.hh:697
DenseMatrix & axpy(const field_type &k, const DenseMatrix< Other > &y)
vector space axpy operation (*this += k y)
Definition: densematrix.hh:333
Iterator RowIterator
rename the iterators for easier access
Definition: densematrix.hh:219
FieldTraits< value_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition: densematrix.hh:500
void umv(const X &x, Y &y) const
y += A x
Definition: densematrix.hh:397
DenseIterator< const DenseMatrix, const row_type, const_row_reference > ConstIterator
Iterator class for sequential access.
Definition: densematrix.hh:250
size_type N() const
number of rows
Definition: densematrix.hh:671
FieldTraits< vt >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition: densematrix.hh:518
Traits::row_type row_type
The type used to represent a row (must fulfill the Dune::DenseVector interface)
Definition: densematrix.hh:180
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densematrix.hh:177
Traits::const_row_reference const_row_reference
The type used to represent a reference to a constant row (usually const row_type &)
Definition: densematrix.hh:186
FieldTraits< value_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition: densematrix.hh:508
std::remove_reference< row_reference >::type::Iterator ColIterator
rename the iterators for easier access
Definition: densematrix.hh:221
Traits::row_reference row_reference
The type used to represent a reference to a row (usually row_type &)
Definition: densematrix.hh:183
Iterator iterator
typedef for stl compliant access
Definition: densematrix.hh:217
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition: densematrix.hh:254
field_type determinant() const
calculates the determinant of this matrix
DenseIterator< DenseMatrix, row_type, row_reference > Iterator
Iterator class for sequential access.
Definition: densematrix.hh:215
void umtv(const X &x, Y &y) const
y += A^T x
Definition: densematrix.hh:408
ConstIterator begin() const
begin iterator
Definition: densematrix.hh:259
@ blocklevel
The number of block levels we contain. This is 1.
Definition: densematrix.hh:191
Iterator begin()
begin iterator
Definition: densematrix.hh:224
void umhv(const X &x, Y &y) const
y += A^H x
Definition: densematrix.hh:419
ConstIterator end() const
end iterator
Definition: densematrix.hh:265
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:235
size_type size() const
size method
Definition: densevector.hh:297
size_type N() const
number of blocks in the vector (are of size 1 here)
Definition: densevector.hh:678
Error thrown if operations of a FieldMatrix fail.
Definition: densematrix.hh:140
static ctype pivoting_limit()
return threshold to do pivoting
Definition: precision.hh:26
static ctype absolute_limit()
return threshold to declare matrix singular
Definition: precision.hh:50
static ctype singular_limit()
return threshold to declare matrix singular
Definition: precision.hh:38
A dense n x m matrix.
Definition: fmatrix.hh:68
vector space out of a tensor product of fields.
Definition: fvector.hh:93
constexpr FieldVector()
Constructor making default-initialized vector.
Definition: fvector.hh:113
Default exception class for mathematical errors.
Definition: exceptions.hh:239
FieldTraits< ft >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition: matrix.hh:1006
A free function to provide the demangled class name of a given object or type as a string.
static void multAssign(const DenseMatrix< MAT > &matrix, const DenseVector< V1 > &x, DenseVector< V2 > &ret)
calculates ret = matrix * x
Definition: densematrix.hh:1058
A few common exception classes.
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_ASSERT_BOUNDS(cond)
If DUNE_CHECK_BOUNDS is defined: check if condition cond holds; otherwise, do nothing.
Definition: boundschecking.hh:28
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Some useful basic math stuff.
Dune namespace.
Definition: alignment.hh:11
int sign(const T &val)
Return the sign of the value.
Definition: math.hh:119
K conjugateComplex(const K &x)
compute conjugate complex of x
Definition: math.hh:103
Various precision settings for calculations with FieldMatrix and FieldVector.
you have to specialize this structure for any type that should be assignable to a DenseMatrix
Definition: densematrix.hh:74
Traits for type conversions and type information.
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:18