Skip to content
Snippets Groups Projects
Commit f77f36dc authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'feature/fieldmatvec_outer_product' into 'master'

Added outer product for FieldVector

See merge request !93
parents b374ce9e 35d37669
No related branches found
No related tags found
1 merge request!93Added outer product for FieldVector
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment