Skip to content
Snippets Groups Projects
Commit a2c3a658 authored by Jorrit Fahlke's avatar Jorrit Fahlke
Browse files

[BCRSMatrix] Implement axpy().

[[Imported from SVN: r1319]]
parent 742cf6a0
No related branches found
No related tags found
No related merge requests found
...@@ -963,6 +963,29 @@ namespace Dune { ...@@ -963,6 +963,29 @@ namespace Dune {
return *this; return *this;
} }
/*! \brief Add the scaled entries of another matrix to this one.
*
* Matrix axpy operation: *this += alpha * b
*
* \param alpha Scaling factor.
* \param b The matrix to add to this one. Its sparsity pattern has to
* be subset of the sparsity pattern of this matrix.
*/
BCRSMatrix& axpy(field_type alpha, const BCRSMatrix& b)
{
#ifdef DUNE_ISTL_WITH_CHECKING
if(N()!=b.N() || M() != b.M())
DUNE_THROW(RangeError, "Matrix sizes do not match!");
#endif
RowIterator endi=end();
ConstRowIterator j=b.begin();
for(RowIterator i=begin(); i!=endi; ++i, ++j)
i->axpy(alpha, *j);
return *this;
}
//===== linear maps //===== linear maps
//! y = A x //! y = A x
......
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