Skip to content
Snippets Groups Projects
Commit ed79fe85 authored by Oliver Sander's avatar Oliver Sander
Browse files

added ISTL-style assignment from scalar and umv()

[[Imported from SVN: r4570]]
parent 3ceb90f1
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,13 @@ namespace Dune {
data[i] = 0;
}
/** \brief Assignment from scalar */
Matrix& operator= (const T& t)
{
for (unsigned int i=0; i<data.size(); i++)
data[i] = t;
}
/** \brief The index operator */
T* operator[](int row) {
#ifdef DUNE_ISTL_WITH_CHECKING
......@@ -141,6 +148,24 @@ namespace Dune {
return out;
}
//! y += A x
template <class X, class Y>
void umv(const X& x, Y& y) const
{
#ifdef DUNE_ISTL_WITH_CHECKING
if (x.N()!=M()) DUNE_THROW(ISTLError,"index out of range");
if (y.N()!=N()) DUNE_THROW(ISTLError,"index out of range");
#endif
for (int i=0; i<rows_; i++) {
for (int j=0; j<cols_; j++)
(*this)[i][j].umv(x[j], y[i]);
}
}
protected:
std::vector<T> data;
......
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