コード例 #1
0
 public void test3Random() {
   java.util.Random r = new java.util.Random();
   int ntest = 1000;
   for (int itest = 0; itest < ntest; ++itest) {
     SymmetricTridiagonalFilter stf = makeRandomFilter();
     boolean inplace = r.nextBoolean(); // apply in-place?
     int n1 = 2 + r.nextInt(11);
     int n2 = 2 + r.nextInt(12);
     int n3 = 2 + r.nextInt(13);
     float[][][] t = randfloat(r, n1, n2, n3);
     float[][][] x = copy(t);
     float[][][] y = inplace ? x : zerofloat(n1, n2, n3);
     float[][][] z = inplace ? x : zerofloat(n1, n2, n3);
     stf.apply1(x, y);
     stf.applyInverse1(y, z);
     assertEqual(t, x);
     assertEqual(t, z);
     stf.apply2(x, y);
     stf.applyInverse2(y, z);
     assertEqual(t, x);
     assertEqual(t, z);
     stf.apply3(x, y);
     stf.applyInverse3(y, z);
     assertEqual(t, x);
     assertEqual(t, z);
   }
 }
コード例 #2
0
 public void test3Simple() {
   int n1 = 11;
   int n2 = 12;
   int n3 = 13;
   float[][][] r = randfloat(n1, n2, n3);
   float[][][] x = copy(r);
   float[][][] y = copy(r);
   SymmetricTridiagonalFilter stf = new SymmetricTridiagonalFilter(2.6, 2.5, 2.7, 1.2);
   stf.apply1(x, x);
   stf.apply2(x, x);
   stf.apply3(x, x);
   stf.apply1(y, y);
   y = transpose12(y);
   stf.apply1(y, y);
   y = transpose12(y);
   y = transpose23(y);
   stf.apply2(y, y);
   y = transpose23(y);
   assertEqual(x, y);
 }
コード例 #3
0
 public void test2Transpose() {
   int n1 = 4;
   int n2 = 5;
   double af, ai, al, b;
   // af = al = 0.50; // zero-value
   af = al = 0.76; // nearly zero-slope, but invertible
   ai = 0.52;
   b = 0.24;
   SymmetricTridiagonalFilter f = new SymmetricTridiagonalFilter(af, ai, al, b);
   float[][] x = randfloat(n1, n2);
   float[][] y = zerofloat(n1, n2);
   float[][] z = zerofloat(n2, n1);
   f.apply1(x, y);
   x = transpose(x);
   f.apply2(x, z);
   z = transpose(z);
   // dump(y); dump(z);
   assertEqual(y, z);
 }
コード例 #4
0
 public void test2Simple() {
   int n1 = 5;
   int n2 = 4;
   double af, ai, al, b;
   // af = al = 0.50; // zero-value
   af = al = 0.75; // zero-slope
   ai = 0.50;
   b = 0.25;
   SymmetricTridiagonalFilter f = new SymmetricTridiagonalFilter(af, ai, al, b);
   float[][] x = zerofloat(n1, n2);
   float[][] y = zerofloat(n1, n2);
   float[][] z = zerofloat(n1, n2);
   fill(1.0f, x);
   // x[n2/2][n1/2] = 1.0f;
   f.apply1(x, y);
   f.apply2(y, y);
   f.applyInverse1(y, z);
   f.applyInverse2(z, z);
   // dump(x); dump(y); dump(z);
   assertEqual(x, z);
 }