From d98c5c90f3786f5178588db5a8a39a36676272f3 Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 10 Mar 2015 19:43:58 +0100 Subject: [PATCH] src/maths/cmaths/cmath4.c, bug fix, cx_fft, cx_ifft, cx_derive incorrect check for VF_COMPLEX in field v_type instead of v_flags --- src/maths/cmaths/cmath4.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index 95d8c262e..1ffccdb07 100644 --- a/src/maths/cmaths/cmath4.c +++ b/src/maths/cmaths/cmath4.c @@ -273,7 +273,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt c_indata = (ngcomplex_t *) data; c_outdata = alloc_c(length); scale = alloc_d(length); /* XXX */ - if (pl->pl_scale->v_type == VF_COMPLEX) + if (iscomplex(pl->pl_scale)) /* Not ideal */ for (i = 0; i < length; i++) scale[i] = realpart(pl->pl_scale->v_compdata[i]); @@ -369,7 +369,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt */ /* Modified to deal with complex frequency vector */ - if (pl->pl_scale->v_type == VF_COMPLEX) + if (iscomplex(pl->pl_scale)) for (i = 0; i < length; i++) scale[i] = realpart(pl->pl_scale->v_compdata[i]); else @@ -398,7 +398,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt * abort. */ - if (pl->pl_scale->v_type == VF_COMPLEX) + if (iscomplex(pl->pl_scale)) x = realpart(pl->pl_scale->v_compdata[j+base]); /* For complex scale vector */ else x = pl->pl_scale->v_realdata[j + base]; /* For real scale vector */ @@ -412,7 +412,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt { /* Again the same error */ /* x = pl->pl_scale->v_realdata[j + base]; */ - if (pl->pl_scale->v_type == VF_COMPLEX) + if (iscomplex(pl->pl_scale)) x = realpart(pl->pl_scale->v_compdata[j+base]); /* For complex scale vector */ else x = pl->pl_scale->v_realdata[j + base]; /* For real scale vector */ @@ -582,7 +582,7 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp } else if (pl->pl_scale->v_type == SV_FREQUENCY) { /* take frequency from ac data and calculate time */ /* Deal with complex frequency vector */ - if (pl->pl_scale->v_type == VF_COMPLEX) { + if (iscomplex(pl->pl_scale)) { span = realpart(pl->pl_scale->v_compdata[pl->pl_scale->v_length-1]) - realpart(pl->pl_scale->v_compdata[0]); for (i = 0; ipl_scale->v_length; i++) xscale[i] = realpart(pl->pl_scale->v_compdata[i]); @@ -836,7 +836,7 @@ cx_ifft(void *data, short int type, int length, int *newlength, short int *newty xscale = TMALLOC(double, tpts); /* Deal with complex frequency vector */ - if (pl->pl_scale->v_type == VF_COMPLEX) + if (iscomplex(pl->pl_scale)) span = realpart(pl->pl_scale->v_compdata[tpts-1]) - realpart(pl->pl_scale->v_compdata[0]); else span = pl->pl_scale->v_realdata[tpts-1] - pl->pl_scale->v_realdata[0];