001: package JSci.maths.wavelet.cdf2_4;
002:
003: import JSci.maths.wavelet.*;
004:
005: /******************************************
006: * Cohen-Daubechies-Feauveau
007: * with N=2 and
008: * Ntilde=4 adapted to the interval
009: * by Deslauriers-Dubuc-Lemire
010: * @author Daniel Lemire
011: *****************************************/
012: public final class DualScaling2_4 extends MultiscaleFunction implements
013: Cloneable {
014: int n0;
015: int k;
016: static CDF2_4 cdf = new CDF2_4();
017:
018: /*****************************************
019: * Check if another object is equal to this
020: * DualScaling2_4 object
021: ******************************************/
022: public boolean equals(Object a) {
023: if ((a != null) && (a instanceof DualScaling2_4)) {
024: DualScaling2_4 iv = (DualScaling2_4) a;
025: return (this .dimension(0) == iv.dimension(0))
026: && (this .position() == iv.position());
027: }
028: return false;
029: }
030:
031: /*******************************
032: * Return a String representation
033: * of the object
034: ********************************/
035: public String toString() {
036: String ans = new String("[n0=");
037: ans.concat(Integer.toString(n0));
038: ans.concat("][k=");
039: ans.concat(Integer.toString(k));
040: ans.concat("]");
041: return (ans);
042: }
043:
044: /****************************************
045: * This method is used to compute
046: * how the number of scaling functions
047: * changes from on scale to the other.
048: * Basically, if you have k scaling
049: * function and a Filter of type t, you'll
050: * have 2*k+t scaling functions at the
051: * next scale (dyadic case).
052: * Notice that this method assumes
053: * that one is working with the dyadic
054: * grid while the method "previousDimension"
055: * define in the interface "Filter" doesn't.
056: ******************************************/
057: public int getFilterType() {
058: return (cdf.filtretype);
059: }
060:
061: public DualScaling2_4(int N0, int K) {
062: setParameters(N0, K);
063: }
064:
065: /********************************************
066: * Return a copy of this object
067: *********************************************/
068: public Object clone() {
069: DualScaling2_4 s = (DualScaling2_4) super .clone();
070: s.n0 = n0;
071: s.k = k;
072: return (s);
073: }
074:
075: public DualScaling2_4() {
076: }
077:
078: /**********************************************
079: * Set the parameters for this object
080: * @param N0 number of scaling function on the
081: * scale of this object
082: * @param K position or number of this object
083: * @exception IllegalScalingException if N0 is not
084: * large enough
085: ***********************************************/
086: public void setParameters(int N0, int K) {
087: if (N0 < cdf.minlength) {
088: throw new IllegalScalingException(N0, cdf.minlength);
089: }
090: n0 = N0;
091: k = K;
092: }
093:
094: /************************************************
095: * Return as an array the sampled values
096: * of the function
097: * @param j number of iterations
098: *************************************************/
099: public double[] evaluate(int j) {
100: return (cdf.evalScaling(n0, k, j));
101: }
102:
103: /****************************************************
104: * Starting with dimension() scaling functions and
105: * going jfin scales ahead (iterating jfin times),
106: * tells you how many scaling functions you'll have.
107: * @param jfin number of iterations
108: ******************************************************/
109: public int dimension(int jfin) {
110: return (Cascades.dimension(n0, jfin));
111: }
112:
113: /****************************************************
114: * Number of scaling functions at scale where this
115: * scaling function belongs.
116: *****************************************************/
117: public int dimension() {
118: return (n0);
119: }
120:
121: /****************************************
122: * Tells you what is the number of this
123: * scaling function. Scaling functions are
124: * numbered from left to right with the
125: * one at the left boundary being noted 0.
126: *****************************************/
127: public int position() {
128: return (k);
129: }
130: }
|