public void test1Random() { 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 n = 2 + r.nextInt(10); float[] t = randfloat(r, n); float[] x = copy(t); float[] y = inplace ? x : zerofloat(n); float[] z = inplace ? x : zerofloat(n); stf.apply(x, y); stf.applyInverse(y, z); assertEqual(t, x); assertEqual(t, z); } }
public void test1Simple() { int n = 5; 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(n); float[] y = zerofloat(n); float[] z = zerofloat(n); fill(1.0f, x); // x[n/2] = 1.0f; f.apply(x, y); f.applyInverse(y, z); // dump(x); dump(y); dump(z); assertEqual(x, z); }