C++ class for matrix algebra