Browse Source

ngcomplex_t instead of complex, #1/2

pre-master-46
rlar 16 years ago
parent
commit
4622d0876e
  1. 27
      ChangeLog
  2. 6
      src/frontend/com_compose.c
  3. 6
      src/frontend/com_fft.c
  4. 4
      src/frontend/com_let.c
  5. 6
      src/frontend/define.c
  6. 2
      src/frontend/diff.c
  7. 14
      src/frontend/evaluate.c
  8. 8
      src/frontend/outitf.c
  9. 10
      src/frontend/plotting/plotit.c
  10. 2
      src/frontend/postcoms.c
  11. 4
      src/frontend/rawfile.c
  12. 6
      src/frontend/spec.c
  13. 12
      src/frontend/vectors.c
  14. 20
      src/include/complex.h
  15. 2
      src/include/dvec.h
  16. 2
      src/maths/cmaths/cmath.h
  17. 40
      src/maths/cmaths/cmath1.c
  18. 76
      src/maths/cmaths/cmath2.c
  19. 78
      src/maths/cmaths/cmath3.c
  20. 20
      src/maths/cmaths/cmath4.c
  21. 6
      src/maths/cmaths/test_cx_j.c
  22. 2
      src/maths/cmaths/test_cx_mag.c
  23. 2
      src/maths/cmaths/test_cx_ph.c
  24. 2
      src/ngsconvert.c

27
ChangeLog

@ -1,3 +1,30 @@
2010-10-24 Robert Larice
* src/frontend/com_compose.c ,
* src/frontend/com_fft.c ,
* src/frontend/com_let.c ,
* src/frontend/define.c ,
* src/frontend/diff.c ,
* src/frontend/evaluate.c ,
* src/frontend/outitf.c ,
* src/frontend/plotting/plotit.c ,
* src/frontend/postcoms.c ,
* src/frontend/rawfile.c ,
* src/frontend/spec.c ,
* src/frontend/vectors.c ,
* src/include/complex.h ,
* src/include/dvec.h ,
* src/maths/cmaths/cmath.h ,
* src/maths/cmaths/cmath1.c ,
* src/maths/cmaths/cmath2.c ,
* src/maths/cmaths/cmath3.c ,
* src/maths/cmaths/cmath4.c ,
* src/maths/cmaths/test_cx_j.c ,
* src/maths/cmaths/test_cx_mag.c ,
* src/maths/cmaths/test_cx_ph.c ,
* src/ngsconvert.c :
ngcomplex_t instead of complex, #1/2
purpose: avoid name collision
2010-10-17 Holger Vogt 2010-10-17 Holger Vogt
* main.c: add mktemp.h * main.c: add mktemp.h

6
src/frontend/com_compose.c

@ -17,7 +17,7 @@
static void static void
dimxpand(struct dvec *v, int *newdims, double *data) dimxpand(struct dvec *v, int *newdims, double *data)
{ {
complex *cdata = (complex *) data;
ngcomplex_t *cdata = (ngcomplex_t *) data;
bool realflag = isreal(v); bool realflag = isreal(v);
int i, j, o, n, t, u; int i, j, o, n, t, u;
int ncount[MAXDIMS], ocount[MAXDIMS]; int ncount[MAXDIMS], ocount[MAXDIMS];
@ -112,7 +112,7 @@ com_compose(wordlist *wl)
char *resname, *s, *var, *val; char *resname, *s, *var, *val;
double *td, tt; double *td, tt;
double *data = NULL; double *data = NULL;
complex *cdata = NULL;
ngcomplex_t *cdata = NULL;
int length = 0; int length = 0;
int dim, type = SV_NOTYPE, blocksize; int dim, type = SV_NOTYPE, blocksize;
bool realflag = TRUE; bool realflag = TRUE;
@ -183,7 +183,7 @@ com_compose(wordlist *wl)
data = (double *) tmalloc(sizeof (double) * length * data = (double *) tmalloc(sizeof (double) * length *
blocksize); blocksize);
else else
cdata = (complex *) tmalloc(sizeof (complex) * length *
cdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * length *
blocksize); blocksize);
/* Now copy all the data over... If the sizes are too small /* Now copy all the data over... If the sizes are too small

6
src/frontend/com_fft.c

@ -23,7 +23,7 @@ static void fftext(double*, double*, long int, long int, int);
void void
com_fft(wordlist *wl) com_fft(wordlist *wl)
{ {
complex **fdvec;
ngcomplex_t **fdvec;
double **tdvec; double **tdvec;
double *freq, *win, *time; double *freq, *win, *time;
double delta_t, span; double delta_t, span;
@ -202,10 +202,10 @@ com_fft(wordlist *wl)
tdvec = (double **) tmalloc(ngood * sizeof(double *)); tdvec = (double **) tmalloc(ngood * sizeof(double *));
fdvec = (complex **) tmalloc(ngood * sizeof(complex *));
fdvec = (ngcomplex_t **) tmalloc(ngood * sizeof(ngcomplex_t *));
for (i = 0, vec = vlist; i<ngood; i++) { for (i = 0, vec = vlist; i<ngood; i++) {
tdvec[i] = vec->v_realdata; /* real input data */ tdvec[i] = vec->v_realdata; /* real input data */
fdvec[i] = (complex *) tmalloc(fpts * sizeof(complex)); /* complex output data */
fdvec[i] = (ngcomplex_t *) tmalloc(fpts * sizeof(ngcomplex_t)); /* complex output data */
f = alloc(struct dvec); f = alloc(struct dvec);
ZERO(f, struct dvec); ZERO(f, struct dvec);
f->v_name = vec_basename(vec); f->v_name = vec_basename(vec);

4
src/frontend/com_let.c

@ -168,7 +168,7 @@ com_let(wordlist *wl)
if (isreal(t)) if (isreal(t))
n->v_realdata = (double *) tmalloc(n->v_length * sizeof(double)); n->v_realdata = (double *) tmalloc(n->v_length * sizeof(double));
else else
n->v_compdata = (complex *) tmalloc(n->v_length * sizeof(complex));
n->v_compdata = (ngcomplex_t *) tmalloc(n->v_length * sizeof(ngcomplex_t));
newvec = 1; newvec = 1;
vec_new(n); vec_new(n);
} }
@ -216,7 +216,7 @@ com_let(wordlist *wl)
length * sizeof (double)); length * sizeof (double));
} else { } else {
bcopy(t->v_compdata, n->v_compdata + offset, bcopy(t->v_compdata, n->v_compdata + offset,
length * sizeof (complex));
length * sizeof(ngcomplex_t));
} }
n->v_minsignal = 0.0; /* How do these get reset ??? */ n->v_minsignal = 0.0; /* How do these get reset ??? */

6
src/frontend/define.c

@ -170,11 +170,11 @@ savetree(struct pnode *pn)
pn->pn_value->v_realdata, pn->pn_value->v_realdata,
sizeof (double) * d->v_length); sizeof (double) * d->v_length);
} else { } else {
pn->pn_value->v_compdata = (complex *)
tmalloc(sizeof (complex) * d->v_length);
pn->pn_value->v_compdata = (ngcomplex_t *)
tmalloc(sizeof(ngcomplex_t) * d->v_length);
bcopy(d->v_compdata, bcopy(d->v_compdata,
pn->pn_value->v_compdata, pn->pn_value->v_compdata,
sizeof (complex) * d->v_length);
sizeof(ngcomplex_t) * d->v_length);
} }
} }
} else if (pn->pn_op) { } else if (pn->pn_op) {

2
src/frontend/diff.c

@ -79,7 +79,7 @@ com_diff(wordlist *wl)
struct plot *p1, *p2 = NULL; struct plot *p1, *p2 = NULL;
struct dvec *v1, *v2; struct dvec *v1, *v2;
double d1, d2; double d1, d2;
complex c1, c2, c3;
ngcomplex_t c1, c2, c3;
int i, j; int i, j;
wordlist *tw; wordlist *tw;
char numbuf[BSIZE_SP],numbuf2[BSIZE_SP] ,numbuf3[BSIZE_SP], numbuf4[BSIZE_SP]; /* For printnum */ char numbuf[BSIZE_SP],numbuf2[BSIZE_SP] ,numbuf3[BSIZE_SP], numbuf4[BSIZE_SP]; /* For printnum */

14
src/frontend/evaluate.c

@ -156,7 +156,7 @@ doop(char what,
struct pnode *arg2) struct pnode *arg2)
{ {
struct dvec *v1, *v2, *res; struct dvec *v1, *v2, *res;
complex *c1 = NULL, *c2 = NULL , lc;
ngcomplex_t *c1 = NULL, *c2 = NULL , lc;
double *d1 = NULL, *d2 = NULL, ld; double *d1 = NULL, *d2 = NULL, ld;
int length = 0, i; int length = 0, i;
void *data; void *data;
@ -234,7 +234,7 @@ doop(char what,
} else { } else {
realpart(&lc) = 0.0; realpart(&lc) = 0.0;
imagpart(&lc) = 0.0; imagpart(&lc) = 0.0;
c1 = (complex *) tmalloc(length * sizeof (complex));
c1 = (ngcomplex_t *) tmalloc(length * sizeof(ngcomplex_t));
for (i = 0; i < v1->v_length; i++) for (i = 0; i < v1->v_length; i++)
c1[i] = v1->v_compdata[i]; c1[i] = v1->v_compdata[i];
if (i > 0) if (i > 0)
@ -261,7 +261,7 @@ doop(char what,
} else { } else {
realpart(&lc) = 0.0; realpart(&lc) = 0.0;
imagpart(&lc) = 0.0; imagpart(&lc) = 0.0;
c2 = (complex *) tmalloc(length * sizeof (complex));
c2 = (ngcomplex_t *) tmalloc(length * sizeof(ngcomplex_t));
for (i = 0; i < v2->v_length; i++) for (i = 0; i < v2->v_length; i++)
c2[i] = v2->v_compdata[i]; c2[i] = v2->v_compdata[i];
if (i > 0) if (i > 0)
@ -304,7 +304,7 @@ doop(char what,
} else { } else {
res->v_flags = (v1->v_flags | v2->v_flags | res->v_flags = (v1->v_flags | v2->v_flags |
VF_COMPLEX) & ~ VF_REAL; VF_COMPLEX) & ~ VF_REAL;
res->v_compdata = (complex *) data;
res->v_compdata = (ngcomplex_t *) data;
} }
res->v_name = mkcname(what, v1->v_name, v2->v_name); res->v_name = mkcname(what, v1->v_name, v2->v_name);
@ -603,7 +603,7 @@ op_range(struct pnode *arg1, struct pnode *arg2)
if (isreal(res)) if (isreal(res))
res->v_realdata = (double *) tmalloc(sizeof (double) * len); res->v_realdata = (double *) tmalloc(sizeof (double) * len);
else else
res->v_compdata = (complex *) tmalloc(sizeof (complex) * len);
res->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * len);
/* Toss in the data */ /* Toss in the data */
@ -754,7 +754,7 @@ op_ind(struct pnode *arg1, struct pnode *arg2)
if (isreal(res)) if (isreal(res))
res->v_realdata = (double *) tmalloc(sizeof (double) * length); res->v_realdata = (double *) tmalloc(sizeof (double) * length);
else else
res->v_compdata = (complex *) tmalloc(sizeof (complex) * length);
res->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * length);
/* And toss in the new data */ /* And toss in the new data */
for (j = 0; j < up - down + 1; j++) { for (j = 0; j < up - down + 1; j++) {
@ -880,7 +880,7 @@ apply_func(struct func *func, struct pnode *arg)
if (isreal(t)) if (isreal(t))
t->v_realdata = (double *) data; t->v_realdata = (double *) data;
else else
t->v_compdata = (complex *) data;
t->v_compdata = (ngcomplex_t *) data;
if (eq(func->fu_name, "minus")) if (eq(func->fu_name, "minus"))
t->v_name = mkcname('a', func->fu_name, v->v_name); t->v_name = mkcname('a', func->fu_name, v->v_name);
else if (eq(func->fu_name, "not")) else if (eq(func->fu_name, "not"))

8
src/frontend/outitf.c

@ -984,8 +984,8 @@ plotAddRealValue(dataDesc *desc, double value)
v->v_realdata[v->v_length] = value; v->v_realdata[v->v_length] = value;
} else { } else {
/* a real parading as a VF_COMPLEX */ /* a real parading as a VF_COMPLEX */
v->v_compdata = (complex *) newrealloc((char *) v->v_compdata,
sizeof (complex) * (v->v_length + 1));
v->v_compdata = (ngcomplex_t *) newrealloc((char *) v->v_compdata,
sizeof(ngcomplex_t) * (v->v_length + 1));
v->v_compdata[v->v_length].cx_real = value; v->v_compdata[v->v_length].cx_real = value;
v->v_compdata[v->v_length].cx_imag = (double) 0; v->v_compdata[v->v_length].cx_imag = (double) 0;
} }
@ -1000,8 +1000,8 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value)
{ {
struct dvec *v = desc->vec; struct dvec *v = desc->vec;
v->v_compdata = (complex *) newrealloc((char *) v->v_compdata,
sizeof (complex) * (v->v_length + 1));
v->v_compdata = (ngcomplex_t *) newrealloc((char *) v->v_compdata,
sizeof(ngcomplex_t) * (v->v_length + 1));
v->v_compdata[v->v_length].cx_real = value.real; v->v_compdata[v->v_length].cx_real = value.real;
v->v_compdata[v->v_length].cx_imag = value.imag; v->v_compdata[v->v_length].cx_imag = value.imag;
v->v_length++; v->v_length++;

10
src/frontend/plotting/plotit.c

@ -90,7 +90,7 @@ static void
xtend(struct dvec *v, int length) xtend(struct dvec *v, int length)
{ {
int i; int i;
complex c, *oc;
ngcomplex_t c, *oc;
double d, *od; double d, *od;
if (v->v_length == length) if (v->v_length == length)
@ -110,7 +110,7 @@ xtend(struct dvec *v, int length)
tfree(od); tfree(od);
} else { } else {
oc = v->v_compdata; oc = v->v_compdata;
v->v_compdata = (complex *) tmalloc(length * sizeof (complex));
v->v_compdata = (ngcomplex_t *) tmalloc(length * sizeof(ngcomplex_t));
for (i = 0; i < v->v_length; i++) { for (i = 0; i < v->v_length; i++) {
realpart(&v->v_compdata[i]) = realpart(&oc[i]); realpart(&v->v_compdata[i]) = realpart(&oc[i]);
imagpart(&v->v_compdata[i]) = imagpart(&oc[i]); imagpart(&v->v_compdata[i]) = imagpart(&oc[i]);
@ -136,9 +136,9 @@ static void
compress(struct dvec *d, double *xcomp, double *xind) compress(struct dvec *d, double *xcomp, double *xind)
{ {
int cfac, ihi, ilo, newlen, i; int cfac, ihi, ilo, newlen, i;
int sz = isreal(d) ? sizeof (double) : sizeof (complex);
int sz = isreal(d) ? sizeof(double) : sizeof(ngcomplex_t);
double *dd; double *dd;
complex *cc;
ngcomplex_t *cc;
if (xind) { if (xind) {
ilo = (int) xind[0]; ilo = (int) xind[0];
@ -147,7 +147,7 @@ compress(struct dvec *d, double *xcomp, double *xind)
(ihi > 1) && (ihi <= d->v_length)) { (ihi > 1) && (ihi <= d->v_length)) {
newlen = ihi - ilo; newlen = ihi - ilo;
dd = (double *) tmalloc(newlen * sz); dd = (double *) tmalloc(newlen * sz);
cc = (complex *) dd;
cc = (ngcomplex_t *) dd;
if (isreal(d)) { if (isreal(d)) {
bcopy(d->v_realdata + ilo, dd, newlen * sz); bcopy(d->v_realdata + ilo, dd, newlen * sz);
tfree(d->v_realdata); tfree(d->v_realdata);

2
src/frontend/postcoms.c

@ -745,7 +745,7 @@ com_cross(wordlist *wl)
v->v_flags |= VF_PERMANENT; v->v_flags |= VF_PERMANENT;
v->v_flags = comp ? VF_COMPLEX : VF_REAL; v->v_flags = comp ? VF_COMPLEX : VF_REAL;
if (comp) if (comp)
v->v_compdata = (complex *) tmalloc(i * sizeof (complex));
v->v_compdata = (ngcomplex_t *) tmalloc(i * sizeof(ngcomplex_t));
else else
v->v_realdata = (double *) tmalloc(i * sizeof (double)); v->v_realdata = (double *) tmalloc(i * sizeof (double));

4
src/frontend/rawfile.c

@ -571,8 +571,8 @@ raw_read(char *name)
v->v_realdata = (double *) tmalloc( v->v_realdata = (double *) tmalloc(
npoints * sizeof (double)); npoints * sizeof (double));
else else
v->v_compdata = (complex *) tmalloc(
npoints * sizeof (complex));
v->v_compdata = (ngcomplex_t *) tmalloc(
npoints * sizeof(ngcomplex_t));
} }
} else if (ciprefix("values:", buf) || } else if (ciprefix("values:", buf) ||
ciprefix("binary:", buf)) { ciprefix("binary:", buf)) {

6
src/frontend/spec.c

@ -22,7 +22,7 @@ $Id$
void void
com_spec(wordlist *wl) com_spec(wordlist *wl)
{ {
complex **fdvec;
ngcomplex_t **fdvec;
double **tdvec; double **tdvec;
double *freq, *win, *time, *dc; double *freq, *win, *time, *dc;
double startf, stopf, stepf, span; double startf, stopf, stepf, span;
@ -214,10 +214,10 @@ com_spec(wordlist *wl)
vec_new(f); vec_new(f);
tdvec = (double **) tmalloc(ngood * sizeof(double *)); tdvec = (double **) tmalloc(ngood * sizeof(double *));
fdvec = (complex **) tmalloc(ngood * sizeof(complex *));
fdvec = (ngcomplex_t **) tmalloc(ngood * sizeof(ngcomplex_t *));
for (i = 0, vec = vlist; i<ngood; i++) { for (i = 0, vec = vlist; i<ngood; i++) {
tdvec[i] = vec->v_realdata; tdvec[i] = vec->v_realdata;
fdvec[i] = (complex *) tmalloc(fpts * sizeof(complex));
fdvec[i] = (ngcomplex_t *) tmalloc(fpts * sizeof(ngcomplex_t));
f = alloc(struct dvec); f = alloc(struct dvec);
ZERO(f, struct dvec); ZERO(f, struct dvec);
f->v_name = vec_basename(vec); f->v_name = vec_basename(vec);

12
src/frontend/vectors.c

@ -650,10 +650,10 @@ vec_copy(struct dvec *v)
nv->v_compdata = NULL; nv->v_compdata = NULL;
} else { } else {
nv->v_realdata = NULL; nv->v_realdata = NULL;
nv->v_compdata = (complex *) tmalloc(sizeof (complex) *
nv->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) *
v->v_length); v->v_length);
bcopy(v->v_compdata, nv->v_compdata, bcopy(v->v_compdata, nv->v_compdata,
sizeof (complex) * v->v_length);
sizeof(ngcomplex_t) * v->v_length);
} }
nv->v_minsignal = v->v_minsignal; nv->v_minsignal = v->v_minsignal;
@ -952,7 +952,7 @@ vec_transpose(struct dvec *v)
int dim0, dim1, nummatrices; int dim0, dim1, nummatrices;
int i, j, k, joffset, koffset, blocksize; int i, j, k, joffset, koffset, blocksize;
double *newreal, *oldreal; double *newreal, *oldreal;
complex *newcomp, *oldcomp;
ngcomplex_t *newcomp, *oldcomp;
if (v->v_numdims < 2 || v->v_length <= 1) if (v->v_numdims < 2 || v->v_length <= 1)
return; return;
@ -996,7 +996,7 @@ vec_transpose(struct dvec *v)
tfree(oldreal); tfree(oldreal);
v->v_realdata = newreal; v->v_realdata = newreal;
} else { } else {
newcomp = (complex *) tmalloc(sizeof (complex) * v->v_length);
newcomp = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t) * v->v_length);
oldcomp = v->v_compdata; oldcomp = v->v_compdata;
koffset = 0; koffset = 0;
for ( k=0; k < nummatrices; k++ ) { for ( k=0; k < nummatrices; k++ ) {
@ -1067,8 +1067,8 @@ vec_mkfamily(struct dvec *v)
d->v_realdata = (double *) tmalloc(size * sizeof(double)); d->v_realdata = (double *) tmalloc(size * sizeof(double));
bcopy(v->v_realdata + size*j, d->v_realdata, size*sizeof(double)); bcopy(v->v_realdata + size*j, d->v_realdata, size*sizeof(double));
} else { } else {
d->v_compdata = (complex *) tmalloc(size * sizeof(complex));
bcopy(v->v_compdata + size*j, d->v_compdata, size*sizeof(complex));
d->v_compdata = (ngcomplex_t *) tmalloc(size * sizeof(ngcomplex_t));
bcopy(v->v_compdata + size*j, d->v_compdata, size*sizeof(ngcomplex_t));
} }
/* Add one to the counter. */ /* Add one to the counter. */
(void) incindex(count, v->v_numdims - 1, v->v_dims, v->v_numdims); (void) incindex(count, v->v_numdims - 1, v->v_dims, v->v_numdims);

20
src/include/complex.h

@ -16,7 +16,7 @@ struct _complex1 { /* IBM portability... renamed due to double definition in M
typedef struct _complex1 _complex; typedef struct _complex1 _complex;
#endif #endif
typedef struct _complex1 complex;
typedef struct _complex1 ngcomplex_t;
#define realpart(cval) ((struct _complex1 *) (cval))->cx_real #define realpart(cval) ((struct _complex1 *) (cval))->cx_real
#define imagpart(cval) ((struct _complex1 *) (cval))->cx_imag #define imagpart(cval) ((struct _complex1 *) (cval))->cx_imag
@ -25,15 +25,15 @@ typedef struct _complex1 complex;
/* From Cider numcomplex.h /* From Cider numcomplex.h
pn:leave it here until I decide what to do about pn:leave it here until I decide what to do about
struct mosAdmittances { struct mosAdmittances {
complex yIdVdb;
complex yIdVsb;
complex yIdVgb;
complex yIsVdb;
complex yIsVsb;
complex yIsVgb;
complex yIgVdb;
complex yIgVsb;
complex yIgVgb;
ngcomplex_t yIdVdb;
ngcomplex_t yIdVsb;
ngcomplex_t yIdVgb;
ngcomplex_t yIsVdb;
ngcomplex_t yIsVsb;
ngcomplex_t yIsVgb;
ngcomplex_t yIgVdb;
ngcomplex_t yIgVsb;
ngcomplex_t yIgVgb;
}; };
*/ */
#endif #endif

2
src/include/dvec.h

@ -39,7 +39,7 @@ struct dvec {
int v_type; /* Same as so_vtype. */ int v_type; /* Same as so_vtype. */
short v_flags; /* Flags (a combination of VF_*). */ short v_flags; /* Flags (a combination of VF_*). */
double *v_realdata; /* Real data. */ double *v_realdata; /* Real data. */
complex *v_compdata; /* Complex data. */
ngcomplex_t *v_compdata; /* Complex data. */
double v_minsignal; /* Minimum value to plot. */ double v_minsignal; /* Minimum value to plot. */
double v_maxsignal; /* Maximum value to plot. */ double v_maxsignal; /* Maximum value to plot. */
GRIDTYPE v_gridtype; /* One of GRID_*. */ GRIDTYPE v_gridtype; /* One of GRID_*. */

2
src/maths/cmaths/cmath.h

@ -1,7 +1,7 @@
#ifndef _CMATH_H #ifndef _CMATH_H
#define _CMATH_H #define _CMATH_H
#define alloc_c(len) ((complex *) tmalloc((len) * sizeof (complex)))
#define alloc_c(len) ((ngcomplex_t *) tmalloc((len) * sizeof(ngcomplex_t)))
#define alloc_d(len) ((double *) tmalloc((len) * sizeof (double))) #define alloc_d(len) ((double *) tmalloc((len) * sizeof (double)))
#endif #endif

40
src/maths/cmaths/cmath1.c

@ -39,7 +39,7 @@ cx_mag(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
double *d = alloc_d(length); double *d = alloc_d(length);
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
*newlength = length; *newlength = length;
@ -57,7 +57,7 @@ void *
cx_ph(void *data, short int type, int length, int *newlength, short int *newtype) cx_ph(void *data, short int type, int length, int *newlength, short int *newtype)
{ {
double *d = alloc_d(length); double *d = alloc_d(length);
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
*newlength = length; *newlength = length;
@ -75,8 +75,8 @@ cx_ph(void *data, short int type, int length, int *newlength, short int *newtype
void * void *
cx_j(void *data, short int type, int length, int *newlength, short int *newtype) cx_j(void *data, short int type, int length, int *newlength, short int *newtype)
{ {
complex *c = alloc_c(length);
complex *cc = (complex *) data;
ngcomplex_t *c = alloc_c(length);
ngcomplex_t *cc = (ngcomplex_t *) data;
double *dd = (double *) data; double *dd = (double *) data;
int i; int i;
@ -100,7 +100,7 @@ cx_real(void *data, short int type, int length, int *newlength, short int *newty
{ {
double *d = alloc_d(length); double *d = alloc_d(length);
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
*newlength = length; *newlength = length;
@ -119,7 +119,7 @@ cx_imag(void *data, short int type, int length, int *newlength, short int *newty
{ {
double *d = alloc_d(length); double *d = alloc_d(length);
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
*newlength = length; *newlength = length;
@ -140,7 +140,7 @@ cx_pos(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
double *d = alloc_d(length); double *d = alloc_d(length);
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
*newlength = length; *newlength = length;
@ -159,7 +159,7 @@ cx_db(void *data, short int type, int length, int *newlength, short int *newtype
{ {
double *d = alloc_d(length); double *d = alloc_d(length);
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
double tt; double tt;
int i; int i;
@ -194,8 +194,8 @@ cx_log(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -241,8 +241,8 @@ cx_ln(void *data, short int type, int length, int *newlength, short int *newtype
{ {
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -285,8 +285,8 @@ cx_exp(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -316,9 +316,9 @@ void *
cx_sqrt(void *data, short int type, int length, int *newlength, short int *newtype) cx_sqrt(void *data, short int type, int length, int *newlength, short int *newtype)
{ {
double *d = NULL; double *d = NULL;
complex *c = NULL;
ngcomplex_t *c = NULL;
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i, cres = (type == VF_REAL) ? 0 : 1; int i, cres = (type == VF_REAL) ? 0 : 1;
if (type == VF_REAL) if (type == VF_REAL)
@ -401,8 +401,8 @@ cx_sin(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -432,8 +432,8 @@ cx_cos(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);

76
src/maths/cmaths/cmath2.c

@ -48,10 +48,10 @@ d_tan(double *dd, int length)
return d; return d;
} }
static complex *
c_tan(complex *cc, int length)
static ngcomplex_t *
c_tan(ngcomplex_t *cc, int length)
{ {
complex *c;
ngcomplex_t *c;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -85,7 +85,7 @@ cx_tan(void *data, short int type, int length, int *newlength, short int *newtyp
return (void *) d_tan((double *) data, length); return (void *) d_tan((double *) data, length);
} else { } else {
*newtype = VF_COMPLEX; *newtype = VF_COMPLEX;
return (void *) c_tan((complex *) data, length);
return (void *) c_tan((ngcomplex_t *) data, length);
} }
} }
@ -100,7 +100,7 @@ cx_atan(void *data, short int type, int length, int *newlength, short int *newty
*newtype = VF_REAL; *newtype = VF_REAL;
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
@ -122,7 +122,7 @@ cx_max_local(void *data, short int type, int length)
double largest = 0.0; double largest = 0.0;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
@ -154,8 +154,8 @@ cx_norm(void *data, short int type, int length, int *newlength, short int *newty
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -185,8 +185,8 @@ cx_uminus(void *data, short int type, int length, int *newlength, short int *new
{ {
*newlength = length; *newlength = length;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -215,8 +215,8 @@ cx_rnd(void *data, short int type, int length, int *newlength, short int *newtyp
*newlength = length; *newlength = length;
checkseed(); checkseed();
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -252,7 +252,7 @@ cx_sunif(void *data, short int type, int length, int *newlength, short int *newt
*newlength = length; *newlength = length;
checkseed(); checkseed();
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
ngcomplex_t *c;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -281,7 +281,7 @@ cx_sgauss(void *data, short int type, int length, int *newlength, short int *new
*newlength = length; *newlength = length;
checkseed(); checkseed();
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c;
ngcomplex_t *c;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -310,9 +310,9 @@ cx_sgauss(void *data, short int type, int length, int *newlength, short int *new
void void
*cx_avg(void *data, short int type, int length, int *newlength, short int *newtype) *cx_avg(void *data, short int type, int length, int *newlength, short int *newtype)
{ {
complex *c;
ngcomplex_t *c;
double *d = NULL, sum_real = 0.0,sum_imag = 0.0; double *d = NULL, sum_real = 0.0,sum_imag = 0.0;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
double *dd = (double *) data; double *dd = (double *) data;
int i; int i;
@ -368,8 +368,8 @@ cx_mean(void *data, short int type, int length, int *newlength, short int *newty
*d /= length; *d /= length;
return ((void *) d); return ((void *) d);
} else { } else {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(1); c = alloc_c(1);
@ -405,7 +405,7 @@ cx_length(void *data, short int type, int length, int *newlength, short int *new
void * void *
cx_vector(void *data, short int type, int length, int *newlength, short int *newtype) cx_vector(void *data, short int type, int length, int *newlength, short int *newtype)
{ {
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
double *dd = (double *) data; double *dd = (double *) data;
int i, len; int i, len;
double *d; double *d;
@ -430,7 +430,7 @@ cx_vector(void *data, short int type, int length, int *newlength, short int *new
void * void *
cx_unitvec(void *data, short int type, int length, int *newlength, short int *newtype) cx_unitvec(void *data, short int type, int length, int *newlength, short int *newtype)
{ {
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
double *dd = (double *) data; double *dd = (double *) data;
int i, len; int i, len;
double *d; double *d;
@ -463,9 +463,9 @@ cx_plus(void *data1, void *data2, short int datatype1, short int datatype2, int
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2;
int i; int i;
if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) { if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) {
@ -503,9 +503,9 @@ cx_minus(void *data1, void *data2, short int datatype1, short int datatype2, int
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2;
int i; int i;
if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) { if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) {
@ -543,9 +543,9 @@ cx_times(void *data1, void *data2, short int datatype1, short int datatype2, int
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2;
int i; int i;
if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) { if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) {
@ -585,9 +585,9 @@ cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int l
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2;
int i, r1, r2, i1, i2, r3, i3; int i, r1, r2, i1, i2, r3, i3;
if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) { if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) {
@ -660,8 +660,8 @@ cx_max(void *data, short int type, int length, int *newlength, short int *newtyp
} else { } else {
double largest_real=0.0; double largest_real=0.0;
double largest_complex=0.0; double largest_complex=0.0;
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(1); c = alloc_c(1);
@ -701,8 +701,8 @@ cx_min(void *data, short int type, int length, int *newlength, short int *newtyp
} else { } else {
double smallest_real; double smallest_real;
double smallest_complex; double smallest_complex;
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(1); c = alloc_c(1);
@ -743,8 +743,8 @@ cx_d(void *data, short int type, int length, int *newlength, short int *newtype)
return ((void *) d); return ((void *) d);
} else { } else {
complex *c;
complex *cc = (complex *) data;
ngcomplex_t *c;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
c = alloc_c(length); c = alloc_c(length);

78
src/maths/cmaths/cmath3.c

@ -23,9 +23,9 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "cmath3.h" #include "cmath3.h"
static complex *cexp_sp3(complex *c); /* cexp exist's in some newer compiler */
static complex *cln(complex *c);
static complex *ctimes(complex *c1, complex *c2);
static ngcomplex_t *cexp_sp3(ngcomplex_t *c); /* cexp exist's in some newer compiler */
static ngcomplex_t *cln(ngcomplex_t *c);
static ngcomplex_t *ctimes(ngcomplex_t *c1, ngcomplex_t *c2);
void * void *
cx_divide(void *data1, void *data2, short int datatype1, short int datatype2, int length) cx_divide(void *data1, void *data2, short int datatype1, short int datatype2, int length)
@ -33,9 +33,9 @@ cx_divide(void *data1, void *data2, short int datatype1, short int datatype2, in
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2;
int i; int i;
if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) { if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) {
@ -81,9 +81,9 @@ cx_comma(void *data1, void *data2, short int datatype1, short int datatype2, int
{ {
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2;
int i; int i;
c = alloc_c(length); c = alloc_c(length);
@ -115,9 +115,9 @@ cx_power(void *data1, void *data2, short int datatype1, short int datatype2, int
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex *c, c1, c2, *t;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t *c, c1, c2, *t;
int i; int i;
if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) { if ((datatype1 == VF_REAL) && (datatype2 == VF_REAL)) {
@ -167,10 +167,10 @@ cx_power(void *data1, void *data2, short int datatype1, short int datatype2, int
/* These are unnecessary... Only cx_power uses them... */ /* These are unnecessary... Only cx_power uses them... */
static complex *
cexp_sp3(complex *c)
static ngcomplex_t *
cexp_sp3(ngcomplex_t *c)
{ {
static complex r;
static ngcomplex_t r;
double d; double d;
d = exp(realpart(c)); d = exp(realpart(c));
@ -182,10 +182,10 @@ cexp_sp3(complex *c)
return (&r); return (&r);
} }
static complex *
cln(complex *c)
static ngcomplex_t *
cln(ngcomplex_t *c)
{ {
static complex r;
static ngcomplex_t r;
rcheck(cmag(c) != 0, "ln"); rcheck(cmag(c) != 0, "ln");
realpart(&r) = log(cmag(c)); realpart(&r) = log(cmag(c));
@ -196,10 +196,10 @@ cln(complex *c)
return (&r); return (&r);
} }
static complex *
ctimes(complex *c1, complex *c2)
static ngcomplex_t *
ctimes(ngcomplex_t *c1, ngcomplex_t *c2)
{ {
static complex r;
static ngcomplex_t r;
realpart(&r) = realpart(c1) * realpart(c2) - realpart(&r) = realpart(c1) * realpart(c2) -
imagpart(c1) * imagpart(c2); imagpart(c1) * imagpart(c2);
@ -221,9 +221,9 @@ cx_eq(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -262,9 +262,9 @@ cx_gt(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -303,9 +303,9 @@ cx_lt(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -344,9 +344,9 @@ cx_ge(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -385,9 +385,9 @@ cx_le(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -426,9 +426,9 @@ cx_ne(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);

20
src/maths/cmaths/cmath4.c

@ -38,9 +38,9 @@ cx_and(void *data1, void *data2, short int datatype1, short int datatype2, int l
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -76,9 +76,9 @@ cx_or(void *data1, void *data2, short int datatype1, short int datatype2, int le
double *dd1 = (double *) data1; double *dd1 = (double *) data1;
double *dd2 = (double *) data2; double *dd2 = (double *) data2;
double *d; double *d;
complex *cc1 = (complex *) data1;
complex *cc2 = (complex *) data2;
complex c1, c2;
ngcomplex_t *cc1 = (ngcomplex_t *) data1;
ngcomplex_t *cc2 = (ngcomplex_t *) data2;
ngcomplex_t c1, c2;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -113,7 +113,7 @@ cx_not(void *data, short int type, int length, int *newlength, short int *newtyp
{ {
double *d; double *d;
double *dd = (double *) data; double *dd = (double *) data;
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
int i; int i;
d = alloc_d(length); d = alloc_d(length);
@ -253,13 +253,13 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt
*newtype = type; *newtype = type;
if (type == VF_COMPLEX) { if (type == VF_COMPLEX) {
complex *c_outdata, *c_indata;
ngcomplex_t *c_outdata, *c_indata;
double *r_coefs, *i_coefs; double *r_coefs, *i_coefs;
double *scale; double *scale;
r_coefs = alloc_d(n); r_coefs = alloc_d(n);
i_coefs = alloc_d(n); i_coefs = alloc_d(n);
c_indata = (complex *) data;
c_indata = (ngcomplex_t *) data;
c_outdata = alloc_c(length); c_outdata = alloc_c(length);
scale = alloc_d(length); /* XXX */ scale = alloc_d(length); /* XXX */
if (pl->pl_scale->v_type == VF_COMPLEX) if (pl->pl_scale->v_type == VF_COMPLEX)
@ -423,7 +423,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt
void * void *
cx_group_delay(void *data, short int type, int length, int *newlength, short int *newtype, struct plot *pl, struct plot *newpl, int grouping) cx_group_delay(void *data, short int type, int length, int *newlength, short int *newtype, struct plot *pl, struct plot *newpl, int grouping)
{ {
complex *cc = (complex *) data;
ngcomplex_t *cc = (ngcomplex_t *) data;
double *v_phase = alloc_d(length); double *v_phase = alloc_d(length);
double *datos,adjust_final; double *datos,adjust_final;
double *group_delay = alloc_d(length); double *group_delay = alloc_d(length);

6
src/maths/cmaths/test_cx_j.c

@ -13,8 +13,8 @@ FILE *cp_err;
int int
main(void) main(void)
{ {
complex *c = NULL;
complex *d = NULL;
ngcomplex_t *c = NULL;
ngcomplex_t *d = NULL;
short int t1; short int t1;
short int t2; short int t2;
int n1; int n1;
@ -26,7 +26,7 @@ main(void)
c = alloc_c(n1); c = alloc_c(n1);
realpart(&c[0]) = .0; realpart(&c[0]) = .0;
imagpart(&c[0]) = 1.0; imagpart(&c[0]) = 1.0;
d = (complex *) cx_j((void *) c, t1, n1, &n2, &t2);
d = (ngcomplex_t *) cx_j((void *) c, t1, n1, &n2, &t2);
if (realpart(&d[0]) == -1 && imagpart(&d[0]) == 0) if (realpart(&d[0]) == -1 && imagpart(&d[0]) == 0)
return 0; return 0;
else else

2
src/maths/cmaths/test_cx_mag.c

@ -13,7 +13,7 @@ FILE *cp_err;
int int
main(void) main(void)
{ {
complex *c = NULL;
ngcomplex_t *c = NULL;
double *d = NULL; double *d = NULL;
short int t1; short int t1;
short int t2; short int t2;

2
src/maths/cmaths/test_cx_ph.c

@ -16,7 +16,7 @@ FILE *cp_err;
int int
main(void) main(void)
{ {
complex *c = NULL;
ngcomplex_t *c = NULL;
double *d = NULL; double *d = NULL;
short int t1; short int t1;
short int t2; short int t2;

2
src/ngsconvert.c

@ -179,7 +179,7 @@ oldread(char *name)
v->v_realdata = (double *) tmalloc(sizeof (double) v->v_realdata = (double *) tmalloc(sizeof (double)
* np); * np);
} else { } else {
v->v_compdata = (complex *) tmalloc(sizeof (complex)
v->v_compdata = (ngcomplex_t *) tmalloc(sizeof(ngcomplex_t)
* np); * np);
} }
} }

Loading…
Cancel
Save