class for working with matrixes