changing Matrix to abstract class, implementing constructors and default
methods to it