Skip to content
Snippets Groups Projects
Commit 673fea5b authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Merge branch 'master' into tree-refactoring

parents 7b9f02d8 4d81e222
No related branches found
No related tags found
No related merge requests found
......@@ -138,6 +138,15 @@ public:
/// vector-matrix multiplication
template<unsigned n_,unsigned m_>
friend VectorGeneric<n_> matmul(const VectorGeneric<m_>&,const TensorGeneric<m_,n_>&);
/// matrix-matrix-matrix multiplication
template<unsigned n_,unsigned m_,unsigned l_,unsigned i_>
friend TensorGeneric<n_,i_> matmul(const TensorGeneric<n_,m_>&,const TensorGeneric<m_,l_>&,const TensorGeneric<l_,i_>&);
/// matrix-matrix-vector multiplication
template<unsigned n_,unsigned m_,unsigned l_>
friend VectorGeneric<n_> matmul(const TensorGeneric<n_,m_>&,const TensorGeneric<m_,l_>&,const VectorGeneric<l_>&);
/// vector-matrix-matrix multiplication
template<unsigned n_,unsigned m_,unsigned l_>
friend VectorGeneric<l_> matmul(const VectorGeneric<n_>,const TensorGeneric<n_,m_>&,const TensorGeneric<m_,l_>&);
/// returns the determinant of a tensor
friend double determinant(const TensorGeneric<3,3>&);
/// returns the inverse of a tensor (same as inverse())
......@@ -353,6 +362,21 @@ VectorGeneric<n> matmul(const VectorGeneric<m>&a,const TensorGeneric<m,n>&b){
return t;
}
template<unsigned n,unsigned m,unsigned l,unsigned i>
TensorGeneric<n,i> matmul(const TensorGeneric<n,m>&a,const TensorGeneric<m,l>&b,const TensorGeneric<l,i>&c){
return matmul(matmul(a,b),c);
}
template<unsigned n,unsigned m,unsigned l>
VectorGeneric<n> matmul(const TensorGeneric<n,m>&a,const TensorGeneric<m,l>&b,const VectorGeneric<l>&c){
return matmul(matmul(a,b),c);
}
template<unsigned n,unsigned m,unsigned l>
VectorGeneric<l> matmul(const VectorGeneric<n>a,const TensorGeneric<n,m>&b,const TensorGeneric<m,l>&c){
return matmul(matmul(a,b),c);
}
inline
double determinant(const TensorGeneric<3,3>&t){
return t.determinant();
......
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