public void testSpd() { // symmetric: y'Ax = x'(A'y) = x'Ay // positive-semidefinite: x'Ax >= 0 int n1 = _ep[0][0].length; int n2 = _ep[0].length; int n3 = _ep.length; float[][][] x = sub(randfloat(n1, n2, n3), 0.5f); float[][][] y = sub(randfloat(n1, n2, n3), 0.5f); float[][][] ax = copy(x); float[][][] ay = copy(y); VecArrayFloat3 vx = new VecArrayFloat3(x); VecArrayFloat3 vy = new VecArrayFloat3(y); VecArrayFloat3 vax = new VecArrayFloat3(ax); VecArrayFloat3 vay = new VecArrayFloat3(ay); apply(ax); apply(ay); applyTranspose(ax); applyTranspose(ay); double yax = vy.dot(vax); double xay = vx.dot(vay); double xax = vx.dot(vax); double yay = vy.dot(vay); System.out.println("S3: yax=" + yax + " xay=" + xay); System.out.println("S3: xax=" + xax + " yay=" + yay); }
public void apply(Vec vx, Vec vy) { VecArrayFloat3 v3x = (VecArrayFloat3) vx; VecArrayFloat3 v3y = (VecArrayFloat3) vy; float[][][] x = v3x.getArray(); float[][][] y = v3y.getArray(); float[][][] z = copy(x); _s3.apply(z); zero(y); applyLhs(_w1, _wp, _p2, _p3, z, y); _s3.applyTranspose(y); }
public void apply(Vec vx, Vec vy) { VecArrayFloat3 v3x = (VecArrayFloat3) vx; VecArrayFloat3 v3y = (VecArrayFloat3) vy; float[][][] x = v3x.getArray(); float[][][] y = v3y.getArray(); float[][][] z = copy(x); // float[][][] p = copy(x); // VecArrayFloat3 v3p = new VecArrayFloat3(p); // zero(p); _s3.apply(z); zero(y); applyLhs(z, y); // laplacian operator // applyLhs(copy(y),p); //biharmonic operator screenLhs(_mk, z, y); // screen points // v3y.add(1f,v3p,1f); _s3.applyTranspose(y); }