fixed inverse and submatrix, now testing identical to gmath