Created generic class of Matrix