/** * Gets the eigenvector u for the tensor with specified indices. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @return array {u1,u2} of eigenvector components. */ public float[] getEigenvectorU(int i1, int i2) { float[] u = new float[2]; getEigenvectorU(i1,i2,u); return u; }
private static void testRandom(double errorAngle, double errorCoeff) { int n1 = 13, n2 = 14; EigenTensors2 et = new EigenTensors2(n1,n2); for (int i2=0; i2<n2; ++i2) { for (int i1=0; i1<n1; ++i1) { float[] a = makeRandomEigenvalues(); float[] u = makeRandomEigenvector(); et.setEigenvalues(i1,i2,a); et.setEigenvectorU(i1,i2,u); float[] c; c = et.getEigenvectorU(i1,i2); checkEigenvectors(u,c,errorAngle); c = et.getEigenvalues(i1,i2); checkEigenvalues(c,a,errorCoeff); et.setTensor(i1,i2,et.getTensor(i1,i2)); c = et.getEigenvectorU(i1,i2); checkEigenvectors(u,c,errorAngle); c = et.getEigenvalues(i1,i2); checkEigenvalues(c,a,errorCoeff); } } }
_et.getEigenvectorU(j1,j2,u); double u1 = u[0]; double u2 = u[1];