#ifndef _sparsematrix_h_ #define _sparsematrix_h_ #include "matrix.h" #include using namespace std; template class SparseMatrix: public Matrix { public: SparseMatrix(int nrows, int ncols); ValType & operator()(int i, int j); private: map _values; }; template SparseMatrix::SparseMatrix(int nrows, int ncols) : Matrix(nrows, ncols) { } template ValType & SparseMatrix::operator()(int i, int j) { return _values[j + i * this->_ncols]; } #endif