21#ifndef OPM_SMALL_DENSE_MATRIX_UTILS_HEADER_INCLUDED
22#define OPM_SMALL_DENSE_MATRIX_UTILS_HEADER_INCLUDED
24#include <dune/common/dynmatrix.hh>
31 template<
class TA,
class TB,
class TC,
class PositiveSign >
32 static inline void multMatrixImpl(
const TA &
A,
37 using size_type =
typename TA :: size_type;
38 using K =
typename TA :: field_type;
43 const size_type
n =
A.N();
44 const size_type
m =
ret.N();
45 const size_type
p = B.M();
46 for( size_type i = 0; i <
m; ++i )
48 for( size_type j = 0; j <
p; ++j )
51 for( size_type
k = 0;
k <
n; ++
k )
53 sum +=
A[ i ][
k ] * B[
k ][ j ];
56 ret[ i ][ j ] = PositiveSign::value ? sum : -sum;
64 template<
class TA,
class TB,
class TC,
class PositiveSign >
65 static inline void multMatrixTransposedImpl (
const TA &
A,
70 using size_type =
typename TA :: size_type;
71 using K =
typename TA :: field_type;
76 const size_type
n =
A.N();
77 const size_type
m =
ret.N();
78 const size_type
p = B.M();
79 for( size_type i = 0; i <
m; ++i )
81 for( size_type j = 0; j <
p; ++j )
84 for( size_type
k = 0;
k <
n; ++
k )
86 sum +=
A[
k ][ i ] * B[
k ][ j ];
89 ret[ i ][ j ] = PositiveSign::value ? sum : -sum;
95 template <
class DenseMatrixA,
class DenseMatrixB,
class DenseMatrixC>
96 static inline void multMatrixTransposed(
const DenseMatrixA&
A,
100 multMatrixTransposedImpl(
A, B,
ret, std::true_type() );
104 template <
class DenseMatrixA,
class DenseMatrixB,
class DenseMatrixC>
105 static inline void negativeMultMatrixTransposed(
const DenseMatrixA&
A,
109 multMatrixTransposedImpl(
A, B,
ret, std::false_type() );
114 static inline void multMatrix(
const Dune::DynamicMatrix<K>&
A,
115 const Dune::DynamicMatrix<K>& B,
116 Dune::DynamicMatrix<K>&
ret )
118 using size_type =
typename Dune::DynamicMatrix<K> :: size_type;
120 const size_type
m =
A.rows();
121 const size_type
n =
A.cols();
125 const size_type
p = B.cols();
129 for( size_type i = 0; i <
m; ++i )
131 for( size_type j = 0; j <
p; ++j )
133 ret[ i ][ j ] =
K( 0 );
134 for( size_type
k = 0;
k <
n; ++
k )
135 ret[ i ][ j ] +=
A[ i ][
k ] * B[
k ][ j ];
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242