The matrix class defines a dense matrix data type with the usual matrix operations. Below is the public interface that is already defined.
class matrix { public: matrix(); matrix(int rows, int cols=1); matrix(int rows, int cols, double *data) ~matrix(); matrix(const matrix& x); matrix& operator=(matrix& x); double& operator()(int i,int j=0); /* element subscripting */ matrix operator+(matrix &x); matrix operator-(matrix &x); matrix operator-(); matrix operator*(matrix &x); matrix transpose(); matrix apply(double (*f)(double)); /* apply function elementwise */ };