![]() | ![]() | ||||||||||||
[help-gsl] Re: Test suite? (2008-09-18)
On Thursday 18 September 2008 01:11:22 Liam Healy wrote: > I modified the function in poly/eval.c almost like this, but using z > instead of x as that looks more correct and it is what is in the > commented-out portion > > gsl_complex > gsl_complex_poly_complex_eval(const gsl_complex c[], const int len, > const gsl_complex z) > { > int i; > gsl_complex ans = c[len-1]; > for(i=len-1; i>0; i--) { > /* The following three lines are equivalent to > ans = gsl_complex_add (c[i-1], gsl_complex_mul (z, ans)); > but faster */ > > ans = gsl_complex_add (c[i-1], gsl_complex_mul (z, ans)); > > /* > double tmp = GSL_REAL (c[i-1]) + GSL_REAL (z) * GSL_REAL (ans) - > GSL_IMAG (z) * GSL_IMAG (ans); > GSL_SET_IMAG (&ans, GSL_IMAG (c[i-1]) + GSL_IMAG (z) * GSL_REAL > (ans) + GSL_REAL (z) * GSL_IMAG (ans)); > GSL_SET_REAL (&ans, tmp); > */ > } > return ans; > } > > However, when I make, it ends with > make[2]: Entering directory `/home/liam/mathematics/gsl-1.11/poly' > /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. > -I.. -I.. -g -O2 -c -o eval.lo eval.c > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I.. -g -O2 -c eval.c > -fPIC -DPIC -o .libs/eval.o > eval.c: In function 'gsl_complex_poly_complex_eval': > eval.c:65: error: incompatible types in assignment > make[2]: *** [eval.lo] Error 1 > make[2]: Leaving directory `/home/liam/mathematics/gsl-1.11/poly' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/liam/mathematics/gsl-1.11' > make: *** [all] Error 2 > Hi Liam, If you change the code to use the functions gsl_complex_add and gsl_complex_mul, then you have to use: #include <gsl/gsl_complex_math.h> grtz Steven
| |||||||||||||
![]() | ![]() |







