edited matrix class. Multidimensional arrays