splitting the matrix classes
added better testing of optimized matrix