diff --git a/dune/solvers/operators/lowrankoperator.hh b/dune/solvers/operators/lowrankoperator.hh index 5f70e2fa0e3191710f021f54ea534b9d5bfcc260..0466a0a4b8cdd95935a4e57c127cb0dbd1b90adf 100644 --- a/dune/solvers/operators/lowrankoperator.hh +++ b/dune/solvers/operators/lowrankoperator.hh @@ -46,16 +46,7 @@ class LowRankOperator { LVectorType temp(lowRankFactor_->N()); lowRankFactor_->mv(x,temp); - - typename LowRankFactorType::ConstRowIterator row_end = lowRankFactor_->end(); - typename LowRankFactorType::ConstRowIterator row_it = lowRankFactor_->begin(); - for (; row_it!=row_end; ++row_it) - { - typename LowRankFactorType::ConstColIterator col_end = row_it->end(); - typename LowRankFactorType::ConstColIterator col_it = row_it->begin(); - for (; col_it!=col_end; ++col_it) - (*lowRankFactor_)[row_it.index()][col_it.index()].umv(temp[row_it.index()],b[col_it.index()]); - } + lowRankFactor_->umtv(temp,b); } //! b += alpha*Ax @@ -64,16 +55,7 @@ class LowRankOperator { LVectorType temp(lowRankFactor_->N()); lowRankFactor_->mv(x,temp); - - typename LowRankFactorType::ConstRowIterator row_end = lowRankFactor_->end(); - typename LowRankFactorType::ConstRowIterator row_it = lowRankFactor_->begin(); - for (; row_it!=row_end; ++row_it) - { - typename LowRankFactorType::ConstColIterator col_end = row_it->end(); - typename LowRankFactorType::ConstColIterator col_it = row_it->begin(); - for (; col_it!=col_end; ++col_it) - (*lowRankFactor_)[row_it.index()][col_it.index()].usmv(alpha,temp[row_it.index()],b[col_it.index()]); - } + lowRankFactor_->usmtv(alpha,temp,b); } //! b -= Ax @@ -82,16 +64,7 @@ class LowRankOperator { LVectorType temp(lowRankFactor_->N()); lowRankFactor_->mv(x,temp); - - typename LowRankFactorType::ConstRowIterator row_end = lowRankFactor_->end(); - typename LowRankFactorType::ConstRowIterator row_it = lowRankFactor_->begin(); - for (; row_it!=row_end; ++row_it) - { - typename LowRankFactorType::ConstColIterator col_end = row_it->end(); - typename LowRankFactorType::ConstColIterator col_it = row_it->begin(); - for (; col_it!=col_end; ++col_it) - (*lowRankFactor_)[row_it.index()][col_it.index()].mmv(temp[row_it.index()],b[col_it.index()]); - } + lowRankFactor_->usmtv(-1.0,temp,b); } //! b = Ax diff --git a/dune/solvers/test/lowrankoperatortest.cc b/dune/solvers/test/lowrankoperatortest.cc index 96c5161f702d1d4103954f8c2f04f21a247b6433..d758e2eb714ee54c47c149c2141f83660fbd36a9 100644 --- a/dune/solvers/test/lowrankoperatortest.cc +++ b/dune/solvers/test/lowrankoperatortest.cc @@ -180,12 +180,18 @@ bool check() int main(int argc, char** argv) try { - static const int block_size = BLOCKSIZE; +// static const int block_size = BLOCKSIZE; bool passed(true); - passed = check<Dune::Matrix<Dune::ScaledIdentityMatrix<double, block_size> > >(); - passed = passed and check<Dune::Matrix<Dune::DiagonalMatrix<double, block_size> > >(); + passed = check<Dune::Matrix<Dune::ScaledIdentityMatrix<double, 1> > >(); + passed = passed and check<Dune::Matrix<Dune::DiagonalMatrix<double, 1> > >(); + passed = check<Dune::Matrix<Dune::ScaledIdentityMatrix<double, 2> > >(); + passed = passed and check<Dune::Matrix<Dune::DiagonalMatrix<double, 2> > >(); + passed = check<Dune::Matrix<Dune::ScaledIdentityMatrix<double, 3> > >(); + passed = passed and check<Dune::Matrix<Dune::DiagonalMatrix<double, 3> > >(); + passed = check<Dune::Matrix<Dune::ScaledIdentityMatrix<double, 4> > >(); + passed = passed and check<Dune::Matrix<Dune::DiagonalMatrix<double, 4> > >(); return passed ? 0 : 1; }