--- trunk/OOPSE-4/src/math/RectMatrix.hpp 2004/10/13 23:53:40 1567 +++ trunk/OOPSE-4/src/math/RectMatrix.hpp 2004/10/17 01:19:11 1586 @@ -38,23 +38,7 @@ namespace oopse { #include "Vector.hpp" namespace oopse { - const double epsilon = 0.000001; - - template - inline bool equal(T e1, T e2) { - return e1 == e2; - } - - template<> - inline bool equal(float e1, float e2) { - return fabs(e1 - e2) < epsilon; - } - template<> - inline bool equal(double e1, double e2) { - return fabs(e1 - e2) < epsilon; - } - /** * @class RectMatrix RectMatrix.hpp "math/RectMatrix.hpp" * @brief rectangular matrix class @@ -428,7 +412,7 @@ namespace oopse { for (unsigned int i = 0; i < Row; i++) for (unsigned int j = 0; j < Col; j++) for (unsigned int k = 0; k < SameDim; k++) - result(i, j) = m1(i, k) * m2(k, j); + result(i, j) += m1(i, k) * m2(k, j); return result; } @@ -464,5 +448,20 @@ namespace oopse { return result; } + + /** + * Write to an output stream + */ + template + std::ostream &operator<< ( std::ostream& o, const RectMatrix& m) { + for (unsigned int i = 0; i < Row ; i++) { + o << "(" + for (unsigned int j = 0; j < Col ; j++) { + o << m(i, j) << "\t" + } + o << ")" << std::endl; + } + return o; + } } #endif //MATH_RECTMATRIX_HPP