21 #include <lal/LALStdlib.h>
22 #include <lal/AVFactories.h>
23 #include <lal/VectorOps.h>
26 #include <lal/ZPGFilter.h>
29 #define UNUSED __attribute__ ((unused))
118 if ( (ar*ar+ai*ai) < (br*br+bi*bi) )
134 if ( (ar*ar+ai*ai) < (br*br+bi*bi) )
186 num = (numZeros>numPoles) ? numZeros : numPoles;
187 numZeros=numPoles=num;
201 if((crealf(*
a)==0.0)&&(cimagf(*
a)==-1.0))
204 if((crealf(*
a)==0.0)&&(cimagf(*
a)==-1.0))
233 *b=(1.0-ai)/(1.0+ai);
238 }
else if(fabs(1.0+ai)>fabs(ar)){
239 REAL8 ratio = -ar/(1.0+ai);
240 REAL8 denom = 1.0+ai - ratio*ar;
242 *b = (1.0-ai + ratio*ar)/denom;
243 *b += I*(ar - ratio*(1.0-ai))/denom;
249 REAL8 ratio = -(1.0+ai)/ar;
250 REAL8 denom = -ar + ratio*(1.0+ai);
252 *b = ((1.0-ai)*ratio + ar)/denom;
253 *b += I*(ar*ratio - 1.0+ai)/denom;
261 for(;j<numZeros;b++,j++){
291 *b=(1.0-ai)/(1.0+ai);
296 }
else if(fabs(1.0+ai)>fabs(ar)){
297 REAL8 ratio = -ar/(1.0+ai);
298 REAL8 denom = 1.0+ai - ratio*ar;
300 *b = (1.0-ai + ratio*ar)/denom;
301 *b += I*(ar - ratio*(1.0-ai))/denom;
307 REAL8 ratio = -(1.0+ai)/ar;
308 REAL8 denom = -ar + ratio*(1.0+ai);
310 *b = ((1.0-ai)*ratio + ar)/denom;
311 *b += I*(ar*ratio - 1.0+ai)/denom;
319 for(;j<numPoles;b++,j++){
342 for(i=0,j=gain->
length-1;i<j;i++,j--){
405 num = (numZeros>numPoles) ? numZeros : numPoles;
406 numZeros=numPoles=num;
420 if((creal(*
a)==0.0)&&(cimag(*
a)==-1.0))
423 if((creal(*
a)==0.0)&&(cimag(*
a)==-1.0))
452 *b=(1.0-ai)/(1.0+ai);
457 }
else if(fabs(1.0+ai)>fabs(ar)){
458 REAL8 ratio = -ar/(1.0+ai);
459 REAL8 denom = 1.0+ai - ratio*ar;
461 *b = (1.0-ai + ratio*ar)/denom;
462 *b += I*(ar - ratio*(1.0-ai))/denom;
468 REAL8 ratio = -(1.0+ai)/ar;
469 REAL8 denom = -ar + ratio*(1.0+ai);
471 *b = ((1.0-ai)*ratio + ar)/denom;
472 *b += I*(ar*ratio - 1.0+ai)/denom;
480 for(;j<numZeros;b++,j++){
510 *b=(1.0-ai)/(1.0+ai);
515 }
else if(fabs(1.0+ai)>fabs(ar)){
516 REAL8 ratio = -ar/(1.0+ai);
517 REAL8 denom = 1.0+ai - ratio*ar;
519 *b = (1.0-ai + ratio*ar)/denom;
520 *b += I*(ar - ratio*(1.0-ai))/denom;
526 REAL8 ratio = -(1.0+ai)/ar;
527 REAL8 denom = -ar + ratio*(1.0+ai);
529 *b = ((1.0-ai)*ratio + ar)/denom;
530 *b += I*(ar*ratio - 1.0+ai)/denom;
538 for(;j<numPoles;b++,j++){
561 for(i=0,j=gain->
length-1;i<j;i++,j--){
#define ABORT(statusptr, code, mesg)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define ZPGFILTERH_MSGEBAD
#define ZPGFILTERH_MSGENUL
double complex COMPLEX16
Double-precision floating-point complex number (16 bytes total)
double REAL8
Double precision real floating-point number (8 bytes).
float complex COMPLEX8
Single-precision floating-point complex number (8 bytes total)
int32_t INT4
Four-byte signed integer.
float REAL4
Single precision real floating-point number (4 bytes).
int XLALHeapIndex(INT4 *indx, void *base, UINT4 nobj, UINT4 size, void *params, int(*compar)(void *, const void *, const void *))
INT4Vector * XLALCreateINT4Vector(UINT4 length)
COMPLEX16Vector * XLALCreateCOMPLEX16Vector(UINT4 length)
void XLALDestroyINT4Vector(INT4Vector *vector)
void XLALDestroyCOMPLEX16Vector(COMPLEX16Vector *vector)
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
void XLALDestroyCOMPLEX8Vector(COMPLEX8Vector *vector)
#define xlalErrno
Modifiable lvalue containing the XLAL error number.
#define XLAL_ERROR(...)
Macro to invoke a failure from a XLAL routine returning an integer.
int XLALClearErrno(void)
Clears the XLAL error number, returns the old value.
@ XLAL_EFAULT
Invalid pointer.
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
@ XLAL_EINVAL
Invalid argument.
#define ZPGFILTERH_EBAD
Bad filter parameters.
#define ZPGFILTERH_ENUL
Unexpected null pointer in arguments.
Vector of type COMPLEX16, see DATATYPE-Vector types for more details.
UINT4 length
Number of elements in array.
COMPLEX16 * data
Pointer to the data array.
See DATATYPE-ZPGFilter types for details.
Vector of type COMPLEX8, see DATATYPE-Vector types for more details.
UINT4 length
Number of elements in array.
COMPLEX8 * data
Pointer to the data array.
See DATATYPE-ZPGFilter types for details.
Vector of type INT4, see DATATYPE-Vector types for more details.
INT4 * data
Pointer to the data array.
LAL status structure, see The LALStatus structure for more details.