getMatrix method implemented