/* * author: Pierre Schnizer * created: June 2003 */ #include #include #include #include #include #include #define IMPORTALL 1 #ifdef PyGSL_NUMERIC #include #include #else #error numarray ufuncs not yet supported! #ifdef IMPORTALL #undef IMPORTALL #endif #endif /* PyGSL_NUMERIC */ #include /* #include #include */ static PyObject* gsl_module_error; static PyObject* module = NULL; /*used by the backtrace*/ static void invoke_error_handler(const char *filename, const char *func_name, int errno, int element); static void invoke_error_handler(const char *filename, const char *func_name, int errno, int element) { ; /* DEBUG_MESS(2, "Got error flag of %d for element number %d", errno, element); */ } /* I add the evaluate functions types by hand to have an extra check */ #ifdef IMPORTALL #include "sf__arrays.c" #define SF_ARRAY(name, function) \ static PyObject* sf_ ## name (PyObject *self, PyObject *args) \ { \ PyObject * tmp; \ FUNC_MESS_BEGIN(); \ tmp = PyGSL_sf_array_evaluator_ ## function (self, args, gsl_sf_ ## name); \ if (tmp == NULL){ \ PyGSL_add_traceback(module, __FILE__, __FUNCTION__, __LINE__); \ } \ FUNC_MESS_END(); \ return tmp; \ } SF_ARRAY(bessel_Jn_array, iid_ad); SF_ARRAY(bessel_Yn_array, iid_ad); SF_ARRAY(bessel_In_array, iid_ad); SF_ARRAY(bessel_Kn_array, iid_ad); SF_ARRAY(bessel_Kn_scaled_array, iid_ad); SF_ARRAY(bessel_jl_array, id_ad); SF_ARRAY(bessel_jl_steed_array, id_ad); SF_ARRAY(bessel_yl_array, id_ad); SF_ARRAY(bessel_il_scaled_array, id_ad); SF_ARRAY(bessel_kl_scaled_array, id_ad); #undef SF_ARRAY #endif static PyMethodDef sf_functions[] = { #ifdef IMPORTALL {"bessel_Jn_array", (PyCFunction) sf_bessel_Jn_array, METH_VARARGS, NULL}, {"bessel_Yn_array", (PyCFunction) sf_bessel_Yn_array, METH_VARARGS, NULL}, {"bessel_In_array", (PyCFunction) sf_bessel_In_array, METH_VARARGS, NULL}, {"bessel_Kn_array", (PyCFunction) sf_bessel_Kn_array, METH_VARARGS, NULL}, {"bessel_Kn_scaled_array", (PyCFunction) sf_bessel_Kn_scaled_array, METH_VARARGS, NULL}, {"bessel_jl_array", (PyCFunction) sf_bessel_jl_array, METH_VARARGS, NULL}, {"bessel_jl_steed_array", (PyCFunction) sf_bessel_jl_steed_array, METH_VARARGS, NULL}, {"bessel_yl_array", (PyCFunction) sf_bessel_yl_array, METH_VARARGS, NULL}, {"bessel_il_scaled_array", (PyCFunction) sf_bessel_il_scaled_array, METH_VARARGS, NULL}, {"bessel_kl_scaled_array", (PyCFunction) sf_bessel_kl_scaled_array, METH_VARARGS, NULL}, #endif {NULL, NULL, 0} }; #ifdef IMPORTALL #include "sf__evals.c" #include "sf__data.c" #endif static void * polar_to_rect_data [] = { (void *) gsl_sf_polar_to_rect, (void *) gsl_sf_polar_to_rect}; static void * rect_to_polar_data [] = { (void *) gsl_sf_rect_to_polar, (void *) gsl_sf_rect_to_polar}; static char PyGSL_sf_ufunc_qi_dd_D_one_types [] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CDOUBLE,PyArray_CDOUBLE }; static char PyGSL_sf_ufunc_qi_D_dd_one_types [] = { PyArray_CFLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_CDOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE }; typedef int PyGSL_sf_ufunc_qi_dd_D_one(double, double, gsl_sf_result *, gsl_sf_result *); void PyGSL_sf_ufunc_qi_dd_D(char **args, int *dimensions, int *steps, void *func) { int is0=steps[0], is1=steps[1], os0=steps[2], os1=steps[3]; char *ip0=args[0], *ip1=args[1], *op0=args[2], *op1=args[3]; double *dop, *derr; gsl_sf_result x, y; int i, tmp; FUNC_MESS_BEGIN(); DEBUG_MESS(2, "dimensions = %d %d %d", dimensions[0], dimensions[1],dimensions[2]); DEBUG_MESS(2, "steps = %d %d %d", steps[0], steps[1], steps[2]); DEBUG_MESS(2, "args = %p %p %p", args[0], args[1], args[2]); for(i = 0; i