KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > maths > wavelet > MultiscaleFunction


1 package JSci.maths.wavelet;
2
3 /*****************************************
4 * Abstract encapsulation mostly meant for
5 * wavelet functions (dyadic case).
6 * @author Daniel Lemire
7 *****************************************/

8 public abstract class MultiscaleFunction implements Cloneable JavaDoc {
9     public abstract int dimension(int jfin);
10
11     public abstract int dimension();
12   /********************************************
13   * Return a copy of the object
14   *********************************************/

15     public Object JavaDoc clone() {
16     try {
17       MultiscaleFunction mf=(MultiscaleFunction) super.clone();
18       return(mf);
19     } catch (CloneNotSupportedException JavaDoc cnse) {
20       throw new InternalError JavaDoc();
21     }
22   }
23   /**********************************************
24   * Return a string representing the object
25   ***********************************************/

26   public abstract String JavaDoc toString();
27
28     /************************************************
29   * Return as an array the sampled values
30   * of the function
31   * @param j number of iterations
32     *************************************************/

33     public abstract double[] evaluate (int j) ;
34
35   /******************************************
36   * Compute the mass (integral)
37   * @param a left boundary of the interval
38   * @param b right boundary of the interval
39   * @param jfin number of iterations to consider
40   * (precision)
41   **********************************************/

42     public double mass(double a, double b, int jfin) {
43         double somme=0;
44         double[] values=evaluate(jfin);
45         for(int k=1;k<values.length-1;k++) {
46             somme+=values[k];
47         }
48         somme+=values[0]/2;
49         somme+=values[values.length-1]/2;
50         somme=somme/(values.length-1)*Math.abs(b-a);
51         return(somme);
52     }
53
54   /******************************************
55   * Compute the mass (integral) of the interval 0,1
56   * @param jfin number of iterations to consider
57   * (precision)
58   **********************************************/

59     public double mass(int jfin) {
60         return(mass(0,1,jfin));
61     }
62
63     /****************************************
64   * This method is used to compute
65   * how the number of scaling functions
66   * changes from on scale to the other.
67   * Basically, if you have k scaling
68   * function and a Filter of type t, you'll
69   * have 2*k+t scaling functions at the
70   * next scale (dyadic case).
71   * Notice that this method assumes
72   * that one is working with the dyadic
73   * grid while the method "previousDimension"
74   * define in the interface "Filter" doesn't.
75     ******************************************/

76     public abstract int getFilterType ();
77
78   /*****************************************
79   * Check if another object is equal to this
80   * MultiscaleFunction object
81   ******************************************/

82   public abstract boolean equals(Object JavaDoc o);
83 }
84
Popular Tags