1 // Author: Aime' Fournier
2 // E-mail: fournier@ucar.edu
4 #include "common.h" // Common definitions and macros.
5 #include "float.h" // Parameters of standard float types.
6 #include "qf.h" // Data structs and function prototypes.
10 void TestFilter(int nam
,int ran
,int kinh
,int king
,pqf
*h
,pqf
*g
) {
12 real fg
=-FLT_MAX
,fl
=FLT_MAX
,fs
=0.;
15 printf("Filter-convolution %s%02d[%d]*%s%02d[%d]:\n",nam
,ran
,kinh
,nam
,ran
,king
);
16 nl
=ICH(g
->alpha
-h
->omega
); // least n
17 ng
=IFH(g
->omega
-h
->alpha
); // greatest n
18 p
=(real
*)calloc(ng
-nl
+1,sizeof(real
));
19 printf("\t%36sn:"," ");
20 for( n
=nl
; n
<=ng
; n
++ ) printf("%7d",n
);
22 for( n
=nl
; n
<=ng
; n
++ ) {
23 for( k
=max(h
->alpha
,g
->alpha
-2*n
); k
<=min(h
->omega
,g
->omega
-2*n
); k
++ )
24 p
[n
-nl
]+=h
->f
[k
]*g
->f
[k
+2*n
];
25 if( n
==0 && kinh
==king
) p
[n
-nl
]--;
29 printf("\t%8.1e<orthogonality error<%8.1e:",fl
,fg
);
30 for( n
=nl
; n
<=ng
; n
++ ) printf(" %6.1f",p
[n
-nl
]);