01: import JSci.maths.*;
02: import JSci.maths.wavelet.*;
03: import JSci.maths.wavelet.daubechies2.*;
04:
05: /****************************************
06: * Test the biorthogonality
07: * @author Daniel Lemire
08: *****************************************/
09: public class TestBiorthogonalityDau2 {
10: public static void main(String arg[]) {
11: int n0 = 8;
12: int j0 = 0;
13: new TestBiorthogonalityDau2(n0, j0);
14: }
15:
16: public TestBiorthogonalityDau2(int n0, int j0) {
17: double[][] mat = new double[2 * n0 - 2][2 * n0 - 2];
18: for (int k = 0; k < n0; k++) {
19: System.out.println("k=" + k + " /" + (2 * n0 - 2));
20: for (int l = 0; l < n0; l++) {
21: mat[k][l] = EcheEche(k, l, n0, j0);
22: }
23: for (int l = n0; l < 2 * n0 - 2; l++) {
24: mat[k][l] = EcheOnde(k, l - n0, n0, j0);
25: }
26: }
27: for (int k = n0; k < 2 * n0 - 2; k++) {
28: System.out.println("k=" + k + " /" + (2 * n0 - 2));
29: for (int l = 0; l < n0 - 2; l++) {
30: mat[k][l] = OndeEche(k - n0, l, n0, j0);
31: }
32: for (int l = n0; l < 2 * n0 - 2; l++) {
33: mat[k][l] = OndeOnde(k - n0, l - n0, n0, j0);
34: }
35: }
36: double[][] Id = new double[2 * n0][2 * n0];
37: for (int k = 0; k < 2 * n0 - 2; k++) {
38: for (int l = 0; l < 2 * n0 - 2; l++) {
39: if (k == l) {
40: Id[k][l] = 1;
41: }
42: }
43: }
44: double max = 0.0;
45: for (int k = 0; k < 2 * n0 - 2; k++) {
46: for (int l = 0; l < 2 * n0 - 2; l++) {
47: if (Math.abs(Id[k][l] - mat[k][l]) > max) {
48: max = Math.abs(Id[k][l] - mat[k][l]);
49: }
50: }
51: }
52:
53: ImprimeMatrice(mat, n0);
54: System.out.println("Max = " + max);
55: }
56:
57: public void ImprimeMatrice(double[][] mat, int n0) {
58: for (int k = 0; k < 2 * n0 - 2; k++) {
59: for (int l = 0; l < 2 * n0 - 2; l++) {
60: if (Math.abs(mat[k][l]) > 0.000001) {
61: System.out.println(" mat [ " + k + " , " + l
62: + " ] = " + mat[k][l]);
63: }
64: }
65: }
66: }
67:
68: public double EcheEche(int k, int l, int n0, int j0) {
69: MultiscaleFunction Primaire = new Scaling2(n0, k);
70: MultiscaleFunction Duale = new Scaling2(n0, l);
71: return (DiscreteHilbertSpace.integrate(Primaire, Duale, j0));
72: }
73:
74: public double EcheOnde(int k, int l, int n0, int j0) {
75: MultiscaleFunction Primaire = new Scaling2(n0, k);
76: MultiscaleFunction Duale = new Wavelet2(n0, l);
77: return (DiscreteHilbertSpace.integrate(Primaire, Duale, j0));
78: }
79:
80: public double OndeEche(int k, int l, int n0, int j0) {
81: MultiscaleFunction Primaire = new Wavelet2(n0, k);
82: MultiscaleFunction Duale = new Scaling2(n0, l);
83: return (DiscreteHilbertSpace.integrate(Primaire, Duale, j0));
84: }
85:
86: public double OndeOnde(int k, int l, int n0, int j0) {
87: MultiscaleFunction Primaire = new Wavelet2(n0, k);
88: MultiscaleFunction Duale = new Wavelet2(n0, l);
89: return (DiscreteHilbertSpace.integrate(Primaire, Duale, j0));
90: }
91: }
|