Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#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);
}
}
}