created PsiSq matrix routine