working matrix class