KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > maths > wavelet > daubechies7 > Daubechies7


1
2 package JSci.maths.wavelet.daubechies7;
3
4 import JSci.maths.wavelet.*;
5 import JSci.maths.*;
6
7 /******************************************
8 * Daubechies wavelets adapted to the
9 * interval by Meyer. Thanks to Pierre Vial
10 * for the filters.
11 * @author Daniel Lemire
12 *****************************************/

13 public final class Daubechies7 extends Multiresolution implements Filter, NumericalConstants {
14     protected final static int filtretype=12;
15     protected final static int minlength=24;
16     /****************************************
17   * This method is used to compute
18   * how the number of scaling functions
19   * changes from on scale to the other.
20   * Basically, if you have k scaling
21   * function and a Filter of type t, you'll
22   * have 2*k+t scaling functions at the
23   * next scale (dyadic case).
24   * Notice that this method assumes
25   * that one is working with the dyadic
26   * grid while the method "previousDimension"
27   * define in the interface "Filter" doesn't.
28     ******************************************/

29     public int getFilterType () {
30         return(filtretype);
31     }
32
33     public MultiscaleFunction primaryScaling(int n0, int k) {
34         return(new Scaling7(n0,k));
35     }
36
37     public MultiscaleFunction dualScaling(int n0, int k) {
38         return(new Scaling7(n0,k));
39     }
40     public MultiscaleFunction primaryWavelet(int n0, int k) {
41         return(new Wavelet7(n0,k));
42     }
43     public MultiscaleFunction dualWavelet(int n0, int k) {
44         return(new Wavelet7(n0,k));
45     }
46
47   
48     final static double[] vg={
49       0.0037926585342,
50       - 0.0014812259146,
51        - 0.0178704316511,
52       0.043155452582,
53        0.0960147679355,
54        - 0.070078291222,
55       0.0246656594886,
56       0.758162601964,
57        1.08578270981,
58        0.408183939725,
59        - 0.198056706807,
60        - 0.152463871896,
61        0.00567134268574,
62        0.014521394762};
63
64     final static double[] v0temp={
65     0.7766665156E+00,
66     0.6299119967E+00};
67     final static double[] v1temp={
68    -0.1148964921E+00,
69     0.1416646431E+00,
70    -0.9671641580E+00,
71     0.1769842267E+00};
72     final static double[] v2temp={
73    -0.3218471381E-01,
74     0.3968298692E-01,
75     0.1563278738E+00,
76     0.8016258409E+00,
77    -0.5564532662E+00,
78     0.1438984865E+00};
79     final static double[] v3temp={
80     0.2211311440E-01,
81    -0.2726494430E-01,
82     0.4246022560E-01,
83     0.2682115073E+00,
84     0.2563887092E+00,
85    -0.5363572642E+00,
86    -0.6324950327E+00,
87     0.4142017603E+00};
88     final static double[] v4temp={
89     0.1199996300E-01,
90    -0.1479566908E-01,
91    -0.5636972038E-01,
92    -0.2884098615E+00,
93    -0.2710188640E+00,
94     0.6266429769E+00,
95    -0.5971809113E+00,
96     0.2582226700E+00,
97     0.5436350287E-01,
98     0.1445242950E+00};
99     final static double[] v5temp={
100     0.4175845107E-02,
101    -0.5148717734E-02,
102    -0.7440855354E-02,
103    -0.3382983614E-01,
104    -0.3079310698E-01,
105     0.7981928189E-01,
106     0.5722707580E-01,
107     0.2319141981E+00,
108    -0.9107619432E+00,
109    -0.3104299380E+00,
110     0.3358655707E-01,
111     0.8599791766E-01};
112     final static double[] v6temp={
113    -0.1031229858E+00,
114     0.1271481897E+00,
115     0.1056363589E-01,
116    -0.1109935195E+00,
117    -0.1694835353E+00,
118    -0.1066751168E+00,
119     0.3522103457E-01,
120     0.1052218705E+00,
121    -0.2477521992E-02,
122    -0.9262193855E-01,
123    -0.8918295201E+00,
124    -0.3112729161E+00,
125     0.3153823148E-01,
126     0.8075320692E-01};
127     final static double[] v7temp={
128    -0.1636840253E+00,
129     0.2018185116E+00,
130     0.2397992313E-01,
131    -0.1367621625E+00,
132    -0.2287872293E+00,
133    -0.2411625975E+00,
134     0.1547745353E+00,
135     0.1738003308E+00,
136    -0.2203021645E+00,
137     0.7991821052E+00,
138     0.4097263186E-01,
139     0.7425536593E-01,
140    -0.2186097493E+00,
141    -0.7664414437E-01,
142     0.7725319564E-02,
143     0.1978057424E-01};
144     final static double[] v8temp={
145    -0.5079391756E-01,
146     0.6262769271E-01,
147     0.6693967094E-02,
148    -0.4652396311E-01,
149    -0.7498687931E-01,
150    -0.6670242581E-01,
151     0.2830429724E-01,
152     0.3953767158E-01,
153     0.1915788427E-01,
154     0.1080996941E+00,
155    -0.9385371148E-01,
156     0.5278533401E+00,
157     0.7495761660E+00,
158     0.2923381676E+00,
159    -0.1429933474E+00,
160    -0.1070457309E+00,
161     0.4143065991E-02,
162     0.1060826335E-01};
163     final static double[] v9temp={
164    -0.1495677487E-02,
165     0.1844134781E-02,
166     0.3796088187E-03,
167    -0.3726476076E-03,
168    -0.1313050363E-02,
169    -0.4257093968E-02,
170     0.4767087176E-02,
171     0.2983259636E-02,
172    -0.1353810327E-01,
173     0.3517346347E-01,
174     0.6457953904E-01,
175    -0.4929701131E-01,
176     0.1763779822E-01,
177     0.5365060286E+00,
178     0.7675636132E+00,
179     0.2885569171E+00,
180    -0.1400433929E+00,
181    -0.1077912821E+00,
182     0.4010358474E-02,
183     0.1026846759E-01};
184     final static double[] v10temp={
185    -0.3038841290E-04,
186     0.3746819061E-04,
187     0.1201067262E-04,
188     0.1591583744E-04,
189     0.1765202958E-04,
190    -0.5058087991E-04,
191    -0.2976878538E-03,
192    -0.5384490113E-03,
193     0.2571676204E-02,
194    -0.9401364213E-03,
195    -0.1271271848E-01,
196     0.3052112329E-01,
197     0.6789733930E-01,
198    -0.4954313507E-01,
199     0.1743713195E-01,
200     0.5361004301E+00,
201     0.7677643255E+00,
202     0.2886299560E+00,
203    -0.1400472373E+00,
204    -0.1078082259E+00,
205     0.4010244932E-02,
206     0.1026817686E-01};
207     final static double[] v11temp={
208    -0.4587815337E-07,
209     0.5656667234E-07,
210     0.1705493214E-07,
211     0.1813824211E-07,
212     0.3222871934E-07,
213    -0.2080479474E-07,
214    -0.2019192222E-06,
215    -0.3625456178E-06,
216    -0.1335197462E-06,
217     0.6674082282E-07,
218     0.2681764400E-02,
219    -0.1047381271E-02,
220    -0.1263630033E-01,
221     0.3051551953E-01,
222     0.6789269080E-01,
223    -0.4955283591E-01,
224     0.1744125510E-01,
225     0.5361019173E+00,
226     0.7677643170E+00,
227     0.2886296318E+00,
228    -0.1400472404E+00,
229    -0.1078082377E+00,
230     0.4010244872E-02,
231     0.1026817671E-01};
232
233
234     final static double[] vd0temp={
235     0.7004199839E+00,
236     0.7137309340E+00};
237
238     final static double[] vd1temp={
239     0.1053864722E-01,
240    -0.1034210340E-01,
241     0.6658963651E+00,
242     0.7458981223E+00};
243
244     final static double[] vd2temp={
245    -0.1757138133E+00,
246     0.1724367832E+00,
247    -0.1665581445E+00,
248     0.1535673633E+00,
249    -0.4422666014E+00,
250     0.8321453685E+00};
251
252     final static double[] vd3temp={
253     0.1613128649E+00,
254    -0.1583044098E+00,
255    -0.3601719723E+00,
256     0.3170674120E+00,
257     0.7182714497E+00,
258     0.3180082506E+00,
259    -0.1351100609E+00,
260     0.2887289881E+00};
261
262     final static double[] vd4temp={
263     0.2626733923E+00,
264    -0.2577745821E+00,
265     0.5300977359E-01,
266    -0.5460956119E-01,
267    -0.7894206983E-01,
268     0.8761351181E-01,
269     0.1138292645E+00,
270    -0.8840156389E-02,
271     0.1186027472E+00,
272     0.9042968950E+00};
273
274     final static double[] vd5temp={
275    -0.9906552530E-01,
276     0.9721797156E-01,
277     0.1575818939E+00,
278    -0.1379327181E+00,
279     0.2550022277E+00,
280     0.1514595280E+00,
281     0.8750776361E+00,
282     0.6499770717E-01,
283     0.2324452664E+00,
284    -0.9349432145E-01,
285    -0.4623379279E-01,
286     0.1183889785E+00};
287
288     final static double[] vd6temp={
289    -0.6250197855E-01,
290     0.6133632819E-01,
291     0.7570194334E-02,
292    -0.5024723655E-02,
293     0.2646032111E-01,
294    -0.9402290802E-02,
295     0.6149372377E-01,
296     0.5681683063E-01,
297     0.2562598477E-01,
298     0.2756686809E-01,
299     0.9366103730E+00,
300    -0.3120657710E+00,
301    -0.3336171928E-01,
302     0.8542222229E-01};
303
304     final static double[] vd7temp={
305    -0.4715917315E+00,
306     0.4627966328E+00,
307    -0.9443328396E-02,
308     0.2151032037E-01,
309     0.4754578984E-01,
310    -0.1760708900E+00,
311    -0.1591797424E+00,
312     0.4829772924E+00,
313     0.2074893977E+00,
314     0.2895141132E+00,
315    -0.4058619450E-01,
316     0.1026407474E+00,
317     0.3418617349E+00,
318    -0.1182037757E+00,
319    -0.1210726949E-01,
320     0.3100049663E-01};
321
322     final static double[] vd8temp={
323    -0.9439529077E-01,
324     0.9263483604E-01,
325    -0.7325279539E-01,
326     0.6801412471E-01,
327    -0.2325217040E-01,
328    -0.7869955176E-01,
329    -0.8937965975E-01,
330     0.4016014208E-01,
331     0.1328240580E+00,
332     0.6204454273E-01,
333     0.1623006055E+00,
334     0.6626531984E+00,
335    -0.6074912864E+00,
336     0.2552288166E+00,
337     0.1574205947E+00,
338    -0.1004613457E+00,
339    -0.4839078318E-02,
340     0.1239039332E-01};
341
342     final static double[] vd9temp={
343     0.1594142646E+00,
344    -0.1564412180E+00,
345     0.7441639637E-02,
346    -0.1106491958E-01,
347    -0.2825478866E-01,
348     0.5459386943E-01,
349    -0.9775758534E-02,
350    -0.1478196128E+00,
351    -0.1113587794E+00,
352    -0.8536948628E-01,
353     0.2751605400E+00,
354     0.6421729864E+00,
355     0.6324608023E+00,
356    -0.1525303792E-01,
357    -0.8448334026E-01,
358     0.8762658370E-01,
359     0.3318133734E-01,
360    -0.1602650231E-01,
361    -0.1102323809E-02,
362     0.2822484916E-02};
363
364     final static double[] vd10temp={
365    -0.6037533035E-02,
366     0.5924934159E-02,
367     0.1534054302E-02,
368    -0.1202064256E-02,
369     0.3182693183E-02,
370    -0.2822206008E-03,
371     0.8251845825E-02,
372     0.6110061754E-02,
373     0.6347460794E-02,
374     0.1773857064E-02,
375    -0.1077767325E+00,
376    -0.1373538162E+00,
377     0.2848100511E+00,
378     0.7687892964E+00,
379     0.5372655282E+00,
380     0.1673410769E-01,
381    -0.4968993169E-01,
382     0.6802066194E-01,
383     0.3052110650E-01,
384    -0.1264613714E-01,
385    -0.1047456655E-02,
386     0.2681998325E-02};
387
388     final static double[] vd11temp={
389    -0.2814830317E-04,
390     0.2762334252E-04,
391    -0.2993814193E-04,
392     0.2750781612E-04,
393     0.1564675966E-04,
394    -0.1442059454E-04,
395     0.2143345853E-04,
396    -0.4969368764E-04,
397    -0.5136649938E-04,
398     0.2578289227E-04,
399     0.1026729934E-01,
400     0.4010109626E-02,
401    -0.1078074809E+00,
402    -0.1400480006E+00,
403     0.2886301179E+00,
404     0.7677642441E+00,
405     0.5361017227E+00,
406     0.1744136474E-01,
407    -0.4955281693E-01,
408     0.6789267353E-01,
409     0.3051551282E-01,
410    -0.1263630236E-01,
411    -0.1047384891E-02,
412     0.2681814574E-02};
413
414     final static double[] v0=ArrayMath.scalarMultiply(SQRT2,v0temp);
415     final static double[] v1=ArrayMath.scalarMultiply(SQRT2,v1temp);
416     final static double[] v2=ArrayMath.scalarMultiply(SQRT2,v2temp);
417     final static double[] v3=ArrayMath.scalarMultiply(SQRT2,v3temp);
418     final static double[] v4=ArrayMath.scalarMultiply(SQRT2,v4temp);
419     final static double[] v5=ArrayMath.scalarMultiply(SQRT2,v5temp);
420     final static double[] v6=ArrayMath.scalarMultiply(SQRT2,v6temp);
421     final static double[] v7=ArrayMath.scalarMultiply(SQRT2,v7temp);
422     final static double[] v8=ArrayMath.scalarMultiply(SQRT2,v8temp);
423     final static double[] v9=ArrayMath.scalarMultiply(SQRT2,v9temp);
424     final static double[] v10=ArrayMath.scalarMultiply(SQRT2,v10temp);
425     final static double[] v11=ArrayMath.scalarMultiply(SQRT2,v11temp);
426
427     final static double[] vd0=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd0temp));
428     final static double[] vd1=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd1temp));
429     final static double[] vd2=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd2temp));
430     final static double[] vd3=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd3temp));
431     final static double[] vd4=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd4temp));
432     final static double[] vd5=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd5temp));
433     final static double[] vd6=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd6temp));
434     final static double[] vd7=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd7temp));
435     final static double[] vd8=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd8temp));
436     final static double[] vd9=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd9temp));
437     final static double[] vd10=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd10temp));
438     final static double[] vd11=ArrayMath.invert(ArrayMath.scalarMultiply(SQRT2,vd11temp));
439
440
441
442     /********************************************
443     * On définit ici le filtre comme tel par le
444     * vecteur phvg (filtre passe-haut).
445     *********************************************/

446     final static double[] vgtemp=ArrayMath.scalarMultiply(1.0/SQRT2,vg);
447     final static double[] phvg=WaveletMath.lowToHigh(vgtemp);
448     final static double[] phv0={
449     0.3969456608E+00,
450    -0.4894245622E+00,
451    -0.1235692328E+00,
452    -0.2582101893E-01,
453    -0.1328855813E+00,
454    -0.1202996209E-01,
455     0.3801419403E+00,
456     0.6231415519E+00,
457     0.1905526450E+00,
458     0.5893964132E-02,
459     0.1561741876E-03,
460     0.6031669262E-05,
461    -0.4927938364E-06,
462    -0.1261756223E-05};
463     final static double[] phv1={
464    -0.3233700290E+00,
465     0.3987075576E+00,
466     0.1351807407E+00,
467     0.2096521373E+00,
468     0.4833387568E+00,
469     0.3720043480E+00,
470     0.2556921125E+00,
471     0.4668718999E+00,
472     0.1373682453E+00,
473     0.2872512719E-02,
474    -0.1360874965E-02,
475    -0.1949202336E-02,
476     0.8743490990E-03,
477     0.3629247193E-03,
478    -0.2999653169E-04,
479    -0.7680570657E-04};
480     final static double[] phv2={
481    -0.2823703425E+00,
482     0.3481559189E+00,
483     0.2903665693E-01,
484    -0.3033125208E+00,
485    -0.4606818655E+00,
486    -0.2824761359E+00,
487     0.5936310480E-01,
488     0.2414473445E+00,
489     0.2265766807E+00,
490    -0.4453082198E+00,
491     0.3158425440E+00,
492    -0.6883194783E-02,
493    -0.3045582749E-01,
494    -0.4030240270E-01,
495     0.1788874193E-01,
496     0.7517433396E-02,
497    -0.6122399330E-03,
498    -0.1567631908E-02};
499     final static double[] phv3={
500    -0.5050738626E-02,
501     0.6227440642E-02,
502     0.1186122150E-02,
503    -0.1781771641E-02,
504    -0.5423430571E-02,
505    -0.1518205990E-01,
506     0.2487591795E-01,
507     0.2339536126E-01,
508    -0.1088432050E+00,
509     0.1555511237E+00,
510     0.2777338303E+00,
511    -0.7671513525E+00,
512     0.5369254850E+00,
513    -0.1606926084E-01,
514    -0.5015309817E-01,
515    -0.6812578033E-01,
516     0.3052715070E-01,
517     0.1268650625E-01,
518    -0.1047058590E-02,
519    -0.2680979085E-02};
520     final static double[] phv4={
521    -0.1153350842E-03,
522     0.1422054166E-03,
523     0.4560875753E-04,
524     0.6053691674E-04,
525     0.6687225073E-04,
526    -0.1932039563E-03,
527    -0.1135318214E-02,
528    -0.2053589490E-02,
529     0.9849438060E-02,
530    -0.3601089889E-02,
531    -0.1080997299E+00,
532     0.1400686730E+00,
533     0.2886474191E+00,
534    -0.7677274911E+00,
535     0.5360863094E+00,
536    -0.1744690015E-01,
537    -0.4955276912E-01,
538    -0.6789145494E-01,
539     0.3051552376E-01,
540     0.1263634496E-01,
541    -0.1047384658E-02,
542    -0.2681813977E-02};
543     final static double[] phv5={
544    -0.1756594007E-06,
545     0.2165838647E-06,
546     0.6530033661E-07,
547     0.6944811113E-07,
548     0.1233981379E-06,
549    -0.7965760361E-07,
550    -0.7731119139E-06,
551    -0.1388121081E-05,
552    -0.5112227575E-06,
553     0.2555383959E-06,
554     0.1026798462E-01,
555    -0.4010231020E-02,
556    -0.1078082259E+00,
557     0.1400472648E+00,
558     0.2886296214E+00,
559    -0.7677643207E+00,
560     0.5361019171E+00,
561    -0.1744125426E-01,
562    -0.4955283493E-01,
563    -0.6789269348E-01,
564     0.3051551317E-01,
565     0.1263630340E-01,
566    -0.1047384889E-02,
567    -0.2681814568E-02};
568
569     final static double[] phvd0temp={
570     0.3287269241E+00,
571    -0.3225962277E+00,
572    -0.3486576217E-01,
573     0.2200880144E-01,
574    -0.4013253310E+00,
575    -0.8807413471E-01,
576     0.7139363748E-01,
577     0.7005967686E+00,
578     0.2475030985E+00,
579    -0.2451712749E+00,
580     0.7181777146E-02,
581     0.2499604984E-04,
582    -0.8073680719E-08,
583    -0.3908981471E-07};
584     final static double[] phvd1temp={
585     0.5957737342E-01,
586    -0.5846626641E-01,
587     0.4582097589E+00,
588    -0.4107166017E+00,
589     0.2022914839E+00,
590     0.2997172270E+00,
591    -0.3986325494E+00,
592    -0.6261552962E-01,
593     0.5532851486E+00,
594    -0.1200134025E+00,
595     0.1616443953E-01,
596    -0.3615532478E-02,
597    -0.1770925212E-02,
598     0.1363254906E-02,
599     0.5071037744E-04,
600    -0.1298432110E-03};
601     final static double[] phvd2temp={
602     0.1154439687E-01,
603    -0.1132909600E-01,
604    -0.3933408112E+00,
605     0.3508326132E+00,
606    -0.1045297744E+00,
607    -0.1942431291E+00,
608     0.4053278706E-01,
609    -0.3956498210E+00,
610     0.7001774443E+00,
611    -0.5344583491E-01,
612    -0.6098922304E-02,
613    -0.7677883475E-01,
614     0.1158196639E+00,
615    -0.4412947160E-01,
616    -0.2089669169E-01,
617     0.1616290641E-01,
618     0.5971498449E-03,
619    -0.1528993947E-02};
620     final static double[] phvd3temp={
621     0.3435795707E-01,
622    -0.3371718752E-01,
623     0.3919592661E-02,
624    -0.4452130171E-02,
625    -0.2728348640E-02,
626     0.1439788762E-01,
627     0.1012896303E-01,
628    -0.3223449962E-01,
629    -0.2185300516E-01,
630    -0.2044704093E-01,
631     0.6843499760E-01,
632     0.2980333628E-01,
633     0.4539318191E-01,
634    -0.5452752162E+00,
635     0.7607344157E+00,
636    -0.2839752561E+00,
637    -0.1395508493E+00,
638     0.1071639975E+00,
639     0.4000222290E-02,
640    -0.1024251403E-01};
641     final static double[] phvd4temp={
642    -0.1619528496E-02,
643     0.1589324589E-02,
644     0.3554364827E-03,
645    -0.2723954613E-03,
646     0.8549575210E-03,
647    -0.9551275473E-04,
648     0.2187750783E-02,
649     0.1520814609E-02,
650     0.1580292226E-02,
651     0.5022963426E-03,
652    -0.1263138978E-01,
653    -0.2981485818E-01,
654     0.6690165825E-01,
655     0.4983337040E-01,
656     0.1775563260E-01,
657    -0.5362889286E+00,
658     0.7677311001E+00,
659    -0.2885962362E+00,
660    -0.1400458666E+00,
661     0.1078059333E+00,
662     0.4010225471E-02,
663    -0.1026812703E-01};
664     final static double[] phvd5temp={
665    -0.7351578516E-05,
666     0.7214472934E-05,
667    -0.7819175985E-05,
668     0.7184425358E-05,
669     0.4086432729E-05,
670    -0.3766364036E-05,
671     0.5597958787E-05,
672    -0.1297860916E-04,
673    -0.1341567344E-04,
674     0.6733817189E-05,
675     0.2681585429E-02,
676     0.1047349568E-02,
677    -0.1263610581E-01,
678    -0.3051571178E-01,
679     0.6789282065E-01,
680     0.4955281636E-01,
681     0.1744120464E-01,
682    -0.5361018885E+00,
683     0.7677643218E+00,
684    -0.2886296370E+00,
685    -0.1400472405E+00,
686     0.1078082380E+00,
687     0.4010244871E-02,
688    -0.1026817671E-01};
689
690     final static double[] phvd0=ArrayMath.invert(phvd0temp);
691     final static double[] phvd1=ArrayMath.invert(phvd1temp);
692     final static double[] phvd2=ArrayMath.invert(phvd2temp);
693     final static double[] phvd3=ArrayMath.invert(phvd3temp);
694     final static double[] phvd4=ArrayMath.invert(phvd4temp);
695     final static double[] phvd5=ArrayMath.invert(phvd5temp);
696
697     /****************************************
698   * This method return the number of "scaling"
699   * functions at the previous scale given a
700   * number of scaling functions. The answer
701   * is always smaller than the provided value
702   * (about half since this is a dyadic
703   * implementation). This relates to the same idea
704   * as the "Filter type". It is used by
705   * the interface "Filter".
706     *****************************************/

707     public int previousDimension (int k) {
708         return(Cascades.previousDimension(filtretype,k));
709
710     }
711
712
713     public Daubechies7 () {}
714     /****************************************
715     * This is the implementation of the lowpass
716   * Filter. It is used by the interface
717   * "Filter". Lowpass filters are normalized
718   * so that they preserve constants away from
719   * the boundaries.
720     *****************************************/

721     public double[] lowpass (double[] v, double[] param) {
722         return(lowpass(v));
723     }
724     /****************************************
725     * This is the implementation of the highpass
726   * Filter. It is used by the interface
727   * "Filter". Highpass filters are normalized
728   * in order to get L2 orthonormality of the
729   * resulting wavelets (when it applies).
730   * See the class DiscreteHilbertSpace for
731   * an implementation of the L2 integration.
732     *****************************************/

733     public double[] highpass (double[] v, double[] param) {
734         return(highpass(v));
735     }
736     /****************************************
737     * This is the implementation of the lowpass
738   * Filter. It is used by the interface
739   * "Filter". Lowpass filters are normalized
740   * so that they preserve constants away from
741   * the boundaries.
742     *****************************************/

743     public double[] lowpass (double[] gete) {
744         if(gete.length<minlength) {
745             throw new IllegalScalingException("The array is not long enough : "+gete.length+" < "+minlength);
746         }
747         double[] sortie=new double[2*gete.length-filtretype];
748         int dl0=gete.length-1;
749         for(int k=12;k<=dl0-12;k++) {
750             for(int L=-7;L<7;L++){
751                 sortie[2*k+L-5]+=vg[L+7]*gete[k];
752             }
753         }
754         sortie=ArrayMath.add(sortie,gete[0],v0,0);
755         sortie=ArrayMath.add(sortie,gete[1],v1,0);
756         sortie=ArrayMath.add(sortie,gete[2],v2,0);
757         sortie=ArrayMath.add(sortie,gete[3],v3,0);
758         sortie=ArrayMath.add(sortie,gete[4],v4,0);
759         sortie=ArrayMath.add(sortie,gete[5],v5,0);
760         sortie=ArrayMath.add(sortie,gete[6],v6,0);
761         sortie=ArrayMath.add(sortie,gete[7],v7,0);
762         sortie=ArrayMath.add(sortie,gete[8],v8,0);
763         sortie=ArrayMath.add(sortie,gete[9],v9,0);
764         sortie=ArrayMath.add(sortie,gete[10],v10,0);
765         sortie=ArrayMath.add(sortie,gete[11],v11,0);
766
767         int p0=sortie.length-vd0.length;
768         int p1=sortie.length-vd1.length;
769         int p2=sortie.length-vd2.length;
770         int p3=sortie.length-vd3.length;
771         int p4=sortie.length-vd4.length;
772         int p5=sortie.length-vd5.length;
773         int p6=sortie.length-vd6.length;
774         int p7=sortie.length-vd7.length;
775         int p8=sortie.length-vd8.length;
776         int p9=sortie.length-vd9.length;
777         int p10=sortie.length-vd10.length;
778         int p11=sortie.length-vd11.length;
779         sortie=ArrayMath.add(sortie,gete[dl0],vd0,p0);
780         sortie=ArrayMath.add(sortie,gete[dl0-1],vd1,p1);
781         sortie=ArrayMath.add(sortie,gete[dl0-2],vd2,p2);
782         sortie=ArrayMath.add(sortie,gete[dl0-3],vd3,p3);
783         sortie=ArrayMath.add(sortie,gete[dl0-4],vd4,p4);
784         sortie=ArrayMath.add(sortie,gete[dl0-5],vd5,p5);
785         sortie=ArrayMath.add(sortie,gete[dl0-6],vd6,p6);
786         sortie=ArrayMath.add(sortie,gete[dl0-7],vd7,p7);
787         sortie=ArrayMath.add(sortie,gete[dl0-8],vd8,p8);
788         sortie=ArrayMath.add(sortie,gete[dl0-9],vd9,p9);
789         sortie=ArrayMath.add(sortie,gete[dl0-10],vd10,p10);
790         sortie=ArrayMath.add(sortie,gete[dl0-11],vd11,p11);
791
792         return(sortie);
793     }
794
795     /****************************************
796     * This is the implementation of the highpass
797   * Filter. It is used by the interface
798   * "Filter". Highpass filters are normalized
799   * in order to get L2 orthonormality of the
800   * resulting wavelets (when it applies).
801   * See the class DiscreteHilbertSpace for
802   * an implementation of the L2 integration.
803     *****************************************/

804     public double[] highpass(double[] gete) {
805         if(gete.length<12) {
806             throw new IllegalScalingException("The array is not long enough : "+gete.length+" < "+12);
807         }
808         double[] sortie=new double[2*gete.length+filtretype];
809         int dl0=gete.length-1;
810         for(int k=6;k<=dl0-6;k++) {
811             for(int L=-7;L<7;L++){
812                 sortie[2*k+L + 7 ]+=phvg[L+7]*gete[k];
813             }
814         }
815         sortie=ArrayMath.add(sortie,gete[0],phv0,0);
816         int p0=sortie.length-phvd0.length;
817         sortie=ArrayMath.add(sortie,gete[dl0],phvd0,p0);
818         sortie=ArrayMath.add(sortie,gete[1],phv1,0);
819         int p1=sortie.length-phvd1.length;
820         sortie=ArrayMath.add(sortie,gete[dl0-1],phvd1,p1);
821         sortie=ArrayMath.add(sortie,gete[2],phv2,0);
822         int p2=sortie.length-phvd2.length;
823         sortie=ArrayMath.add(sortie,gete[dl0-2],phvd2,p2);
824         sortie=ArrayMath.add(sortie,gete[3],phv3,0);
825         int p3=sortie.length-phvd3.length;
826         sortie=ArrayMath.add(sortie,gete[dl0-3],phvd3,p3);
827         sortie=ArrayMath.add(sortie,gete[4],phv4,0);
828         int p4=sortie.length-phvd4.length;
829         sortie=ArrayMath.add(sortie,gete[dl0-4],phvd4,p4);
830         sortie=ArrayMath.add(sortie,gete[5],phv5,0);
831         int p5=sortie.length-phvd5.length;
832         sortie=ArrayMath.add(sortie,gete[dl0-5],phvd5,p5);
833
834         return(sortie);
835     }
836
837
838     public double[] evalScaling (int n0, int k, int j1) {
839         return(Cascades.evalScaling(this,n0,j1,k));
840     }
841
842
843     public double[] evalWavelet (int n0, int k, int j1) {
844         return(Cascades.evalWavelet(this,filtretype,n0,j1,k));
845     }
846
847 }
848
Popular Tags