# | Line 38 | Line 38 | namespace oopse { | |
---|---|---|
38 | #include "Vector.hpp" | |
39 | ||
40 | namespace oopse { | |
41 | – | const double epsilon = 0.000001; |
42 | – | |
43 | – | template<typename T> |
44 | – | inline bool equal(T e1, T e2) { |
45 | – | return e1 == e2; |
46 | – | } |
47 | – | |
48 | – | template<> |
49 | – | inline bool equal(float e1, float e2) { |
50 | – | return fabs(e1 - e2) < epsilon; |
51 | – | } |
41 | ||
53 | – | template<> |
54 | – | inline bool equal(double e1, double e2) { |
55 | – | return fabs(e1 - e2) < epsilon; |
56 | – | } |
57 | – | |
42 | /** | |
43 | * @class RectMatrix RectMatrix.hpp "math/RectMatrix.hpp" | |
44 | * @brief rectangular matrix class | |
# | Line 428 | Line 412 | namespace oopse { | |
412 | for (unsigned int i = 0; i < Row; i++) | |
413 | for (unsigned int j = 0; j < Col; j++) | |
414 | for (unsigned int k = 0; k < SameDim; k++) | |
415 | < | result(i, j) = m1(i, k) * m2(k, j); |
415 | > | result(i, j) += m1(i, k) * m2(k, j); |
416 | ||
417 | return result; | |
418 | } | |
# | Line 464 | Line 448 | namespace oopse { | |
448 | ||
449 | return result; | |
450 | } | |
451 | + | |
452 | + | /** |
453 | + | * Write to an output stream |
454 | + | */ |
455 | + | template<typename Real, unsigned int Row, unsigned int Col> |
456 | + | std::ostream &operator<< ( std::ostream& o, const RectMatrix<Real, Row, Col>& m) { |
457 | + | for (unsigned int i = 0; i < Row ; i++) { |
458 | + | o << "(" |
459 | + | for (unsigned int j = 0; j < Col ; j++) { |
460 | + | o << m(i, j) << "\t" |
461 | + | } |
462 | + | o << ")" << std::endl; |
463 | + | } |
464 | + | return o; |
465 | + | } |
466 | } | |
467 | #endif //MATH_RECTMATRIX_HPP |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |