RowMatrix<T> operator~(const RowMatrix<T> &r) { RowMatrix<T> m{ r.cols(), r.rows() }; for (size_t i = 0; i < r.rows(); ++i) { for (size_t j = 0; j < r.cols(); ++j) { m[j][i] = r[i][j]; } } m.compress(); return m; }
RowMatrix<T> operator*(const RowMatrix<T> &lhs, const RowMatrix<T> &rhs) { RowMatrix<T> m{ lhs.rows(), rhs.cols() }; for (size_t i = 0; i < lhs.rows(); ++i) { for (size_t j = 0; j < rhs.cols(); ++j) { T accum = 0; for (size_t k = lhs.row_left(i); k < lhs.row_right(i); ++k) { accum += lhs[i][k] * rhs[k][j]; } m[i][j] = accum; } } m.compress(); return m; }