Skip to content
Snippets Groups Projects
Commit 31ef576c authored by Carsten Gräser's avatar Carsten Gräser
Browse files

*Fix bug in rightmultiply()

*Add const to *multiplyany()
*Implement *multiplyany() for FieldMatrix<k,1,1>
Thanks to Atgeirr Flø Rasmussen!

[[Imported from SVN: r5704]]
parent ab1cf467
No related branches found
No related tags found
No related merge requests found
......@@ -513,7 +513,7 @@ namespace Dune
//! Multiplies M from the left to this matrix, this matrix is not modified
template<int l>
FieldMatrix<K,l,cols> leftmultiplyany (const FieldMatrix<K,l,rows>& M)
FieldMatrix<K,l,cols> leftmultiplyany (const FieldMatrix<K,l,rows>& M) const
{
FieldMatrix<K,l,cols> C;
......@@ -535,7 +535,7 @@ namespace Dune
for (size_type i=0; i<rows; i++)
for (size_type j=0; j<cols; j++) {
(*this)[i][j] = 0;
for (size_type k=0; k<rows; k++)
for (size_type k=0; k<cols; k++)
(*this)[i][j] += C[i][k]*M[k][j];
}
return *this;
......@@ -543,7 +543,7 @@ namespace Dune
//! Multiplies M from the right to this matrix, this matrix is not modified
template<int l>
FieldMatrix<K,rows,l> rightmultiplyany (const FieldMatrix<K,cols,l>& M)
FieldMatrix<K,rows,l> rightmultiplyany (const FieldMatrix<K,cols,l>& M) const
{
FieldMatrix<K,rows,l> C;
......@@ -1219,6 +1219,16 @@ namespace Dune
return *this;
}
//! Multiplies M from the left to this matrix, this matrix is not modified
template<int l>
FieldMatrix<K,l,1> leftmultiplyany (const FieldMatrix<K,l,1>& M) const
{
FieldMatrix<K,l,1> C;
for (size_type j=0; j<l; j++)
C[j][0] = M[j][0]*a[0];
return C;
}
//! left multiplication
FieldMatrix& rightmultiply (const FieldMatrix& M)
{
......@@ -1226,6 +1236,16 @@ namespace Dune
return *this;
}
//! Multiplies M from the right to this matrix, this matrix is not modified
template<int l>
FieldMatrix<K,1,l> rightmultiplyany (const FieldMatrix<K,1,l>& M) const
{
FieldMatrix<K,1,l> C;
for (size_type j=0; j<l; j++)
C[0][j] = M[0][j]*a[0];
return C;
}
//===== sizes
......
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