/* W W AAA RRRR N N III N N GGG !!! ** W W A A R R NN N I NN N G G !!! ** W W W AAAAA RRRR N N N I N N N G ! ** W W W A A R R N NN I N NN G GG ** W W A A R R N N III N N GGG !!! ** ** WARNING: This file is program generated by codegenerator.py. ** ** DO NOT EDIT THIS FILE! Any changes made to this file will be lost! */ #include #include #include "libnumarray.h" /****************** Bool *******************/ static PyObject *BoolasPyValue(void *data) { return Py_BuildValue(PY_BOOL_CHAR, *((Bool *) data)); } SELF_CHECKED_CFUNC_DESCR(BoolasPyValue, CFUNC_AS_PY_VALUE); static int BoolfromPyValue(PyObject *value, void *dataptr) { Bool *data = (Bool *) dataptr; if (!PyNumber_Check(value)) return 0; else { if (PyLong_Check(value)) { *data = (Bool) isNonZERO(PyLong_AsLongLong(value)); } else if (PyInt_Check(value)) { *data = (Bool) isNonZERO(PyInt_AsLong(value)); } else if (PyFloat_Check(value)) { *data = (Bool) isNonZERO(PyFloat_AsDouble(value)); } else if (PyComplex_Check(value)) { *data = (Bool) isNonZERO(PyComplex_RealAsDouble(value)); } else { return 0; } if (PyErr_Occurred()) return 0; else return 1; } } SELF_CHECKED_CFUNC_DESCR(BoolfromPyValue, CFUNC_FROM_PY_VALUE); static int BoolasInt8(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Bool *tin = (Bool *) buffers[0]; Int8 *tout = (Int8 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(BoolasComplex32, sizeof(Bool), sizeof(Complex32)); static int BoolasComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Bool *tin = (Bool *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(BoolasComplex64, sizeof(Bool), sizeof(Complex64)); static int BoolasInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Bool *tin = (Bool *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int8asComplex32, sizeof(Int8), sizeof(Complex32)); static int Int8asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int8 *tin = (Int8 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int8asComplex64, sizeof(Int8), sizeof(Complex64)); static int Int8asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int8 *tin = (Int8 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int16asComplex32, sizeof(Int16), sizeof(Complex32)); static int Int16asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int16 *tin = (Int16 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int16asComplex64, sizeof(Int16), sizeof(Complex64)); static int Int16asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int16 *tin = (Int16 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int32asComplex32, sizeof(Int32), sizeof(Complex32)); static int Int32asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int32 *tin = (Int32 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int32asComplex64, sizeof(Int32), sizeof(Complex64)); static int Int32asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int32 *tin = (Int32 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt32asComplex32, sizeof(UInt32), sizeof(Complex32)); static int UInt32asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt32 *tin = (UInt32 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt32asComplex64, sizeof(UInt32), sizeof(Complex64)); static int UInt32asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt32 *tin = (UInt32 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt8asComplex32, sizeof(UInt8), sizeof(Complex32)); static int UInt8asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt8 *tin = (UInt8 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt8asComplex64, sizeof(UInt8), sizeof(Complex64)); static int UInt8asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt8 *tin = (UInt8 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt16asComplex32, sizeof(UInt16), sizeof(Complex32)); static int UInt16asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt16 *tin = (UInt16 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt16asComplex64, sizeof(UInt16), sizeof(Complex64)); static int UInt16asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt16 *tin = (UInt16 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Float32asComplex32, sizeof(Float32), sizeof(Complex32)); static int Float32asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Float32 *tin = (Float32 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Float32asComplex64, sizeof(Float32), sizeof(Complex64)); static int Float32asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Float32 *tin = (Float32 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Float64asComplex32, sizeof(Float64), sizeof(Complex32)); static int Float64asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Float64 *tin = (Float64 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Float64asComplex64, sizeof(Float64), sizeof(Complex64)); static int Float64asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Float64 *tin = (Float64 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir, ((Complex32 *) data)->i); } SELF_CHECKED_CFUNC_DESCR(Complex32asPyValue, CFUNC_AS_PY_VALUE); static int Complex32fromPyValue(PyObject *value, void *dataptr) { Complex32 *data = (Complex32 *) dataptr; if (!PyNumber_Check(value)) return 0; else { if (PyLong_Check(value)) { data->r = PyLong_AsLong(value); data->i = 0; } else if (PyInt_Check(value)) { data->r = PyInt_AsLong(value); data->i = 0; } else if (PyFloat_Check(value)) { data->r = PyFloat_AsDouble(value); data->i = 0; } else if (PyComplex_Check(value)) { data->r = PyComplex_RealAsDouble(value); data->i = PyComplex_ImagAsDouble(value); } else { return 0; } if (PyErr_Occurred()) return 0; else return 1; } } SELF_CHECKED_CFUNC_DESCR(Complex32fromPyValue, CFUNC_FROM_PY_VALUE); static int Complex32asBool(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Bool *tout = (Bool *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asBool, sizeof(Complex32), sizeof(Bool)); static int Complex32asInt8(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Int8 *tout = (Int8 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asInt8, sizeof(Complex32), sizeof(Int8)); static int Complex32asInt16(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Int16 *tout = (Int16 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asInt16, sizeof(Complex32), sizeof(Int16)); static int Complex32asInt32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Int32 *tout = (Int32 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asInt32, sizeof(Complex32), sizeof(Int32)); static int Complex32asUInt32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; UInt32 *tout = (UInt32 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asUInt32, sizeof(Complex32), sizeof(UInt32)); static int Complex32asUInt8(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; UInt8 *tout = (UInt8 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asUInt8, sizeof(Complex32), sizeof(UInt8)); static int Complex32asUInt16(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; UInt16 *tout = (UInt16 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asUInt16, sizeof(Complex32), sizeof(UInt16)); static int Complex32asFloat32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Float32 *tout = (Float32 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asFloat32, sizeof(Complex32), sizeof(Float32)); static int Complex32asFloat64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Float64 *tout = (Float64 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asFloat64, sizeof(Complex32), sizeof(Float64)); static int Complex32asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = tin->r; tout->i = tin->i; } END_THREADS return 0; } UFUNC_DESCR2(Complex32asComplex64, sizeof(Complex32), sizeof(Complex64)); static int Complex32asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asInt64, sizeof(Complex32), sizeof(Int64)); static int Complex32asUInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex32 *tin = (Complex32 *) buffers[0]; UInt64 *tout = (UInt64 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex32asUInt64, sizeof(Complex32), sizeof(UInt64)); /****************** Complex64 *******************/ static PyObject *Complex64asPyValue(void *data) { return PyComplex_FromDoubles(((Complex64 *) data)->r, ((Complex64 *) data)->i); } SELF_CHECKED_CFUNC_DESCR(Complex64asPyValue, CFUNC_AS_PY_VALUE); static int Complex64fromPyValue(PyObject *value, void *dataptr) { Complex64 *data = (Complex64 *) dataptr; if (!PyNumber_Check(value)) return 0; else { if (PyLong_Check(value)) { data->r = PyLong_AsLong(value); data->i = 0; } else if (PyInt_Check(value)) { data->r = PyInt_AsLong(value); data->i = 0; } else if (PyFloat_Check(value)) { data->r = PyFloat_AsDouble(value); data->i = 0; } else if (PyComplex_Check(value)) { data->r = PyComplex_RealAsDouble(value); data->i = PyComplex_ImagAsDouble(value); } else { return 0; } if (PyErr_Occurred()) return 0; else return 1; } } SELF_CHECKED_CFUNC_DESCR(Complex64fromPyValue, CFUNC_FROM_PY_VALUE); static int Complex64asBool(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Bool *tout = (Bool *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asBool, sizeof(Complex64), sizeof(Bool)); static int Complex64asInt8(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Int8 *tout = (Int8 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asInt8, sizeof(Complex64), sizeof(Int8)); static int Complex64asInt16(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Int16 *tout = (Int16 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asInt16, sizeof(Complex64), sizeof(Int16)); static int Complex64asInt32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Int32 *tout = (Int32 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asInt32, sizeof(Complex64), sizeof(Int32)); static int Complex64asUInt32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; UInt32 *tout = (UInt32 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asUInt32, sizeof(Complex64), sizeof(UInt32)); static int Complex64asUInt8(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; UInt8 *tout = (UInt8 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asUInt8, sizeof(Complex64), sizeof(UInt8)); static int Complex64asUInt16(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; UInt16 *tout = (UInt16 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asUInt16, sizeof(Complex64), sizeof(UInt16)); static int Complex64asFloat32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Float32 *tout = (Float32 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asFloat32, sizeof(Complex64), sizeof(Float32)); static int Complex64asFloat64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Float64 *tout = (Float64 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asFloat64, sizeof(Complex64), sizeof(Float64)); static int Complex64asComplex32(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Complex32 *tout = (Complex32 *) buffers[1]; BEGIN_THREADS for (i=0; ir = tin->r; tout->i = tin->i; } END_THREADS return 0; } UFUNC_DESCR2(Complex64asComplex32, sizeof(Complex64), sizeof(Complex32)); static int Complex64asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asInt64, sizeof(Complex64), sizeof(Int64)); static int Complex64asUInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Complex64 *tin = (Complex64 *) buffers[0]; UInt64 *tout = (UInt64 *) buffers[1]; BEGIN_THREADS for (i=0; ir); } END_THREADS return 0; } UFUNC_DESCR2(Complex64asUInt64, sizeof(Complex64), sizeof(UInt64)); /****************** Int64 *******************/ static PyObject *Int64asPyValue(void *data) { return Py_BuildValue(PY_LONG_CHAR, *((Int64 *) data)); } SELF_CHECKED_CFUNC_DESCR(Int64asPyValue, CFUNC_AS_PY_VALUE); static int Int64fromPyValue(PyObject *value, void *dataptr) { Int64 *data = (Int64 *) dataptr; if (!PyNumber_Check(value)) return 0; else { if (PyLong_Check(value)) { *data = (Int64)(PyLong_AsLongLong(value)); } else if (PyInt_Check(value)) { *data = (Int64)(PyInt_AsLong(value)); } else if (PyFloat_Check(value)) { *data = (Int64)(PyFloat_AsDouble(value)); } else if (PyComplex_Check(value)) { *data = (Int64)(PyComplex_RealAsDouble(value)); } else { return 0; } if (PyErr_Occurred()) return 0; else return 1; } } SELF_CHECKED_CFUNC_DESCR(Int64fromPyValue, CFUNC_FROM_PY_VALUE); static int Int64asBool(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin = (Int64 *) buffers[0]; Bool *tout = (Bool *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int64asComplex32, sizeof(Int64), sizeof(Complex32)); static int Int64asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin = (Int64 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(Int64asComplex64, sizeof(Int64), sizeof(Complex64)); static int Int64asUInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; Int64 *tin = (Int64 *) buffers[0]; UInt64 *tout = (UInt64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt64asComplex32, sizeof(UInt64), sizeof(Complex32)); static int UInt64asComplex64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt64 *tin = (UInt64 *) buffers[0]; Complex64 *tout = (Complex64 *) buffers[1]; BEGIN_THREADS for (i=0; ir = *tin; tout->i = 0; } END_THREADS return 0; } UFUNC_DESCR2(UInt64asComplex64, sizeof(UInt64), sizeof(Complex64)); static int UInt64asInt64(long niter, long ninargs, long noutargs, void **buffers, long *bsizes) { long i; UInt64 *tin = (UInt64 *) buffers[0]; Int64 *tout = (Int64 *) buffers[1]; BEGIN_THREADS for (i=0; i