diff --git a/src/amdis/common/FieldMatVec.hpp b/src/amdis/common/FieldMatVec.hpp index eaa65e1a9b2c4e5ffe65f3f2f41dd41b2b2353e0..ced91c4a0c386ad0a0f56ee7b682aa4c2105f01e 100644 --- a/src/amdis/common/FieldMatVec.hpp +++ b/src/amdis/common/FieldMatVec.hpp @@ -367,6 +367,9 @@ namespace Dune template <class T, class S, int N, int M, int K> auto outer(FieldMatrix<T,N,K> const& vec1, FieldMatrix<S,M,K> const& vec2); + template <class T, class S, int N, int M> + auto outer(FieldVector<T,N> const& vec1, FieldVector<S,M> const& vec2); + // ---------------------------------------------------------------------------- template <class T> diff --git a/src/amdis/common/FieldMatVec.inc.hpp b/src/amdis/common/FieldMatVec.inc.hpp index 405239cdcf4a45cff50ff65e764f64fe31398c91..dc4fe7fbcdc167889c082725a8f6fba6e23b4f15 100644 --- a/src/amdis/common/FieldMatVec.inc.hpp +++ b/src/amdis/common/FieldMatVec.inc.hpp @@ -422,6 +422,18 @@ auto outer(FieldMatrix<T,N,K> const& vec1, FieldMatrix<S,M,K> const& vec2) return mat; } +/// Outer product (vec1 * vec2^T) +template <class T, class S, int N, int M> +auto outer(FieldVector<T,N> const& vec1, FieldVector<S,M> const& vec2) +{ + using result_type = FieldMatrix<TYPEOF( std::declval<T>() * std::declval<S>() ), N, M>; + result_type mat; + for (int i = 0; i < N; ++i) + for (int j = 0; j < M; ++j) + mat[i][j] = vec1[i] * vec2[j]; + return mat; +} + // ---------------------------------------------------------------------------- template <class T>