@@ -201,99 +201,6 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUS
201201 ** SETUP UFUNCS **
202202 *****************************************************************************
203203 */
204-
205- /* Less automated additions to the ufuncs */
206-
207- static PyUFuncGenericFunction frexp_functions [] = {
208- #ifdef HAVE_FREXPF
209- HALF_frexp ,
210- FLOAT_frexp ,
211- #endif
212- DOUBLE_frexp
213- #ifdef HAVE_FREXPL
214- ,LONGDOUBLE_frexp
215- #endif
216- };
217-
218- static void * blank3_data [] = { (void * )NULL , (void * )NULL , (void * )NULL };
219- static void * blank6_data [] = { (void * )NULL , (void * )NULL , (void * )NULL ,
220- (void * )NULL , (void * )NULL , (void * )NULL };
221- static char frexp_signatures [] = {
222- #ifdef HAVE_FREXPF
223- NPY_HALF , NPY_HALF , NPY_INT ,
224- NPY_FLOAT , NPY_FLOAT , NPY_INT ,
225- #endif
226- NPY_DOUBLE , NPY_DOUBLE , NPY_INT
227- #ifdef HAVE_FREXPL
228- ,NPY_LONGDOUBLE , NPY_LONGDOUBLE , NPY_INT
229- #endif
230- };
231-
232- #if NPY_SIZEOF_LONG == NPY_SIZEOF_INT
233- #define LDEXP_LONG (typ ) typ##_ldexp
234- #else
235- #define LDEXP_LONG (typ ) typ##_ldexp_long
236- #endif
237-
238- static PyUFuncGenericFunction ldexp_functions [] = {
239- #ifdef HAVE_LDEXPF
240- HALF_ldexp ,
241- FLOAT_ldexp ,
242- LDEXP_LONG (HALF ),
243- LDEXP_LONG (FLOAT ),
244- #endif
245- DOUBLE_ldexp ,
246- LDEXP_LONG (DOUBLE )
247- #ifdef HAVE_LDEXPL
248- ,
249- LONGDOUBLE_ldexp ,
250- LDEXP_LONG (LONGDOUBLE )
251- #endif
252- };
253-
254- static char ldexp_signatures [] = {
255- #ifdef HAVE_LDEXPF
256- NPY_HALF , NPY_INT , NPY_HALF ,
257- NPY_FLOAT , NPY_INT , NPY_FLOAT ,
258- NPY_HALF , NPY_LONG , NPY_HALF ,
259- NPY_FLOAT , NPY_LONG , NPY_FLOAT ,
260- #endif
261- NPY_DOUBLE , NPY_INT , NPY_DOUBLE ,
262- NPY_DOUBLE , NPY_LONG , NPY_DOUBLE
263- #ifdef HAVE_LDEXPL
264- ,NPY_LONGDOUBLE , NPY_INT , NPY_LONGDOUBLE
265- ,NPY_LONGDOUBLE , NPY_LONG , NPY_LONGDOUBLE
266- #endif
267- };
268-
269- static void
270- InitOtherOperators (PyObject * dictionary ) {
271- PyObject * f ;
272- int num ;
273-
274- num = sizeof (frexp_functions ) / sizeof (frexp_functions [0 ]);
275- f = PyUFunc_FromFuncAndData (frexp_functions , blank3_data ,
276- frexp_signatures , num ,
277- 1 , 2 , PyUFunc_None , "frexp" ,
278- "Split the number, x, into a normalized" \
279- " fraction (y1) and exponent (y2)" ,0 );
280- PyDict_SetItemString (dictionary , "frexp" , f );
281- Py_DECREF (f );
282-
283- num = sizeof (ldexp_functions ) / sizeof (ldexp_functions [0 ]);
284- f = PyUFunc_FromFuncAndData (ldexp_functions , blank6_data , ldexp_signatures , num ,
285- 2 , 1 , PyUFunc_None , "ldexp" ,
286- "Compute y = x1 * 2**x2." ,0 );
287- PyDict_SetItemString (dictionary , "ldexp" , f );
288- Py_DECREF (f );
289-
290- #if defined(NPY_PY3K )
291- f = PyDict_GetItemString (dictionary , "true_divide" );
292- PyDict_SetItemString (dictionary , "divide" , f );
293- #endif
294- return ;
295- }
296-
297204NPY_VISIBILITY_HIDDEN PyObject * npy_um_str_out = NULL ;
298205NPY_VISIBILITY_HIDDEN PyObject * npy_um_str_subok = NULL ;
299206NPY_VISIBILITY_HIDDEN PyObject * npy_um_str_array_prepare = NULL ;
@@ -409,15 +316,18 @@ PyMODINIT_FUNC initumath(void)
409316 /* Load the ufunc operators into the array module's namespace */
410317 InitOperators (d );
411318
412- InitOtherOperators (d );
413-
414319 PyDict_SetItemString (d , "pi" , s = PyFloat_FromDouble (NPY_PI ));
415320 Py_DECREF (s );
416321 PyDict_SetItemString (d , "e" , s = PyFloat_FromDouble (NPY_E ));
417322 Py_DECREF (s );
418323 PyDict_SetItemString (d , "euler_gamma" , s = PyFloat_FromDouble (NPY_EULER ));
419324 Py_DECREF (s );
420325
326+ #if defined(NPY_PY3K )
327+ s = PyDict_GetItemString (d , "true_divide" );
328+ PyDict_SetItemString (d , "divide" , s );
329+ #endif
330+
421331#define ADDCONST (str ) PyModule_AddIntConstant(m, #str, UFUNC_##str)
422332#define ADDSCONST (str ) PyModule_AddStringConstant(m, "UFUNC_" #str, UFUNC_##str)
423333
0 commit comments