implemented getsubmatrix