Updated matrix2d

Added some functionality to matrix2d.