Skip to content
Snippets Groups Projects
Commit 9ac07500 authored by Uli Sack's avatar Uli Sack Committed by usack
Browse files

shorten code considerably by using umtv resp usmtv instead of a by hand...

shorten code considerably by using umtv resp usmtv instead of a by hand implementation; test for some more dimensions

[[Imported from SVN: r5644]]
parent d771b212
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment