Go to the documentation of this file.00001
00002
00003
00004 #ifndef matrixmult_hh
00005 #define matrixmult_hh
00006
00007 #include "matrixIterator.hh"
00008 #include "basics/exceptions.hh"
00009 #include "basics/debug.hh"
00010
00011 #define MatrixMultRowSort_D 0
00012
00013 namespace concepts {
00014
00015
00016
00025 template<class F, class G, class H>
00026 void matrixMultiplyRowSorting(const F& factL, const G& factR,
00027 Matrix<H>& dest) {
00028 conceptsAssert(factL.nofCols() == factR.nofRows(), Assertion());
00029 conceptsAssert(factL.nofRows() == dest.nofRows(), Assertion());
00030 conceptsAssert(factR.nofCols() == dest.nofCols(), Assertion());
00031 DEBUGL(MatrixMultRowSort_D, "factL = " << factL << ", factR = " << factR);
00032
00033
00034 uint col, row;
00035
00036 typename F::type value;
00037
00038 typename F::const_iterator factL_end = factL.end();
00039 typename G::const_iterator factR_end = factR.end();
00040
00041 for(typename F::const_iterator i = factL.begin(); i != factL_end; ++i) {
00042 DEBUGL(MatrixMultRowSort_D, "i = " << i);
00043 col = i.col();
00044 row = i.row();
00045 value = *i;
00046 for(typename G::const_iterator j = factR.begin(col);
00047 j != factR_end && j.row() == col; ++j) {
00048 DEBUGL(MatrixMultRowSort_D, "j = " << j);
00049 dest(row, j.col()) += value * *j;
00050 }
00051 }
00052 DEBUGL(MatrixMultRowSort_D, "done");
00053 }
00054
00055 }
00056
00057 #endif // matrixmult_hh