PyMODINIT_FUNC
initumath_tests(void)
#endif
{
    PyObject *m;
    PyObject *d;
    PyObject *version;

#if defined(NPY_PY3K)
    m = PyModule_Create(&moduledef);
#else
    m = Py_InitModule("umath_tests", UMath_TestsMethods);
#endif
    if (m == NULL)
        return RETVAL;

    import_array();
    import_ufunc();

    d = PyModule_GetDict(m);

    version = PyString_FromString("0.1");
    PyDict_SetItemString(d, "__version__", version);
    Py_DECREF(version);

    /* Load the ufunc operators into the module's namespace */
    addUfuncs(d);

    if (PyErr_Occurred()) {
        PyErr_SetString(PyExc_RuntimeError,
                        "cannot load umath_tests module.");
    }

    return RETVAL;
}
示例#2
0
文件: numpy.cpp 项目: DoDNet/Halide
void initialize(bool register_scalar_converters) 
{
  wrap_import_array();
  import_ufunc();
  if (register_scalar_converters)
	dtype::register_scalar_converters();
}
示例#3
0
PyMODINIT_FUNC init_cephes(void) {
  PyObject *m, *d, *s;
  
  /* Create the module and add the functions */
  m = Py_InitModule("_cephes", methods); 

  /* Import the ufunc objects */
  import_array();
  import_ufunc();

  /* Add some symbolic constants to the module */
  d = PyModule_GetDict(m);

  s = PyString_FromString("2.0");
  PyDict_SetItemString(d, "__version__", s);
  Py_DECREF(s);

  /* Add scipy_special_print_error_message global variable */
  /*  No, instead acessible through errprint */

  /* Load the cephes operators into the array module's namespace */
  Cephes_InitOperators(d); 
  
  /* Check for errors */
  if (PyErr_Occurred())
    Py_FatalError("can't initialize module _cephes");
}
示例#4
0
void init_mergesort(void) {
    import_array();
    import_ufunc();
	m = Py_InitModule3("_mergesort", module_methods, "mergesort module for parallel mergesort");
	PyObject * mergefunc = PyCFunction_New(module_methods, NULL);
	PyObject * argmergefunc = PyCFunction_New(module_methods + 1, NULL);
	PyObject * permutefunc = PyCFunction_New(module_methods + 2, NULL);
	PyObject * reorderdtypefunc = PyCFunction_New(module_methods + 3, NULL);
	PyModule_AddObject(m, "merge", mergefunc);
	PyModule_AddObject(m, "argmerge", argmergefunc);
	PyModule_AddObject(m, "permute", permutefunc);
	PyModule_AddObject(m, "reorderdtype", reorderdtypefunc);
}
示例#5
0
文件: numpy.cpp 项目: CUAir/edges
static void* initialize2(bool register_scalar_converters) {
	init_numpy();
	import_ufunc();
	if (register_scalar_converters)
		dtype::register_scalar_converters();
}