--- trunk/src/math/RectMatrix.hpp 2004/10/17 01:19:11 93 +++ trunk/src/math/RectMatrix.hpp 2004/10/19 23:01:03 113 @@ -151,6 +151,30 @@ namespace oopse { for (unsigned int j = 0; j < Col; j++) data_[j][col] = v[j]; } + + /** + * swap two rows of this matrix + * @param i the first row + * @param j the second row + */ + void swapRow(unsigned int i, unsigned int j){ + assert(i < Row && j < Row); + + for (unsigned int k = 0; k < Col; k++) + std::swap(data_[i][k], data_[j][k]); + } + + /** + * swap two colums of this matrix + * @param i the first colum + * @param j the second colum + */ + void swapColum(unsigned int i, unsigned int j){ + assert(i < Col && j < Col); + + for (unsigned int k = 0; k < Row; k++) + std::swap(data_[k][i], data_[k][j]); + } /** * Tests if this matrix is identical to matrix m @@ -455,9 +479,11 @@ namespace oopse { template std::ostream &operator<< ( std::ostream& o, const RectMatrix& m) { for (unsigned int i = 0; i < Row ; i++) { - o << "(" + o << "("; for (unsigned int j = 0; j < Col ; j++) { - o << m(i, j) << "\t" + o << m(i, j); + if (j != Col -1) + o << "\t"; } o << ")" << std::endl; }