/** * Gets eigenvalues for the tensor with specified indices. * @param i1 index for 1st dimension. * @param i2 index for 2nd dimension. * @return array {au,av} of eigenvalues. */ public float[] getEigenvalues(int i1, int i2) { float[] a = new float[2]; getEigenvalues(i1,i2,a); return a; }
public void apply( Direction2 d, EigenTensors2 t, float[][] f, float[][] g) { if (_scale==0.0f) { copy(f,g); } else { int n1 = f[0].length; int n2 = f.length; float[][] au = new float[n2][n1]; float[][] av = new float[n2][n1]; float[][] sf = new float[n2][n1]; t.getEigenvalues(au,av); setEigenvalues(d,t); _lsf.applySmoothL(_kmax,f,sf); //_lsf.applySmoothS(f,sf); _lsf.apply(t,_scale,sf,g); t.setEigenvalues(au,av); } } public void apply(
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); } } }
for (int i2=0; i2<n2; ++i2) { for (int i1=0; i1<n1; ++i1) { _et.getEigenvalues(i1,i2,a); emax = max(emax,a[0],a[1]); int j1 = _s1.indexOfNearest(x1); _et.getEigenvalues(j1,j2,a); _et.getEigenvectorU(j1,j2,u); double u1 = u[0];