#include "DOFIndexed.h" #include "DOFMatrix.h" namespace AMDiS { void mv(MatrixTranspose transpose, const DOFMatrix &a, DOFIndexed<double> &x, DOFIndexed<double> &result, bool add) { FUNCNAME("DOFVector<T>::mv"); int irow, jcol; double sum; if (transpose == NoTranspose) { DOFMatrix::Iterator rowIterator(const_cast<DOFMatrix*>(&a), USED_DOFS); for(rowIterator.reset(); !rowIterator.end(); ++rowIterator) { sum = 0; irow = rowIterator.getDOFIndex(); if(!add) result[irow] = 0.0; for(::std::vector<MatEntry>::iterator colIterator = rowIterator->begin(); colIterator != rowIterator->end(); colIterator++) { jcol = colIterator->col; if (jcol >= 0) { // entry used? sum += (static_cast<double>(colIterator->entry)) * x[jcol]; } else { if (jcol == DOFMatrix::NO_MORE_ENTRIES) break; } } result[irow] += sum; } } else { ERROR_EXIT("transpose=%d\n", transpose); } } }