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

Added outer product for FieldVector

parent b374ce9e
No related branches found
No related tags found
No related merge requests found
......@@ -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