44a45,46 > > /* real polynomial, real x */ 46a49,54 > /* real polynomial, complex x */ > gsl_complex gsl_poly_complex_eval (const double c [], const int len, const gsl_complex x); > > /* complex polynomial, complex x */ > gsl_complex gsl_complex_poly_complex_eval (const gsl_complex c [], const int len, const gsl_complex x); > 57a66,100 > > extern inline > gsl_complex > gsl_poly_complex_eval(const double c[], const int len, const gsl_complex x) > { > int i; > gsl_complex ans; > GSL_SET_COMPLEX (&ans, c[len-1], 0.0); > for(i=len-1; i>0; i--) { > /* The following three lines are equivalent to > ans = gsl_complex_add_real (gsl_complex_mul (x, ans), c[i-1]); > but faster */ > double tmp = c[i-1] + GSL_REAL (x) * GSL_REAL (ans) - GSL_IMAG (x) * GSL_IMAG (ans); > GSL_SET_IMAG (&ans, GSL_IMAG (x) * GSL_REAL (ans) + GSL_REAL (x) * GSL_IMAG (ans)); > GSL_SET_REAL (&ans, tmp); > } > return ans; > } > > extern inline > gsl_complex > gsl_complex_poly_complex_eval(const gsl_complex c[], const int len, const gsl_complex x) > { > 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 (x, ans)); > but faster */ > double tmp = GSL_REAL (c[i-1]) + GSL_REAL (x) * GSL_REAL (ans) - GSL_IMAG (x) * GSL_IMAG (ans); > GSL_SET_IMAG (&ans, GSL_IMAG (c[i-1]) + GSL_IMAG (x) * GSL_REAL (ans) + GSL_REAL (x) * GSL_IMAG (ans)); > GSL_SET_REAL (&ans, tmp); > } > return ans; > }