Skip to content
Snippets Groups Projects
Commit 9ef73c5e authored by Elias Pipping's avatar Elias Pipping
Browse files

Incorporate Promote from Arithmetic/StaticMatrix

parent 3004176d
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ install(FILES ...@@ -8,6 +8,7 @@ install(FILES
genericvectortools.hh genericvectortools.hh
ldlt.hh ldlt.hh
matrixtraits.hh matrixtraits.hh
promote.hh
scalartraits.hh scalartraits.hh
singlenonzerocolumnmatrix.hh singlenonzerocolumnmatrix.hh
singlenonzerorowmatrix.hh singlenonzerorowmatrix.hh
......
#ifndef DUNE_MATRIX_VECTOR_PROMOTE_HH
#define DUNE_MATRIX_VECTOR_PROMOTE_HH
#include <dune/common/diagonalmatrix.hh>
#include <dune/common/fmatrix.hh>
#include <dune/istl/scaledidmatrix.hh>
namespace Dune {
namespace MatrixVector {
// type promotion (smallest matrix that can hold the sum of two matrices
// *******************
template <class MatrixA, class MatrixB>
struct Promote {
typedef Dune::FieldMatrix<typename MatrixA::field_type, MatrixA::rows,
MatrixA::cols>
Type;
};
template <class Matrix>
struct Promote<Matrix, Matrix> {
typedef Matrix Type;
};
template <typename FieldType, int n>
struct Promote<Dune::FieldMatrix<FieldType, n, n>,
Dune::DiagonalMatrix<FieldType, n>> {
typedef Dune::FieldMatrix<FieldType, n, n> Type;
};
template <typename FieldType, int n>
struct Promote<Dune::DiagonalMatrix<FieldType, n>,
Dune::FieldMatrix<FieldType, n, n>> {
typedef Dune::FieldMatrix<FieldType, n, n> Type;
};
template <typename FieldType, int n>
struct Promote<Dune::DiagonalMatrix<FieldType, n>,
Dune::ScaledIdentityMatrix<FieldType, n>> {
typedef Dune::DiagonalMatrix<FieldType, n> Type;
};
template <typename FieldType, int n>
struct Promote<Dune::ScaledIdentityMatrix<FieldType, n>,
Dune::DiagonalMatrix<FieldType, n>> {
typedef Dune::DiagonalMatrix<FieldType, n> Type;
};
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment