Revised matrix.hpp