*
* @param data vector with approximation and details.
* @param endIndex index where details start and approximations ended.
*/
private void decomposeInplace1Lvl(double[] data, int endIndex) {
Filter lowDecompositionFilter = filtersFactory.getLowDecompositionFilter();
Filter highDecompositionFilter = filtersFactory.getHighDecompositionFilter();
double[] approximation = new double[endIndex]; //working only with approximation coefficients
System.arraycopy(data, 0, approximation, 0, endIndex);
double[] temp = new Extensioner(approximation)
.schedule(new MirrorExtension(1))
.execute();
//TODO ugly but need one more element...
double[] extended = new double[temp.length + 1];
System.arraycopy(temp, 0, extended, 0, temp.length);
extended[extended.length - 1] = approximation[approximation.length - 3];
/* Here in "extended" we have extended data to reduce boundary effect */
temp = MathUtils.convolve(extended, lowDecompositionFilter.getCoeff());
temp = sampler.downsample(temp);
temp = windower.window(temp, 2, endIndex / 2 + 2);
double[] temp2 = MathUtils.convolve(extended, highDecompositionFilter.getCoeff());
temp2 = sampler.downsample(temp2);
temp2 = windower.window(temp2, 1, endIndex / 2 + 1);
System.arraycopy(temp, 0, data, 0, temp.length);
System.arraycopy(temp2, 0, data, temp.length, temp2.length);