5#ifndef DUNE_DENSEMATRIX_HH 
    6#define DUNE_DENSEMATRIX_HH 
   25#include <dune/common/std/iterator.hh> 
   30  template<
typename M> 
class DenseMatrix;
 
   33  struct FieldTraits< DenseMatrix<M> >
 
   35    typedef const typename FieldTraits< typename DenseMatVecTraits<M>::value_type >::field_type field_type;
 
   36    typedef const typename FieldTraits< typename DenseMatVecTraits<M>::value_type >::real_type real_type;
 
   39  template<
class K, 
int N, 
int M> 
class FieldMatrix;
 
   40  template<
class K, 
int N> 
class FieldVector;
 
   60  template< 
class DenseMatrix, 
class RHS >
 
   67    template< 
class DenseMatrix, 
class RHS >
 
   71    template< 
class DenseMatrix, 
class RHS >
 
   76      constexpr static void apply ( 
DenseMatrix &denseMatrix, 
const RHS &rhs )
 
   79        std::fill( denseMatrix.
begin(), denseMatrix.
end(), 
static_cast< field_type 
>( rhs ) );
 
   83    template< 
class DenseMatrix, 
class RHS >
 
   84      requires Std::indirectly_copyable<
 
   85          decltype(std::begin(*std::declval<typename RHS::const_iterator>())),
 
   86          decltype(std::begin(*std::declval<typename DenseMatrix::iterator>()))>
 
   87    class DenseMatrixAssigner<DenseMatrix, RHS>
 
   90      constexpr static void apply ( DenseMatrix &denseMatrix, 
const RHS &rhs )
 
   95        typename RHS::const_iterator sIt = std::begin(rhs);
 
   96        for(; sIt != std::end(rhs); ++tIt, ++sIt)
 
   97          std::copy(std::begin(*sIt), std::end(*sIt), std::begin(*tIt));
 
  105  template< 
class DenseMatrix, 
class RHS >
 
  106  struct DenseMatrixAssigner
 
  107    : 
public Impl::DenseMatrixAssigner< DenseMatrix, RHS >
 
  114    template< 
class DenseMatrix, 
class RHS >
 
  117    std::false_type hasDenseMatrixAssigner ( ... );
 
  121  template< 
class DenseMatrix, 
class RHS >
 
  122  struct HasDenseMatrixAssigner
 
  123    : 
public decltype( Impl::hasDenseMatrixAssigner( std::declval< DenseMatrix & >(), std::declval< const RHS & >() ) )
 
  143  template<
typename MAT>
 
  146    typedef DenseMatVecTraits<MAT> Traits;
 
  149    constexpr MAT & asImp() { 
return static_cast<MAT&
>(*this); }
 
  150    constexpr const MAT & asImp()
 const { 
return static_cast<const MAT&
>(*this); }
 
  196      return asImp().mat_access(i);
 
  201      return asImp().mat_access(i);
 
  218    typedef typename std::remove_reference<row_reference>::type::Iterator 
ColIterator;
 
  253    typedef typename std::remove_reference<const_row_reference>::type::ConstIterator 
ConstColIterator;
 
  283    template< class RHS, class = std::enable_if_t< HasDenseMatrixAssigner< MAT, RHS >::value > >
 
  293    template <
class Other>
 
  306      using idx_type = 
typename decltype(result)
::size_type;
 
  308      for (idx_type i = 0; i < 
rows(); ++i)
 
  309        for (idx_type j = 0; j < 
cols(); ++j)
 
  310          result[i][j] = - asImp()[i][j];
 
  316    template <
class Other>
 
  342    template <
class Other>
 
  347        (*
this)[ i ].axpy( a, x[ i ] );
 
  352    template <
class Other>
 
  357        if ((*
this)[i]!=x[i])
 
  362    template <
class Other>
 
  372    template<
class X, 
class Y>
 
  373    constexpr void mv (
const X& x, Y& y)
 const 
  375      auto&& xx = Impl::asVector(x);
 
  376      auto&& yy = Impl::asVector(y);
 
  381      using y_field_type = 
typename FieldTraits<Y>::field_type;
 
  384        yy[i] = y_field_type(0);
 
  386          yy[i] += (*
this)[i][j] * xx[j];
 
  391    template< 
class X, 
class Y >
 
  392    constexpr void mtv ( 
const X &x, Y &y )
 const 
  394      auto&& xx = Impl::asVector(x);
 
  395      auto&& yy = Impl::asVector(y);
 
  400      using y_field_type = 
typename FieldTraits<Y>::field_type;
 
  403        yy[i] = y_field_type(0);
 
  405          yy[i] += (*
this)[j][i] * xx[j];
 
  410    template<
class X, 
class Y>
 
  411    constexpr void umv (
const X& x, Y& y)
 const 
  413      auto&& xx = Impl::asVector(x);
 
  414      auto&& yy = Impl::asVector(y);
 
  419          yy[i] += (*
this)[i][j] * xx[j];
 
  423    template<
class X, 
class Y>
 
  424    constexpr void umtv (
const X& x, Y& y)
 const 
  426      auto&& xx = Impl::asVector(x);
 
  427      auto&& yy = Impl::asVector(y);
 
  432          yy[j] += (*
this)[i][j]*xx[i];
 
  436    template<
class X, 
class Y>
 
  437    constexpr void umhv (
const X& x, Y& y)
 const 
  439      auto&& xx = Impl::asVector(x);
 
  440      auto&& yy = Impl::asVector(y);
 
  449    template<
class X, 
class Y>
 
  450    constexpr void mmv (
const X& x, Y& y)
 const 
  452      auto&& xx = Impl::asVector(x);
 
  453      auto&& yy = Impl::asVector(y);
 
  458          yy[i] -= (*
this)[i][j] * xx[j];
 
  462    template<
class X, 
class Y>
 
  463    constexpr void mmtv (
const X& x, Y& y)
 const 
  465      auto&& xx = Impl::asVector(x);
 
  466      auto&& yy = Impl::asVector(y);
 
  471          yy[j] -= (*
this)[i][j]*xx[i];
 
  475    template<
class X, 
class Y>
 
  476    constexpr void mmhv (
const X& x, Y& y)
 const 
  478      auto&& xx = Impl::asVector(x);
 
  479      auto&& yy = Impl::asVector(y);
 
  488    template<
class X, 
class Y>
 
  489    constexpr void usmv (
const typename FieldTraits<Y>::field_type & alpha,
 
  490      const X& x, Y& y)
 const 
  492      auto&& xx = Impl::asVector(x);
 
  493      auto&& yy = Impl::asVector(y);
 
  498          yy[i] += alpha * (*
this)[i][j] * xx[j];
 
  502    template<
class X, 
class Y>
 
  503    constexpr void usmtv (
const typename FieldTraits<Y>::field_type & alpha,
 
  504      const X& x, Y& y)
 const 
  506      auto&& xx = Impl::asVector(x);
 
  507      auto&& yy = Impl::asVector(y);
 
  512          yy[j] += alpha*(*
this)[i][j]*xx[i];
 
  516    template<
class X, 
class Y>
 
  517    constexpr void usmhv (
const typename FieldTraits<Y>::field_type & alpha,
 
  518      const X& x, Y& y)
 const 
  520      auto&& xx = Impl::asVector(x);
 
  521      auto&& yy = Impl::asVector(y);
 
  535      typename FieldTraits<value_type>::real_type sum=(0.0);
 
  536      for (
size_type i=0; i<
rows(); ++i) sum += (*
this)[i].two_norm2();
 
  537      return fvmeta::sqrt(sum);
 
  543      typename FieldTraits<value_type>::real_type sum=(0.0);
 
  544      for (
size_type i=0; i<
rows(); ++i) sum += (*
this)[i].two_norm2();
 
  550              typename std::enable_if<!HasNaN<vt>::value, 
int>::type = 0>
 
  552      using real_type = 
typename FieldTraits<vt>::real_type;
 
  556      for (
auto const &x : *
this) {
 
  557        real_type 
const a = x.one_norm();
 
  565              typename std::enable_if<!HasNaN<vt>::value, 
int>::type = 0>
 
  567      using real_type = 
typename FieldTraits<vt>::real_type;
 
  571      for (
auto const &x : *
this) {
 
  572        real_type 
const a = x.one_norm_real();
 
  580              typename std::enable_if<HasNaN<vt>::value, 
int>::type = 0>
 
  582      using real_type = 
typename FieldTraits<vt>::real_type;
 
  587      for (
auto const &x : *
this) {
 
  588        real_type 
const a = x.one_norm();
 
  597              typename std::enable_if<HasNaN<vt>::value, 
int>::type = 0>
 
  599      using real_type = 
typename FieldTraits<vt>::real_type;
 
  604      for (
auto const &x : *
this) {
 
  605        real_type 
const a = x.one_norm_real();
 
  618    template <
class V1, 
class V2>
 
  619    void solve (V1& x, 
const V2& b, 
bool doPivoting = 
true) 
const;
 
  631    template<
typename M2>
 
  642            (*
this)[i][j] += 
M[i][k]*C[k][j];
 
  649    template<
typename M2>
 
  660            (*
this)[i][j] += C[i][k]*
M[k][j];
 
  676            C[i][j] += 
M[i][k]*(*
this)[k][j];
 
  684    FieldMatrix<K,rows,l> rightmultiplyany (
const FieldMatrix<K,cols,l>& 
M)
 const 
  686      FieldMatrix<K,rows,l> C;
 
  692            C[i][j] += (*
this)[i][k]*
M[k][j];
 
  716      return asImp().mat_rows();
 
  722      return asImp().mat_cols();
 
  740      ElimPivot(std::vector<simd_index_type> & pivot);
 
  742      void swap(std::size_t i, simd_index_type j);
 
  745      void operator()(
const T&, 
int, 
int)
 
  748      std::vector<simd_index_type> & pivot_;
 
  756      void swap(std::size_t i, simd_index_type j);
 
  758      void operator()(
const typename V::field_type& factor, 
int k, 
int i);
 
  768      void swap(std::size_t i, simd_index_type j)
 
  820    template<
class Func, 
class Mask>
 
  822                         Mask &nonsingularLanes, 
bool throwEarly, 
bool doPivoting);
 
  826  template<
typename MAT>
 
  830    typedef typename std::vector<size_type>::size_type 
size_type;
 
  831    for(
size_type i=0; i < pivot_.size(); ++i) pivot_[i]=i;
 
  834  template<
typename MAT>
 
  835  void DenseMatrix<MAT>::ElimPivot::swap(std::size_t i, simd_index_type j)
 
  838      Simd::cond(Simd::Scalar<simd_index_type>(i) == j, pivot_[i], j);
 
  841  template<
typename MAT>
 
  843  DenseMatrix<MAT>::Elim<V>::Elim(V& rhs)
 
  847  template<
typename MAT>
 
  849  void DenseMatrix<MAT>::Elim<V>::swap(std::size_t i, simd_index_type j)
 
  859  template<
typename MAT>
 
  861  void DenseMatrix<MAT>::
 
  862  Elim<V>::operator()(
const typename V::field_type& factor, 
int k, 
int i)
 
  864    (*rhs_)[k] -= factor*(*rhs_)[i];
 
  867  template<
typename MAT>
 
  868  template<
typename Func, 
class Mask>
 
  871                  bool throwEarly, 
bool doPivoting)
 
  876    typedef typename FieldTraits<value_type>::real_type real_type;
 
  879    for (size_type i=0; i<A.rows(); i++)  
 
  881      real_type pivmax = fvmeta::absreal(A[i][i]);
 
  886        simd_index_type imax=i;
 
  887        for (size_type k=i+1; k<A.rows(); k++)
 
  889          auto abs = fvmeta::absreal(A[k][i]);
 
  890          auto mask = abs > pivmax;
 
  895        for (size_type j=0; j<A.rows(); j++)
 
  905          for(std::size_t l = 0; l < 
Simd::lanes(A[i][j]); ++l)
 
  913      nonsingularLanes = nonsingularLanes && (pivmax != real_type(0));
 
  916          DUNE_THROW(FMatrixError, 
"matrix is singular");
 
  924      for (size_type k=i+1; k<A.rows(); k++)
 
  928        field_type factor = A[k][i]/A[i][i];
 
  930        for (size_type j=i+1; j<A.rows(); j++)
 
  931          A[k][j] -= factor*A[i][j];
 
  937  template<
typename MAT>
 
  938  template <
class V1, 
class V2>
 
  941    using real_type = 
typename FieldTraits<value_type>::real_type;
 
  944      DUNE_THROW(FMatrixError, 
"Can't solve for a " << rows() << 
"x" << cols() << 
" matrix!");
 
  948#ifdef DUNE_FMatrix_WITH_CHECKING 
  951        DUNE_THROW(FMatrixError,
"matrix is singular");
 
  953      x[0] = b[0]/(*this)[0][0];
 
  956    else if (rows()==2) {
 
  958      field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1][0];
 
  959#ifdef DUNE_FMatrix_WITH_CHECKING 
  962        DUNE_THROW(FMatrixError,
"matrix is singular");
 
  964      detinv = real_type(1.0)/detinv;
 
  966      x[0] = detinv*((*this)[1][1]*b[0]-(*this)[0][1]*b[1]);
 
  967      x[1] = detinv*((*this)[0][0]*b[1]-(*this)[1][0]*b[0]);
 
  970    else if (rows()==3) {
 
  972      field_type d = determinant(doPivoting);
 
  973#ifdef DUNE_FMatrix_WITH_CHECKING 
  976        DUNE_THROW(FMatrixError,
"matrix is singular");
 
  979      x[0] = (b[0]*(*this)[1][1]*(*this)[2][2] - b[0]*(*this)[2][1]*(*this)[1][2]
 
  980              - b[1] *(*this)[0][1]*(*this)[2][2] + b[1]*(*this)[2][1]*(*this)[0][2]
 
  981              + b[2] *(*this)[0][1]*(*this)[1][2] - b[2]*(*this)[1][1]*(*this)[0][2]) / d;
 
  983      x[1] = ((*this)[0][0]*b[1]*(*this)[2][2] - (*this)[0][0]*b[2]*(*this)[1][2]
 
  984              - (*this)[1][0] *b[0]*(*this)[2][2] + (*this)[1][0]*b[2]*(*this)[0][2]
 
  985              + (*this)[2][0] *b[0]*(*this)[1][2] - (*this)[2][0]*b[1]*(*this)[0][2]) / d;
 
  987      x[2] = ((*this)[0][0]*(*this)[1][1]*b[2] - (*this)[0][0]*(*this)[2][1]*b[1]
 
  988              - (*this)[1][0] *(*this)[0][1]*b[2] + (*this)[1][0]*(*this)[2][1]*b[0]
 
  989              + (*this)[2][0] *(*this)[0][1]*b[1] - (*this)[2][0]*(*this)[1][1]*b[0]) / d;
 
  997      AutonomousValue<MAT> A(asImp());
 
  998      Simd::Mask<typename FieldTraits<value_type>::real_type>
 
  999        nonsingularLanes(
true);
 
 1001      AutonomousValue<MAT>::luDecomposition(A, elim, nonsingularLanes, 
true, doPivoting);
 
 1004      for(
int i=rows()-1; i>=0; i--) {
 
 1005        for (size_type j=i+1; j<rows(); j++)
 
 1006          rhs[i] -= A[i][j]*x[j];
 
 1007        x[i] = rhs[i]/A[i][i];
 
 1012  template<
typename MAT>
 
 1015    using real_type = 
typename FieldTraits<MAT>::real_type;
 
 1020      DUNE_THROW(FMatrixError, 
"Can't invert a " << rows() << 
"x" << cols() << 
" matrix!");
 
 1024#ifdef DUNE_FMatrix_WITH_CHECKING 
 1027        DUNE_THROW(FMatrixError,
"matrix is singular");
 
 1029      (*this)[0][0] = real_type( 1 ) / (*this)[0][0];
 
 1032    else if (rows()==2) {
 
 1034      field_type detinv = (*this)[0][0]*(*this)[1][1]-(*this)[0][1]*(*this)[1][0];
 
 1035#ifdef DUNE_FMatrix_WITH_CHECKING 
 1038        DUNE_THROW(FMatrixError,
"matrix is singular");
 
 1040      detinv = real_type( 1 ) / detinv;
 
 1042      field_type temp=(*this)[0][0];
 
 1043      (*this)[0][0] =  (*this)[1][1]*detinv;
 
 1044      (*this)[0][1] = -(*this)[0][1]*detinv;
 
 1045      (*this)[1][0] = -(*this)[1][0]*detinv;
 
 1046      (*this)[1][1] =  temp*detinv;
 
 1051      using K = field_type;
 
 1053      K t4  = (*this)[0][0] * (*this)[1][1];
 
 1054      K t6  = (*this)[0][0] * (*this)[1][2];
 
 1055      K t8  = (*this)[0][1] * (*this)[1][0];
 
 1056      K t10 = (*this)[0][2] * (*this)[1][0];
 
 1057      K t12 = (*this)[0][1] * (*this)[2][0];
 
 1058      K t14 = (*this)[0][2] * (*this)[2][0];
 
 1060      K det = (t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+
 
 1061               t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]);
 
 1064      K matrix01 = (*this)[0][1];
 
 1065      K matrix00 = (*this)[0][0];
 
 1066      K matrix10 = (*this)[1][0];
 
 1067      K matrix11 = (*this)[1][1];
 
 1069      (*this)[0][0] =  ((*this)[1][1] * (*this)[2][2] - (*this)[1][2] * (*this)[2][1])*t17;
 
 1070      (*this)[0][1] = -((*this)[0][1] * (*this)[2][2] - (*this)[0][2] * (*this)[2][1])*t17;
 
 1071      (*this)[0][2] =  (matrix01 * (*this)[1][2] - (*this)[0][2] * (*this)[1][1])*t17;
 
 1072      (*this)[1][0] = -((*this)[1][0] * (*this)[2][2] - (*this)[1][2] * (*this)[2][0])*t17;
 
 1073      (*this)[1][1] =  (matrix00 * (*this)[2][2] - t14) * t17;
 
 1074      (*this)[1][2] = -(t6-t10) * t17;
 
 1075      (*this)[2][0] =  (matrix10 * (*this)[2][1] - matrix11 * (*this)[2][0]) * t17;
 
 1076      (*this)[2][1] = -(matrix00 * (*this)[2][1] - t12) * t17;
 
 1077      (*this)[2][2] =  (t4-t8) * t17;
 
 1082      AutonomousValue<MAT> A(asImp());
 
 1083      std::vector<simd_index_type> pivot(rows());
 
 1084      Simd::Mask<typename FieldTraits<value_type>::real_type>
 
 1085        nonsingularLanes(
true);
 
 1086      AutonomousValue<MAT>::luDecomposition(A, ElimPivot(pivot), nonsingularLanes, 
true, doPivoting);
 
 1093      for(size_type i=0; i<rows(); ++i)
 
 1097      for (size_type i=0; i<rows(); i++)
 
 1098        for (size_type j=0; j<i; j++)
 
 1099          for (size_type k=0; k<rows(); k++)
 
 1100            (*
this)[i][k] -= L[i][j]*(*this)[j][k];
 
 1103      for (size_type i=rows(); i>0;) {
 
 1105        for (size_type k=0; k<rows(); k++) {
 
 1106          for (size_type j=i+1; j<rows(); j++)
 
 1107            (*
this)[i][k] -= U[i][j]*(*this)[j][k];
 
 1108          (*this)[i][k] /= U[i][i];
 
 1112      for(size_type i=rows(); i>0; ) {
 
 1114        for(std::size_t l = 0; l < 
Simd::lanes((*
this)[0][0]); ++l)
 
 1118            for(size_type j=0; j<rows(); ++j)
 
 1127  template<
typename MAT>
 
 1133      DUNE_THROW(FMatrixError, 
"There is no determinant for a " << rows() << 
"x" << cols() << 
" matrix!");
 
 1136      return (*
this)[0][0];
 
 1139      return (*
this)[0][0]*(*this)[1][1] - (*this)[0][1]*(*this)[1][0];
 
 1143      field_type t4  = (*this)[0][0] * (*this)[1][1];
 
 1144      field_type t6  = (*this)[0][0] * (*this)[1][2];
 
 1145      field_type t8  = (*this)[0][1] * (*this)[1][0];
 
 1146      field_type t10 = (*this)[0][2] * (*this)[1][0];
 
 1147      field_type t12 = (*this)[0][1] * (*this)[2][0];
 
 1148      field_type t14 = (*this)[0][2] * (*this)[2][0];
 
 1150      return (t4*(*
this)[2][2]-t6*(*
this)[2][1]-t8*(*
this)[2][2]+
 
 1151              t10*(*
this)[2][1]+t12*(*
this)[1][2]-t14*(*
this)[1][1]);
 
 1155    AutonomousValue<MAT> A(asImp());
 
 1157    Simd::Mask<typename FieldTraits<value_type>::real_type>
 
 1158      nonsingularLanes(
true);
 
 1160    AutonomousValue<MAT>::luDecomposition(A, ElimDet(det), nonsingularLanes, 
false, doPivoting);
 
 1161    det = 
Simd::cond(nonsingularLanes, det, field_type(0));
 
 1163    for (size_type i = 0; i < rows(); ++i)
 
 1170  namespace DenseMatrixHelp {
 
 1173    template <
typename MAT, 
typename V1, 
typename V2>
 
 1180      for(size_type i=0; i<matrix.
rows(); ++i)
 
 1183        for(size_type j=0; j<matrix.
cols(); ++j)
 
 1185          ret[i] += matrix[i][j]*x[j];
 
 1192    template <
typename K, 
int rows, 
int cols>
 
 1195      typedef typename FieldMatrix<K,rows,cols>::size_type size_type;
 
 1197      for(size_type i=0; i<cols(); ++i)
 
 1200        for(size_type j=0; j<rows(); ++j)
 
 1201          ret[i] += matrix[j][i]*x[j];
 
 1206    template <
typename K, 
int rows, 
int cols>
 
 1207    static inline FieldVector<K,rows> mult(
const FieldMatrix<K,rows,cols> &matrix, 
const FieldVector<K,cols> & x)
 
 1209      FieldVector<K,rows> ret;
 
 1215    template <
typename K, 
int rows, 
int cols>
 
 1216    static inline FieldVector<K,cols> multTransposed(
const FieldMatrix<K,rows,cols> &matrix, 
const FieldVector<K,rows> & x)
 
 1218      FieldVector<K,cols> ret;
 
 1219      multAssignTransposed( matrix, x, ret );
 
 1227  template<
typename MAT>
 
 1231      s << a[i] << std::endl;
 
Macro for wrapping boundary checks.
 
Generic iterator class for dense vector and matrix implementations.
Definition: densevector.hh:132
 
A dense n x m matrix.
Definition: densematrix.hh:145
 
ConstIterator const_iterator
typedef for stl compliant access
Definition: densematrix.hh:249
 
constexpr derived_type & operator+=(const DenseMatrix< Other > &x)
vector space addition
Definition: densematrix.hh:294
 
constexpr Iterator beforeBegin()
Definition: densematrix.hh:241
 
constexpr void umhv(const X &x, Y &y) const
y += A^H x
Definition: densematrix.hh:437
 
constexpr derived_type & operator*=(const field_type &k)
vector space multiplication with scalar
Definition: densematrix.hh:326
 
constexpr void usmhv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition: densematrix.hh:517
 
constexpr derived_type & operator-=(const DenseMatrix< Other > &x)
vector space subtraction
Definition: densematrix.hh:317
 
void solve(V1 &x, const V2 &b, bool doPivoting=true) const
Solve system A x = b.
 
Traits::value_type field_type
export the type representing the field
Definition: densematrix.hh:165
 
constexpr ConstIterator beforeEnd() const
Definition: densematrix.hh:269
 
constexpr bool operator!=(const DenseMatrix< Other > &x) const
Binary matrix incomparison.
Definition: densematrix.hh:363
 
constexpr derived_type & axpy(const field_type &a, const DenseMatrix< Other > &x)
vector space axpy operation (*this += a x)
Definition: densematrix.hh:343
 
std::remove_reference< const_row_reference >::type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition: densematrix.hh:253
 
void invert(bool doPivoting=true)
Compute inverse.
 
constexpr void usmtv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition: densematrix.hh:503
 
static void luDecomposition(DenseMatrix< MAT > &A, Func func, Mask &nonsingularLanes, bool throwEarly, bool doPivoting)
do an LU-Decomposition on matrix A
 
Traits::value_type block_type
export the type representing the components
Definition: densematrix.hh:168
 
constexpr size_type cols() const
number of columns
Definition: densematrix.hh:720
 
constexpr size_type size() const
size method (number of rows)
Definition: densematrix.hh:205
 
constexpr size_type M() const
number of columns
Definition: densematrix.hh:708
 
constexpr void mmhv(const X &x, Y &y) const
y -= A^H x
Definition: densematrix.hh:476
 
MAT & rightmultiply(const DenseMatrix< M2 > &M)
Multiplies M from the right to this matrix.
Definition: densematrix.hh:650
 
constexpr Iterator beforeEnd()
Definition: densematrix.hh:234
 
constexpr ConstIterator beforeBegin() const
Definition: densematrix.hh:276
 
constexpr FieldTraits< value_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition: densematrix.hh:533
 
Traits::value_type value_type
export the type representing the field
Definition: densematrix.hh:162
 
constexpr Iterator end()
end iterator
Definition: densematrix.hh:227
 
constexpr derived_type & operator/=(const field_type &k)
vector space division by scalar
Definition: densematrix.hh:334
 
constexpr derived_type operator-() const
Matrix negation.
Definition: densematrix.hh:303
 
constexpr size_type rows() const
number of rows
Definition: densematrix.hh:714
 
constexpr void mv(const X &x, Y &y) const
y = A x
Definition: densematrix.hh:373
 
MAT & leftmultiply(const DenseMatrix< M2 > &M)
Multiplies M from the left to this matrix.
Definition: densematrix.hh:632
 
constexpr void mtv(const X &x, Y &y) const
y = A^T x
Definition: densematrix.hh:392
 
constexpr FieldTraits< vt >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition: densematrix.hh:551
 
constexpr row_reference operator[](size_type i)
random access
Definition: densematrix.hh:194
 
constexpr void umv(const X &x, Y &y) const
y += A x
Definition: densematrix.hh:411
 
Traits::derived_type derived_type
type of derived matrix class
Definition: densematrix.hh:159
 
constexpr bool exists(size_type i, size_type j) const
return true when (i,j) is in pattern
Definition: densematrix.hh:728
 
constexpr void usmv(const typename FieldTraits< Y >::field_type &alpha, const X &x, Y &y) const
y += alpha A x
Definition: densematrix.hh:489
 
Iterator RowIterator
rename the iterators for easier access
Definition: densematrix.hh:216
 
static constexpr int blocklevel
The number of block levels we contain. This is the leaf, that is, 1.
Definition: densematrix.hh:183
 
constexpr ConstIterator begin() const
begin iterator
Definition: densematrix.hh:256
 
constexpr void umtv(const X &x, Y &y) const
y += A^T x
Definition: densematrix.hh:424
 
DenseIterator< const DenseMatrix, const row_type, const_row_reference > ConstIterator
Iterator class for sequential access.
Definition: densematrix.hh:247
 
constexpr void mmtv(const X &x, Y &y) const
y -= A^T x
Definition: densematrix.hh:463
 
constexpr ConstIterator end() const
end iterator
Definition: densematrix.hh:262
 
constexpr FieldTraits< value_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition: densematrix.hh:541
 
Traits::row_type row_type
The type used to represent a row (must fulfill the Dune::DenseVector interface)
Definition: densematrix.hh:174
 
constexpr size_type N() const
number of rows
Definition: densematrix.hh:702
 
constexpr bool operator==(const DenseMatrix< Other > &x) const
Binary matrix comparison.
Definition: densematrix.hh:353
 
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densematrix.hh:171
 
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:180
 
std::remove_reference< row_reference >::type::Iterator ColIterator
rename the iterators for easier access
Definition: densematrix.hh:218
 
Traits::row_reference row_reference
The type used to represent a reference to a row (usually row_type &)
Definition: densematrix.hh:177
 
constexpr void mmv(const X &x, Y &y) const
y -= A x
Definition: densematrix.hh:450
 
Iterator iterator
typedef for stl compliant access
Definition: densematrix.hh:214
 
constexpr FieldTraits< vt >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition: densematrix.hh:566
 
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition: densematrix.hh:251
 
constexpr Iterator begin()
begin iterator
Definition: densematrix.hh:221
 
DenseIterator< DenseMatrix, row_type, row_reference > Iterator
Iterator class for sequential access.
Definition: densematrix.hh:212
 
field_type determinant(bool doPivoting=true) const
calculates the determinant of this matrix
 
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:230
 
constexpr size_type size() const
size method
Definition: densevector.hh:337
 
Error thrown if operations of a FieldMatrix fail.
Definition: densematrix.hh:131
 
static ctype absolute_limit()
return threshold to declare matrix singular
Definition: precision.hh:28
 
A dense n x m matrix.
Definition: fmatrix.hh:117
 
vector space out of a tensor product of fields.
Definition: fvector.hh:97
 
Default exception class for mathematical errors.
Definition: exceptions.hh:335
 
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:1174
 
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:30
 
typename AutonomousValueType< T >::type AutonomousValue
Type free of internal references that T can be converted to.
Definition: typetraits.hh:566
 
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
 
constexpr auto max
Function object that returns the greater of the given values.
Definition: hybridutilities.hh:485
 
Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
implements Simd::mask()
Definition: defaults.hh:153
 
bool anyTrue(const Mask &mask)
Whether any entry is true
Definition: interface.hh:429
 
V cond(M &&mask, const V &ifTrue, const V &ifFalse)
Like the ?: operator.
Definition: interface.hh:386
 
bool allTrue(const Mask &mask)
Whether all entries are true
Definition: interface.hh:439
 
typename Overloads::RebindType< std::decay_t< S >, std::decay_t< V > >::type Rebind
Construct SIMD type with different scalar type.
Definition: interface.hh:253
 
constexpr std::size_t lanes()
Number of lanes in a SIMD type.
Definition: interface.hh:305
 
decltype(auto) lane(std::size_t l, V &&v)
Extract an element of a SIMD type.
Definition: interface.hh:324
 
Rebind< bool, V > Mask
Mask type type of some SIMD type.
Definition: interface.hh:289
 
Some useful basic math stuff.
 
bool isNaN(const FieldVector< K, SIZE > &b, PriorityTag< 2 >, ADLTag)
Returns whether any entry is NaN.
Definition: fvector.hh:458
 
Dune namespace.
Definition: alignedallocator.hh:13
 
constexpr int sign(const T &val)
Return the sign of the value.
Definition: math.hh:162
 
constexpr K conjugateComplex(const K &x)
compute conjugate complex of x
Definition: math.hh:146
 
Various precision settings for calculations with FieldMatrix and FieldVector.
 
Implements a scalar vector view wrapper around an existing scalar.
 
Include file for users of the SIMD abstraction layer.
 
you have to specialize this structure for any type that should be assignable to a DenseMatrix
Definition: densematrix.hh:61
 
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition: typetraits.hh:194
 
Traits for type conversions and type information.