Class documentation of Concepts

Loading...
Searching...
No Matches
matrixMult.hh
Go to the documentation of this file.
1
6#ifndef matrixmult_hh
7#define matrixmult_hh
8
9#include "matrixIterator.hh"
10#include "basics/exceptions.hh"
11#include "basics/debug.hh"
12
13#define MatrixMultRowSort_D 0
14
15namespace concepts {
16
17 // ********************************************** matrixMultiplyRowSorting **
18
27 template<class F, class G, class H>
28 void matrixMultiplyRowSorting(const F& factL, const G& factR,
29 Matrix<H>& dest) {
30 conceptsAssert(factL.nofCols() == factR.nofRows(), Assertion());
31 conceptsAssert(factL.nofRows() == dest.nofRows(), Assertion());
32 conceptsAssert(factR.nofCols() == dest.nofCols(), Assertion());
33 DEBUGL(MatrixMultRowSort_D, "factL = " << factL << ", factR = " << factR);
34
35 // current column and row in the left matrix
36 uint col, row;
37 // current value in left matrix
38 typename F::type value;
39
40 typename F::const_iterator factL_end = factL.end();
41 typename G::const_iterator factR_end = factR.end();
42 // iterator over one row in factR
43 for(typename F::const_iterator i = factL.begin(); i != factL_end; ++i) {
44 DEBUGL(MatrixMultRowSort_D, "i = " << i);
45 col = i.col();
46 row = i.row();
47 value = *i;
48 for(typename G::const_iterator j = factR.begin(col);
49 j != factR_end && j.row() == col; ++j) {
50 DEBUGL(MatrixMultRowSort_D, "j = " << j);
51 dest(row, j.col()) += value * *j;
52 }
53 }
54 DEBUGL(MatrixMultRowSort_D, "done");
55 }
56
57} // namespace concepts
58
59#endif // matrixmult_hh
#define conceptsAssert(cond, exc)
#define DEBUGL(doit, msg)
Definition debug.hh:40
void matrixMultiplyRowSorting(const F &factL, const G &factR, Matrix< H > &dest)
Definition matrixMult.hh:28
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320