01: package JSci.maths.wavelet;
02:
03: /*****************************************
04: * Abstract encapsulation mostly meant for
05: * wavelet functions (dyadic case).
06: * @author Daniel Lemire
07: *****************************************/
08: public abstract class MultiscaleFunction implements Cloneable {
09: public abstract int dimension(int jfin);
10:
11: public abstract int dimension();
12:
13: /********************************************
14: * Return a copy of the object
15: *********************************************/
16: public Object clone() {
17: try {
18: MultiscaleFunction mf = (MultiscaleFunction) super .clone();
19: return (mf);
20: } catch (CloneNotSupportedException cnse) {
21: throw new InternalError();
22: }
23: }
24:
25: /**********************************************
26: * Return a string representing the object
27: ***********************************************/
28: public abstract String toString();
29:
30: /************************************************
31: * Return as an array the sampled values
32: * of the function
33: * @param j number of iterations
34: *************************************************/
35: public abstract double[] evaluate(int j);
36:
37: /******************************************
38: * Compute the mass (integral)
39: * @param a left boundary of the interval
40: * @param b right boundary of the interval
41: * @param jfin number of iterations to consider
42: * (precision)
43: **********************************************/
44: public double mass(double a, double b, int jfin) {
45: double somme = 0;
46: double[] values = evaluate(jfin);
47: for (int k = 1; k < values.length - 1; k++) {
48: somme += values[k];
49: }
50: somme += values[0] / 2;
51: somme += values[values.length - 1] / 2;
52: somme = somme / (values.length - 1) * Math.abs(b - a);
53: return (somme);
54: }
55:
56: /******************************************
57: * Compute the mass (integral) of the interval 0,1
58: * @param jfin number of iterations to consider
59: * (precision)
60: **********************************************/
61: public double mass(int jfin) {
62: return (mass(0, 1, jfin));
63: }
64:
65: /****************************************
66: * This method is used to compute
67: * how the number of scaling functions
68: * changes from on scale to the other.
69: * Basically, if you have k scaling
70: * function and a Filter of type t, you'll
71: * have 2*k+t scaling functions at the
72: * next scale (dyadic case).
73: * Notice that this method assumes
74: * that one is working with the dyadic
75: * grid while the method "previousDimension"
76: * define in the interface "Filter" doesn't.
77: ******************************************/
78: public abstract int getFilterType();
79:
80: /*****************************************
81: * Check if another object is equal to this
82: * MultiscaleFunction object
83: ******************************************/
84: public abstract boolean equals(Object o);
85: }
|