--- trunk/src/math/RectMatrix.hpp 2004/10/13 22:24:59 71 +++ trunk/src/math/RectMatrix.hpp 2004/10/17 01:19:11 93 @@ -34,25 +34,11 @@ #ifndef MATH_RECTMATRIX_HPP #define MATH_RECTMATRIX_HPP +#include #include "Vector.hpp" namespace oopse { - - template - inline bool equal(T e1, T e2) { - return e1 == e2; - } - - template<> - inline bool equal(float e1, float e2) { - return e1 == e2; - } - template<> - inline bool equal(double e1, double e2) { - return e1 == e2; - } - /** * @class RectMatrix RectMatrix.hpp "math/RectMatrix.hpp" * @brief rectangular matrix class @@ -426,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; } @@ -462,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