package jsci.maths.wavelet.cdf2_4;
import jsci.maths.*;
import jsci.maths.wavelet.*;
import jsci.maths.wavelet.splines.*;
/******************************************
* Cohen-Daubechies-Feauveau
* with N=2 and
* Ntilde=4 adapted to the interval
* by Deslauriers-Dubuc-Lemire
* @author Daniel Lemire
*****************************************/
public final class MultiSpline2_4 implements Filter {
public MultiSpline2_4() {}
// constantes pour le filtre passe-bas
static final double[] vg={1/2d,1d,1/2d};
static final double[] v0={1d,1/2d};
// constantes pour le filtre passe-hat
static final double[] og={3/128d,3/64d,-1/8d,-19/64d,45/64d,-19/64d,-1/8d,3/64d,3/128d};
static final double[] o0={-35/64d,875/1536d,-241/768d,-53/512d,41/384d,67/1536d,-5/256d,-5/512d};
static final double[] on0_1=ArrayMath.invert(o0);
static final double[] o1={15/64d,-45/512d,-105/256d,345/512d,-31/128d,-53/512d,9/256d,9/512d};
static final double[] on0_2=ArrayMath.invert(o1);
/****************************************
* This method return the number of "scaling"
* functions at the previous scale given a
* number of scaling functions. The answer
* is always smaller than the provided value
* (about half since this is a dyadic
* implementation). This relates to the same idea
* as the "Filter type". It is used by
* the interface "Filter".
*****************************************/
public int previousDimension (int k) {
int i=(int) Math.round((k+1)/2d);
if(2*i-1==k) {
return(i);
} else {
throw new IllegalScalingException("Even number of values presented to an odd Filter. Please change the number of values/iterations.");
}
}
/***************************************************
****************************************************/
public double[] lowpass (double[] v, double[] param) {
return(lowpass(v));
}
/***************************************************
****************************************************/
public double[] highpass (double[] v, double[] param) {
return(highpass(v));
}
/**************************************
***************************************/
public double[] lowpass (double[] donnee) {
if(donnee.length<2) {
throw new IllegalScalingException("The array is not long enough : "+donnee.length+" < 2");
}
double[] sortie=new double[2*donnee.length-1];
for(int k=1;k=n0)) {
throw new IllegalArgumentException("Incorrect parameters : "+n0+", "+k+" !");
}
if(n0=n0-1)) {
throw new IllegalArgumentException("Incorrect parameters : "+n0+", "+k);
}
if(n01)&&(k
Ads help maintain this website.