summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/CodeGenerators/generate_array_api.py656
-rw-r--r--base/CodeGenerators/generate_ufunc_api.py185
-rw-r--r--base/CodeGenerators/generate_umath.py462
-rw-r--r--base/_na_imports.py124
-rw-r--r--base/_nc_imports.py91
-rw-r--r--base/fastumath_nounsigned.inc2461
-rw-r--r--base/fastumath_unsigned.inc2908
-rw-r--r--base/fastumathmodule.c711
-rw-r--r--base/include/scipy/arrayobject.h1204
-rw-r--r--base/include/scipy/ufuncobject.h279
-rw-r--r--base/isnan.c241
-rw-r--r--base/mconf_lite.h6
-rw-r--r--base/mconf_lite_BE.h119
-rw-r--r--base/mconf_lite_LE.h119
-rw-r--r--base/numerix.h34
-rwxr-xr-xbase/setup_scipy_base.py88
16 files changed, 1483 insertions, 8205 deletions
diff --git a/base/CodeGenerators/generate_array_api.py b/base/CodeGenerators/generate_array_api.py
deleted file mode 100644
index 8d817fe74..000000000
--- a/base/CodeGenerators/generate_array_api.py
+++ /dev/null
@@ -1,656 +0,0 @@
-
-# doc is comment_documentation
-
-# use list so order is preserved.
-objectapi_list = [
- (r"""Set internal structure with number functions that all
- arrays will use
- """,
- 'SetNumericOps','PyObject *dict','int'),
-
- (r"""Get dictionary showing number functions that all
- arrays will use
- """,
- 'GetNumericOps','void','PyObject *'),
-
-
- (r"""For object arrays, increment all internal references.
- """,
- 'INCREF','PyArrayObject *','int'),
-
- (r"""Decrement all internal references for object arrays.
- """,
- 'XDECREF','PyArrayObject *','int'),
-
- (r"""Set the array print function to be a Python function.
- """,
- 'SetStringFunction','PyObject *op, int repr','void'),
-
- (r"""Get the PyArray_Descr structure for a type.
- """,
- 'DescrFromType','int','PyArray_Descr *'),
-
- (r"""Get pointer to zero of correct type for array.
- """,
- 'Zero', 'PyArrayObject *', 'char *'),
-
- (r"""Get pointer to one of correct type for array
- """,
- 'One', 'PyArrayObject *', 'char *'),
-
-
- (r"""Cast an array to a different type.
- """,
- 'Cast','PyArrayObject *, int','PyObject *'),
-
- (r"""Cast an array using typecode structure.
- """,
- 'CastToType','PyArrayObject *, PyArray_Typecode *','PyObject *'),
-
- (r"""Cast to an already created array.
- """,
- 'CastTo', 'PyArrayObject *, PyArrayObject *', 'int'),
-
- (r"""Check the type coercion rules.
- """,
- 'CanCastSafely','int fromtype, int totype','int'),
-
- (r"""Return the typecode of the array a Python object would be
- converted to
- """,
- 'ObjectType','PyObject *, int','int'),
-
- (r"""Return type typecode from array scalar.
- """,
- 'TypecodeFromScalar','PyObject *, PyArray_Typecode *','void'),
-
- (r"""Compute the size of an array (in number of items)
- """,
- 'Size','PyObject *','intp'),
-
- (r"""Get scalar-equivalent to 0-d array
- """,
- 'Scalar', 'char *, int, int, int', 'PyObject *'),
-
- (r"""Get scalar-equivalent to 0-d array
- """,
- 'ToScalar', 'char *, PyArrayObject *', 'PyObject *'),
-
- (r"""Get 0-dim array from scalar
- """,
- 'FromScalar', 'PyObject *, PyArray_Typecode *', 'PyObject *'),
-
- (r"""Construct an empty array from dimensions and typenum
- """,
- 'FromDims','int nd, int *, int typenum','PyObject *'),
-
- (r"""Construct an array from dimensions, typenum, and a pointer
- to the data. Python will never free this (unless you later set
- the OWN_DATA flag).
- """,
- 'FromDimsAndData','int, int *, int, char *','PyObject *'),
-
- (r"""Construct an array from an arbitrary Python Object.
- Last two integers are min_dimensions, and max_dimensions.
- If max_dimensions = 0, then any number of dimensions are allowed.
- Fix the dimension by setting min_dimension == max_dimension.
- If the array is already contiguous (and aligned and not swapped)
- no copy is done, just a new reference created.
- """,
- 'ContiguousFromObject',
- 'PyObject *, int typenum, int, int',
- 'PyObject *'),
-
- (r"""Same as ContiguousFromObject except ensure a copy.
- """,
- 'CopyFromObject','PyObject *, int, int, int','PyObject *'),
-
- (r"""Can return a discontiguous array (but aligned and byteswapped)
- """,
- 'FromObject','PyObject *, int, int, int','PyObject *'),
-
- (r"""
- """,
- 'FromAny', 'PyObject *, PyArray_Typecode *, int, int, int', 'PyObject *'),
-
- (r"""
- """,
- 'FromFile', 'FILE *, PyArray_Typecode *, intp, char *','PyObject *'),
-
- (r"""
- """,
- 'FromBuffer', 'PyObject *, PyArray_Typecode *, intp, int','PyObject *'),
-
- (r"""Return either an array or the appropriate Python object if the
- array is 0d and matches a Python type.
- """,
- 'Return','PyArrayObject *','PyObject *'),
-
- (r"""Get a subset of bytes from each element of the array
- """,
- 'GetField', 'PyArrayObject *, PyArray_Typecode *, int', 'PyObject *'),
-
- (r"""
- """,
- 'Byteswap', 'PyArrayObject *, bool', 'PyObject *'),
-
- (r"""Resize (reallocate data). Only works if nothing else is
- referencing this array and it is contiguous.
- """,
- 'Resize','PyArrayObject *ap, PyArray_Dims *newshape','PyObject *'),
-
- (r"""Copy an array.
- """,
- 'Copy','PyArrayObject *','PyObject *'),
-
- (r"""Like FromDimsAndData but uses the Descr structure instead of
- typecode as input.
- """,
- 'FromDimsAndDataAndDescr','int, int *, PyArray_Descr *, char *',
- 'PyObject *'),
-
- (r"""Copy an Array to another array.
- """,
- 'CopyArray','PyArrayObject *dest, PyArrayObject *src','int'),
-
- (r"""To List
- """,
- 'ToList','PyArrayObject *', 'PyObject *'),
-
- (r"""To File
- """,
- 'ToFile','PyArrayObject *, FILE *, char *, char *', 'int'),
-
- (r"""
- """,
- 'Dump', 'PyObject *, PyObject *, int', 'int'),
-
- (r"""
- """,
- 'Dumps', 'PyObject *, int', 'PyObject *'),
-
-
- (r"""Is the typenum valid?
- """,
- 'ValidType','int','int'),
-
- (r"""Update Several Flags at once.
- """,
- 'UpdateFlags','PyArrayObject *, int','void'),
-
- (r"""Generic new array creation routine.
- """,
- 'New','PyTypeObject *, int nd, intp *dims, int type, intp *strides, char *data, int itemsize, int fortran, PyArrayObject *arr', 'PyObject *'),
-
- (r"""Get Priority from object
- """,
- 'GetPriority', 'PyObject *, double', 'double'),
-
- (r"""Get Buffers.
- """,
- 'GetBuffer','int num','char *'),
-
- (r"""Get Iterator.
- """,
- 'IterNew','PyObject *', 'PyObject *'),
-
- (r"""Map Iterator.
- """,
- 'MapIterNew', 'PyObject *', 'PyObject *'),
-
- (r"""Bind Map Iterator
- """,
- 'MapIterBind', 'PyArrayMapIterObject *, PyArrayObject *', 'void'),
-
- (r"""Bind Map Iterator
- """,
- 'MapIterReset', 'PyArrayMapIterObject *', 'void'),
-
- (r"""
- """,
- 'MapIterNext', 'PyArrayMapIterObject *', 'void'),
-
- (r"""
- """,
- 'PyIntAsInt', 'PyObject *', 'int'),
-
- (r"""
- """,
- 'PyIntAsIntp','PyObject *', 'intp'),
-
- (r"""
- """,
- 'Broadcast', 'PyArrayMultiIterObject *', 'int'),
-
- (r"""
- """,
- 'FillObjectArray', 'PyArrayObject *, PyObject *','void'),
-
- (r"""
- """,
- 'CheckStrides', 'int, int, intp, intp *, intp *', 'bool')
-
- ]
-
-multiapi_list = [
- (r"""Return Transpose.
- """,
- 'Transpose','PyArrayObject *, PyObject *','PyObject *'),
-
- (r"""Take
- """,
- 'Take','PyArrayObject *, PyObject *, int axis','PyObject *'),
-
- (r"""Put values into an array
- """,
- 'Put','PyArrayObject *arr, PyObject *items, PyObject *values','PyObject *'),
-
- (r"""Put values into an array according to a mask.
- """,
- 'PutMask','PyArrayObject *arr, PyObject *mask, PyObject *values','PyObject *'),
-
- (r"""Repeat the array.
- """,
- 'Repeat','PyArrayObject *, PyObject *, int','PyObject *'),
-
- (r"""Numeric.choose()
- """,
- 'Choose','PyArrayObject *, PyObject *','PyObject *'),
-
- (r"""Sort an array
- """,
- 'Sort','PyArrayObject *, int', 'PyObject *'),
-
- (r"""ArgSort an array
- """,
- 'ArgSort','PyArrayObject *, int','PyObject *'),
-
- (r"""Numeric.searchsorted(a,v)
- """,
- 'SearchSorted','PyArrayObject *, PyObject *','PyObject *'),
-
- (r"""ArgMax
- """,
- 'ArgMax','PyArrayObject *, int','PyObject *'),
-
- (r"""ArgMin
- """,
- 'ArgMin','PyArrayObject *, int','PyObject *'),
-
- (r"""Reshape an array
- """,
- 'Reshape','PyArrayObject *, PyObject *','PyObject *'),
-
- (r"""New shape for an array
- """,
- 'Newshape','PyArrayObject *, PyArray_Dims *','PyObject *'),
-
- (r"""View
- """,
- 'View','PyArrayObject *, PyArray_Typecode *','PyObject *'),
-
- (r"""SwapAxes
- """,
- 'SwapAxes','PyArrayObject *, int, int','PyObject *'),
-
- (r"""Max
- """,
- 'Max','PyArrayObject *, int','PyObject *'),
-
- (r"""Min
- """,
- 'Min','PyArrayObject *, int','PyObject *'),
-
- (r"""Ptp
- """,
- 'Ptp','PyArrayObject *, int','PyObject *'),
-
- (r"""Mean
- """,
- 'Mean','PyArrayObject *, int, int','PyObject *'),
-
- (r"""Trace
- """,
- 'Trace','PyArrayObject *, int, int, int, int','PyObject *'),
-
- (r"""Diagonal
- """,
- 'Diagonal','PyArrayObject *, int, int, int','PyObject *'),
-
- (r"""Clip
- """,
- 'Clip','PyArrayObject *, PyObject *, PyObject *','PyObject *'),
-
- (r"""Conjugate
- """,
- 'Conjugate','PyArrayObject *','PyObject *'),
-
- (r"""Nonzero
- """,
- 'Nonzero','PyArrayObject *','PyObject *'),
-
- (r"""Std
- """,
- 'Std','PyArrayObject *, int, int','PyObject *'),
-
- (r"""Sum
- """,
- 'Sum','PyArrayObject *, int, int','PyObject *'),
-
- (r"""CumSum
- """,
- 'CumSum','PyArrayObject *, int, int','PyObject *'),
-
- (r"""Prod
- """,
- 'Prod','PyArrayObject *, int, int','PyObject *'),
-
- (r"""CumProd
- """,
- 'CumProd','PyArrayObject *, int, int','PyObject *'),
-
- (r"""All
- """,
- 'All','PyArrayObject *, int','PyObject *'),
-
- (r"""Any
- """,
- 'Any','PyArrayObject *, int','PyObject *'),
-
- (r"""Compress
- """,
- 'Compress','PyArrayObject *, PyObject *, int','PyObject *'),
-
- (r"""Flatten
- """,
- 'Flatten','PyArrayObject *','PyObject *'),
-
- (r"""Ravel
- """,
- 'Ravel','PyArrayObject *','PyObject *'),
-
- (r"""Sign
- """,
- 'Sign','PyArrayObject *','PyObject *'),
-
- (r"""Round
- """,
- 'Round','PyArrayObject *, int','PyObject *'),
-
- (r"""Multiply a List
- """,
- 'MultiplyList','intp *lp, int n','intp'),
-
- (r"""Compare Lists
- """,
- 'CompareLists','intp *, intp *, int n','int'),
-
- (r"""Simulat a C-array
- """,
- "AsCArray",'PyObject **, void *ptr, intp *, int, int','int'),
-
- (r"""Convert to a 1D C-array
- """,
- 'As1D','PyObject **, char **ptr, int *d1, int typecode','int'),
-
- (r"""Convert to a 2D C-array
- """,
- 'As2D','PyObject **, char ***ptr, int *d1, int *d2, int typecode','int'),
-
- (r"""Free pointers created if As2D is called
- """,
- 'Free','PyObject *, void *','int'),
-
- (r"""Useful to pass as converter function for O& processing in
- PyArgs_ParseTuple.
- """,
- 'Converter','PyObject *, PyObject **','int'),
-
- (r"""PyArray_IntpFromSequence
- """,
- 'IntpFromSequence', 'PyObject *, intp *, int', 'int'),
-
- (r"""Concatenate an arbitrary Python sequence into
- an array.
- """,
- 'Concatenate','PyObject *, int','PyObject *'),
-
- (r"""Numeric.innerproduct(a,v)
- """,
- 'InnerProduct','PyObject *, PyObject *','PyObject *'),
-
- (r"""Numeric.matrixproduct(a,v)
- """,
- 'MatrixProduct','PyObject *, PyObject *','PyObject *'),
-
- (r"""Fast Copy and Transpose
- """,
- 'CopyAndTranspose','PyObject *','PyObject *'),
-
- (r"""Numeric.correlate(a1,a2,mode)
- """,
- 'Correlate','PyObject *, PyObject *, int mode','PyObject *'),
-
- (r"""Typestr converter
- """,
- 'TypestrConvert', 'int, int', 'int'),
-
- (r"""Get typenum from an object -- a converter function
- """,
- 'TypecodeConverter','PyObject *, PyArray_Typecode *', 'int'),
-
- (r"""Get intp chunk from sequence
- """,
- 'IntpConverter', 'PyObject *, PyArray_Dims *', 'int'),
-
- (r"""Get buffer chunk from object
- """,
- 'BufferConverter', 'PyObject *, PyArray_Chunk *', 'int'),
-
- (r"""Get axis from an object (possibly None) -- a converter function,
- """,
- 'AxisConverter','PyObject *, int *', 'int'),
-
- (r"""Convert an object to true / false
- """,
- 'BoolConverter','PyObject *, bool *', 'int'),
-
- (r"""
- """,
- 'EquivalentTypes', 'PyArray_Typecode *, PyArray_Typecode *', 'bool'),
-
- (r"""
- """,
- 'EquivArrTypes', 'PyArrayObject *, PyArrayObject *', 'bool'),
-
- (r"""Zeros
- """,
- 'Zeros', 'int, intp *, PyArray_Typecode *', 'PyObject *'),
-
- (r"""Empty
- """,
- 'Empty', 'int, intp *, PyArray_Typecode *', 'PyObject *'),
-
-
- (r"""Where
- """,
- 'Where', 'PyObject *, PyObject *, PyObject *', 'PyObject *'),
-
- (r"""Arange
- """,
- 'Arange', 'double, double, double, int', 'PyObject *')
-
- ]
-
-
-types = ['Generic','Numeric','Integer','SignedInteger','UnsignedInteger',
- 'Floating', 'Complex', 'Flexible', 'Character',
- 'Bool','Byte','Short','Int', 'Long', 'LongLong', 'UByte', 'UShort',
- 'UInt', 'ULong', 'ULongLong', 'Float', 'Double', 'LongDouble',
- 'CFloat', 'CDouble', 'CLongDouble', 'Object', 'String', 'Unicode',
- 'Void']
-
-# API fixes for __arrayobject_api.h
-
-fixed = 3
-numtypes = len(types) + fixed
-numobject = len(objectapi_list) + numtypes
-nummulti = len(multiapi_list)
-numtotal = numobject + nummulti
-
-
-module_list = []
-extension_list = []
-init_list = []
-
-# setup types
-for k, atype in enumerate(types):
- num = fixed + k
- astr = " (void *) &Py%sArrType_Type," % types[k]
- init_list.append(astr)
- astr = "static PyTypeObject Py%sArrType_Type;" % types[k]
- module_list.append(astr)
- astr = "#define Py%sArrType_Type (*(PyTypeObject *)PyArray_API[%d])" % \
- (types[k], num)
- extension_list.append(astr)
-
-
-#setup object API
-for k, item in enumerate(objectapi_list):
- num = numtypes + k
- astr = "static %s PyArray_%s \\\n (%s);" % \
- (item[3],item[1],item[2])
- module_list.append(astr)
- astr = "#define PyArray_%s \\\n (*(%s (*)(%s)) \\\n"\
- " PyArray_API[%d])" % (item[1],item[3],item[2],num)
- extension_list.append(astr)
- astr = " (void *) PyArray_%s," % item[1]
- init_list.append(astr)
-
-
-##outstr = r"""
-###ifdef _ARRAYOBJECT
-
-##static PyTypeObject PyArray_Type;
-##static PyTypeObject PyArrayIter_Type;
-
-##%s
-
-
-###else
-
-###define PyArray_Type (*(PyTypeObject *)PyArray_API[0])
-###define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[1])
-
-##%s
-
-###endif
-##""" % ('\n'.join(module_list), '\n'.join(extension_list))
-
-### Write out to header
-##fid = open('__arrayobject_api.h','w')
-##fid.write(outstr)
-##fid.close()
-
-
-##outstr = r"""
-##/* Export only these pointers */
-
-##void *arrayobject_API[] = {
-## (void *) &PyArray_Type,
-## (void *) &PyArrayIter_Type,
-##%s
-##};
-##""" % '\n'.join(init_list)
-
-###Write out to c-code
-##fid = open('__arrayobject_api.c','w')
-##fid.write(outstr)
-##fid.close()
-
-
-#module_list = []
-#extension_list = []
-#init_list = []
-
-# setup multiarray module API
-for k, item in enumerate(multiapi_list):
- num = numobject + k
- astr = "static %s PyArray_%s \\\n (%s);" % \
- (item[3],item[1],item[2])
- module_list.append(astr)
- astr = "#define PyArray_%s \\\n (*(%s (*)(%s)) \\\n"\
- " PyArray_API[%d])" % (item[1],item[3],item[2],num)
- extension_list.append(astr)
- astr = " (void *) PyArray_%s," % item[1]
- init_list.append(astr)
-
-
-outstr = r"""
-#ifdef _MULTIARRAYMODULE
-
-static PyTypeObject PyArray_Type;
-static PyTypeObject PyArrayIter_Type;
-static PyTypeObject PyArrayMapIter_Type;
-
-%s
-
-#else
-
-static void **PyArray_API=NULL;
-
-#define PyArray_Type (*(PyTypeObject *)PyArray_API[0])
-#define PyArrayIter_Type (*(PyTypeObject *)PyArray_API[1])
-#define PyArrayMapIter_Type (*(PyTypeObject *)PyArray_API[2])
-
-%s
-
-static int
-import_array(void)
-{
- PyObject *numpy = PyImport_ImportModule("scipy.base.multiarray");
- PyObject *c_api = NULL;
- if (numpy == NULL) return -1;
- c_api = PyObject_GetAttrString(numpy, "_ARRAY_API");
- if (c_api == NULL) {Py_DECREF(numpy); return -1;}
- if (PyCObject_Check(c_api)) {
- PyArray_API = (void **)PyCObject_AsVoidPtr(c_api);
- }
- Py_DECREF(c_api);
- Py_DECREF(numpy);
- if (PyArray_API == NULL) return -1;
- return 0;
-}
-
-#endif
-
-""" % ('\n'.join(module_list),
- '\n'.join(extension_list))
-
-# Write to header
-fid = open('__multiarray_api.h','w')
-fid.write(outstr)
-fid.close()
-
-
-outstr = r"""
-/* These pointers will be stored in the C-object for use in other
- extension modules
-*/
-
-void *PyArray_API[] = {
- (void *) &PyArray_Type,
- (void *) &PyArrayIter_Type,
- (void *) &PyArrayMapIter_Type,
-%s
-};
-""" % '\n'.join(init_list)
-
-# Write to c-code
-fid = open('__multiarray_api.c','w')
-fid.write(outstr)
-fid.close()
-
-
-
-
diff --git a/base/CodeGenerators/generate_ufunc_api.py b/base/CodeGenerators/generate_ufunc_api.py
deleted file mode 100644
index 2f78f8042..000000000
--- a/base/CodeGenerators/generate_ufunc_api.py
+++ /dev/null
@@ -1,185 +0,0 @@
-
-# doc is comment_documentation
-
-# use list so order is preserved.
-ufunc_api_list = [
- (r"""
- """,
- 'FromFuncAndData', 'PyUFuncGenericFunction *, void **, char *, int, int, int, int, char *, char *, int', 'PyObject *'),
- (r"""
- """,
- 'GenericFunction', 'PyUFuncObject *, PyObject *, PyArrayObject **', 'int'),
-
- (r"""
- """,
- 'f_f_As_d_d','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'd_d','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'f_f','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'g_g','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'F_F_As_D_D','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'F_F','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'D_D','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'G_G','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'O_O','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'ff_f_As_dd_d','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'ff_f','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'dd_d','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'gg_g','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'FF_F_As_DD_D','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'DD_D','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'FF_F','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'GG_G','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'OO_O','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'O_O_method','char **, intp *, intp *, void *','void'),
-
- (r"""
- """,
- 'checkfperr', 'int, PyObject *', 'int'),
-
- (r"""
- """,
- 'clearfperr', 'void', 'void')
-
-]
-
-# API fixes for __arrayobject_api.h
-
-fixed = 1
-nummulti = len(ufunc_api_list)
-numtotal = fixed + nummulti
-
-
-module_list = []
-extension_list = []
-init_list = []
-
-#setup object API
-for k, item in enumerate(ufunc_api_list):
- num = fixed + k
- astr = "static %s PyUFunc_%s \\\n (%s);" % \
- (item[3],item[1],item[2])
- module_list.append(astr)
- astr = "#define PyUFunc_%s \\\n (*(%s (*)(%s)) \\\n"\
- " PyUFunc_API[%d])" % (item[1],item[3],item[2],num)
- extension_list.append(astr)
- astr = " (void *) PyUFunc_%s," % item[1]
- init_list.append(astr)
-
-
-outstr = r"""
-#ifdef _UMATHMODULE
-
-static PyTypeObject PyUFunc_Type;
-
-%s
-
-#else
-
-static void **PyUFunc_API;
-
-#define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0])
-
-%s
-
-static int
-import_ufunc(void)
-{
- PyObject *numpy = PyImport_ImportModule("scipy.base.umath");
- PyObject *c_api = NULL;
-
- if (numpy == NULL) return -1;
- c_api = PyObject_GetAttrString(numpy, "_UFUNC_API");
- if (c_api == NULL) {Py_DECREF(numpy); return -1;}
- if (PyCObject_Check(c_api)) {
- PyUFunc_API = (void **)PyCObject_AsVoidPtr(c_api);
- }
- Py_DECREF(c_api);
- Py_DECREF(numpy);
- if (PyUFunc_API == NULL) return -1;
- return 0;
-}
-
-#endif
-
-""" % ('\n'.join(module_list),
- '\n'.join(extension_list))
-
-# Write to header
-fid = open('__ufunc_api.h','w')
-fid.write(outstr)
-fid.close()
-
-
-outstr = r"""
-/* These pointers will be stored in the C-object for use in other
- extension modules
-*/
-
-void *PyUFunc_API[] = {
- (void *) &PyUFunc_Type,
-%s
-};
-""" % '\n'.join(init_list)
-
-# Write to c-code
-fid = open('__ufunc_api.c','w')
-fid.write(outstr)
-fid.close()
-
-
-
-
diff --git a/base/CodeGenerators/generate_umath.py b/base/CodeGenerators/generate_umath.py
deleted file mode 100644
index 27333b4ee..000000000
--- a/base/CodeGenerators/generate_umath.py
+++ /dev/null
@@ -1,462 +0,0 @@
-
-import string
-import re
-
-Zero = "PyUFunc_Zero"
-One = "PyUFunc_One"
-None_ = "PyUFunc_None"
-#each entry in defdict is
-
-#name: [string of chars for which it is defined,
-# string of characters using func interface,
-# tuple of strings giving funcs for data,
-# (in, out),
-# identity,
-# docstring]
-
-all = '?bBhHiIlLqQfdgFDGO'
-ints = 'bBhHiIlLqQ'
-intsO = ints + 'O'
-bintsO = '?'+ints+'O'
-flts = 'fdg'
-fltsO = flts+'O'
-fltsM = flts+'M'
-cmplx = 'FDG'
-cmplxO = cmplx+'O'
-cmplxM = cmplx+'M'
-noint = flts+cmplx+'O'
-nointM = flts+cmplx+'M'
-all = '?'+ints+flts+cmplxO
-nobool = all[1:]
-nobool_or_obj = all[1:-1]
-intflt = ints+flts
-nocmplx = '?'+ints+flts
-nocmplxO = nocmplx+'O'
-nocmplxM = nocmplx+'M'
-noobj = all[:-1]
-
-defdict = {
-'add': [all,'O',("PyNumber_Add",),
- (2,1), Zero,
- "Add the arguments elementwise."
- ],
-'subtract' : [all,'O',("PyNumber_Subtract",),
- (2,1), Zero,
- "Subtract the arguments elementwise."
- ],
-'multiply' : [all,cmplxO,
- ("prod,"*3,"PyNumber_Multiply",),
- (2,1), One,
- "Multiply the arguments elementwise."
- ],
-'divide' : [nobool,cmplxO,
- ("quot,"*3,"PyNumber_Divide",),
- (2,1), One,
- "Divide the arguments elementwise."
- ],
-'floor_divide' : [nobool, cmplxO,
- ("floor_quot,"*3,
- "PyNumber_FloorDivide"),
- (2,1), One,
- "Floor divide the arguments elementwise."
- ],
-'true_divide' : [nobool, cmplxO,
- ("quot,"*3,"PyNumber_TrueDivide"),
- (2,1), One,
- "True divide the arguments elementwise.",
- 'f'*4+'d'*6+flts+cmplxO
- ],
-'conjugate' : [nobool_or_obj, 'M',
- ('"conjugate"',),
- (1,1), None,
- "take the conjugate elementwise."
- ],
-'remainder' : [intflt,fltsO,
- ("fmod,"*3, "PyNumber_Remainder"),
- (2,1), Zero,
- "remainder(x,y) returns x % y elementwise."
- ],
-'power' : [nobool,noint,
- ("pow,"*6,
- "PyNumber_Power"),
- (2,1), One,
- "power(x,y) == x**y elementwise."
- ],
-'absolute' : [all,'O',
- ("PyNumber_Absolute",),
- (1,1), None,
- "absolute value elementwise."
- ],
-'negative' : [all,cmplxO,
- ("neg,"*3,"PyNumber_Negative"),
- (1,1), None,
- "negative elements",
- ],
-'greater' : [all,'',(),(2,1), None,
- "greater(x,y) is the bool array x > y.",
- '?'*len(all)
- ],
-'greater_equal' : [all,'',(),(2,1), None,
- "greater_equal(x,y) is the bool array x >= y.",
- '?'*len(all)
- ],
-'less' : [all,'',(),(2,1), None,
- "less(x,y) is the bool array x < y.",
- '?'*len(all)
- ],
-'less_equal' : [all,'',(),(2,1), None,
- "less_equal(x,y) is the bool array x <= y.",
- '?'*len(all)
- ],
-'equal' : [all, '', (), (2,1), None,
- "equal(x,y) is the bool array x == y.",
- '?'*len(all)
- ],
-'not_equal' : [all, '', (), (2,1), None,
- "not_equal(x,y) is the bool array x != y.",
- '?'*len(all)
- ],
-'logical_and': [nocmplxM,'M',('"logical_and"',),
- (2,1), One,
- "logical and of arguments elementwise.",
- '?'*len(nocmplxM)
- ],
-'logical_or': [nocmplxM,'M',('"logical_or"',),
- (2,1), Zero,
- "logical or of arguments elementwise.",
- '?'*len(nocmplxM)
- ],
-'logical_xor': [nocmplxM, 'M', ('"logical_xor"',),
- (2,1), None,
- "logical xor of arguments elementwise.",
- '?'*len(nocmplxM)
- ],
-'logical_not' : [nocmplxM, 'M', ('"logical_not"',),
- (1,1), None,
- "logical not of argument elementwise.",
- '?'*len(nocmplxM)
- ],
-'maximum' : [noobj,'',(),
- (2,1), None,
- "maximum of two arrays elementwise."],
-'minimum' : [noobj,'',(),
- (2,1), None,
- "minimum of two arrays elementwise."],
-'bitwise_and' : [bintsO,'O',("PyNumber_And",),
- (2,1), One,
- "bitwise and of two arrays elementwise."],
-'bitwise_or' : [bintsO, 'O', ("PyNumber_Or",),
- (2,1), Zero,
- "bitwise or of two arrays elementwise."],
-'bitwise_xor' : [bintsO, 'O', ("PyNumber_Xor",),
- (2,1), None,
- "bitwise xor of two arrays elementwise."],
-'invert' : [bintsO,'O', ("PyNumber_Invert",),
- (1,1), None,
- "bit inversion elementwise."
- ],
-'left_shift' : [intsO, 'O', ("PyNumber_Lshift",),
- (2,1), None,
- "left_shift(n,m) is n << m (n shifted to left by m bits) elementwise."
- ],
-'right_shift' : [intsO, 'O', ("PyNumber_Rshift",),
- (2,1), None,
- "right_shift(n,m) is n >> m (n shifted to right by m bits) elementwise."
- ],
-'arccos' : [nointM, nointM,
- ("acos,"*6, '"arccos"'),
- (1, 1), None,
- "inverse cosine elementwise."
- ],
-'arcsin': [nointM, nointM,
- ("asin,"*6, '"arcsin"'),
- (1, 1), None,
- "inverse sine elementwise."
- ],
-'arctan': [nointM, nointM,
- ("atan,"*6, '"arctan"'),
- (1, 1), None,
- "inverse tangent elementwise."
- ],
-'arccosh' : [nointM, nointM,
- ("acosh,"*6, '"arccosh"'),
- (1, 1), None,
- "inverse hyperbolic cosine elementwise."
- ],
-'arcsinh': [nointM, nointM,
- ("asinh,"*6, '"arcsinh"'),
- (1, 1), None,
- "inverse hyperbolic sine elementwise."
- ],
-'arctanh': [nointM, nointM,
- ("atanh,"*6, '"arctanh"'),
- (1, 1), None,
- "inverse hyperbolic tangent elementwise."
- ],
-'cos': [nointM, nointM,
- ("cos,"*6, '"cos"'),
- (1, 1), None,
- "cosine elementwise."
- ],
-'sin': [nointM, nointM,
- ("sin,"*6, '"sin"'),
- (1, 1), None,
- "sine elementwise."
- ],
-'tan': [nointM, nointM,
- ("tan,"*6, '"tan"'),
- (1, 1), None,
- "tangent elementwise."
- ],
-'cosh': [nointM, nointM,
- ("cosh,"*6, '"cosh"'),
- (1, 1), None,
- "hyperbolic cosine elementwise."
- ],
-'sinh': [nointM, nointM,
- ("sinh,"*6, '"sinh"'),
- (1, 1), None,
- "hyperbolic sine elementwise."
- ],
-'tanh': [nointM, nointM,
- ("tanh,"*6, '"tanh"'),
- (1, 1), None,
- "hyperbolic tangent elementwise."
- ],
-'exp' : [nointM, nointM,
- ("exp,"*6, '"exp"'),
- (1, 1), None,
- "e**x elementwise."
- ],
-'log' : [nointM, nointM,
- ("log,"*6, '"log"'),
- (1, 1), None,
- "log(x) elementwise."
- ],
-'log10' : [nointM, nointM,
- ("log10,"*6, '"log10"'),
- (1, 1), None,
- "log10(x) elementwise."
- ],
-'sqrt' : [nointM, nointM,
- ("sqrt,"*6, '"sqrt"'),
- (1,1), None,
- "sqrt(x) elementwise."
- ],
-'ceil' : [fltsM, fltsM,
- ("ceil,"*3, '"ceil"'),
- (1,1), None,
- "elementwise smallest integer >= x."
- ],
-'fabs' : [fltsM, fltsM,
- ("fabs,"*3, '"fabs"'),
- (1,1), None,
- "absolute values."
- ],
-'floor' : [fltsM, fltsM,
- ("floor,"*3, '"floor"'),
- (1,1), None,
- "elementwise largest integer <= x"
- ],
-'arctan2' : [fltsM, fltsM,
- ("atan2,"*3, '"arctan2"'),
- (2,1), None,
- "arctan2(x,y) is a safe and corrent tan(x/y)"
- ],
-'fmod' : [fltsM, fltsM,
- ("fmod,"*3,'"fmod"'),
- (2,1), None,
- "fmod(x,y) is remainder(x,y)"],
-'hypot' : [fltsM, fltsM,
- ("hypot,"*3, '"hypot"'),
- (2,1), None,
- "sqrt(x**2 + y**2) elementwise"
- ]
-}
-
-
-def indent(st,spaces):
- indention = ' '*spaces
- indented = indention + string.replace(st,'\n','\n'+indention)
- # trim off any trailing spaces
- indented = re.sub(r' +$',r'',indented)
- return indented
-
-chartoname = {'?': 'bool',
- 'b': 'byte',
- 'B': 'ubyte',
- 'h': 'short',
- 'H': 'ushort',
- 'i': 'int',
- 'I': 'uint',
- 'l': 'long',
- 'L': 'ulong',
- 'q': 'longlong',
- 'Q': 'ulonglong',
- 'f': 'float',
- 'd': 'double',
- 'g': 'longdouble',
- 'F': 'cfloat',
- 'D': 'cdouble',
- 'G': 'clongdouble',
- 'O': 'OBJECT',
- 'M': 'OBJECT',
- }
-
-chartotype1 = {'f': 'f_f',
- 'd': 'd_d',
- 'g': 'g_g',
- 'F': 'F_F',
- 'D': 'D_D',
- 'G': 'G_G',
- 'O': 'O_O',
- 'M': 'O_O_method'}
-
-chartotype2 = {'f': 'ff_f',
- 'd': 'dd_d',
- 'g': 'gg_g',
- 'F': 'FF_F',
- 'D': 'DD_D',
- 'G': 'GG_G',
- 'O': 'OO_O',
- 'M': 'O_O_method'}
-#for each name
-# 1) create functions, data, and signature
-# 2) fill in functions and data in InitOperators
-# 3) add function.
-
-def make_arrays(funcdict):
- # functions array contains an entry for every type implemented
- # NULL should be placed where PyUfunc_ style function will be filled in later
- #
- code1list = []
- code2list = []
- for name, vals in funcdict.iteritems():
- funclist = []
- datalist = []
- siglist = []
- k=0;
- sub=0;
- if vals[3][0] > 1:
- thedict = chartotype2
- else:
- thedict = chartotype1
- for char in vals[0]:
- if char in vals[1]:
- funclist.append('NULL')
- astr = '%s_functions[%d] = PyUFunc_%s;' % \
- (name, k, thedict[char])
- code2list.append(astr)
- thisfunc = vals[2][sub]
- if len(thisfunc) > 8 and thisfunc[:8] == "PyNumber":
- astr = '%s_data[%d] = (void *) %s;' % \
- (name, k, thisfunc)
- code2list.append(astr)
- datalist.append('(void *)NULL');
- else:
- datalist.append('(void *)%s' % thisfunc)
- sub += 1
- else:
- datalist.append('(void *)NULL');
- funclist.append('%s_%s' % (chartoname[char].upper(), name))
- siglist.append('PyArray_%s' % chartoname[char].upper())
- if vals[3][0] > 1:
- siglist.append('PyArray_%s' % chartoname[char].upper())
- if len(vals) > 6: # have output specification
- siglist.append('PyArray_%s' % chartoname[vals[6][k]].upper())
- else:
- siglist.append('PyArray_%s' % chartoname[char].upper())
- k += 1
- funcnames = ', '.join(funclist)
- signames = ', '.join(siglist)
- datanames = ', '.join(datalist)
- code1list.append("static PyUFuncGenericFunction %s_functions[] = { %s };" \
- % (name, funcnames))
- code1list.append("static void * %s_data[] = { %s };" \
- % (name, datanames))
- code1list.append("static char %s_signatures[] = { %s };" \
- % (name, signames))
- return "\n".join(code1list),"\n".join(code2list)
-
-def make_ufuncs(funcdict):
- code3list = []
- for name, vals in funcdict.items():
- mlist = []
- mlist.append(\
-r"""f = PyUFunc_FromFuncAndData(%s_functions, %s_data, %s_signatures, %d,
- %d, %d, %s, "%s",
- "%s", 0);""" % (name,name,name,len(vals[0]),
- vals[3][0], vals[3][1], vals[4],
- name, vals[5]))
- mlist.append(r"""PyDict_SetItemString(dictionary, "%s", f);"""%name)
- mlist.append(r"""Py_DECREF(f);""")
- code3list.append('\n'.join(mlist))
- return '\n'.join(code3list)
-
-
-def convert_vals(funcdict):
- for name, vals in funcdict.iteritems():
- if vals[4] is None:
- vals[4] = None_
- vals2 = vals[2]
- if len(vals2) > 0:
- alist = vals2[0].split(',')
- if len(alist) == 4:
- a = alist[0]
- if 'f' in vals[1]:
- newlist = [ a+'f', a, a+'l']
- else:
- newlist = ['nc_'+a+'f', 'nc_'+a, 'nc_'+a+'l']
- elif len(alist) == 7:
- a = alist[0]
- newlist = [a+'f', a, a+'l','nc_'+a+'f', 'nc_'+a, 'nc_'+a+'l']
- else:
- newlist = alist
- newlist = newlist + list(vals2[1:])
- vals[2] = tuple(newlist)
- funcdict[name] = vals
-
-
-def make_code(funcdict,filename):
- convert_vals(funcdict)
- code1, code2 = make_arrays(funcdict)
- code3 = make_ufuncs(funcdict)
- code2 = indent(code2,4)
- code3 = indent(code3,4)
- code = r"""
-
-/** Warning this file is autogenerated!!!
-
- Please make changes to the code generator program (%s)
-**/
-
-%s
-
-static void
-InitOperators(PyObject *dictionary) {
- PyObject *f;
-
-%s
-%s
-}
-""" % (filename, code1, code2, code3)
- return code;
-
-
-if __name__ == "__main__":
- filename = __file__
- fid = open('__umath_generated.c','w')
- code = make_code(defdict, filename)
- fid.write(code)
- fid.close()
-
-
-
-
-
-
-
-
-
-
-
diff --git a/base/_na_imports.py b/base/_na_imports.py
deleted file mode 100644
index 763bf41d0..000000000
--- a/base/_na_imports.py
+++ /dev/null
@@ -1,124 +0,0 @@
-"""Imports from numarray for numerix, the numarray/Numeric interchangeability
-module. These array functions are used when numarray is chosen.
-"""
-from ppimport import ppimport, ppimport_attr
-import numarray as _na
-from numarray.numeric import *
-import numarray.ufunc as fastumath
-
-import _compiled_base
-from _compiled_base import arraymap, _unique, _insert
-
-try:
- from numarray.ieeespecial import isinf, isnan, isfinite
-except ImportError,msg:
- isinf = isnan = isfinite = None
- print msg
-
-from numarray.ieeespecial import \
- plus_inf as PINF, \
- minus_inf as NINF, \
- inf, \
- inf as infty, \
- inf as Infinity, \
- nan, \
- nan as NAN, \
- nan as Nan
-
-try:
- from numarray.ieeespecial import \
- plus_zero as PZERO, \
- minus_zero as NZERO
-except ImportError,msg:
- print msg
-
-import numarray.linear_algebra as LinearAlgebra
-import numarray.linear_algebra.mlab as MLab
-import numarray.random_array as RandomArray
-from numarray.fft import fft
-try:
- from numarray.matrix import Matrix
-except ImportError,msg:
- Matrix = None
- print msg
-from numarray.linear_algebra import inverse, eigenvectors
-from numarray.convolve import convolve, cross_correlate
-from numarray.arrayprint import array2string
-
-# LinearAlgebra = ppimport("numarray.linear_algebra")
-# MLab = ppimport("numarray.mlab")
-# inverse = ppimport_from("numarray.linear_algebra.inverse")
-# eigenvectors = ppimport_from("numarray.linear_algebra.eigenvectors")
-# convolve = ppimport_from("numarray.convolve.convolve")
-# fft = ppimport_from("numarray.fft.fft")
-# Matrix = ppimport_from("numarray.matrix.Matrix")
-# RandomArray = ppimport("numarray.random_array")
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = typecode[Int8]
- UInt8 = typecode[UInt8]
- Int16 = typecode[Int16]
- UInt16 = typecode[UInt16]
- Int32 = typecode[Int32]
- UInt32 = typecode[UInt32]
- Float32 = typecode[Float32]
- Float64 = typecode[Float64]
- Complex32 = typecode[Complex32]
- Complex64 = typecode[Complex64]
-
-nx = _TypeNamespace()
-
-def alter_numeric():
- pass
-
-def restore_numeric():
- pass
-
-conj = conjugate
-
-UnsignedInt8 = UInt8
-UnsignedInt16 = UInt16
-UnsignedInt32 = UInt32
-
-ArrayType = arraytype
-
-class UfuncType(object):
- """numarray ufuncs work differently than Numeric ufuncs and
- have no single UfuncType... TBD"""
- pass
-
-
-def zeros(shape, typecode='l', savespace=0):
- """scipy version of numarray.zeros() which supports creation of object
- arrays as well as numerical arrays.
- """
- if typecode == 'O':
- import numarray.objects as obj
- z = obj.ObjectArray(shape=shape)
- z[:] = 0
- else:
- z = _na.zeros(shape=shape, type=typecode)
- return z
-
-def asscalar(a):
- """Returns Python scalar value corresponding to 'a' for rank-0 arrays
- or the unaltered array for non-rank-0."""
- return a[()]
-
-# _Error.setMode(dividebyzero="ignore", invalid="ignore")
-Error.setMode(all="ignore")
-
-NX_VERSION = 'numarray %s' % _na.__version__
-NX_INCLUDE = '"numarray/arrayobject.h"'
-NX_ARRAYPKG = "numarray"
-
-# Must appear after all public definititions
-__all__ = []
-for k in globals().keys():
- if k[0] != "_":
- __all__.append(k)
-__all__.append("_insert")
-__all__.append("_unique")
-
-
diff --git a/base/_nc_imports.py b/base/_nc_imports.py
deleted file mode 100644
index 37ccb98e3..000000000
--- a/base/_nc_imports.py
+++ /dev/null
@@ -1,91 +0,0 @@
-"""Imports from Numeric for numerix, the numarray/Numeric interchangeability
-module. These array functions are used when Numeric is chosen.
-"""
-import Numeric
-from Numeric import *
-
-import fastumath
-from fastumath import *
-from fastumath import PINF as inf
-from fastumath import alter_numeric, restore_numeric
-
-import _compiled_base
-from _compiled_base import arraymap, _unique, _insert
-
-from ppimport import ppimport, ppimport_attr
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = Int8
- UInt8 = UInt8
- Int16 = Int16
- UInt16 = UInt16
- Int32 = Int32
- UInt32 = UInt32
- Float32 = Float32
- Float64 = Float64
- Complex32 = Complex32
- Complex64 = Complex64
-
-nx = _TypeNamespace()
-
-# inf is useful for testing infinities in results of array divisions
-# (which don't raise exceptions)
-
-inf = infty = Infinity = (array([1])/0.0)[0]
-
-# The following import statements are equivalent to
-#
-# from Matrix import Matrix as mat
-#
-# but avoids expensive LinearAlgebra import when
-# Matrix is not used.
-#
-LinearAlgebra = ppimport('LinearAlgebra')
-inverse = ppimport_attr(LinearAlgebra, 'inverse')
-eigenvectors = ppimport_attr(LinearAlgebra, 'eigenvectors')
-Matrix = mat = ppimport_attr(ppimport('Matrix'), 'Matrix')
-fft = ppimport_attr(ppimport('FFT'), 'fft')
-RandomArray = ppimport('RandomArray')
-MLab = ppimport('MLab')
-
-#
-# Force numerix to use scipy_base.fastumath instead of numerix.umath.
-#
-import sys as _sys
-_sys.modules['umath'] = fastumath
-
-if Numeric.__version__ < '23.5':
- matrixmultiply=dot
-
-Inf = inf = fastumath.PINF
-try:
- NAN = NaN = nan = fastumath.NAN
-except AttributeError:
- NaN = NAN = nan = fastumath.PINF/fastumath.PINF
-
-try:
- from Numeric import UfuncType
-except ImportError:
- UfuncType = type(Numeric.sin)
-
-NX_VERSION = 'Numeric %s' % Numeric.__version__
-NX_INCLUDE = '"Numeric/arrayobject.h"'
-NX_ARRAYPKG = "Numeric"
-
-def asscalar(a):
- """Returns Python scalar value corresponding to 'a' for rank-0 arrays
- or the unaltered array for non-rank-0."""
- if len(a.shape) == 0:
- return a[0]
- else:
- return a
-
-__all__ = []
-for k in globals().keys():
- if k[0] != "_":
- __all__.append(k)
-__all__.append("_insert")
-__all__.append("_unique")
-
-
diff --git a/base/fastumath_nounsigned.inc b/base/fastumath_nounsigned.inc
deleted file mode 100644
index 7e1975301..000000000
--- a/base/fastumath_nounsigned.inc
+++ /dev/null
@@ -1,2461 +0,0 @@
-/* -*- c -*- */
-/* Fast umath module whose functions do not check for range and domain
- errors.
-
- Replacement for umath + additions for isnan, isfinite, and isinf
- Also allows comparison operations on complex numbers (just compares
- the real part) and logical operations.
-
- All logical operations return UBYTE arrays.
-*/
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-#ifndef LONG_BIT
-#define LONG_BIT (CHAR_BIT * sizeof(long))
-#endif
-
-#ifndef INT_BIT
-#define INT_BIT (CHAR_BIT * sizeof(int))
-#endif
-
-#ifndef SHORT_BIT
-#define SHORT_BIT (CHAR_BIT * sizeof(short))
-#endif
-
-/* A whole slew of basic math functions are provided by Konrad Hinsen. */
-
-#if !defined(__STDC__) && !defined(_MSC_VER)
-extern double fmod (double, double);
-extern double frexp (double, int *);
-extern double ldexp (double, int);
-extern double modf (double, double *);
-#endif
-
-#ifndef M_PI
-#define M_PI 3.1415926535897931
-#endif
-
-#define ABS(x) ((x) < 0 ? -(x) : (x))
-
-/* isnan and isinf and isfinite functions */
-static void FLOAT_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) ABS(isnan((double)(*((float *)i1))));
- }
-}
-
-static void DOUBLE_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) ABS(isnan((double)(*((double *)i1))));
- }
-}
-
-static void CFLOAT_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isnan((double)((float *)i1)[0]) || isnan((double)((float *)i1)[1]);
- }
-}
-
-static void CDOUBLE_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isnan((double)((double *)i1)[0]) || isnan((double)((double *)i1)[1]);
- }
-}
-
-
-static void FLOAT_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) !(isfinite((double)(*((float *)i1))) || isnan((double)(*((float *)i1))));
- }
-}
-
-static void DOUBLE_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op)= (unsigned char) !(isfinite((double)(*((double *)i1))) || isnan((double)(*((double *)i1))));
- }
-}
-
-static void CFLOAT_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op)= (unsigned char) !((isfinite((double)(((float *)i1)[0])) && isfinite((double)(((float *)i1)[1]))) || isnan((double)(((float *)i1)[0])) || isnan((double)(((float *)i1)[1])));
- }
-}
-
-static void CDOUBLE_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op)= (unsigned char) !((isfinite((double)(((double *)i1)[0])) && isfinite((double)(((double *)i1)[1]))) || isnan((double)(((double *)i1)[0])) || isnan((double)(((double *)i1)[1])));
- }
-}
-
-
-static void FLOAT_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)(*((float *)i1)));
- }
-}
-
-static void DOUBLE_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)(*((double *)i1)));
- }
-}
-
-static void CFLOAT_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)((float *)i1)[0]) && isfinite((double)((float *)i1)[1]);
- }
-}
-
-static void CDOUBLE_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)((double *)i1)[0]) && isfinite((double)((double *)i1)[1]);
- }
-}
-
-static PyUFuncGenericFunction isnan_functions[] = {FLOAT_isnan, DOUBLE_isnan, CFLOAT_isnan, CDOUBLE_isnan, NULL};
-static PyUFuncGenericFunction isinf_functions[] = {FLOAT_isinf, DOUBLE_isinf, CFLOAT_isinf, CDOUBLE_isinf, NULL};
-static PyUFuncGenericFunction isfinite_functions[] = {FLOAT_isfinite, DOUBLE_isfinite, CFLOAT_isfinite, CDOUBLE_isfinite, NULL};
-
-static char isinf_signatures[] = { PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_UBYTE, };
-
-static void * isnan_data[] = {(void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * isinf_data[] = {(void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * isfinite_data[] = {(void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-
-
-
-/* Some functions needed from ufunc object, so that Py_complex's aren't being returned
-between code possibly compiled with different compilers.
-*/
-
-typedef Py_complex ComplexBinaryFunc(Py_complex x, Py_complex y);
-typedef Py_complex ComplexUnaryFunc(Py_complex x);
-
-static void fastumath_F_F_As_D_D(char **args, int *dimensions, int *steps, void *func) {
- int i; Py_complex x;
- char *ip1=args[0], *op=args[1];
- for(i=0; i<*dimensions; i++, ip1+=steps[0], op+=steps[1]) {
- x.real = ((float *)ip1)[0]; x.imag = ((float *)ip1)[1];
- x = ((ComplexUnaryFunc *)func)(x);
- ((float *)op)[0] = (float)x.real;
- ((float *)op)[1] = (float)x.imag;
- }
-}
-
-static void fastumath_D_D(char **args, int *dimensions, int *steps, void *func) {
- int i; Py_complex x;
- char *ip1=args[0], *op=args[1];
- for(i=0; i<*dimensions; i++, ip1+=steps[0], op+=steps[1]) {
- x.real = ((double *)ip1)[0]; x.imag = ((double *)ip1)[1];
- x = ((ComplexUnaryFunc *)func)(x);
- ((double *)op)[0] = x.real;
- ((double *)op)[1] = x.imag;
- }
-}
-
-
-static void fastumath_FF_F_As_DD_D(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2];
- char *ip1=args[0], *ip2=args[1], *op=args[2];
- int n=dimensions[0];
- Py_complex x, y;
-
- for(i=0; i<n; i++, ip1+=is1, ip2+=is2, op+=os) {
- x.real = ((float *)ip1)[0]; x.imag = ((float *)ip1)[1];
- y.real = ((float *)ip2)[0]; y.imag = ((float *)ip2)[1];
- x = ((ComplexBinaryFunc *)func)(x, y);
- ((float *)op)[0] = (float)x.real;
- ((float *)op)[1] = (float)x.imag;
- }
-}
-
-static void fastumath_DD_D(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2];
- char *ip1=args[0], *ip2=args[1], *op=args[2];
- int n=dimensions[0];
- Py_complex x,y;
-
- for(i=0; i<n; i++, ip1+=is1, ip2+=is2, op+=os) {
- x.real = ((double *)ip1)[0]; x.imag = ((double *)ip1)[1];
- y.real = ((double *)ip2)[0]; y.imag = ((double *)ip2)[1];
- x = ((ComplexBinaryFunc *)func)(x, y);
- ((double *)op)[0] = x.real;
- ((double *)op)[1] = x.imag;
- }
-}
-
-
-static long powll(long x, long n, int nbits)
- /* Overflow check: overflow will occur if log2(abs(x)) * n > nbits. */
-{
- long r = 1;
- long p = x;
- double logtwox;
- long mask = 1;
- if (n < 0) PyErr_SetString(PyExc_ValueError, "Integer to a negative power");
- if (x != 0) {
- logtwox = log10 (fabs ( (double) x))/log10 ( (double) 2.0);
- if (logtwox * (double) n > (double) nbits)
- PyErr_SetString(PyExc_ArithmeticError, "Integer overflow in power.");
- }
- while (mask > 0 && n >= mask) {
- if (n & mask)
- r *= p;
- mask <<= 1;
- p *= p;
- }
- return r;
-}
-
-
-static void UBYTE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) + *((unsigned char *)i2);
- }
-}
-static void SBYTE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) + *((signed char *)i2);
- }
-}
-static void SHORT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) + *((short *)i2);
- }
-}
-static void INT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) + *((int *)i2);
- }
-}
-static void LONG_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) + *((long *)i2);
- }
-}
-static void FLOAT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) + *((float *)i2);
- }
-}
-static void DOUBLE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) + *((double *)i2);
- }
-}
-static void CFLOAT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((float *)op)[0]=((float *)i1)[0] + ((float *)i2)[0]; ((float *)op)[1]=((float *)i1)[1] + ((float *)i2)[1];
- }
-}
-static void CDOUBLE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((double *)op)[0]=((double *)i1)[0] + ((double *)i2)[0]; ((double *)op)[1]=((double *)i1)[1] + ((double *)i2)[1];
- }
-}
-static void UBYTE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) - *((unsigned char *)i2);
- }
-}
-static void SBYTE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) - *((signed char *)i2);
- }
-}
-static void SHORT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) - *((short *)i2);
- }
-}
-static void INT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) - *((int *)i2);
- }
-}
-static void LONG_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) - *((long *)i2);
- }
-}
-static void FLOAT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) - *((float *)i2);
- }
-}
-static void DOUBLE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) - *((double *)i2);
- }
-}
-static void CFLOAT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((float *)op)[0]=((float *)i1)[0] - ((float *)i2)[0]; ((float *)op)[1]=((float *)i1)[1] - ((float *)i2)[1];
- }
-}
-static void CDOUBLE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((double *)op)[0]=((double *)i1)[0] - ((double *)i2)[0]; ((double *)op)[1]=((double *)i1)[1] - ((double *)i2)[1];
- }
-}
-static void UBYTE_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- unsigned int x;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- x = (unsigned int) (*((unsigned char *)i1)) * (unsigned int) (*((unsigned char *)i2));
- if (x > 255) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((unsigned char *)op)=(unsigned char) x;
- }
-}
-static void SBYTE_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- int x;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- x = (int) (*((signed char *)i1)) * (int) (*((signed char *)i2));
- if (x > 127 || x < -128) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((signed char *)op)=(signed char) x;
- }
-}
-static void SHORT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- short a, b, ah, bh, x, y;
- int s;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- s = 1;
- a = *((short *)i1);
- b = *((short *)i2);
- ah = a >> (SHORT_BIT/2);
- bh = b >> (SHORT_BIT/2);
- /* Quick test for common case: two small positive shorts */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((short *)op)=x;
- continue;
- }
- }
- /* Arrange that a >= b >= 0 */
- if (a < 0) {
- a = -a;
- if (a < 0) {
- /* Largest negative */
- if (b == 0 || b == 1) {
- *((short *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- ah = a >> (SHORT_BIT/2);
- }
- if (b < 0) {
- b = -b;
- if (b < 0) {
- /* Largest negative */
- if (a == 0 || a == 1) {
- *((short *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- bh = b >> (SHORT_BIT/2);
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* 2) both ah and bh = 0 : then compute a*b and report
- overflow if it comes out negative */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((short *)op)=s * x;
- continue;
- }
- }
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^31
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1 << (SHORT_BIT/2 - 1))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1 << (SHORT_BIT/2)) - 1;
- x = a*b;
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- x += y << (SHORT_BIT/2);
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((short *)op)=s*x;
- }
-}
-static void INT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- int a, b, ah, bh, x, y;
- int s;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- s = 1;
- a = *((int *)i1);
- b = *((int *)i2);
- ah = a >> (INT_BIT/2);
- bh = b >> (INT_BIT/2);
- /* Quick test for common case: two small positive ints */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((int *)op)=x;
- continue;
- }
- }
- /* Arrange that a >= b >= 0 */
- if (a < 0) {
- a = -a;
- if (a < 0) {
- /* Largest negative */
- if (b == 0 || b == 1) {
- *((int *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- ah = a >> (INT_BIT/2);
- }
- if (b < 0) {
- b = -b;
- if (b < 0) {
- /* Largest negative */
- if (a == 0 || a == 1) {
- *((int *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- bh = b >> (INT_BIT/2);
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* 2) both ah and bh = 0 : then compute a*b and report
- overflow if it comes out negative */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((int *)op)=s * x;
- continue;
- }
- }
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^31
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1 << (INT_BIT/2 - 1))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1 << (INT_BIT/2)) - 1;
- x = a*b;
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- x += y << (INT_BIT/2);
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((int *)op)=s*x;
- }
-}
-static void LONG_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- long a, b, ah, bh, x, y;
- int s;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- s = 1;
- a = *((long *)i1);
- b = *((long *)i2);
- ah = a >> (LONG_BIT/2);
- bh = b >> (LONG_BIT/2);
- /* Quick test for common case: two small positive ints */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((long *)op)=x;
- continue;
- }
- }
- /* Arrange that a >= b >= 0 */
- if (a < 0) {
- a = -a;
- if (a < 0) {
- /* Largest negative */
- if (b == 0 || b == 1) {
- *((long *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- ah = a >> (LONG_BIT/2);
- }
- if (b < 0) {
- b = -b;
- if (b < 0) {
- /* Largest negative */
- if (a == 0 || a == 1) {
- *((long *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- bh = b >> (LONG_BIT/2);
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* 2) both ah and bh = 0 : then compute a*b and report
- overflow if it comes out negative */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((long *)op)=s * x;
- continue;
- }
- }
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^31
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1L << (LONG_BIT/2 - 1))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1L << (LONG_BIT/2)) - 1;
- x = a*b;
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- x += y << (LONG_BIT/2);
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((long *)op)=s*x;
- }
-}
-static void FLOAT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) * *((float *)i2);
- }
-}
-static void DOUBLE_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) * *((double *)i2);
- }
-}
-static void UBYTE_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned char *)i1) / *((unsigned char *)i2);
- }
-}
-static void SBYTE_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((signed char *)i1) / *((signed char *)i2);
- }
-}
-static void SHORT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((short *)i1) / *((short *)i2);
- }
-}
-static void INT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void LONG_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((long *)i1) / *((long *)i2);
- }
-}
-static void FLOAT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) / *((float *)i2);
- }
-}
-static void DOUBLE_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) / *((double *)i2);
- }
-}
-#if PY_VERSION_HEX >= 0x02020000
-static void UBYTE_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned char *)i1) / *((unsigned char *)i2);
- }
-}
-static void SBYTE_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((signed char *)i1) / *((signed char *)i2);
- }
-}
-static void SHORT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((short *)i1) / *((short *)i2);
- }
-}
-static void USHORT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned short *)i1) / *((unsigned short *)i2);
- }
-}
-static void INT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void UINT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void LONG_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((long *)i1) / *((long *)i2);
- }
-}
-static void FLOAT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=floor((double) (*((float *)i1) / *((float *)i2)));
- }
-}
-static void DOUBLE_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=floor(*((double *)i1) / *((double *)i2));
- }
-}
-
-static void UBYTE_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((unsigned char *)i1)) / ((float)*((unsigned char *)i2));
- }
-}
-static void SBYTE_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((signed char *)i1)) / ((float)*((signed char *)i2));
- }
-}
-static void SHORT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((short *)i1)) / ((float)*((short *)i2));
- }
-}
-static void INT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)= ((double)*((int *)i1)) / ((double)*((int *)i2));
- }
-}
-static void LONG_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)= ((double)*((long *)i1)) / ((double)*((long *)i2));
- }
-}
-static void FLOAT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) / *((float *)i2);
- }
-}
-static void DOUBLE_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) / *((double *)i2);
- }
-}
-#endif
-static void UBYTE_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned char *)i1) / *((unsigned char *)i2);
- }
-}
-static void SBYTE_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((signed char *)i1) / *((signed char *)i2);
- }
-}
-static void SHORT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((short *)i1) / *((short *)i2);
- }
-}
-static void INT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void LONG_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((long *)i1) / *((long *)i2);
- }
-}
-static void FLOAT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((float *)i1) / *((float *)i2);
- }
-}
-static void DOUBLE_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((double *)i1) / *((double *)i2);
- }
-}
-static void UBYTE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=*((unsigned char *)i1);}}
-static void SBYTE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=*((signed char *)i1);}}
-static void SHORT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=*((short *)i1);}}
-static void INT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=*((int *)i1);}}
-static void LONG_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=*((long *)i1);}}
-static void FLOAT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=*((float *)i1);}}
-static void DOUBLE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=*((double *)i1);}}
-static void CFLOAT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((float *)op)[0]=((float *)i1)[0]; ((float *)op)[1]=-((float *)i1)[1];}}
-static void CDOUBLE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((double *)op)[0]=((double *)i1)[0]; ((double *)op)[1]=-((double *)i1)[1];}}
-static void UBYTE_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) % *((unsigned char *)i2);
- }
-}
-static void SBYTE_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) % *((signed char *)i2);
- }
-}
-static void SHORT_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) % *((short *)i2);
- }
-}
-static void INT_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) % *((int *)i2);
- }
-}
-static void LONG_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) % *((long *)i2);
- }
-}
-static void UBYTE_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(unsigned char)powll(*((unsigned char *)i1), *((unsigned char *)i2), 8);
- }
-}
-static void SBYTE_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=(signed char)powll(*((signed char *)i1), *((signed char *)i2), 7);
- }
-}
-static void SHORT_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=(short)powll(*((short *)i1), *((short *)i2), SHORT_BIT - 1);
- }
-}
-static void INT_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=powll(*((int *)i1), *((int *)i2), INT_BIT - 1);
- }
-}
-static void LONG_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=powll(*((long *)i1), *((long *)i2), LONG_BIT - 1);
- }
-}
-static void SBYTE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=*((signed char *)i1)<0 ? -*((signed char *)i1) : *((signed char *)i1);}}
-static void SHORT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=*((short *)i1)<0 ? -*((short *)i1) : *((short *)i1);}}
-static void INT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=*((int *)i1)<0 ? -*((int *)i1) : *((int *)i1);}}
-static void LONG_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=*((long *)i1)<0 ? -*((long *)i1) : *((long *)i1);}}
-static void FLOAT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=*((float *)i1)<0 ? -*((float *)i1) : *((float *)i1);}}
-static void DOUBLE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=*((double *)i1)<0 ? -*((double *)i1) : *((double *)i1);}}
-static void CFLOAT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=(float)sqrt(((float *)i1)[0]*((float *)i1)[0] + ((float *)i1)[1]*((float *)i1)[1]);}}
-static void CDOUBLE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=sqrt(((double *)i1)[0]*((double *)i1)[0] + ((double *)i1)[1]*((double *)i1)[1]);}}
-static void SBYTE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=-*((signed char *)i1);}}
-static void SHORT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=-*((short *)i1);}}
-static void INT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=-*((int *)i1);}}
-static void LONG_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=-*((long *)i1);}}
-static void FLOAT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=-*((float *)i1);}}
-static void DOUBLE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=-*((double *)i1);}}
-static void CFLOAT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((float *)op)[0]=-((float *)i1)[0]; ((float *)op)[1]=-((float *)i1)[1];}}
-static void CDOUBLE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((double *)op)[0]=-((double *)i1)[0]; ((double *)op)[1]=-((double *)i1)[1];}}
-static void UBYTE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) > *((unsigned char *)i2);
- }
-}
-static void SBYTE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) > *((signed char *)i2);
- }
-}
-static void SHORT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) > *((short *)i2);
- }
-}
-static void INT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) > *((int *)i2);
- }
-}
-static void LONG_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) > *((long *)i2);
- }
-}
-static void FLOAT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) > *((float *)i2);
- }
-}
-static void DOUBLE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) > *((double *)i2);
- }
-}
-
-/* complex numbers are compared by there real parts. */
-static void CFLOAT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)= ((float *)i1)[0] > ((float *)i2)[0];
- }
-}
-static void CDOUBLE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)= ((double *)i1)[0] > ((double *)i2)[0];
- }
-}
-
-static void UBYTE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) >= *((unsigned char *)i2);
- }
-}
-static void SBYTE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) >= *((signed char *)i2);
- }
-}
-static void SHORT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) >= *((short *)i2);
- }
-}
-static void INT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) >= *((int *)i2);
- }
-}
-static void LONG_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) >= *((long *)i2);
- }
-}
-static void FLOAT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) >= *((float *)i2);
- }
-}
-static void DOUBLE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) >= *((double *)i2);
- }
-}
-static void CFLOAT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) >= *((float *)i2);
- }
-}
-static void CDOUBLE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) >= *((double *)i2);
- }
-}
-
-static void UBYTE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) < *((unsigned char *)i2);
- }
-}
-static void SBYTE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) < *((signed char *)i2);
- }
-}
-static void SHORT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) < *((short *)i2);
- }
-}
-static void INT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) < *((int *)i2);
- }
-}
-static void LONG_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) < *((long *)i2);
- }
-}
-static void FLOAT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) < *((float *)i2);
- }
-}
-static void DOUBLE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) < *((double *)i2);
- }
-}
-static void CFLOAT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) < *((float *)i2);
- }
-}
-static void CDOUBLE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) < *((double *)i2);
- }
-}
-
-static void UBYTE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) <= *((unsigned char *)i2);
- }
-}
-static void SBYTE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) <= *((signed char *)i2);
- }
-}
-static void SHORT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) <= *((short *)i2);
- }
-}
-static void INT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) <= *((int *)i2);
- }
-}
-static void LONG_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) <= *((long *)i2);
- }
-}
-static void FLOAT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) <= *((float *)i2);
- }
-}
-static void DOUBLE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) <= *((double *)i2);
- }
-}
-static void CFLOAT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) <= *((float *)i2);
- }
-}
-static void CDOUBLE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) <= *((double *)i2);
- }
-}
-static void CHAR_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((char *)i1) == *((char *)i2);
- }
-}
-static void UBYTE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) == *((unsigned char *)i2);
- }
-}
-static void SBYTE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) == *((signed char *)i2);
- }
-}
-static void SHORT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) == *((short *)i2);
- }
-}
-static void INT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) == *((int *)i2);
- }
-}
-static void LONG_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) == *((long *)i2);
- }
-}
-static void FLOAT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) == *((float *)i2);
- }
-}
-static void DOUBLE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)= (*((double *)i1) == *((double *)i2));
- }
-}
-static void CFLOAT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((float *)i1)[0] == ((float *)i2)[0]) && (((float *)i1)[1] == ((float *)i2)[1]);
- }
-}
-static void CDOUBLE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((double *)i1)[0] == ((double *)i2)[0]) && (((double *)i1)[1] == ((double *)i2)[1]);
- }
-}
-static void OBJECT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(PyObject_Compare(*((PyObject **)i1),*((PyObject **)i2)) == 0);
- }
-}
-static void CHAR_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((char *)i1) != *((char *)i2);
- }
-}
-static void UBYTE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) != *((unsigned char *)i2);
- }
-}
-static void SBYTE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) != *((signed char *)i2);
- }
-}
-static void SHORT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) != *((short *)i2);
- }
-}
-static void INT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) != *((int *)i2);
- }
-}
-static void LONG_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) != *((long *)i2);
- }
-}
-static void FLOAT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) != *((float *)i2);
- }
-}
-static void DOUBLE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) != *((double *)i2);
- }
-}
-static void CFLOAT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((float *)i1)[0] != ((float *)i2)[0]) || (((float *)i1)[1] != ((float *)i2)[1]);
- }
-}
-static void CDOUBLE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((double *)i1)[0] != ((double *)i2)[0]) || (((double *)i1)[1] != ((double *)i2)[1]);
- }
-}
-static void OBJECT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(PyObject_Compare(*((PyObject **)i1),*((PyObject **)i2)) != 0);
- }
-}
-static void UBYTE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) && *((unsigned char *)i2);
- }
-}
-static void SBYTE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) && *((signed char *)i2);
- }
-}
-static void SHORT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) && *((short *)i2);
- }
-}
-static void INT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) && *((int *)i2);
- }
-}
-static void LONG_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) && *((long *)i2);
- }
-}
-static void FLOAT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(*((float *)i1) && *((float *)i2));
- }
-}
-static void DOUBLE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(*((double *)i1) && *((double *)i2));
- }
-}
-static void CFLOAT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) && *((float *)i2);
- }
-}
-static void CDOUBLE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(*((double *)i1) && *((double *)i2));
- }
-}
-static void UBYTE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) || *((unsigned char *)i2);
- }
-}
-static void SBYTE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) || *((signed char *)i2);
- }
-}
-static void SHORT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) || *((short *)i2);
- }
-}
-static void INT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) || *((int *)i2);
- }
-}
-static void LONG_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) || *((long *)i2);
- }
-}
-static void FLOAT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(*((float *)i1) || *((float *)i2));
- }
-}
-static void DOUBLE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(*((double *)i1) || *((double *)i2));
- }
-}
-static void CFLOAT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(*((float *)i1) || *((float *)i2));
- }
-}
-static void CDOUBLE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(*((double *)i1) || *((double *)i2));
- }
-}
-static void UBYTE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=((*((unsigned char *)i1) || *((unsigned char *)i2)) && !(*((unsigned char *)i1) && *((unsigned char *)i2)));
- }
-}
-static void SBYTE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=((*((signed char *)i1) || *((signed char *)i2)) && !(*((signed char *)i1) && *((signed char *)i2)));
- }
-}
-static void SHORT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short*)op)=((*((short *)i1) || *((short *)i2)) && !(*((short *)i1) && *((short *)i2)));
- }
-}
-static void INT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int*)op)=((*((int *)i1) || *((int *)i2)) && !(*((int *)i1) && *((int *)i2)));
- }
-}
-static void LONG_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long*)op)=((*((long *)i1) || *((long *)i2)) && !(*((long *)i1) && *((long *)i2)));
- }
-}
-static void FLOAT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float*)op)=((*((float *)i1) || *((float *)i2)) && !(*((float *)i1) && *((float *)i2)));
- }
-}
-static void DOUBLE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double*)op)=((*((double *)i1) || *((double *)i2)) && !(*((double *)i1) && *((double *)i2)));
- }
-}
-static void CFLOAT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float*)op)=((*((float *)i1) || *((float *)i2)) && !(*((float *)i1) && *((float *)i2)));
- }
-}
-static void CDOUBLE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double*)op)=((*((double *)i1) || *((double *)i2)) && !(*((double *)i1) && *((double *)i2)));
- }
-}
-static void UBYTE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((unsigned char *)i1);}}
-static void SBYTE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((signed char *)i1);}}
-static void SHORT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((short *)i1);}}
-static void INT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((int *)i1);}}
-static void LONG_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((long *)i1);}}
-static void FLOAT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char*)op)=(!*((float *)i1));}}
-static void DOUBLE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((double *)i1);}}
-static void CFLOAT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char*)op)=(!*((float *)i1));}}
-static void CDOUBLE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((double *)i1);}}
-static void UBYTE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) > *((unsigned char *)i2) ? *((unsigned char *)i1) : *((unsigned char *)i2);
- }
-}
-static void SBYTE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) > *((signed char *)i2) ? *((signed char *)i1) : *((signed char *)i2);
- }
-}
-static void SHORT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) > *((short *)i2) ? *((short *)i1) : *((short *)i2);
- }
-}
-static void INT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) > *((int *)i2) ? *((int *)i1) : *((int *)i2);
- }
-}
-static void LONG_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) > *((long *)i2) ? *((long *)i1) : *((long *)i2);
- }
-}
-static void FLOAT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) > *((float *)i2) ? *((float *)i1) : *((float *)i2);
- }
-}
-static void DOUBLE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) > *((double *)i2) ? *((double *)i1) : *((double *)i2);
- }
-}
-static void CFLOAT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) > *((float *)i2) ? *((float *)i1) : *((float *)i2);
- ((float *)op)[1]=*((float *)i1) > *((float *)i2) ? ((float *)i1)[1] : ((float *)i2)[1];
- }
-}
-static void CDOUBLE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) > *((double *)i2) ? *((double *)i1) : *((double *)i2);
- ((double *)op)[1]=*((double *)i1) > *((double *)i2) ? ((double *)i1)[1] : ((double *)i2)[1];
- }
-}
-static void UBYTE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) < *((unsigned char *)i2) ? *((unsigned char *)i1) : *((unsigned char *)i2);
- }
-}
-static void SBYTE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) < *((signed char *)i2) ? *((signed char *)i1) : *((signed char *)i2);
- }
-}
-static void SHORT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) < *((short *)i2) ? *((short *)i1) : *((short *)i2);
- }
-}
-static void INT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) < *((int *)i2) ? *((int *)i1) : *((int *)i2);
- }
-}
-static void LONG_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) < *((long *)i2) ? *((long *)i1) : *((long *)i2);
- }
-}
-static void FLOAT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) < *((float *)i2) ? *((float *)i1) : *((float *)i2);
- }
-}
-static void DOUBLE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) < *((double *)i2) ? *((double *)i1) : *((double *)i2);
- }
-}
-static void CFLOAT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) < *((float *)i2) ? *((float *)i1) : *((float *)i2);
- ((float *)op)[1]=*((float *)i1) < *((float *)i2) ? ((float *)i1)[1] : ((float *)i2)[1];
- }
-}
-static void CDOUBLE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) < *((double *)i2) ? *((double *)i1) : *((double *)i2);
- ((double *)op)[1]=*((double *)i1) < *((double *)i2) ? ((double *)i1)[1] : ((double *)i2)[1];
- }
-}
-static void UBYTE_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) & *((unsigned char *)i2);
- }
-}
-static void SBYTE_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) & *((signed char *)i2);
- }
-}
-static void SHORT_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) & *((short *)i2);
- }
-}
-static void INT_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) & *((int *)i2);
- }
-}
-static void LONG_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) & *((long *)i2);
- }
-}
-static void UBYTE_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) | *((unsigned char *)i2);
- }
-}
-static void SBYTE_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) | *((signed char *)i2);
- }
-}
-static void SHORT_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) | *((short *)i2);
- }
-}
-static void INT_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) | *((int *)i2);
- }
-}
-static void LONG_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) | *((long *)i2);
- }
-}
-static void UBYTE_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) ^ *((unsigned char *)i2);
- }
-}
-static void SBYTE_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) ^ *((signed char *)i2);
- }
-}
-static void SHORT_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) ^ *((short *)i2);
- }
-}
-static void INT_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) ^ *((int *)i2);
- }
-}
-static void LONG_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) ^ *((long *)i2);
- }
-}
-static void UBYTE_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=~*((unsigned char *)i1);}}
-static void SBYTE_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=~*((signed char *)i1);}}
-static void SHORT_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=~*((short *)i1);}}
-static void INT_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=~*((int *)i1);}}
-static void LONG_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=~*((long *)i1);}}
-static void UBYTE_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) << *((unsigned char *)i2);
- }
-}
-static void SBYTE_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) << *((signed char *)i2);
- }
-}
-static void SHORT_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) << *((short *)i2);
- }
-}
-static void INT_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) << *((int *)i2);
- }
-}
-static void LONG_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) << *((long *)i2);
- }
-}
-static void UBYTE_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) >> *((unsigned char *)i2);
- }
-}
-static void SBYTE_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)= *((signed char *)i1) >> *((signed char *)i2);
- }
-}
-static void SHORT_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)= *((short *)i1) >> *((short *)i2);
- }
-}
-static void INT_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)= *((int *)i1) >> *((int *)i2);
- }
-}
-static void LONG_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) >> *((long *)i2);
- }
-}
-
-static PyUFuncGenericFunction add_functions[] = { UBYTE_add, SBYTE_add, SHORT_add, INT_add, LONG_add, FLOAT_add, DOUBLE_add, CFLOAT_add, CDOUBLE_add, NULL, };
-static PyUFuncGenericFunction subtract_functions[] = { UBYTE_subtract, SBYTE_subtract, SHORT_subtract, INT_subtract, LONG_subtract, FLOAT_subtract, DOUBLE_subtract, CFLOAT_subtract, CDOUBLE_subtract, NULL, };
-static PyUFuncGenericFunction multiply_functions[] = { UBYTE_multiply, SBYTE_multiply, SHORT_multiply, INT_multiply, LONG_multiply, FLOAT_multiply, DOUBLE_multiply, NULL, NULL, NULL, };
-static PyUFuncGenericFunction divide_functions[] = { UBYTE_divide, SBYTE_divide, SHORT_divide, INT_divide, LONG_divide, FLOAT_divide, DOUBLE_divide, NULL, NULL, NULL, };
-
-#if PY_VERSION_HEX >= 0x02020000
-static PyUFuncGenericFunction floor_divide_functions[] = { UBYTE_floor_divide, SBYTE_floor_divide, SHORT_floor_divide, INT_floor_divide, LONG_floor_divide, FLOAT_floor_divide, DOUBLE_floor_divide, NULL, NULL, NULL, };
-static PyUFuncGenericFunction true_divide_functions[] = { UBYTE_true_divide, SBYTE_true_divide, SHORT_true_divide, INT_true_divide, LONG_true_divide, FLOAT_true_divide, DOUBLE_true_divide, NULL, NULL, NULL, };
-#endif
-
-static PyUFuncGenericFunction divide_safe_functions[] = { UBYTE_divide_safe, SBYTE_divide_safe, SHORT_divide_safe, INT_divide_safe, LONG_divide_safe, FLOAT_divide_safe, DOUBLE_divide_safe, };
-static PyUFuncGenericFunction conjugate_functions[] = { UBYTE_conjugate, SBYTE_conjugate, SHORT_conjugate, INT_conjugate, LONG_conjugate, FLOAT_conjugate, DOUBLE_conjugate, CFLOAT_conjugate, CDOUBLE_conjugate, NULL, };
-static PyUFuncGenericFunction remainder_functions[] = { UBYTE_remainder, SBYTE_remainder, SHORT_remainder, INT_remainder, LONG_remainder, NULL, NULL, NULL, };
-static PyUFuncGenericFunction power_functions[] = { UBYTE_power, SBYTE_power, SHORT_power, INT_power, LONG_power, NULL, NULL, NULL, NULL, NULL, };
-static PyUFuncGenericFunction absolute_functions[] = { SBYTE_absolute, SHORT_absolute, INT_absolute, LONG_absolute, FLOAT_absolute, DOUBLE_absolute, CFLOAT_absolute, CDOUBLE_absolute, NULL, };
-static PyUFuncGenericFunction negative_functions[] = { SBYTE_negative, SHORT_negative, INT_negative, LONG_negative, FLOAT_negative, DOUBLE_negative, CFLOAT_negative, CDOUBLE_negative, NULL, };
-static PyUFuncGenericFunction greater_functions[] = { UBYTE_greater, SBYTE_greater, SHORT_greater, INT_greater, LONG_greater, FLOAT_greater, DOUBLE_greater, CFLOAT_greater, CDOUBLE_greater, };
-static PyUFuncGenericFunction greater_equal_functions[] = { UBYTE_greater_equal, SBYTE_greater_equal, SHORT_greater_equal, INT_greater_equal, LONG_greater_equal, FLOAT_greater_equal, DOUBLE_greater_equal, CFLOAT_greater_equal, CDOUBLE_greater_equal, };
-static PyUFuncGenericFunction less_functions[] = { UBYTE_less, SBYTE_less, SHORT_less, INT_less, LONG_less, FLOAT_less, DOUBLE_less, CFLOAT_less, CDOUBLE_less, };
-static PyUFuncGenericFunction less_equal_functions[] = { UBYTE_less_equal, SBYTE_less_equal, SHORT_less_equal, INT_less_equal, LONG_less_equal, FLOAT_less_equal, DOUBLE_less_equal, CFLOAT_less_equal, CDOUBLE_less_equal, };
-static PyUFuncGenericFunction equal_functions[] = { CHAR_equal, UBYTE_equal, SBYTE_equal, SHORT_equal, INT_equal, LONG_equal, FLOAT_equal, DOUBLE_equal, CFLOAT_equal, CDOUBLE_equal, OBJECT_equal};
-static PyUFuncGenericFunction not_equal_functions[] = { CHAR_not_equal, UBYTE_not_equal, SBYTE_not_equal, SHORT_not_equal, INT_not_equal, LONG_not_equal, FLOAT_not_equal, DOUBLE_not_equal, CFLOAT_not_equal, CDOUBLE_not_equal, OBJECT_not_equal};
-static PyUFuncGenericFunction logical_and_functions[] = { UBYTE_logical_and, SBYTE_logical_and, SHORT_logical_and, INT_logical_and, LONG_logical_and, FLOAT_logical_and, DOUBLE_logical_and, CFLOAT_logical_and, CDOUBLE_logical_and, };
-static PyUFuncGenericFunction logical_or_functions[] = { UBYTE_logical_or, SBYTE_logical_or, SHORT_logical_or, INT_logical_or, LONG_logical_or, FLOAT_logical_or, DOUBLE_logical_or, CFLOAT_logical_or, CDOUBLE_logical_or, };
-static PyUFuncGenericFunction logical_xor_functions[] = { UBYTE_logical_xor, SBYTE_logical_xor, SHORT_logical_xor, INT_logical_xor, LONG_logical_xor, FLOAT_logical_xor, DOUBLE_logical_xor, CFLOAT_logical_xor, CDOUBLE_logical_xor, };
-static PyUFuncGenericFunction logical_not_functions[] = { UBYTE_logical_not, SBYTE_logical_not, SHORT_logical_not, INT_logical_not, LONG_logical_not, FLOAT_logical_not, DOUBLE_logical_not, CFLOAT_logical_xor, CDOUBLE_logical_xor, };
-static PyUFuncGenericFunction maximum_functions[] = { UBYTE_maximum, SBYTE_maximum, SHORT_maximum, INT_maximum, LONG_maximum, FLOAT_maximum, DOUBLE_maximum, CFLOAT_maximum, CDOUBLE_maximum,};
-static PyUFuncGenericFunction minimum_functions[] = { UBYTE_minimum, SBYTE_minimum, SHORT_minimum, INT_minimum, LONG_minimum, FLOAT_minimum, DOUBLE_minimum, CFLOAT_minimum, CDOUBLE_minimum, };
-static PyUFuncGenericFunction bitwise_and_functions[] = { UBYTE_bitwise_and, SBYTE_bitwise_and, SHORT_bitwise_and, INT_bitwise_and, LONG_bitwise_and, NULL, };
-static PyUFuncGenericFunction bitwise_or_functions[] = { UBYTE_bitwise_or, SBYTE_bitwise_or, SHORT_bitwise_or, INT_bitwise_or, LONG_bitwise_or, NULL, };
-static PyUFuncGenericFunction bitwise_xor_functions[] = { UBYTE_bitwise_xor, SBYTE_bitwise_xor, SHORT_bitwise_xor, INT_bitwise_xor, LONG_bitwise_xor, NULL, };
-static PyUFuncGenericFunction invert_functions[] = { UBYTE_invert, SBYTE_invert, SHORT_invert, INT_invert, LONG_invert, };
-static PyUFuncGenericFunction left_shift_functions[] = { UBYTE_left_shift, SBYTE_left_shift, SHORT_left_shift, INT_left_shift, LONG_left_shift, NULL, };
-static PyUFuncGenericFunction right_shift_functions[] = { UBYTE_right_shift, SBYTE_right_shift, SHORT_right_shift, INT_right_shift, LONG_right_shift, NULL, };
-static PyUFuncGenericFunction arccos_functions[] = { NULL, NULL, NULL, NULL, NULL, };
-static PyUFuncGenericFunction ceil_functions[] = { NULL, NULL, NULL, };
-static PyUFuncGenericFunction arctan2_functions[] = { NULL, NULL, NULL, };
-static void * add_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * subtract_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * multiply_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * divide_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-#if PY_VERSION_HEX >= 0x02020000
-static void * floor_divide_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-static void * true_divide_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-#endif
-static void * divide_safe_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * conjugate_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * remainder_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * power_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * absolute_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * negative_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * equal_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * bitwise_and_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * bitwise_or_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * bitwise_xor_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * invert_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-static void * left_shift_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * right_shift_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * arccos_data[] = { (void *)acos, (void *)acos, (void *)c_acos, (void *)c_acos, (void *)"arccos", };
-static void * arcsin_data[] = { (void *)asin, (void *)asin, (void *)c_asin, (void *)c_asin, (void *)"arcsin", };
-static void * arctan_data[] = { (void *)atan, (void *)atan, (void *)c_atan, (void *)c_atan, (void *)"arctan", };
-static void * arccosh_data[] = { (void *)acosh, (void *)acosh, (void *)c_acosh, (void *)c_acosh, (void *)"arccosh", };
-static void * arcsinh_data[] = { (void *)asinh, (void *)asinh, (void *)c_asinh, (void *)c_asinh, (void *)"arcsinh", };
-static void * arctanh_data[] = { (void *)atanh, (void *)atanh, (void *)c_atanh, (void *)c_atanh, (void *)"arctanh", };
-static void * cos_data[] = { (void *)cos, (void *)cos, (void *)c_cos, (void *)c_cos, (void *)"cos", };
-static void * cosh_data[] = { (void *)cosh, (void *)cosh, (void *)c_cosh, (void *)c_cosh, (void *)"cosh", };
-static void * exp_data[] = { (void *)exp, (void *)exp, (void *)c_exp, (void *)c_exp, (void *)"exp", };
-static void * log_data[] = { (void *)log, (void *)log, (void *)c_log, (void *)c_log, (void *)"log", };
-static void * log10_data[] = { (void *)log10, (void *)log10, (void *)c_log10, (void *)c_log10, (void *)"log10", };
-static void * sin_data[] = { (void *)sin, (void *)sin, (void *)c_sin, (void *)c_sin, (void *)"sin", };
-static void * sinh_data[] = { (void *)sinh, (void *)sinh, (void *)c_sinh, (void *)c_sinh, (void *)"sinh", };
-static void * sqrt_data[] = { (void *)sqrt, (void *)sqrt, (void *)c_sqrt, (void *)c_sqrt, (void *)"sqrt", };
-static void * tan_data[] = { (void *)tan, (void *)tan, (void *)c_tan, (void *)c_tan, (void *)"tan", };
-static void * tanh_data[] = { (void *)tanh, (void *)tanh, (void *)c_tanh, (void *)c_tanh, (void *)"tanh", };
-static void * ceil_data[] = { (void *)ceil, (void *)ceil, (void *)"ceil", };
-static void * fabs_data[] = { (void *)fabs, (void *)fabs, (void *)"fabs", };
-static void * floor_data[] = { (void *)floor, (void *)floor, (void *)"floor", };
-static void * arctan2_data[] = { (void *)atan2, (void *)atan2, (void *)"arctan2", };
-static void * fmod_data[] = { (void *)fmod, (void *)fmod, (void *)"fmod", };
-static void * hypot_data[] = { (void *)hypot, (void *)hypot, (void *)"hypot", };
-static char add_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-#if PY_VERSION_HEX >= 0x02020000
-static char floor_divide_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, };
-static char true_divide_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_FLOAT, PyArray_SBYTE, PyArray_SBYTE, PyArray_FLOAT, PyArray_SHORT, PyArray_SHORT, PyArray_FLOAT, PyArray_INT, PyArray_INT, PyArray_DOUBLE, PyArray_LONG, PyArray_LONG, PyArray_DOUBLE, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-#endif
-static char divide_safe_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, };
-static char conjugate_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char remainder_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-static char absolute_signatures[] = { PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_FLOAT, PyArray_CDOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char negative_signatures[] = { PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char equal_signatures[] = { PyArray_CHAR, PyArray_CHAR, PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_UBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_UBYTE, PyArray_INT, PyArray_INT, PyArray_UBYTE, PyArray_LONG, PyArray_LONG, PyArray_UBYTE, PyArray_FLOAT, PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_UBYTE, PyArray_OBJECT, PyArray_OBJECT, PyArray_UBYTE};
-static char greater_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_UBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_UBYTE, PyArray_INT, PyArray_INT, PyArray_UBYTE, PyArray_LONG, PyArray_LONG, PyArray_UBYTE, PyArray_FLOAT, PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_UBYTE };
-static char logical_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, };
-static char logical_not_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_UBYTE, PyArray_SHORT, PyArray_UBYTE, PyArray_INT, PyArray_UBYTE, PyArray_LONG, PyArray_UBYTE, PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_UBYTE, };
-static char maximum_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE, };
-static char bitwise_and_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-static char invert_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_INT, PyArray_INT, PyArray_LONG, PyArray_LONG, PyArray_OBJECT, PyArray_OBJECT, };
-static char arccos_signatures[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char ceil_signatures[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char arctan2_signatures[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static void InitOperators(PyObject *dictionary) {
- PyObject *f;
-
- add_data[9] =(void *)PyNumber_Add;
- subtract_data[9] = (void *)PyNumber_Subtract;
- multiply_data[7] = (void *)c_prod_;
- multiply_data[8] = (void *)c_prod_;
- multiply_data[9] = (void *)PyNumber_Multiply;
- divide_data[7] = (void *)c_quot_fast;
- divide_data[8] = (void *)c_quot_fast;
- divide_data[9] = (void *)PyNumber_Divide;
- /*
- divide_safe_data[7] = (void *)c_quot;
- divide_safe_data[8] = (void *)c_quot;
- divide_safe_data[9] = (void *)PyNumber_Divide;
- */
- conjugate_data[9] = (void *)"conjugate";
- remainder_data[5] = (void *)fmod;
- remainder_data[6] = (void *)fmod;
- remainder_data[7] = (void *)PyNumber_Remainder;
- power_data[5] = (void *)pow;
- power_data[6] = (void *)pow;
- power_data[7] = (void *)c_pow_;
- power_data[8] = (void *)c_pow_;
- power_data[9] = (void *)PyNumber_Power;
- absolute_data[8] = (void *)PyNumber_Absolute;
- negative_data[8] = (void *)PyNumber_Negative;
- bitwise_and_data[5] = (void *)PyNumber_And;
- bitwise_or_data[5] = (void *)PyNumber_Or;
- bitwise_xor_data[5] = (void *)PyNumber_Xor;
- invert_data[5] = (void *)PyNumber_Invert;
- left_shift_data[5] = (void *)PyNumber_Lshift;
- right_shift_data[5] = (void *)PyNumber_Rshift;
-#if PY_VERSION_HEX >= 0x02020000
- true_divide_data[7] = (void *)c_quot_fast;
- true_divide_data[8] = (void *)c_quot_fast;
- true_divide_data[9] = (void *)PyNumber_TrueDivide;
- true_divide_functions[7] = fastumath_FF_F_As_DD_D;
- true_divide_functions[8] = fastumath_DD_D;
- true_divide_functions[9] = PyUFunc_OO_O;
-
- floor_divide_data[7] = (void *)c_quot_floor_fast;
- floor_divide_data[8] = (void *)c_quot_floor_fast;
- floor_divide_data[9] = (void *)PyNumber_FloorDivide;
- floor_divide_functions[7] = fastumath_FF_F_As_DD_D;
- floor_divide_functions[8] = fastumath_DD_D;
- floor_divide_functions[9] = PyUFunc_OO_O;
-#endif
-
- add_functions[9] = PyUFunc_OO_O;
- subtract_functions[9] = PyUFunc_OO_O;
- multiply_functions[7] = fastumath_FF_F_As_DD_D;
- multiply_functions[8] = fastumath_DD_D;
- multiply_functions[9] = PyUFunc_OO_O;
- divide_functions[7] = fastumath_FF_F_As_DD_D;
- divide_functions[8] = fastumath_DD_D;
- divide_functions[9] = PyUFunc_OO_O;
- divide_safe_functions[7] = fastumath_FF_F_As_DD_D;
- divide_safe_functions[8] = fastumath_DD_D;
- divide_safe_functions[9] = PyUFunc_OO_O;
- conjugate_functions[9] = PyUFunc_O_O_method;
- remainder_functions[5] = PyUFunc_ff_f_As_dd_d;
- remainder_functions[6] = PyUFunc_dd_d;
- remainder_functions[7] = PyUFunc_OO_O;
- power_functions[5] = PyUFunc_ff_f_As_dd_d;
- power_functions[6] = PyUFunc_dd_d;
- power_functions[7] = fastumath_FF_F_As_DD_D;
- power_functions[8] = fastumath_DD_D;
- power_functions[9] = PyUFunc_OO_O;
- absolute_functions[8] = PyUFunc_O_O;
- negative_functions[8] = PyUFunc_O_O;
- bitwise_and_functions[5] = PyUFunc_OO_O;
- bitwise_or_functions[5] = PyUFunc_OO_O;
- bitwise_xor_functions[5] = PyUFunc_OO_O;
- invert_functions[5] = PyUFunc_O_O;
- left_shift_functions[5] = PyUFunc_OO_O;
- right_shift_functions[5] = PyUFunc_OO_O;
- arccos_functions[0] = PyUFunc_f_f_As_d_d;
- arccos_functions[1] = PyUFunc_d_d;
- arccos_functions[2] = fastumath_F_F_As_D_D;
- arccos_functions[3] = fastumath_D_D;
- arccos_functions[4] = PyUFunc_O_O_method;
- ceil_functions[0] = PyUFunc_f_f_As_d_d;
- ceil_functions[1] = PyUFunc_d_d;
- ceil_functions[2] = PyUFunc_O_O_method;
- arctan2_functions[0] = PyUFunc_ff_f_As_dd_d;
- arctan2_functions[1] = PyUFunc_dd_d;
- arctan2_functions[2] = PyUFunc_O_O_method;
-
-
- f = PyUFunc_FromFuncAndData(isinf_functions, isinf_data, isinf_signatures,
- 4, 1, 1, PyUFunc_None, "isinf",
- "isinf(x) returns non-zero if x is infinity.", 0);
- PyDict_SetItemString(dictionary, "isinf", f);
- Py_DECREF(f);
-
- f = PyUFunc_FromFuncAndData(isfinite_functions, isfinite_data, isinf_signatures,
- 4, 1, 1, PyUFunc_None, "isfinite",
- "isfinite(x) returns non-zero if x is not infinity or not a number.", 0);
- PyDict_SetItemString(dictionary, "isfinite", f);
- Py_DECREF(f);
-
- f = PyUFunc_FromFuncAndData(isnan_functions, isnan_data, isinf_signatures,
- 4, 1, 1, PyUFunc_None, "isnan",
- "isnan(x) returns non-zero if x is not a number.", 0);
- PyDict_SetItemString(dictionary, "isnan", f);
- Py_DECREF(f);
-
- f = PyUFunc_FromFuncAndData(add_functions, add_data, add_signatures, 10,
- 2, 1, PyUFunc_Zero, "add",
- "Add the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "add", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(subtract_functions, subtract_data, add_signatures,
- 10, 2, 1, PyUFunc_Zero, "subtract",
- "Subtract the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "subtract", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(multiply_functions, multiply_data, add_signatures,
- 10, 2, 1, PyUFunc_One, "multiply",
- "Multiply the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "multiply", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(divide_functions, divide_data, add_signatures,
- 10, 2, 1, PyUFunc_One, "divide",
- "Divide the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "divide", f);
- Py_DECREF(f);
-
-#if PY_VERSION_HEX >= 0x02020000
- f = PyUFunc_FromFuncAndData(floor_divide_functions, floor_divide_data, floor_divide_signatures,
- 10, 2, 1, PyUFunc_One, "floor_divide",
- "Floor divide the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "floor_divide", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(true_divide_functions, true_divide_data, true_divide_signatures,
- 10, 2, 1, PyUFunc_One, "true_divide",
- "True divide the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "true_divide", f);
- Py_DECREF(f);
-#endif
-
- f = PyUFunc_FromFuncAndData(divide_safe_functions, divide_safe_data, divide_safe_signatures,
- 7, 2, 1, PyUFunc_One, "divide_safe",
- "Divide elementwise, ZeroDivision exception thrown if necessary.", 0);
- PyDict_SetItemString(dictionary, "divide_safe", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(conjugate_functions, conjugate_data, conjugate_signatures,
- 10, 1, 1, PyUFunc_None, "conjugate",
- "returns conjugate of each element", 0);
- PyDict_SetItemString(dictionary, "conjugate", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(remainder_functions, remainder_data, remainder_signatures,
- 8, 2, 1, PyUFunc_Zero, "remainder",
- "returns remainder of division elementwise", 0);
- PyDict_SetItemString(dictionary, "remainder", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(power_functions, power_data, add_signatures,
- 10, 2, 1, PyUFunc_One, "power",
- "power(x,y) = x**y elementwise.", 0);
- PyDict_SetItemString(dictionary, "power", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(absolute_functions, absolute_data, absolute_signatures,
- 9, 1, 1, PyUFunc_None, "absolute",
- "returns absolute value of each element", 0);
- PyDict_SetItemString(dictionary, "absolute", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(negative_functions, negative_data, negative_signatures,
- 9, 1, 1, PyUFunc_None, "negative",
- "negative(x) == -x elementwise.", 0);
- PyDict_SetItemString(dictionary, "negative", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(greater_functions, divide_safe_data, greater_signatures,
- 9, 2, 1, PyUFunc_None, "greater",
- "greater(x,y) is array of 1's where x > y, 0 otherwise.",1);
- PyDict_SetItemString(dictionary, "greater", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(greater_equal_functions, divide_safe_data, greater_signatures,
- 9, 2, 1, PyUFunc_None, "greater_equal",
- "greater_equal(x,y) is array of 1's where x >=y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "greater_equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(less_functions, divide_safe_data, greater_signatures,
- 9, 2, 1, PyUFunc_None, "less",
- "less(x,y) is array of 1's where x < y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "less", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(less_equal_functions, divide_safe_data, greater_signatures,
- 9, 2, 1, PyUFunc_None, "less_equal",
- "less_equal(x,y) is array of 1's where x <= y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "less_equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(equal_functions, equal_data, equal_signatures,
- 11, 2, 1, PyUFunc_One, "equal",
- "equal(x,y) is array of 1's where x == y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(not_equal_functions, equal_data, equal_signatures,
- 11, 2, 1, PyUFunc_None, "not_equal",
- "not_equal(x,y) is array of 0's where x == y, 1 otherwise.", 0);
- PyDict_SetItemString(dictionary, "not_equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_and_functions, divide_safe_data, logical_signatures,
- 9, 2, 1, PyUFunc_One, "logical_and",
- "logical_and(x,y) returns array of 1's where x and y both true.", 0);
- PyDict_SetItemString(dictionary, "logical_and", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_or_functions, divide_safe_data, logical_signatures,
- 9, 2, 1, PyUFunc_Zero, "logical_or",
- "logical_or(x,y) returns array of 1's where x or y or both are true.", 0);
- PyDict_SetItemString(dictionary, "logical_or", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_xor_functions, divide_safe_data, logical_signatures,
- 9, 2, 1, PyUFunc_None, "logical_xor",
- "logical_xor(x,y) returns array of 1's where exactly one of x or y is true.", 0);
- PyDict_SetItemString(dictionary, "logical_xor", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_not_functions, divide_safe_data, logical_not_signatures,
- 9, 1, 1, PyUFunc_None, "logical_not",
- "logical_not(x) returns array of 1's where x is false, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "logical_not", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(maximum_functions, divide_safe_data, maximum_signatures,
- 9, 2, 1, PyUFunc_None, "maximum",
- "maximum(x,y) returns maximum of x and y taken elementwise.", 0);
- PyDict_SetItemString(dictionary, "maximum", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(minimum_functions, divide_safe_data, maximum_signatures,
- 9, 2, 1, PyUFunc_None, "minimum",
- "minimum(x,y) returns minimum of x and y taken elementwise.", 0);
- PyDict_SetItemString(dictionary, "minimum", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(bitwise_and_functions, bitwise_and_data, bitwise_and_signatures,
- 6, 2, 1, PyUFunc_One, "bitwise_and",
- "bitwise_and(x,y) returns array of bitwise-and of respective elements.", 0);
- PyDict_SetItemString(dictionary, "bitwise_and", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(bitwise_or_functions, bitwise_or_data, bitwise_and_signatures,
- 6, 2, 1, PyUFunc_Zero, "bitwise_or",
- "bitwise_or(x,y) returns array of bitwise-or of respective elements.", 0);
- PyDict_SetItemString(dictionary, "bitwise_or", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(bitwise_xor_functions, bitwise_xor_data, bitwise_and_signatures,
- 6, 2, 1, PyUFunc_None, "bitwise_xor",
- "bitwise_xor(x,y) returns array of bitwise exclusive or of respective elements.", 0);
- PyDict_SetItemString(dictionary, "bitwise_xor", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(invert_functions, invert_data, invert_signatures,
- 6, 1, 1, PyUFunc_None, "invert",
- "invert(n) returns array of bit inversion elementwise if n is an integer array.", 0);
- PyDict_SetItemString(dictionary, "invert", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(left_shift_functions, left_shift_data, bitwise_and_signatures,
- 6, 2, 1, PyUFunc_None, "left_shift",
- "left_shift(n, m) is n << m elementwise.", 0);
- PyDict_SetItemString(dictionary, "left_shift", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(right_shift_functions, right_shift_data, bitwise_and_signatures,
- 6, 2, 1, PyUFunc_None, "right_shift",
- "right_shift(n, m) is n >> m elementwise.", 0);
- PyDict_SetItemString(dictionary, "right_shift", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arccos_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arccos",
- "arccos(x) returns array of elementwise inverse cosines.", 0);
- PyDict_SetItemString(dictionary, "arccos", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arcsin_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arcsin",
- "arcsin(x) returns array of elementwise inverse sines.", 0);
- PyDict_SetItemString(dictionary, "arcsin", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arctan_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arctan",
- "arctan(x) returns array of elementwise inverse tangents.", 0);
- PyDict_SetItemString(dictionary, "arctan", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arctanh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arctanh",
- "arctanh(x) returns array of elementwise inverse hyperbolic tangents.", 0);
- PyDict_SetItemString(dictionary, "arctanh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arccosh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arccosh",
- "arccosh(x) returns array of elementwise inverse hyperbolic cosines.", 0);
- PyDict_SetItemString(dictionary, "arccosh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arcsinh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arcsinh",
- "arcsinh(x) returns array of elementwise inverse hyperbolic sines.", 0);
- PyDict_SetItemString(dictionary, "arcsinh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, cos_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "cos",
- "cos(x) returns array of elementwise cosines.", 0);
- PyDict_SetItemString(dictionary, "cos", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, cosh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "cosh",
- "cosh(x) returns array of elementwise hyberbolic cosines.", 0);
- PyDict_SetItemString(dictionary, "cosh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, exp_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "exp",
- "exp(x) returns array of elementwise e**x.", 0);
- PyDict_SetItemString(dictionary, "exp", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, log_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "log",
- "log(x) returns array of elementwise natural logarithms.", 0);
- PyDict_SetItemString(dictionary, "log", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, log10_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "log10",
- "log10(x) returns array of elementwise base-10 logarithms.", 0);
- PyDict_SetItemString(dictionary, "log10", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, sin_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "sin",
- "sin(x) returns array of elementwise sines.", 0);
- PyDict_SetItemString(dictionary, "sin", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, sinh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "sinh",
- "sinh(x) returns array of elementwise hyperbolic sines.", 0);
- PyDict_SetItemString(dictionary, "sinh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, sqrt_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "sqrt",
- "sqrt(x) returns array of elementwise square roots.", 0);
- PyDict_SetItemString(dictionary, "sqrt", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, tan_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "tan",
- "tan(x) returns array of elementwise tangents.", 0);
- PyDict_SetItemString(dictionary, "tan", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, tanh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "tanh",
- "tanh(x) returns array of elementwise hyperbolic tangents.", 0);
- PyDict_SetItemString(dictionary, "tanh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(ceil_functions, ceil_data, ceil_signatures,
- 3, 1, 1, PyUFunc_None, "ceil",
- "ceil(x) returns array of elementwise least whole number >= x.", 0);
- PyDict_SetItemString(dictionary, "ceil", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(ceil_functions, fabs_data, ceil_signatures,
- 3, 1, 1, PyUFunc_None, "fabs",
- "fabs(x) returns array of elementwise absolute values, 32 bit if x is.", 0);
-
- PyDict_SetItemString(dictionary, "fabs", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(ceil_functions, floor_data, ceil_signatures,
- 3, 1, 1, PyUFunc_None, "floor",
- "floor(x) returns array of elementwise least whole number <= x.", 0);
- PyDict_SetItemString(dictionary, "floor", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arctan2_functions, arctan2_data, arctan2_signatures,
- 3, 2, 1, PyUFunc_None, "arctan2",
- "arctan2(x,y) is a safe and correct tan(x/y).", 0);
- PyDict_SetItemString(dictionary, "arctan2", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arctan2_functions, fmod_data, arctan2_signatures,
- 3, 2, 1, PyUFunc_None, "fmod",
- "fmod(x,y) is remainder(x,y)", 0);
- PyDict_SetItemString(dictionary, "fmod", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arctan2_functions, hypot_data, arctan2_signatures,
- 3, 2, 1, PyUFunc_None, "hypot",
- "hypot(x,y) = sqrt(x**2 + y**2), elementwise.", 0);
- PyDict_SetItemString(dictionary, "hypot", f);
- Py_DECREF(f);
-}
-
-
diff --git a/base/fastumath_unsigned.inc b/base/fastumath_unsigned.inc
deleted file mode 100644
index 0f45f953c..000000000
--- a/base/fastumath_unsigned.inc
+++ /dev/null
@@ -1,2908 +0,0 @@
-/* -*- c -*- */
-/* Fast umath module whose functions do not check for range and domain errors.
-
- Replacement for umath + additions for isnan, isfinite, and isinf
- Also allows comparison operations on complex numbers (just compares the
- real part) and logical operations.
-
- All logical operations return UBYTE arrays.
-
- This version supports unsigned types.
- */
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-#ifndef LONG_BIT
-#define LONG_BIT (CHAR_BIT * sizeof(long))
-#endif
-
-#ifndef INT_BIT
-#define INT_BIT (CHAR_BIT * sizeof(int))
-#endif
-
-#ifndef SHORT_BIT
-#define SHORT_BIT (CHAR_BIT * sizeof(short))
-#endif
-
-#ifndef UINT_BIT
-#define UINT_BIT (CHAR_BIT * sizeof(unsigned int))
-#endif
-
-#ifndef USHORT_BIT
-#define USHORT_BIT (CHAR_BIT * sizeof(unsigned short))
-#endif
-
-/* A whole slew of basic math functions are provided by Konrad Hinsen. */
-
-#if !defined(__STDC__) && !defined(_MSC_VER)
-extern double fmod (double, double);
-extern double frexp (double, int *);
-extern double ldexp (double, int);
-extern double modf (double, double *);
-#endif
-
-#ifndef M_PI
-#define M_PI 3.1415926535897931
-#endif
-
-#define ABS(x) ((x) < 0 ? -(x) : (x))
-
-/* isnan and isinf and isfinite functions */
-static void FLOAT_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) ABS(isnan((double)(*((float *)i1))));
- }
-}
-
-static void DOUBLE_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) ABS(isnan((double)(*((double *)i1))));
- }
-}
-
-static void CFLOAT_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isnan((double)((float *)i1)[0]) || isnan((double)((float *)i1)[1]);
- }
-}
-
-static void CDOUBLE_isnan(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isnan((double)((double *)i1)[0]) || isnan((double)((double *)i1)[1]);
- }
-}
-
-
-static void FLOAT_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) !(isfinite((double)(*((float *)i1))) || isnan((double)(*((float *)i1))));
- }
-}
-
-static void DOUBLE_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op)= (unsigned char) !(isfinite((double)(*((double *)i1))) || isnan((double)(*((double *)i1))));
- }
-}
-
-static void CFLOAT_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op)= (unsigned char) !((isfinite((double)(((float *)i1)[0])) && isfinite((double)(((float *)i1)[1]))) || isnan((double)(((float *)i1)[0])) || isnan((double)(((float *)i1)[1])));
- }
-}
-
-static void CDOUBLE_isinf(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op)= (unsigned char) !((isfinite((double)(((double *)i1)[0])) && isfinite((double)(((double *)i1)[1]))) || isnan((double)(((double *)i1)[0])) || isnan((double)(((double *)i1)[1])));
- }
-}
-
-
-static void FLOAT_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)(*((float *)i1)));
- }
-}
-
-static void DOUBLE_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)(*((double *)i1)));
- }
-}
-
-static void CFLOAT_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)((float *)i1)[0]) && isfinite((double)((float *)i1)[1]);
- }
-}
-
-static void CDOUBLE_isfinite(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0], os=steps[1], n=dimensions[0];
- char *i1=args[0], *op=args[1];
- for (i=0; i < n; i++, i1+=is1, op+=os) {
- *((unsigned char *)op) = (unsigned char) isfinite((double)((double *)i1)[0]) && isfinite((double)((double *)i1)[1]);
- }
-}
-
-static PyUFuncGenericFunction isnan_functions[] = {FLOAT_isnan, DOUBLE_isnan, CFLOAT_isnan, CDOUBLE_isnan, NULL};
-static PyUFuncGenericFunction isinf_functions[] = {FLOAT_isinf, DOUBLE_isinf, CFLOAT_isinf, CDOUBLE_isinf, NULL};
-static PyUFuncGenericFunction isfinite_functions[] = {FLOAT_isfinite, DOUBLE_isfinite, CFLOAT_isfinite, CDOUBLE_isfinite, NULL};
-
-static char isinf_signatures[] = { PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_UBYTE, };
-
-static void * isnan_data[] = {(void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * isinf_data[] = {(void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * isfinite_data[] = {(void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-
-
-
-/* Some functions needed from ufunc object, so that Py_complex's aren't being returned
-between code possibly compiled with different compilers.
-*/
-
-typedef Py_complex ComplexBinaryFunc(Py_complex x, Py_complex y);
-typedef Py_complex ComplexUnaryFunc(Py_complex x);
-
-static void fastumath_F_F_As_D_D(char **args, int *dimensions, int *steps, void *func) {
- int i; Py_complex x;
- char *ip1=args[0], *op=args[1];
- for(i=0; i<*dimensions; i++, ip1+=steps[0], op+=steps[1]) {
- x.real = ((float *)ip1)[0]; x.imag = ((float *)ip1)[1];
- x = ((ComplexUnaryFunc *)func)(x);
- ((float *)op)[0] = (float)x.real;
- ((float *)op)[1] = (float)x.imag;
- }
-}
-
-static void fastumath_D_D(char **args, int *dimensions, int *steps, void *func) {
- int i; Py_complex x;
- char *ip1=args[0], *op=args[1];
- for(i=0; i<*dimensions; i++, ip1+=steps[0], op+=steps[1]) {
- x.real = ((double *)ip1)[0]; x.imag = ((double *)ip1)[1];
- x = ((ComplexUnaryFunc *)func)(x);
- ((double *)op)[0] = x.real;
- ((double *)op)[1] = x.imag;
- }
-}
-
-
-static void fastumath_FF_F_As_DD_D(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2];
- char *ip1=args[0], *ip2=args[1], *op=args[2];
- int n=dimensions[0];
- Py_complex x, y;
-
- for(i=0; i<n; i++, ip1+=is1, ip2+=is2, op+=os) {
- x.real = ((float *)ip1)[0]; x.imag = ((float *)ip1)[1];
- y.real = ((float *)ip2)[0]; y.imag = ((float *)ip2)[1];
- x = ((ComplexBinaryFunc *)func)(x, y);
- ((float *)op)[0] = (float)x.real;
- ((float *)op)[1] = (float)x.imag;
- }
-}
-
-static void fastumath_DD_D(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2];
- char *ip1=args[0], *ip2=args[1], *op=args[2];
- int n=dimensions[0];
- Py_complex x,y;
-
- for(i=0; i<n; i++, ip1+=is1, ip2+=is2, op+=os) {
- x.real = ((double *)ip1)[0]; x.imag = ((double *)ip1)[1];
- y.real = ((double *)ip2)[0]; y.imag = ((double *)ip2)[1];
- x = ((ComplexBinaryFunc *)func)(x, y);
- ((double *)op)[0] = x.real;
- ((double *)op)[1] = x.imag;
- }
-}
-
-static long powll(long x, long n, int nbits)
- /* Overflow check: overflow will occur if log2(abs(x)) * n > nbits. */
-{
- long r = 1;
- long p = x;
- double logtwox;
- long mask = 1;
- if (n < 0) PyErr_SetString(PyExc_ValueError, "Integer to a negative power");
- if (x != 0) {
- logtwox = log10 (fabs ( (double) x))/log10 ( (double) 2.0);
- if (logtwox * (double) n > (double) nbits)
- PyErr_SetString(PyExc_ArithmeticError, "Integer overflow in power.");
- }
- while (mask > 0 && n >= mask) {
- if (n & mask)
- r *= p;
- mask <<= 1;
- p *= p;
- }
- return r;
-}
-
-
-static void UBYTE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) + *((unsigned char *)i2);
- }
-}
-static void SBYTE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) + *((signed char *)i2);
- }
-}
-static void SHORT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) + *((short *)i2);
- }
-}
-static void USHORT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) + *((unsigned short *)i2);
- }
-}
-static void INT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) + *((int *)i2);
- }
-}
-static void UINT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) + *((unsigned int *)i2);
- }
-}
-static void LONG_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) + *((long *)i2);
- }
-}
-static void FLOAT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) + *((float *)i2);
- }
-}
-static void DOUBLE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) + *((double *)i2);
- }
-}
-static void CFLOAT_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((float *)op)[0]=((float *)i1)[0] + ((float *)i2)[0]; ((float *)op)[1]=((float *)i1)[1] + ((float *)i2)[1];
- }
-}
-static void CDOUBLE_add(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((double *)op)[0]=((double *)i1)[0] + ((double *)i2)[0]; ((double *)op)[1]=((double *)i1)[1] + ((double *)i2)[1];
- }
-}
-static void UBYTE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) - *((unsigned char *)i2);
- }
-}
-static void SBYTE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) - *((signed char *)i2);
- }
-}
-static void SHORT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) - *((short *)i2);
- }
-}
-static void USHORT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) - *((unsigned short *)i2);
- }
-}
-static void INT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) - *((int *)i2);
- }
-}
-static void UINT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) - *((unsigned int *)i2);
- }
-}
-static void LONG_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) - *((long *)i2);
- }
-}
-static void FLOAT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) - *((float *)i2);
- }
-}
-static void DOUBLE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) - *((double *)i2);
- }
-}
-static void CFLOAT_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((float *)op)[0]=((float *)i1)[0] - ((float *)i2)[0]; ((float *)op)[1]=((float *)i1)[1] - ((float *)i2)[1];
- }
-}
-static void CDOUBLE_subtract(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- ((double *)op)[0]=((double *)i1)[0] - ((double *)i2)[0]; ((double *)op)[1]=((double *)i1)[1] - ((double *)i2)[1];
- }
-}
-static void UBYTE_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- unsigned int x;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- x = (unsigned int) (*((unsigned char *)i1)) * (unsigned int) (*((unsigned char *)i2));
- if (x > 255) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((unsigned char *)op)=(unsigned char) x;
- }
-}
-static void SBYTE_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- int x;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- x = (int) (*((signed char *)i1)) * (int) (*((signed char *)i2));
- if (x > 127 || x < -128) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((signed char *)op)=(signed char) x;
- }
-}
-static void SHORT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- short a, b, ah, bh, x, y;
- int s;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- s = 1;
- a = *((short *)i1);
- b = *((short *)i2);
- ah = a >> (SHORT_BIT/2);
- bh = b >> (SHORT_BIT/2);
- /* Quick test for common case: two small positive shorts */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((short *)op)=x;
- continue;
- }
- }
- /* Arrange that a >= b >= 0 */
- if (a < 0) {
- a = -a;
- if (a < 0) {
- /* Largest negative */
- if (b == 0 || b == 1) {
- *((short *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- ah = a >> (SHORT_BIT/2);
- }
- if (b < 0) {
- b = -b;
- if (b < 0) {
- /* Largest negative */
- if (a == 0 || a == 1) {
- *((short *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- bh = b >> (SHORT_BIT/2);
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* 2) both ah and bh = 0 : then compute a*b and report
- overflow if it comes out negative */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((short *)op)=s * x;
- continue;
- }
- }
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^31
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1 << (SHORT_BIT/2 - 1))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1 << (SHORT_BIT/2)) - 1;
- x = a*b;
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- x += y << (SHORT_BIT/2);
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((short *)op)=s*x;
- }
-}
-static void USHORT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- unsigned int x;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- x = (unsigned int) (*((unsigned short *)i1)) * (unsigned int) (*((unsigned short *)i2));
- if (x > 65535) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((unsigned short *)op)=(unsigned short) x;
- }
-}
-static void INT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- int a, b, ah, bh, x, y;
- int s;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- s = 1;
- a = *((int *)i1);
- b = *((int *)i2);
- ah = a >> (INT_BIT/2);
- bh = b >> (INT_BIT/2);
- /* Quick test for common case: two small positive ints */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((int *)op)=x;
- continue;
- }
- }
- /* Arrange that a >= b >= 0 */
- if (a < 0) {
- a = -a;
- if (a < 0) {
- /* Largest negative */
- if (b == 0 || b == 1) {
- *((int *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- ah = a >> (INT_BIT/2);
- }
- if (b < 0) {
- b = -b;
- if (b < 0) {
- /* Largest negative */
- if (a == 0 || a == 1) {
- *((int *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- bh = b >> (INT_BIT/2);
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* 2) both ah and bh = 0 : then compute a*b and report
- overflow if it comes out negative */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((int *)op)=s * x;
- continue;
- }
- }
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^31
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1 << (INT_BIT/2 - 1))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1 << (INT_BIT/2)) - 1;
- x = a*b;
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- x += y << (INT_BIT/2);
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((int *)op)=s*x;
- }
-}
-static void UINT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- unsigned int a, b, ah, bh, x, y;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- a = *((unsigned int *)i1);
- b = *((unsigned int *)i2);
- ah = a >> (INT_BIT/2);
- bh = b >> (INT_BIT/2);
- /* Quick test for common case: two small positive ints */
- if (ah == 0 && bh == 0) { /* result should fit into bits available. */
- x = a*b;
- *((unsigned int *)op)=x;
- continue;
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* Otherwise one and only one of ah or bh is non-zero. Make it so a > b (ah >0 and bh=0) */
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* Now a = ah */
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^(INT_BIT/2) -- shifted_version won't fit in unsigned int.
-
- Then compute al*bl (this should fit in the allotated space)
-
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1 << (INT_BIT/2))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1 << (INT_BIT/2)) - 1; /* mask off ah so a is now al */
- x = a*b; /* al * bl */
- x += y << (INT_BIT/2); /* add ah * bl * 2^SHIFT */
- /* This could have caused overflow. One way to know is to check to see if x < al
- Not sure if this get's all cases */
- if (x < a) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((unsigned int *)op)=x;
- }
-}
-static void LONG_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- long a, b, ah, bh, x, y;
- int s;
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- s = 1;
- a = *((long *)i1);
- b = *((long *)i2);
- ah = a >> (LONG_BIT/2);
- bh = b >> (LONG_BIT/2);
- /* Quick test for common case: two small positive ints */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((long *)op)=x;
- continue;
- }
- }
- /* Arrange that a >= b >= 0 */
- if (a < 0) {
- a = -a;
- if (a < 0) {
- /* Largest negative */
- if (b == 0 || b == 1) {
- *((long *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- ah = a >> (LONG_BIT/2);
- }
- if (b < 0) {
- b = -b;
- if (b < 0) {
- /* Largest negative */
- if (a == 0 || a == 1) {
- *((long *)op)=a*b;
- continue;
- }
- else {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- }
- s = -s;
- bh = b >> (LONG_BIT/2);
- }
- /* 1) both ah and bh > 0 : then report overflow */
- if (ah != 0 && bh != 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- /* 2) both ah and bh = 0 : then compute a*b and report
- overflow if it comes out negative */
- if (ah == 0 && bh == 0) {
- if ((x=a*b) < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- else {
- *((long *)op)=s * x;
- continue;
- }
- }
- if (a < b) {
- /* Swap */
- x = a;
- a = b;
- b = x;
- ah = bh;
- /* bh not used beyond this point */
- }
- /* 3) ah > 0 and bh = 0 : compute ah*bl and report overflow if
- it's >= 2^31
- compute al*bl and report overflow if it's negative
- add (ah*bl)<<32 to al*bl and report overflow if
- it's negative
- (NB b == bl in this case, and we make a = al) */
- y = ah*b;
- if (y >= (1L << (LONG_BIT/2 - 1))) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- a &= (1L << (LONG_BIT/2)) - 1;
- x = a*b;
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- x += y << (LONG_BIT/2);
- if (x < 0) {
- PyErr_SetString (PyExc_ArithmeticError, "Integer overflow in multiply.");
- return;
- }
- *((long *)op)=s*x;
- }
-}
-static void FLOAT_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) * *((float *)i2);
- }
-}
-static void DOUBLE_multiply(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) * *((double *)i2);
- }
-}
-static void UBYTE_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned char *)i1) / *((unsigned char *)i2);
- }
-}
-static void SBYTE_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((signed char *)i1) / *((signed char *)i2);
- }
-}
-static void SHORT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((short *)i1) / *((short *)i2);
- }
-}
-static void USHORT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned short *)i1) / *((unsigned short *)i2);
- }
-}
-static void INT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void UINT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void LONG_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((long *)i1) / *((long *)i2);
- }
-}
-static void FLOAT_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) / *((float *)i2);
- }
-}
-static void DOUBLE_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) / *((double *)i2);
- }
-}
-#if PY_VERSION_HEX >= 0x02020000
-static void UBYTE_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned char *)i1) / *((unsigned char *)i2);
- }
-}
-static void SBYTE_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((signed char *)i1) / *((signed char *)i2);
- }
-}
-static void SHORT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((short *)i1) / *((short *)i2);
- }
-}
-static void USHORT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned short *)i1) / *((unsigned short *)i2);
- }
-}
-static void INT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void UINT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void LONG_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((long *)i1) / *((long *)i2);
- }
-}
-static void FLOAT_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=floor((double) (*((float *)i1) / *((float *)i2)));
- }
-}
-static void DOUBLE_floor_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=floor(*((double *)i1) / *((double *)i2));
- }
-}
-
-static void UBYTE_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((unsigned char *)i1)) / ((float)*((unsigned char *)i2));
- }
-}
-static void SBYTE_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((signed char *)i1)) / ((float)*((signed char *)i2));
- }
-}
-static void SHORT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((short *)i1)) / ((float)*((short *)i2));
- }
-}
-static void USHORT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)= ((float)*((unsigned short *)i1)) / ((float)*((unsigned short *)i2));
- }
-}
-static void INT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)= ((double)*((int *)i1)) / ((double)*((int *)i2));
- }
-}
-static void UINT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)= ((double)*((int *)i1)) / ((double)*((int *)i2));
- }
-}
-static void LONG_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)= ((double)*((long *)i1)) / ((double)*((long *)i2));
- }
-}
-static void FLOAT_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) / *((float *)i2);
- }
-}
-static void DOUBLE_true_divide(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) / *((double *)i2);
- }
-}
-#endif
-static void UBYTE_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned char *)i1) / *((unsigned char *)i2);
- }
-}
-static void SBYTE_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((signed char *)i1) / *((signed char *)i2);
- }
-}
-static void SHORT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((short *)i1) / *((short *)i2);
- }
-}
-static void USHORT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((unsigned short *)i1) / *((unsigned short *)i2);
- }
-}
-static void INT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void UINT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((int *)i1) / *((int *)i2);
- }
-}
-static void LONG_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((long *)i1) / *((long *)i2);
- }
-}
-static void FLOAT_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((float *)i1) / *((float *)i2);
- }
-}
-static void DOUBLE_divide_safe(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i2) == 0 ? PyErr_SetString(PyExc_ZeroDivisionError, "divide by zero"),0 : *((double *)i1) / *((double *)i2);
- }
-}
-static void UBYTE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=*((unsigned char *)i1);}}
-static void SBYTE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=*((signed char *)i1);}}
-static void SHORT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=*((short *)i1);}}
-static void USHORT_conjugate(char **args, int *dimensions, int *steps, void *func)
- {int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned short *)op)=*((unsigned short *)i1);}}
-static void INT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=*((int *)i1);}}
-static void UINT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned int *)op)=*((unsigned int *)i1);}}
-static void LONG_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=*((long *)i1);}}
-static void FLOAT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=*((float *)i1);}}
-static void DOUBLE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=*((double *)i1);}}
-static void CFLOAT_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((float *)op)[0]=((float *)i1)[0]; ((float *)op)[1]=-((float *)i1)[1];}}
-static void CDOUBLE_conjugate(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((double *)op)[0]=((double *)i1)[0]; ((double *)op)[1]=-((double *)i1)[1];}}
-static void UBYTE_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) % *((unsigned char *)i2);
- }
-}
-static void SBYTE_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) % *((signed char *)i2);
- }
-}
-static void SHORT_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) % *((short *)i2);
- }
-}
-static void USHORT_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) % *((unsigned short *)i2);
- }
-}
-static void INT_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) % *((int *)i2);
- }
-}
-static void UINT_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) % *((unsigned int *)i2);
- }
-}
-static void LONG_remainder(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) % *((long *)i2);
- }
-}
-static void UBYTE_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(unsigned char)powll(*((unsigned char *)i1), *((unsigned char *)i2), 8);
- }
-}
-static void SBYTE_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=(signed char)powll(*((signed char *)i1), *((signed char *)i2), 7);
- }
-}
-static void SHORT_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=(short)powll(*((short *)i1), *((short *)i2), SHORT_BIT - 1);
- }
-}
-static void USHORT_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=(unsigned short)powll(*((unsigned short *)i1), *((unsigned short *)i2), USHORT_BIT - 1);
- }
-}
-static void INT_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=powll(*((int *)i1), *((int *)i2), INT_BIT - 1);
- }
-}
-static void UINT_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=powll(*((unsigned int *)i1), *((unsigned int *)i2), INT_BIT - 1);
- }
-}
-static void LONG_power(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=powll(*((long *)i1), *((long *)i2), LONG_BIT - 1);
- }
-}
-
-static void UBYTE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op) = *((unsigned char *)i1);}}
-static void SBYTE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=*((signed char *)i1)<0 ? -*((signed char *)i1) : *((signed char *)i1);}}
-static void SHORT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=*((short *)i1)<0 ? -*((short *)i1) : *((short *)i1);}}
-static void USHORT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned short *)op)=*((unsigned short *)i1);}}
-static void INT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=*((int *)i1)<0 ? -*((int *)i1) : *((int *)i1);}}
-static void UINT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned int *)op)=*((unsigned int *)i1);}}
-static void LONG_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=*((long *)i1)<0 ? -*((long *)i1) : *((long *)i1);}}
-static void FLOAT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=*((float *)i1)<0 ? -*((float *)i1) : *((float *)i1);}}
-static void DOUBLE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=*((double *)i1)<0 ? -*((double *)i1) : *((double *)i1);}}
-static void CFLOAT_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=(float)sqrt(((float *)i1)[0]*((float *)i1)[0] + ((float *)i1)[1]*((float *)i1)[1]);}}
-static void CDOUBLE_absolute(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=sqrt(((double *)i1)[0]*((double *)i1)[0] + ((double *)i1)[1]*((double *)i1)[1]);}}
-static void UBYTE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=-*((unsigned char *)i1);}}
-static void SBYTE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=-*((signed char *)i1);}}
-static void SHORT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=-*((short *)i1);}}
-static void USHORT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned short *)op)=-*((unsigned short *)i1);}}
-static void INT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=-*((int *)i1);}}
-static void UINT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned int *)op)=-*((unsigned int *)i1);}}
-static void LONG_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=-*((long *)i1);}}
-static void FLOAT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((float *)op)=-*((float *)i1);}}
-static void DOUBLE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((double *)op)=-*((double *)i1);}}
-static void CFLOAT_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((float *)op)[0]=-((float *)i1)[0]; ((float *)op)[1]=-((float *)i1)[1];}}
-static void CDOUBLE_negative(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {((double *)op)[0]=-((double *)i1)[0]; ((double *)op)[1]=-((double *)i1)[1];}}
-static void UBYTE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) > *((unsigned char *)i2);
- }
-}
-static void SBYTE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) > *((signed char *)i2);
- }
-}
-static void SHORT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) > *((short *)i2);
- }
-}
-static void USHORT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned short *)i1) > *((unsigned short *)i2);
- }
-}
-static void INT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) > *((int *)i2);
- }
-}
-static void UINT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned int *)i1) > *((unsigned int *)i2);
- }
-}
-static void LONG_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) > *((long *)i2);
- }
-}
-static void FLOAT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) > *((float *)i2);
- }
-}
-static void DOUBLE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) > *((double *)i2);
- }
-}
-
-/* complex numbers are compared by there real parts. */
-static void CFLOAT_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)= ((float *)i1)[0] > ((float *)i2)[0];
- }
-}
-static void CDOUBLE_greater(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)= ((double *)i1)[0] > ((double *)i2)[0];
- }
-}
-
-static void UBYTE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) >= *((unsigned char *)i2);
- }
-}
-static void SBYTE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) >= *((signed char *)i2);
- }
-}
-static void SHORT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) >= *((short *)i2);
- }
-}
-static void USHORT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned short *)i1) >= *((unsigned short *)i2);
- }
-}
-static void INT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) >= *((int *)i2);
- }
-}
-static void UINT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned int *)i1) >= *((unsigned int *)i2);
- }
-}
-static void LONG_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) >= *((long *)i2);
- }
-}
-static void FLOAT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) >= *((float *)i2);
- }
-}
-static void DOUBLE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) >= *((double *)i2);
- }
-}
-static void CFLOAT_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) >= *((float *)i2);
- }
-}
-static void CDOUBLE_greater_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) >= *((double *)i2);
- }
-}
-
-static void UBYTE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) < *((unsigned char *)i2);
- }
-}
-static void SBYTE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) < *((signed char *)i2);
- }
-}
-static void SHORT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) < *((short *)i2);
- }
-}
-static void USHORT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned short *)i1) < *((unsigned short *)i2);
- }
-}
-static void INT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) < *((int *)i2);
- }
-}
-static void UINT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned int *)i1) < *((unsigned int *)i2);
- }
-}
-static void LONG_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) < *((long *)i2);
- }
-}
-static void FLOAT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) < *((float *)i2);
- }
-}
-static void DOUBLE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) < *((double *)i2);
- }
-}
-static void CFLOAT_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) < *((float *)i2);
- }
-}
-static void CDOUBLE_less(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) < *((double *)i2);
- }
-}
-
-static void UBYTE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) <= *((unsigned char *)i2);
- }
-}
-static void SBYTE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) <= *((signed char *)i2);
- }
-}
-static void SHORT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) <= *((short *)i2);
- }
-}
-static void USHORT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned short *)i1) <= *((unsigned short *)i2);
- }
-}
-static void INT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) <= *((int *)i2);
- }
-}
-static void UINT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned int *)i1) <= *((unsigned int *)i2);
- }
-}
-static void LONG_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) <= *((long *)i2);
- }
-}
-static void FLOAT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) <= *((float *)i2);
- }
-}
-static void DOUBLE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) <= *((double *)i2);
- }
-}
-static void CFLOAT_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) <= *((float *)i2);
- }
-}
-static void CDOUBLE_less_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) <= *((double *)i2);
- }
-}
-static void CHAR_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((char *)i1) == *((char *)i2);
- }
-}
-static void UBYTE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) == *((unsigned char *)i2);
- }
-}
-static void SBYTE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) == *((signed char *)i2);
- }
-}
-static void SHORT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) == *((short *)i2);
- }
-}
-static void USHORT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned short *)i1) == *((unsigned short *)i2);
- }
-}
-static void INT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) == *((int *)i2);
- }
-}
-static void UINT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned int *)i1) == *((unsigned int *)i2);
- }
-}
-static void LONG_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) == *((long *)i2);
- }
-}
-static void FLOAT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) == *((float *)i2);
- }
-}
-static void DOUBLE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)= (*((double *)i1) == *((double *)i2));
- }
-}
-static void CFLOAT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((float *)i1)[0] == ((float *)i2)[0]) && (((float *)i1)[1] == ((float *)i2)[1]);
- }
-}
-static void CDOUBLE_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((double *)i1)[0] == ((double *)i2)[0]) && (((double *)i1)[1] == ((double *)i2)[1]);
- }
-}
-static void OBJECT_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(PyObject_Compare(*((PyObject **)i1),*((PyObject **)i2)) == 0);
- }
-}
-static void CHAR_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((char *)i1) != *((char *)i2);
- }
-}
-static void UBYTE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) != *((unsigned char *)i2);
- }
-}
-static void SBYTE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((signed char *)i1) != *((signed char *)i2);
- }
-}
-static void SHORT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((short *)i1) != *((short *)i2);
- }
-}
-static void USHORT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned short *)i1) != *((unsigned short *)i2);
- }
-}
-static void INT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((int *)i1) != *((int *)i2);
- }
-}
-static void UINT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned int *)i1) != *((unsigned int *)i2);
- }
-}
-static void LONG_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((long *)i1) != *((long *)i2);
- }
-}
-static void FLOAT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((float *)i1) != *((float *)i2);
- }
-}
-static void DOUBLE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((double *)i1) != *((double *)i2);
- }
-}
-static void CFLOAT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((float *)i1)[0] != ((float *)i2)[0]) || (((float *)i1)[1] != ((float *)i2)[1]);
- }
-}
-static void CDOUBLE_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(((double *)i1)[0] != ((double *)i2)[0]) || (((double *)i1)[1] != ((double *)i2)[1]);
- }
-}
-static void OBJECT_not_equal(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(PyObject_Compare(*((PyObject **)i1),*((PyObject **)i2)) != 0);
- }
-}
-static void UBYTE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) && *((unsigned char *)i2);
- }
-}
-static void SBYTE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) && *((signed char *)i2);
- }
-}
-static void SHORT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) && *((short *)i2);
- }
-}
-static void USHORT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) && *((unsigned short *)i2);
- }
-}
-static void INT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) && *((int *)i2);
- }
-}
-static void UINT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) && *((unsigned int *)i2);
- }
-}
-static void LONG_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) && *((long *)i2);
- }
-}
-static void FLOAT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(float)(*((float *)i1) && *((float *)i2));
- }
-}
-static void DOUBLE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(double)(*((double *)i1) && *((double *)i2));
- }
-}
-
-#if 0
-static void CFLOAT_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(float)(*((float *)i1) && *((float *)i2));
- }
-}
-static void CDOUBLE_logical_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(double)(*((double *)i1) && *((double *)i2));
- }
-}
-#endif
-
-static void UBYTE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) || *((unsigned char *)i2);
- }
-}
-static void SBYTE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) || *((signed char *)i2);
- }
-}
-static void SHORT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) || *((short *)i2);
- }
-}
-static void USHORT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) || *((unsigned short *)i2);
- }
-}
-static void INT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) || *((int *)i2);
- }
-}
-static void UINT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) || *((unsigned int *)i2);
- }
-}
-static void LONG_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) || *((long *)i2);
- }
-}
-static void FLOAT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(float)(*((float *)i1) || *((float *)i2));
- }
-}
-static void DOUBLE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(double)(*((double *)i1) || *((double *)i2));
- }
-}
-
-#if 0
-static void CFLOAT_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=(float)(*((float *)i1) || *((float *)i2));
- }
-}
-static void CDOUBLE_logical_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=(double)(*((double *)i1) || *((double *)i2));
- }
-}
-#endif
-
-static void UBYTE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=(*((unsigned char *)i1) || *((unsigned char *)i2)) && !(*((unsigned char *)i1) && *((unsigned char *)i2));
- }
-}
-static void SBYTE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((char *)op)=(*((signed char *)i1) || *((signed char *)i2)) && !(*((signed char *)i1) && *((signed char *)i2));
- }
-}
-static void SHORT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=(*((short *)i1) || *((short *)i2)) && !(*((short *)i1) && *((short *)i2));
- }
-}
-static void USHORT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=(*((unsigned short *)i1) || *((unsigned short *)i2)) && !(*((unsigned short *)i1) && *((unsigned short *)i2));
- }
-}
-static void INT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=(*((int *)i1) || *((int *)i2)) && !(*((int *)i1) && *((int *)i2));
- }
-}
-static void UINT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=(*((unsigned int *)i1) || *((unsigned int *)i2)) && !(*((unsigned int *)i1) && *((unsigned int *)i2));
- }
-}
-static void LONG_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=(*((long *)i1) || *((long *)i2)) && !(*((long *)i1) && *((long *)i2));
- }
-}
-static void FLOAT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float*)op)=(float)((*((float*)i1)||*((float*)i2))&&!(*((float*)i1)&&*((float*)i2)));
- }
-}
-static void DOUBLE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double*)op)=(double)(*((double *)i1) || *((double *)i2)) && !(*((double *)i1) && *((double *)i2));
- }
-}
-
-#if 0
-static void CFLOAT_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float*)op)=(float)((*((float *)i1) || *((float *)i2)) && !(*((float *)i1) && *((float *)i2)));
- }
-}
-static void CDOUBLE_logical_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double*)op)=(double)(*((double *)i1) || *((double *)i2)) && !(*((double *)i1) && *((double *)i2));
- }
-}
-#endif
-
-static void UBYTE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((unsigned char *)i1);}}
-static void SBYTE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((signed char *)i1);}}
-static void SHORT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((short *)i1);}}
-static void USHORT_logical_not(char **args, int *dimensions, int *steps, void *func)
- {int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((unsigned short *)i1);}}
-static void INT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((int *)i1);}}
-static void UINT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((unsigned int *)i1);}}
-static void LONG_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((long *)i1);}}
-static void FLOAT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char*)op)=(!*((float *)i1));}}
-static void DOUBLE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((double *)i1);}}
-
-#if 0
-static void CFLOAT_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char*)op)=(!*((float *)i1));}}
-static void CDOUBLE_logical_not(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=!*((double *)i1);}}
-#endif
-
-static void UBYTE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) > *((unsigned char *)i2) ? *((unsigned char *)i1) : *((unsigned char *)i2);
- }
-}
-static void SBYTE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) > *((signed char *)i2) ? *((signed char *)i1) : *((signed char *)i2);
- }
-}
-static void SHORT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) > *((short *)i2) ? *((short *)i1) : *((short *)i2);
- }
-}
-static void USHORT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) > *((unsigned short *)i2) ? *((unsigned short *)i1) : *((unsigned short *)i2);
- }
-}
-static void INT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) > *((int *)i2) ? *((int *)i1) : *((int *)i2);
- }
-}
-static void UINT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) > *((unsigned int *)i2) ? *((unsigned int *)i1) : *((unsigned int *)i2);
- }
-}
-static void LONG_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) > *((long *)i2) ? *((long *)i1) : *((long *)i2);
- }
-}
-static void FLOAT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) > *((float *)i2) ? *((float *)i1) : *((float *)i2);
- }
-}
-static void DOUBLE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) > *((double *)i2) ? *((double *)i1) : *((double *)i2);
- }
-}
-static void CFLOAT_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) > *((float *)i2) ? *((float *)i1) : *((float *)i2);
- ((float *)op)[1]=*((float *)i1) > *((float *)i2) ? ((float *)i1)[1] : ((float *)i2)[1];
- }
-}
-static void CDOUBLE_maximum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) > *((double *)i2) ? *((double *)i1) : *((double *)i2);
- ((double *)op)[1]=*((double *)i1) > *((double *)i2) ? ((double *)i1)[1] : ((double *)i2)[1];
- }
-}
-static void UBYTE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) < *((unsigned char *)i2) ? *((unsigned char *)i1) : *((unsigned char *)i2);
- }
-}
-static void SBYTE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) < *((signed char *)i2) ? *((signed char *)i1) : *((signed char *)i2);
- }
-}
-static void SHORT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) < *((short *)i2) ? *((short *)i1) : *((short *)i2);
- }
-}
-static void USHORT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) < *((unsigned short *)i2) ? *((unsigned short *)i1) : *((unsigned short *)i2);
- }
-}
-static void INT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) < *((int *)i2) ? *((int *)i1) : *((int *)i2);
- }
-}
-static void UINT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) < *((unsigned int *)i2) ? *((unsigned int *)i1) : *((unsigned int *)i2);
- }
-}
-static void LONG_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) < *((long *)i2) ? *((long *)i1) : *((long *)i2);
- }
-}
-static void FLOAT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) < *((float *)i2) ? *((float *)i1) : *((float *)i2);
- }
-}
-static void DOUBLE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) < *((double *)i2) ? *((double *)i1) : *((double *)i2);
- }
-}
-static void CFLOAT_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((float *)op)=*((float *)i1) < *((float *)i2) ? *((float *)i1) : *((float *)i2);
- ((float *)op)[1]=*((float *)i1) < *((float *)i2) ? ((float *)i1)[1] : ((float *)i2)[1];
- }
-}
-static void CDOUBLE_minimum(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((double *)op)=*((double *)i1) < *((double *)i2) ? *((double *)i1) : *((double *)i2);
- ((double *)op)[1]=*((double *)i1) < *((double *)i2) ? ((double *)i1)[1] : ((double *)i2)[1];
- }
-}
-static void UBYTE_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) & *((unsigned char *)i2);
- }
-}
-static void SBYTE_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) & *((signed char *)i2);
- }
-}
-static void SHORT_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) & *((short *)i2);
- }
-}
-static void USHORT_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) & *((unsigned short *)i2);
- }
-}
-static void INT_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) & *((int *)i2);
- }
-}
-static void UINT_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) & *((unsigned int *)i2);
- }
-}
-static void LONG_bitwise_and(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) & *((long *)i2);
- }
-}
-static void UBYTE_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) | *((unsigned char *)i2);
- }
-}
-static void SBYTE_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) | *((signed char *)i2);
- }
-}
-static void SHORT_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) | *((short *)i2);
- }
-}
-static void USHORT_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) | *((unsigned short *)i2);
- }
-}
-static void INT_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) | *((int *)i2);
- }
-}
-static void UINT_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) | *((unsigned int *)i2);
- }
-}
-static void LONG_bitwise_or(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) | *((long *)i2);
- }
-}
-static void UBYTE_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) ^ *((unsigned char *)i2);
- }
-}
-static void SBYTE_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) ^ *((signed char *)i2);
- }
-}
-static void SHORT_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) ^ *((short *)i2);
- }
-}
-static void USHORT_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) ^ *((unsigned short *)i2);
- }
-}
-static void INT_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) ^ *((int *)i2);
- }
-}
-static void UINT_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) ^ *((unsigned int *)i2);
- }
-}
-static void LONG_bitwise_xor(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) ^ *((long *)i2);
- }
-}
-static void UBYTE_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned char *)op)=~*((unsigned char *)i1);}}
-static void SBYTE_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((signed char *)op)=~*((signed char *)i1);}}
-static void SHORT_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((short *)op)=~*((short *)i1);}}
-static void USHORT_invert(char **args, int *dimensions, int *steps, void *func)
- {int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned short *)op)=~*((unsigned short *)i1);}}
-static void INT_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((int *)op)=~*((int *)i1);}}
-static void UINT_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((unsigned int *)op)=~*((unsigned int *)i1);}}
-static void LONG_invert(char **args, int *dimensions, int *steps, void *func)
-{int i; char *i1=args[0], *op=args[1]; for(i=0; i<*dimensions; i++, i1+=steps[0], op+=steps[1]) {*((long *)op)=~*((long *)i1);}}
-static void UBYTE_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) << *((unsigned char *)i2);
- }
-}
-static void SBYTE_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)=*((signed char *)i1) << *((signed char *)i2);
- }
-}
-static void SHORT_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)=*((short *)i1) << *((short *)i2);
- }
-}
-static void USHORT_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) << *((unsigned short *)i2);
- }
-}
-static void INT_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) << *((int *)i2);
- }
-}
-static void UINT_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) << *((unsigned int *)i2);
- }
-}
-static void LONG_left_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) << *((long *)i2);
- }
-}
-static void UBYTE_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned char *)op)=*((unsigned char *)i1) >> *((unsigned char *)i2);
- }
-}
-static void SBYTE_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((signed char *)op)= *((signed char *)i1) >> *((signed char *)i2);
- }
-}
-static void SHORT_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((short *)op)= *((short *)i1) >> *((short *)i2);
- }
-}
-static void USHORT_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned short *)op)=*((unsigned short *)i1) >> *((unsigned short *)i2);
- }
-}
-static void INT_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((int *)op)=*((int *)i1) >> *((int *)i2);
- }
-}
-static void UINT_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((unsigned int *)op)=*((unsigned int *)i1) >> *((unsigned int *)i2);
- }
-}
-static void LONG_right_shift(char **args, int *dimensions, int *steps, void *func) {
- int i, is1=steps[0],is2=steps[1],os=steps[2], n=dimensions[0];
- char *i1=args[0], *i2=args[1], *op=args[2];
- for(i=0; i<n; i++, i1+=is1, i2+=is2, op+=os) {
- *((long *)op)=*((long *)i1) >> *((long *)i2);
- }
-}
-
-static PyUFuncGenericFunction add_functions[] = { UBYTE_add, SBYTE_add, SHORT_add, USHORT_add, INT_add, UINT_add, LONG_add, FLOAT_add, DOUBLE_add, CFLOAT_add, CDOUBLE_add, NULL, };
-static PyUFuncGenericFunction subtract_functions[] = { UBYTE_subtract, SBYTE_subtract, SHORT_subtract, USHORT_subtract, INT_subtract, UINT_subtract, LONG_subtract, FLOAT_subtract, DOUBLE_subtract, CFLOAT_subtract, CDOUBLE_subtract, NULL, };
-static PyUFuncGenericFunction multiply_functions[] = { UBYTE_multiply, SBYTE_multiply, SHORT_multiply, USHORT_multiply, INT_multiply, UINT_multiply, LONG_multiply, FLOAT_multiply, DOUBLE_multiply, NULL, NULL, NULL, };
-static PyUFuncGenericFunction divide_functions[] = { UBYTE_divide, SBYTE_divide, SHORT_divide, USHORT_divide, INT_divide, UINT_divide, LONG_divide, FLOAT_divide, DOUBLE_divide, NULL, NULL, NULL, };
-#if PY_VERSION_HEX >= 0x02020000
-static PyUFuncGenericFunction floor_divide_functions[] = { UBYTE_floor_divide, SBYTE_floor_divide, SHORT_floor_divide, USHORT_floor_divide, INT_floor_divide, UINT_floor_divide, LONG_floor_divide, FLOAT_floor_divide, DOUBLE_floor_divide, NULL, NULL, NULL, };
-static PyUFuncGenericFunction true_divide_functions[] = { UBYTE_true_divide, SBYTE_true_divide, SHORT_true_divide, USHORT_true_divide, INT_true_divide, UINT_true_divide, LONG_true_divide, FLOAT_true_divide, DOUBLE_true_divide, NULL, NULL, NULL, };
-#endif
-static PyUFuncGenericFunction divide_safe_functions[] = { UBYTE_divide_safe, SBYTE_divide_safe, SHORT_divide_safe, USHORT_divide_safe, INT_divide_safe, UINT_divide_safe, LONG_divide_safe, FLOAT_divide_safe, DOUBLE_divide_safe, };
-static PyUFuncGenericFunction conjugate_functions[] = { UBYTE_conjugate, SBYTE_conjugate, SHORT_conjugate, USHORT_conjugate, INT_conjugate, UINT_conjugate, LONG_conjugate, FLOAT_conjugate, DOUBLE_conjugate, CFLOAT_conjugate, CDOUBLE_conjugate, NULL, };
-static PyUFuncGenericFunction remainder_functions[] = { UBYTE_remainder, SBYTE_remainder, SHORT_remainder, USHORT_remainder, INT_remainder, UINT_remainder, LONG_remainder, NULL, NULL, NULL, };
-static PyUFuncGenericFunction power_functions[] = { UBYTE_power, SBYTE_power, SHORT_power, USHORT_power, INT_power, UINT_power, LONG_power, NULL, NULL, NULL, NULL, NULL, };
-static PyUFuncGenericFunction absolute_functions[] = { UBYTE_absolute, SBYTE_absolute, SHORT_absolute, USHORT_absolute, INT_absolute, UINT_absolute, LONG_absolute, FLOAT_absolute, DOUBLE_absolute, CFLOAT_absolute, CDOUBLE_absolute, NULL, };
-static PyUFuncGenericFunction negative_functions[] = { UBYTE_negative, SBYTE_negative, SHORT_negative, USHORT_negative, INT_negative, UINT_negative, LONG_negative, FLOAT_negative, DOUBLE_negative, CFLOAT_negative, CDOUBLE_negative, NULL, };
-static PyUFuncGenericFunction greater_functions[] = { UBYTE_greater, SBYTE_greater, SHORT_greater, USHORT_greater, INT_greater, UINT_greater, LONG_greater, FLOAT_greater, DOUBLE_greater, CFLOAT_greater, CDOUBLE_greater, };
-static PyUFuncGenericFunction greater_equal_functions[] = { UBYTE_greater_equal, SBYTE_greater_equal, SHORT_greater_equal, USHORT_greater_equal, INT_greater_equal, UINT_greater_equal, LONG_greater_equal, FLOAT_greater_equal, DOUBLE_greater_equal, CFLOAT_greater_equal, CDOUBLE_greater_equal, };
-static PyUFuncGenericFunction less_functions[] = { UBYTE_less, SBYTE_less, SHORT_less, USHORT_less, INT_less, UINT_less, LONG_less, FLOAT_less, DOUBLE_less, CFLOAT_less, CDOUBLE_less, };
-static PyUFuncGenericFunction less_equal_functions[] = { UBYTE_less_equal, SBYTE_less_equal, SHORT_less_equal, USHORT_less_equal, INT_less_equal, UINT_less_equal, LONG_less_equal, FLOAT_less_equal, DOUBLE_less_equal, CFLOAT_less_equal, CDOUBLE_less_equal, };
-static PyUFuncGenericFunction equal_functions[] = { CHAR_equal, UBYTE_equal, SBYTE_equal, SHORT_equal, USHORT_equal, INT_equal, UINT_equal, LONG_equal, FLOAT_equal, DOUBLE_equal, CFLOAT_equal, CDOUBLE_equal, OBJECT_equal};
-static PyUFuncGenericFunction not_equal_functions[] = { CHAR_not_equal, UBYTE_not_equal, SBYTE_not_equal, SHORT_not_equal, USHORT_not_equal, INT_not_equal, UINT_not_equal, LONG_not_equal, FLOAT_not_equal, DOUBLE_not_equal, CFLOAT_not_equal, CDOUBLE_not_equal, OBJECT_not_equal};
-static PyUFuncGenericFunction logical_and_functions[] = { UBYTE_logical_and, SBYTE_logical_and, SHORT_logical_and, USHORT_logical_and, INT_logical_and, UINT_logical_and, LONG_logical_and, FLOAT_logical_and, DOUBLE_logical_and, };
-static PyUFuncGenericFunction logical_or_functions[] = { UBYTE_logical_or, SBYTE_logical_or, SHORT_logical_or, USHORT_logical_or, INT_logical_or, UINT_logical_or, LONG_logical_or, FLOAT_logical_or, DOUBLE_logical_or, };
-static PyUFuncGenericFunction logical_xor_functions[] = { UBYTE_logical_xor, SBYTE_logical_xor, SHORT_logical_xor, USHORT_logical_xor, INT_logical_xor, UINT_logical_xor, LONG_logical_xor, FLOAT_logical_xor, DOUBLE_logical_xor, };
-static PyUFuncGenericFunction logical_not_functions[] = { UBYTE_logical_not, SBYTE_logical_not, SHORT_logical_not, USHORT_logical_not, INT_logical_not, UINT_logical_not, LONG_logical_not, FLOAT_logical_not, DOUBLE_logical_not, };
-static PyUFuncGenericFunction maximum_functions[] = { UBYTE_maximum, SBYTE_maximum, SHORT_maximum, USHORT_maximum, INT_maximum, UINT_maximum, LONG_maximum, FLOAT_maximum, DOUBLE_maximum, CFLOAT_maximum, CDOUBLE_maximum, };
-static PyUFuncGenericFunction minimum_functions[] = { UBYTE_minimum, SBYTE_minimum, SHORT_minimum, USHORT_minimum, INT_minimum, UINT_minimum, LONG_minimum, FLOAT_minimum, DOUBLE_minimum, CFLOAT_minimum, CDOUBLE_minimum, };
-static PyUFuncGenericFunction bitwise_and_functions[] = { UBYTE_bitwise_and, SBYTE_bitwise_and, SHORT_bitwise_and, USHORT_bitwise_and, INT_bitwise_and, UINT_bitwise_and, LONG_bitwise_and, NULL, };
-static PyUFuncGenericFunction bitwise_or_functions[] = { UBYTE_bitwise_or, SBYTE_bitwise_or, SHORT_bitwise_or, USHORT_bitwise_or, INT_bitwise_or, UINT_bitwise_or, LONG_bitwise_or, NULL, };
-static PyUFuncGenericFunction bitwise_xor_functions[] = { UBYTE_bitwise_xor, SBYTE_bitwise_xor, SHORT_bitwise_xor, USHORT_bitwise_xor, INT_bitwise_xor, UINT_bitwise_xor, LONG_bitwise_xor, NULL, };
-static PyUFuncGenericFunction invert_functions[] = { UBYTE_invert, SBYTE_invert, SHORT_invert, USHORT_invert, INT_invert, UINT_invert, LONG_invert, NULL, };
-static PyUFuncGenericFunction left_shift_functions[] = { UBYTE_left_shift, SBYTE_left_shift, SHORT_left_shift, USHORT_left_shift, INT_left_shift, UINT_left_shift, LONG_left_shift, NULL, };
-static PyUFuncGenericFunction right_shift_functions[] = { UBYTE_right_shift, SBYTE_right_shift, SHORT_right_shift, USHORT_right_shift, INT_right_shift, UINT_right_shift, LONG_right_shift, NULL, };
-
-static PyUFuncGenericFunction arccos_functions[] = { NULL, NULL, NULL, NULL, NULL, };
-static PyUFuncGenericFunction ceil_functions[] = { NULL, NULL, NULL, };
-static PyUFuncGenericFunction arctan2_functions[] = { NULL, NULL, NULL, };
-
-
-static void * add_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * subtract_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * multiply_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * divide_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-#if PY_VERSION_HEX >= 0x02020000
-static void * floor_divide_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * true_divide_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL };
-#endif
-static void * divide_safe_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *) NULL, (void *) NULL };
-static void * conjugate_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL };
-static void * remainder_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * power_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-static void * absolute_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL};
-static void * negative_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-static void * equal_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * bitwise_and_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * bitwise_or_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * bitwise_xor_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, };
-static void * invert_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-static void * left_shift_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-static void * right_shift_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL,};
-
-static void * arccos_data[] = { (void *)acos, (void *)acos, (void *)c_acos, (void *)c_acos, (void *)"arccos", };
-static void * arcsin_data[] = { (void *)asin, (void *)asin, (void *)c_asin, (void *)c_asin, (void *)"arcsin", };
-static void * arctan_data[] = { (void *)atan, (void *)atan, (void *)c_atan, (void *)c_atan, (void *)"arctan", };
-static void * arccosh_data[] = { (void *)acosh, (void *)acosh, (void *)c_acosh, (void *)c_acosh, (void *)"arccosh", };
-static void * arcsinh_data[] = { (void *)asinh, (void *)asinh, (void *)c_asinh, (void *)c_asinh, (void *)"arcsinh", };
-static void * arctanh_data[] = { (void *)atanh, (void *)atanh, (void *)c_atanh, (void *)c_atanh, (void *)"arctanh", };
-static void * cos_data[] = { (void *)cos, (void *)cos, (void *)c_cos, (void *)c_cos, (void *)"cos", };
-static void * cosh_data[] = { (void *)cosh, (void *)cosh, (void *)c_cosh, (void *)c_cosh, (void *)"cosh", };
-static void * exp_data[] = { (void *)exp, (void *)exp, (void *)c_exp, (void *)c_exp, (void *)"exp", };
-static void * log_data[] = { (void *)log, (void *)log, (void *)c_log, (void *)c_log, (void *)"log", };
-static void * log10_data[] = { (void *)log10, (void *)log10, (void *)c_log10, (void *)c_log10, (void *)"log10", };
-static void * sin_data[] = { (void *)sin, (void *)sin, (void *)c_sin, (void *)c_sin, (void *)"sin", };
-static void * sinh_data[] = { (void *)sinh, (void *)sinh, (void *)c_sinh, (void *)c_sinh, (void *)"sinh", };
-static void * sqrt_data[] = { (void *)sqrt, (void *)sqrt, (void *)c_sqrt, (void *)c_sqrt, (void *)"sqrt", };
-static void * tan_data[] = { (void *)tan, (void *)tan, (void *)c_tan, (void *)c_tan, (void *)"tan", };
-static void * tanh_data[] = { (void *)tanh, (void *)tanh, (void *)c_tanh, (void *)c_tanh, (void *)"tanh", };
-static void * ceil_data[] = { (void *)ceil, (void *)ceil, (void *)"ceil", };
-static void * fabs_data[] = { (void *)fabs, (void *)fabs, (void *)"fabs", };
-static void * floor_data[] = { (void *)floor, (void *)floor, (void *)"floor", };
-static void * arctan2_data[] = { (void *)atan2, (void *)atan2, (void *)"arctan2", };
-static void * fmod_data[] = { (void *)fmod, (void *)fmod, (void *)"fmod", };
-static void * hypot_data[] = { (void *)hypot, (void *)hypot, (void *)"hypot", };
-
-static char add_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-#if PY_VERSION_HEX >= 0x02020000
-static char floor_divide_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, };
-static char true_divide_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_FLOAT, PyArray_SBYTE, PyArray_SBYTE, PyArray_FLOAT, PyArray_SHORT, PyArray_SHORT, PyArray_FLOAT, PyArray_USHORT, PyArray_USHORT, PyArray_FLOAT, PyArray_INT, PyArray_INT, PyArray_DOUBLE, PyArray_UINT, PyArray_UINT, PyArray_DOUBLE, PyArray_LONG, PyArray_LONG, PyArray_DOUBLE, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-#endif
-static char divide_safe_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, };
-static char conjugate_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char remainder_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-static char absolute_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_FLOAT, PyArray_CDOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char negative_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char equal_signatures[] = { PyArray_CHAR, PyArray_CHAR, PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_UBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_UBYTE, PyArray_USHORT, PyArray_USHORT, PyArray_UBYTE, PyArray_INT, PyArray_INT, PyArray_UBYTE, PyArray_UINT, PyArray_UINT, PyArray_UBYTE, PyArray_LONG, PyArray_LONG, PyArray_UBYTE, PyArray_FLOAT, PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_UBYTE, PyArray_OBJECT, PyArray_OBJECT, PyArray_UBYTE,};
-static char greater_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_UBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_UBYTE, PyArray_USHORT, PyArray_USHORT, PyArray_UBYTE, PyArray_INT, PyArray_INT, PyArray_UBYTE, PyArray_UINT, PyArray_UINT, PyArray_UBYTE, PyArray_LONG, PyArray_LONG, PyArray_UBYTE, PyArray_FLOAT, PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_UBYTE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_UBYTE, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_UBYTE };
-static char logical_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE };
-static char logical_not_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_UBYTE, PyArray_SHORT, PyArray_UBYTE, PyArray_USHORT, PyArray_UBYTE, PyArray_INT, PyArray_UBYTE, PyArray_UINT, PyArray_UBYTE, PyArray_LONG, PyArray_UBYTE, PyArray_FLOAT, PyArray_UBYTE, PyArray_DOUBLE, PyArray_UBYTE, };
-static char maximum_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_CDOUBLE, };
-static char bitwise_and_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_LONG, PyArray_OBJECT, PyArray_OBJECT, PyArray_OBJECT, };
-static char invert_signatures[] = { PyArray_UBYTE, PyArray_UBYTE, PyArray_SBYTE, PyArray_SBYTE, PyArray_SHORT, PyArray_SHORT, PyArray_USHORT, PyArray_USHORT, PyArray_INT, PyArray_INT, PyArray_UINT, PyArray_UINT, PyArray_LONG, PyArray_LONG, PyArray_OBJECT, PyArray_OBJECT, };
-
-static char arccos_signatures[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_CFLOAT, PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CDOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char ceil_signatures[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-static char arctan2_signatures[] = { PyArray_FLOAT, PyArray_FLOAT, PyArray_FLOAT, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_DOUBLE, PyArray_OBJECT, PyArray_OBJECT, };
-
-static void InitOperators(PyObject *dictionary) {
- PyObject *f;
-
- add_data[11] =(void *)PyNumber_Add;
- subtract_data[11] = (void *)PyNumber_Subtract;
- multiply_data[9] = (void *)c_prod_;
- multiply_data[10] = (void *)c_prod_;
- multiply_data[11] = (void *)PyNumber_Multiply;
- divide_data[9] = (void *)c_quot_fast;
- divide_data[10] = (void *)c_quot_fast;
- divide_data[11] = (void *)PyNumber_Divide;
- /* need to add and worry
- divide_safe_data[9] = (void *)c_quot;
- divide_safe_data[10] = (void *)c_quot;
- divide_safe_data[11] = (void *)PyNumber_Divide;
- */
- conjugate_data[11] = (void *)"conjugate";
- remainder_data[7] = (void *)fmod;
- remainder_data[8] = (void *)fmod;
- remainder_data[9] = (void *)PyNumber_Remainder;
- power_data[7] = (void *)pow;
- power_data[8] = (void *)pow;
- power_data[9] = (void *)c_pow_;
- power_data[10] = (void *)c_pow_;
- power_data[11] = (void *)PyNumber_Power;
- absolute_data[11] = (void *)PyNumber_Absolute;
- negative_data[11] = (void *)PyNumber_Negative;
- bitwise_and_data[7] = (void *)PyNumber_And;
- bitwise_or_data[7] = (void *)PyNumber_Or;
- bitwise_xor_data[7] = (void *)PyNumber_Xor;
- invert_data[7] = (void *)PyNumber_Invert;
- left_shift_data[7] = (void *)PyNumber_Lshift;
- right_shift_data[7] = (void *)PyNumber_Rshift;
-
- add_functions[11] = PyUFunc_OO_O;
- subtract_functions[11] = PyUFunc_OO_O;
- multiply_functions[9] = fastumath_FF_F_As_DD_D;
- multiply_functions[10] = fastumath_DD_D;
- multiply_functions[11] = PyUFunc_OO_O;
- divide_functions[9] = fastumath_FF_F_As_DD_D;
- divide_functions[10] = fastumath_DD_D;
- divide_functions[11] = PyUFunc_OO_O;
-
-
-#if PY_VERSION_HEX >= 0x02020000
- true_divide_data[9] = (void *)c_quot_fast;
- true_divide_data[10] = (void *)c_quot_fast;
- true_divide_data[11] = (void *)PyNumber_TrueDivide;
- true_divide_functions[9] = fastumath_FF_F_As_DD_D;
- true_divide_functions[10] = fastumath_DD_D;
- true_divide_functions[11] = PyUFunc_OO_O;
-
- floor_divide_data[9] = (void *)c_quot_floor_fast;
- floor_divide_data[10] = (void *)c_quot_floor_fast;
- floor_divide_data[11] = (void *)PyNumber_FloorDivide;
- floor_divide_functions[9] = fastumath_FF_F_As_DD_D;
- floor_divide_functions[10] = fastumath_DD_D;
- floor_divide_functions[11] = PyUFunc_OO_O;
-#endif
-
- conjugate_functions[11] = PyUFunc_O_O_method;
- remainder_functions[7] = PyUFunc_ff_f_As_dd_d;
- remainder_functions[8] = PyUFunc_dd_d;
- remainder_functions[9] = PyUFunc_OO_O;
- power_functions[7] = PyUFunc_ff_f_As_dd_d;
- power_functions[8] = PyUFunc_dd_d;
- power_functions[9] = fastumath_FF_F_As_DD_D;
- power_functions[10] = fastumath_DD_D;
- power_functions[11] = PyUFunc_OO_O;
- absolute_functions[11] = PyUFunc_O_O;
- negative_functions[11] = PyUFunc_O_O;
- bitwise_and_functions[7] = PyUFunc_OO_O;
- bitwise_or_functions[7] = PyUFunc_OO_O;
- bitwise_xor_functions[7] = PyUFunc_OO_O;
- invert_functions[7] = PyUFunc_O_O;
- left_shift_functions[7] = PyUFunc_OO_O;
- right_shift_functions[7] = PyUFunc_OO_O;
-
- arccos_functions[0] = PyUFunc_f_f_As_d_d;
- arccos_functions[1] = PyUFunc_d_d;
- arccos_functions[2] = fastumath_F_F_As_D_D;
- arccos_functions[3] = fastumath_D_D;
- arccos_functions[4] = PyUFunc_O_O_method;
- ceil_functions[0] = PyUFunc_f_f_As_d_d;
- ceil_functions[1] = PyUFunc_d_d;
- ceil_functions[2] = PyUFunc_O_O_method;
- arctan2_functions[0] = PyUFunc_ff_f_As_dd_d;
- arctan2_functions[1] = PyUFunc_dd_d;
- arctan2_functions[2] = PyUFunc_O_O_method;
-
-
- f = PyUFunc_FromFuncAndData(isinf_functions, isinf_data, isinf_signatures,
- 4, 1, 1, PyUFunc_None, "isinf",
- "isinf(x) returns non-zero if x is infinity.", 0);
- PyDict_SetItemString(dictionary, "isinf", f);
- Py_DECREF(f);
-
- f = PyUFunc_FromFuncAndData(isfinite_functions, isfinite_data, isinf_signatures,
- 4, 1, 1, PyUFunc_None, "isfinite",
- "isfinite(x) returns non-zero if x is not infinity or not a number.", 0);
- PyDict_SetItemString(dictionary, "isfinite", f);
- Py_DECREF(f);
-
- f = PyUFunc_FromFuncAndData(isnan_functions, isnan_data, isinf_signatures,
- 4, 1, 1, PyUFunc_None, "isnan",
- "isnan(x) returns non-zero if x is not a number.", 0);
- PyDict_SetItemString(dictionary, "isnan", f);
- Py_DECREF(f);
-
-
- f = PyUFunc_FromFuncAndData(add_functions, add_data, add_signatures, 12,
- 2, 1, PyUFunc_Zero, "add",
- "Add the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "add", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(subtract_functions, subtract_data, add_signatures,
- 12, 2, 1, PyUFunc_Zero, "subtract",
- "Subtract the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "subtract", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(multiply_functions, multiply_data, add_signatures,
- 12, 2, 1, PyUFunc_One, "multiply",
- "Multiply the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "multiply", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(divide_functions, divide_data, add_signatures,
- 12, 2, 1, PyUFunc_One, "divide",
- "Divide the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "divide", f);
- Py_DECREF(f);
-#if PY_VERSION_HEX >= 0x02020000
- f = PyUFunc_FromFuncAndData(floor_divide_functions, floor_divide_data, floor_divide_signatures,
- 12, 2, 1, PyUFunc_One, "floor_divide",
- "Floor divide the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "floor_divide", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(true_divide_functions, true_divide_data, true_divide_signatures,
- 12, 2, 1, PyUFunc_One, "true_divide",
- "True divide the arguments elementwise.", 0);
- PyDict_SetItemString(dictionary, "true_divide", f);
- Py_DECREF(f);
-#endif
-
- f = PyUFunc_FromFuncAndData(divide_safe_functions, divide_safe_data, divide_safe_signatures,
- 9, 2, 1, PyUFunc_One, "divide_safe",
- "Divide elementwise, ZeroDivision exception thrown if necessary.", 0);
- PyDict_SetItemString(dictionary, "divide_safe", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(conjugate_functions, conjugate_data, conjugate_signatures,
- 12, 1, 1, PyUFunc_None, "conjugate",
- "returns conjugate of each element", 0);
- PyDict_SetItemString(dictionary, "conjugate", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(remainder_functions, remainder_data, remainder_signatures,
- 10, 2, 1, PyUFunc_Zero, "remainder",
- "returns remainder of division elementwise", 0);
- PyDict_SetItemString(dictionary, "remainder", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(power_functions, power_data, add_signatures,
- 12, 2, 1, PyUFunc_One, "power",
- "power(x,y) = x**y elementwise.", 0);
- PyDict_SetItemString(dictionary, "power", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(absolute_functions, absolute_data, absolute_signatures,
- 12, 1, 1, PyUFunc_None, "absolute",
- "returns absolute value of each element", 0);
- PyDict_SetItemString(dictionary, "absolute", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(negative_functions, negative_data, negative_signatures,
- 12, 1, 1, PyUFunc_None, "negative",
- "negative(x) == -x elementwise.", 0);
- PyDict_SetItemString(dictionary, "negative", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(greater_functions, divide_safe_data, greater_signatures,
- 11, 2, 1, PyUFunc_None, "greater",
- "greater(x,y) is array of 1's where x > y, 0 otherwise.",1);
- PyDict_SetItemString(dictionary, "greater", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(greater_equal_functions, divide_safe_data, greater_signatures,
- 11, 2, 1, PyUFunc_None, "greater_equal",
- "greater_equal(x,y) is array of 1's where x >=y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "greater_equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(less_functions, divide_safe_data, greater_signatures,
- 11, 2, 1, PyUFunc_None, "less",
- "less(x,y) is array of 1's where x < y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "less", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(less_equal_functions, divide_safe_data, greater_signatures,
- 11, 2, 1, PyUFunc_None, "less_equal",
- "less_equal(x,y) is array of 1's where x <= y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "less_equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(equal_functions, equal_data, equal_signatures,
- 13, 2, 1, PyUFunc_One, "equal",
- "equal(x,y) is array of 1's where x == y, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(not_equal_functions, equal_data, equal_signatures,
- 13, 2, 1, PyUFunc_None, "not_equal",
- "not_equal(x,y) is array of 0's where x == y, 1 otherwise.", 0);
- PyDict_SetItemString(dictionary, "not_equal", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_and_functions, divide_safe_data, logical_signatures,
- 9, 2, 1, PyUFunc_One, "logical_and",
- "logical_and(x,y) returns array of 1's where x and y both true.", 0);
- PyDict_SetItemString(dictionary, "logical_and", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_or_functions, divide_safe_data, logical_signatures,
- 9, 2, 1, PyUFunc_Zero, "logical_or",
- "logical_or(x,y) returns array of 1's where x or y or both are true.", 0);
- PyDict_SetItemString(dictionary, "logical_or", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_xor_functions, divide_safe_data, logical_signatures,
- 9, 2, 1, PyUFunc_None, "logical_xor",
- "logical_xor(x,y) returns array of 1's where exactly one of x or y is true.", 0);
- PyDict_SetItemString(dictionary, "logical_xor", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(logical_not_functions, divide_safe_data, logical_not_signatures,
- 9, 1, 1, PyUFunc_None, "logical_not",
- "logical_not(x) returns array of 1's where x is false, 0 otherwise.", 0);
- PyDict_SetItemString(dictionary, "logical_not", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(maximum_functions, divide_safe_data, maximum_signatures,
- 11, 2, 1, PyUFunc_None, "maximum",
- "maximum(x,y) returns maximum of x and y taken elementwise.", 0);
- PyDict_SetItemString(dictionary, "maximum", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(minimum_functions, divide_safe_data, maximum_signatures,
- 11, 2, 1, PyUFunc_None, "minimum",
- "minimum(x,y) returns minimum of x and y taken elementwise.", 0);
- PyDict_SetItemString(dictionary, "minimum", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(bitwise_and_functions, bitwise_and_data, bitwise_and_signatures,
- 8, 2, 1, PyUFunc_One, "bitwise_and",
- "bitwise_and(x,y) returns array of bitwise-and of respective elements.", 0);
- PyDict_SetItemString(dictionary, "bitwise_and", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(bitwise_or_functions, bitwise_or_data, bitwise_and_signatures,
- 8, 2, 1, PyUFunc_Zero, "bitwise_or",
- "bitwise_or(x,y) returns array of bitwise-or of respective elements.", 0);
- PyDict_SetItemString(dictionary, "bitwise_or", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(bitwise_xor_functions, bitwise_xor_data, bitwise_and_signatures,
- 8, 2, 1, PyUFunc_None, "bitwise_xor",
- "bitwise_xor(x,y) returns array of bitwise exclusive or of respective elements.", 0);
- PyDict_SetItemString(dictionary, "bitwise_xor", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(invert_functions, invert_data, invert_signatures,
- 8, 1, 1, PyUFunc_None, "invert",
- "invert(n) returns array of bit inversion elementwise.", 0);
- PyDict_SetItemString(dictionary, "invert", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(left_shift_functions, left_shift_data, bitwise_and_signatures,
- 8, 2, 1, PyUFunc_None, "left_shift",
- "left_shift(n, m) is n << m elementwise.", 0);
- PyDict_SetItemString(dictionary, "left_shift", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(right_shift_functions, right_shift_data, bitwise_and_signatures,
- 8, 2, 1, PyUFunc_None, "right_shift",
- "right_shift(n, m) is n >> m elementwise.", 0);
- PyDict_SetItemString(dictionary, "right_shift", f);
- Py_DECREF(f);
-
- f = PyUFunc_FromFuncAndData(arccos_functions, arccos_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arccos",
- "arccos(x) returns array of elementwise inverse cosines.", 0);
- PyDict_SetItemString(dictionary, "arccos", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arcsin_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arcsin",
- "arcsin(x) returns array of elementwise inverse sines.", 0);
- PyDict_SetItemString(dictionary, "arcsin", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arctan_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arctan",
- "arctan(x) returns array of elementwise inverse tangents.", 0);
- PyDict_SetItemString(dictionary, "arctan", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arctanh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arctanh",
- "arctanh(x) returns array of elementwise inverse hyperbolic tangents.", 0);
- PyDict_SetItemString(dictionary, "arctanh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arccosh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arccosh",
- "arccosh(x) returns array of elementwise inverse hyperbolic cosines.", 0);
- PyDict_SetItemString(dictionary, "arccosh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, arcsinh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "arcsinh",
- "arcsinh(x) returns array of elementwise inverse hyperbolic sines.", 0);
- PyDict_SetItemString(dictionary, "arcsinh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, cos_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "cos",
- "cos(x) returns array of elementwise cosines.", 0);
- PyDict_SetItemString(dictionary, "cos", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, cosh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "cosh",
- "cosh(x) returns array of elementwise hyberbolic cosines.", 0);
- PyDict_SetItemString(dictionary, "cosh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, exp_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "exp",
- "exp(x) returns array of elementwise e**x.", 0);
- PyDict_SetItemString(dictionary, "exp", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, log_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "log",
- "log(x) returns array of elementwise natural logarithms.", 0);
- PyDict_SetItemString(dictionary, "log", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, log10_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "log10",
- "log10(x) returns array of elementwise base-10 logarithms.", 0);
- PyDict_SetItemString(dictionary, "log10", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, sin_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "sin",
- "sin(x) returns array of elementwise sines.", 0);
- PyDict_SetItemString(dictionary, "sin", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, sinh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "sinh",
- "sinh(x) returns array of elementwise hyperbolic sines.", 0);
- PyDict_SetItemString(dictionary, "sinh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, sqrt_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "sqrt",
- "sqrt(x) returns array of elementwise square roots.", 0);
- PyDict_SetItemString(dictionary, "sqrt", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, tan_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "tan",
- "tan(x) returns array of elementwise tangents.", 0);
- PyDict_SetItemString(dictionary, "tan", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arccos_functions, tanh_data, arccos_signatures,
- 5, 1, 1, PyUFunc_None, "tanh",
- "tanh(x) returns array of elementwise hyperbolic tangents.", 0);
- PyDict_SetItemString(dictionary, "tanh", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(ceil_functions, ceil_data, ceil_signatures,
- 3, 1, 1, PyUFunc_None, "ceil",
- "ceil(x) returns array of elementwise least whole number >= x.", 0);
- PyDict_SetItemString(dictionary, "ceil", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(ceil_functions, fabs_data, ceil_signatures,
- 3, 1, 1, PyUFunc_None, "fabs",
- "fabs(x) returns array of elementwise absolute values, 32 bit if x is.", 0);
-
- PyDict_SetItemString(dictionary, "fabs", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(ceil_functions, floor_data, ceil_signatures,
- 3, 1, 1, PyUFunc_None, "floor",
- "floor(x) returns array of elementwise least whole number <= x.", 0);
- PyDict_SetItemString(dictionary, "floor", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arctan2_functions, arctan2_data, arctan2_signatures,
- 3, 2, 1, PyUFunc_None, "arctan2",
- "arctan2(x,y) is a safe and correct tan(x/y).", 0);
- PyDict_SetItemString(dictionary, "arctan2", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arctan2_functions, fmod_data, arctan2_signatures,
- 3, 2, 1, PyUFunc_None, "fmod",
- "fmod(x,y) is remainder(x,y)", 0);
- PyDict_SetItemString(dictionary, "fmod", f);
- Py_DECREF(f);
- f = PyUFunc_FromFuncAndData(arctan2_functions, hypot_data, arctan2_signatures,
- 3, 2, 1, PyUFunc_None, "hypot",
- "hypot(x,y) = sqrt(x**2 + y**2), elementwise.", 0);
- PyDict_SetItemString(dictionary, "hypot", f);
- Py_DECREF(f);
-}
-
-
diff --git a/base/fastumathmodule.c b/base/fastumathmodule.c
deleted file mode 100644
index c664316cb..000000000
--- a/base/fastumathmodule.c
+++ /dev/null
@@ -1,711 +0,0 @@
-#include "Python.h"
-#include <math.h>
-#include "Numeric/arrayobject.h"
-#include "Numeric/ufuncobject.h"
-#include "abstract.h"
-#include "mconf_lite.h"
-
-/* Fast umath module whose functions do not check for range and domain
- errors.
-
- Replacement for umath + additions for isnan, isfinite, and isinf
- Also allows comparison operations on complex numbers (just compares
- the real part) and logical operations.
-
- All logical operations return UBYTE arrays except for
- logical_and, logical_or, and logical_xor
- which return their type so that reduce works correctly on them....
-*/
-
-#if defined _ISOC99_SOURCE || defined _XOPEN_SOURCE_EXTENDED \
- || defined _BSD_SOURCE || defined _SVID_SOURCE
-#define HAVE_INVERSE_HYPERBOLIC 1
-#endif
-
-/* static PyObject *Array0d_FromDouble(double); */
-
-/* Wrapper to include the correct version */
-
-/* Complex functions */
-
-
-#if !defined(HAVE_INVERSE_HYPERBOLIC)
-static double acosh(double x)
-{
- return log(x + sqrt((x-1.0)*(x+1.0)));
-}
-
-static double asinh(double xx)
-{
- double x;
- int sign;
- if (xx < 0.0) {
- sign = -1;
- x = -xx;
- }
- else {
- sign = 1;
- x = xx;
- }
- return sign*log(x + sqrt(x*x+1.0));
-}
-
-static double atanh(double x)
-{
- return 0.5*log((1.0+x)/(1.0-x));
-}
-#endif
-
-#if defined(HAVE_HYPOT)
-#if !defined(NeXT) && !defined(_MSC_VER)
-extern double hypot(double, double);
-#endif
-#else
-double hypot(double x, double y)
-{
- double yx;
-
- x = fabs(x);
- y = fabs(y);
- if (x < y) {
- double temp = x;
- x = y;
- y = temp;
- }
- if (x == 0.)
- return 0.;
- else {
- yx = y/x;
- return x*sqrt(1.+yx*yx);
- }
-}
-#endif
-
-#ifdef i860
-/* Cray APP has bogus definition of HUGE_VAL in <math.h> */
-#undef HUGE_VAL
-#endif
-
-#ifdef HUGE_VAL
-#define CHECK(x) if (errno != 0) ; else if (-HUGE_VAL <= (x) && (x) <= HUGE_VAL) ; else errno = ERANGE
-#else
-#define CHECK(x) /* Don't know how to check */
-#endif
-
-/* constants */
-static Py_complex c_1 = {1., 0.};
-static Py_complex c_half = {0.5, 0.};
-static Py_complex c_i = {0., 1.};
-static Py_complex c_i2 = {0., 0.5};
-/*
-static Py_complex c_mi = {0., -1.};
-static Py_complex c_pi2 = {M_PI/2., 0.};
-*/
-
-static Py_complex
-c_sum_(Py_complex a, Py_complex b)
-{
- Py_complex r;
- r.real = a.real + b.real;
- r.imag = a.imag + b.imag;
- return r;
-}
-
-static Py_complex
-c_diff_(Py_complex a, Py_complex b)
-{
- Py_complex r;
- r.real = a.real - b.real;
- r.imag = a.imag - b.imag;
- return r;
-}
-
-static Py_complex
-c_neg_(Py_complex a)
-{
- Py_complex r;
- r.real = -a.real;
- r.imag = -a.imag;
- return r;
-}
-
-static Py_complex
-c_prod_(Py_complex a, Py_complex b)
-{
- Py_complex r;
- r.real = a.real*b.real - a.imag*b.imag;
- r.imag = a.real*b.imag + a.imag*b.real;
- return r;
-}
-
-static Py_complex
-c_pow_(Py_complex a, Py_complex b)
-{
- Py_complex r;
- double vabs,len,at,phase;
- if (b.real == 0. && b.imag == 0.) {
- r.real = 1.;
- r.imag = 0.;
- }
- else if (a.real == 0. && a.imag == 0.) {
- if (b.imag != 0. || b.real < 0.)
- errno = EDOM;
- r.real = 0.;
- r.imag = 0.;
- }
- else {
- vabs = hypot(a.real,a.imag);
- len = pow(vabs,b.real);
- at = atan2(a.imag, a.real);
- phase = at*b.real;
- if (b.imag != 0.0) {
- len /= exp(at*b.imag);
- phase += b.imag*log(vabs);
- }
- r.real = len*cos(phase);
- r.imag = len*sin(phase);
- }
- return r;
-}
-
-/* First, the C functions that do the real work */
-
-static Py_complex
-c_quot_fast(Py_complex a, Py_complex b)
-{
- /******************************************************************/
-
- /* This algorithm is better, and is pretty obvious: first divide the
- * numerators and denominator by whichever of {b.real, b.imag} has
- * larger magnitude. The earliest reference I found was to CACM
- * Algorithm 116 (Complex Division, Robert L. Smith, Stanford
- * University). As usual, though, we're still ignoring all IEEE
- * endcases.
- */
- Py_complex r; /* the result */
-
- const double abs_breal = b.real < 0 ? -b.real : b.real;
- const double abs_bimag = b.imag < 0 ? -b.imag : b.imag;
-
- if ((b.real == 0.0) && (b.imag == 0.0)) {
- r.real = a.real / b.real;
- r.imag = a.imag / b.imag;
- /* Using matlab's convention (x+0j is x):
- (0+0j)/0 -> nan+0j
- (0+xj)/0 -> nan+sign(x)*infj
- (x+0j)/0 -> sign(x)*inf+0j
- */
- if (a.imag == 0.0) {r.imag = 0.0;}
- return r;
- }
- if (abs_breal >= abs_bimag) {
- /* divide tops and bottom by b.real */
- const double ratio = b.imag / b.real;
- const double denom = b.real + b.imag * ratio;
- r.real = (a.real + a.imag * ratio) / denom;
- r.imag = (a.imag - a.real * ratio) / denom;
- }
- else {
- /* divide tops and bottom by b.imag */
- const double ratio = b.real / b.imag;
- const double denom = b.real * ratio + b.imag;
- r.real = (a.real * ratio + a.imag) / denom;
- r.imag = (a.imag * ratio - a.real) / denom;
- }
- return r;
-}
-
-#if PY_VERSION_HEX >= 0x02020000
-static Py_complex
-c_quot_floor_fast(Py_complex a, Py_complex b)
-{
- /* Not really sure what to do here, but it looks like Python takes the
- floor of the real part and returns that as the answer. So, we will do the same.
- */
- Py_complex r;
-
- r = c_quot_fast(a, b);
- r.imag = 0.0;
- r.real = floor(r.real);
- return r;
-}
-#endif
-
-static Py_complex
-c_sqrt(Py_complex x)
-{
- Py_complex r;
- double s,d;
- if (x.real == 0. && x.imag == 0.)
- r = x;
- else {
- s = sqrt(0.5*(fabs(x.real) + hypot(x.real,x.imag)));
- d = 0.5*x.imag/s;
- if (x.real > 0.) {
- r.real = s;
- r.imag = d;
- }
- else if (x.imag >= 0.) {
- r.real = d;
- r.imag = s;
- }
- else {
- r.real = -d;
- r.imag = -s;
- }
- }
- return r;
-}
-
-static Py_complex
-c_log(Py_complex x)
-{
- Py_complex r;
- double l = hypot(x.real,x.imag);
- r.imag = atan2(x.imag, x.real);
- r.real = log(l);
- return r;
-}
-
-static Py_complex
-c_prodi(Py_complex x)
-{
- Py_complex r;
- r.real = -x.imag;
- r.imag = x.real;
- return r;
-}
-
-static Py_complex
-c_acos(Py_complex x)
-{
- return c_neg_(c_prodi(c_log(c_sum_(x,c_prod_(c_i,
- c_sqrt(c_diff_(c_1,c_prod_(x,x))))))));
-}
-
-static Py_complex
-c_acosh(Py_complex x)
-{
- return c_log(c_sum_(x,c_prod_(c_i,
- c_sqrt(c_diff_(c_1,c_prod_(x,x))))));
-}
-
-static Py_complex
-c_asin(Py_complex x)
-{
- return c_neg_(c_prodi(c_log(c_sum_(c_prod_(c_i,x),
- c_sqrt(c_diff_(c_1,c_prod_(x,x)))))));
-}
-
-static Py_complex
-c_asinh(Py_complex x)
-{
- return c_neg_(c_log(c_diff_(c_sqrt(c_sum_(c_1,c_prod_(x,x))),x)));
-}
-
-static Py_complex
-c_atan(Py_complex x)
-{
- return c_prod_(c_i2,c_log(c_quot_fast(c_sum_(c_i,x),c_diff_(c_i,x))));
-}
-
-static Py_complex
-c_atanh(Py_complex x)
-{
- return c_prod_(c_half,c_log(c_quot_fast(c_sum_(c_1,x),c_diff_(c_1,x))));
-}
-
-static Py_complex
-c_cos(Py_complex x)
-{
- Py_complex r;
- r.real = cos(x.real)*cosh(x.imag);
- r.imag = -sin(x.real)*sinh(x.imag);
- return r;
-}
-
-static Py_complex
-c_cosh(Py_complex x)
-{
- Py_complex r;
- r.real = cos(x.imag)*cosh(x.real);
- r.imag = sin(x.imag)*sinh(x.real);
- return r;
-}
-
-static Py_complex
-c_exp(Py_complex x)
-{
- Py_complex r;
- double l = exp(x.real);
- r.real = l*cos(x.imag);
- r.imag = l*sin(x.imag);
- return r;
-}
-
-static Py_complex
-c_log10(Py_complex x)
-{
- Py_complex r;
- double l = hypot(x.real,x.imag);
- r.imag = atan2(x.imag, x.real)/log(10.);
- r.real = log10(l);
- return r;
-}
-
-static Py_complex
-c_sin(Py_complex x)
-{
- Py_complex r;
- r.real = sin(x.real)*cosh(x.imag);
- r.imag = cos(x.real)*sinh(x.imag);
- return r;
-}
-
-static Py_complex
-c_sinh(Py_complex x)
-{
- Py_complex r;
- r.real = cos(x.imag)*sinh(x.real);
- r.imag = sin(x.imag)*cosh(x.real);
- return r;
-}
-
-static Py_complex
-c_tan(Py_complex x)
-{
- Py_complex r;
- double sr,cr,shi,chi;
- double rs,is,rc,ic;
- double d;
- sr = sin(x.real);
- cr = cos(x.real);
- shi = sinh(x.imag);
- chi = cosh(x.imag);
- rs = sr*chi;
- is = cr*shi;
- rc = cr*chi;
- ic = -sr*shi;
- d = rc*rc + ic*ic;
- r.real = (rs*rc+is*ic)/d;
- r.imag = (is*rc-rs*ic)/d;
- return r;
-}
-
-static Py_complex
-c_tanh(Py_complex x)
-{
- Py_complex r;
- double si,ci,shr,chr;
- double rs,is,rc,ic;
- double d;
- si = sin(x.imag);
- ci = cos(x.imag);
- shr = sinh(x.real);
- chr = cosh(x.real);
- rs = ci*shr;
- is = si*chr;
- rc = ci*chr;
- ic = si*shr;
- d = rc*rc + ic*ic;
- r.real = (rs*rc+is*ic)/d;
- r.imag = (is*rc-rs*ic)/d;
- return r;
-}
-
-
-#ifdef PyArray_UNSIGNED_TYPES
-#include "fastumath_unsigned.inc"
-#else
-#include "fastumath_nounsigned.inc"
-#endif
-
-/*
-static PyObject *Array0d_FromDouble(double val){
- PyArrayObject *a;
- a = (PyArrayObject *)PyArray_FromDims(0,NULL,PyArray_DOUBLE);
- memcpy(a->data,(char *)(&val), sizeof(double));
- return (PyObject *)a;
-}
-*/
-
-static double pinf_init(void) {
- double mul = 1e10;
- double tmp = 0.0;
- double pinf;
-
- pinf = mul;
- for (;;) {
- pinf *= mul;
- if (pinf == tmp) break;
- tmp = pinf;
- }
- return pinf;
-}
-
-static double pzero_init(void) {
- double div = 1e10;
- double tmp = 0.0;
- double pinf;
-
- pinf = div;
- for (;;) {
- pinf /= div;
- if (pinf == tmp) break;
- tmp = pinf;
- }
- return pinf;
-}
-
-/* CODE BELOW is used to Update Numeric object behavior */
-
-/* A copy of the original PyArrayType structure is kept and can be used
- to restore the original Numeric behavior at any time.
-*/
-
-static PyTypeObject BackupPyArray_Type;
-static PyTypeObject BackupPyUFunc_Type;
-static PyNumberMethods backup_array_as_number;
-static PySequenceMethods backup_array_as_sequence;
-static PyMappingMethods backup_array_as_mapping;
-static PyBufferProcs backup_array_as_buffer;
-static int scipy_numeric_stored = 0;
-
-#ifndef PyUFunc_Type
-#define PyUFunc_Type PyUfunc_Type /* fix bug in Numeric < 23.3 */
-#endif
-
-/* make sure memory copy is going on with this */
-void scipy_numeric_save(void) {
-
- /* we just save copies of things we may alter. */
- if (!scipy_numeric_stored) {
- BackupPyUFunc_Type.tp_name = (PyUFunc_Type).tp_name;
- BackupPyUFunc_Type.tp_call = (PyUFunc_Type).tp_call;
-
- BackupPyArray_Type.tp_name = (PyArray_Type).tp_name;
- BackupPyArray_Type.tp_getattr = (PyArray_Type).tp_getattr;
-
- memcpy(&backup_array_as_number, (PyArray_Type).tp_as_number,
- sizeof(PyNumberMethods));
- memcpy(&backup_array_as_sequence, (PyArray_Type).tp_as_sequence,
- sizeof(PySequenceMethods));
- memcpy(&backup_array_as_mapping, (PyArray_Type).tp_as_mapping,
- sizeof(PyMappingMethods));
- memcpy(&backup_array_as_buffer, (PyArray_Type).tp_as_buffer,
- sizeof(PyBufferProcs));
- scipy_numeric_stored = 1;
- }
-}
-
-void scipy_numeric_restore(void) {
-
- /* restore only what was copied */
- if (scipy_numeric_stored) {
- (PyUFunc_Type).tp_name = BackupPyUFunc_Type.tp_name;
- (PyUFunc_Type).tp_call = BackupPyUFunc_Type.tp_call;
-
- (PyArray_Type).tp_name = BackupPyArray_Type.tp_name;
- (PyArray_Type).tp_getattr = BackupPyArray_Type.tp_getattr;
-
- memcpy((PyArray_Type).tp_as_number, &backup_array_as_number,
- sizeof(PyNumberMethods));
- memcpy((PyArray_Type).tp_as_sequence, &backup_array_as_sequence,
- sizeof(PySequenceMethods));
- memcpy((PyArray_Type).tp_as_mapping, &backup_array_as_mapping,
- sizeof(PyMappingMethods));
- memcpy((PyArray_Type).tp_as_buffer, &backup_array_as_buffer,
- sizeof(PyBufferProcs));
- }
-}
-
-static char *_scipy_array_str = "array (scipy)";
-static char *_scipy_ufunc_str = "ufunc (scipy)";
-
-#define MAX_DIMS 30
-#include "_scipy_mapping.c"
-
-static PyMappingMethods scipy_array_as_mapping = {
- (inquiry)scipy_array_length, /*mp_length*/
- (binaryfunc)scipy_array_subscript_nice, /*mp_subscript*/
- (objobjargproc)scipy_array_ass_sub, /*mp_ass_subscript*/
-};
-
-#define MAX_ARGS 10
-#include "_scipy_number.c"
-
-static PyNumberMethods scipy_array_as_number = {
- (binaryfunc)scipy_array_add, /*nb_add*/
- (binaryfunc)scipy_array_subtract, /*nb_subtract*/
- (binaryfunc)scipy_array_multiply, /*nb_multiply*/
- (binaryfunc)scipy_array_divide, /*nb_divide*/
- (binaryfunc)scipy_array_remainder, /*nb_remainder*/
- (binaryfunc)scipy_array_divmod, /*nb_divmod*/
- (ternaryfunc)scipy_array_power, /*nb_power*/
- (unaryfunc)scipy_array_negative,
- (unaryfunc)scipy_array_copy, /*nb_pos*/
- (unaryfunc)scipy_array_absolute, /*(unaryfunc)scipy_array_abs,*/
- (inquiry)scipy_array_nonzero, /*nb_nonzero*/
- (unaryfunc)scipy_array_invert, /*nb_invert*/
- (binaryfunc)scipy_array_left_shift, /*nb_lshift*/
- (binaryfunc)scipy_array_right_shift, /*nb_rshift*/
- (binaryfunc)scipy_array_bitwise_and, /*nb_and*/
- (binaryfunc)scipy_array_bitwise_xor, /*nb_xor*/
- (binaryfunc)scipy_array_bitwise_or, /*nb_or*/
- (coercion)scipy_array_coerce, /*nb_coerce*/
- (unaryfunc)scipy_array_int, /*nb_int*/
- (unaryfunc)scipy_array_long, /*nb_long*/
- (unaryfunc)scipy_array_float, /*nb_float*/
- (unaryfunc)scipy_array_oct, /*nb_oct*/
- (unaryfunc)scipy_array_hex, /*nb_hex*/
-
- /*This code adds augmented assignment functionality*/
- /*that was made available in Python 2.0*/
- (binaryfunc)scipy_array_inplace_add, /*inplace_add*/
- (binaryfunc)scipy_array_inplace_subtract, /*inplace_subtract*/
- (binaryfunc)scipy_array_inplace_multiply, /*inplace_multiply*/
- (binaryfunc)scipy_array_inplace_divide, /*inplace_divide*/
- (binaryfunc)scipy_array_inplace_remainder, /*inplace_remainder*/
- (ternaryfunc)scipy_array_inplace_power, /*inplace_power*/
- (binaryfunc)scipy_array_inplace_left_shift, /*inplace_lshift*/
- (binaryfunc)scipy_array_inplace_right_shift, /*inplace_rshift*/
- (binaryfunc)scipy_array_inplace_bitwise_and, /*inplace_and*/
- (binaryfunc)scipy_array_inplace_bitwise_xor, /*inplace_xor*/
- (binaryfunc)scipy_array_inplace_bitwise_or, /*inplace_or*/
-
- /* Added in release 2.2 */
- /* The following require the Py_TPFLAGS_HAVE_CLASS flag */
-#if PY_VERSION_HEX >= 0x02020000
- (binaryfunc)scipy_array_floor_divide, /*nb_floor_divide*/
- (binaryfunc)scipy_array_true_divide, /*nb_true_divide*/
- (binaryfunc)scipy_array_inplace_floor_divide, /*nb_inplace_floor_divide*/
- (binaryfunc)scipy_array_inplace_true_divide, /*nb_inplace_true_divide*/
-#endif
-};
-
-static PyObject *_scipy_getattr(PyArrayObject *self, char *name) {
- PyArrayObject *ret;
-
- if (strcmp(name, "M") == 0) {
- PyObject *fm, *o;
-
- /* Call the array constructor registered as matrix_base.matrix
- or else raise exception if nothing registered */
-
- /* Import matrix_base module */
- fm = PyImport_ImportModule("scipy_base.matrix_base");
- o = PyObject_CallMethod(fm,"matrix","O",(PyObject *)self);
- if (ret == NULL) {
- PyErr_SetString(PyExc_ReferenceError, "Error using scipy_base.matrix_base.matrix to construct matrix representation");
- Py_XDECREF(fm);
- return NULL;
- }
- Py_XDECREF(fm);
- return o;
- }
-
- return (BackupPyArray_Type.tp_getattr)((void *)self, name);
-}
-
-
-void scipy_numeric_alter(void) {
-
- (PyArray_Type).tp_name = _scipy_array_str;
- (PyArray_Type).tp_getattr = (getattrfunc)_scipy_getattr;
- memcpy((PyArray_Type).tp_as_mapping, &scipy_array_as_mapping,
- sizeof(PyMappingMethods));
- memcpy((PyArray_Type).tp_as_number, &scipy_array_as_number,
- sizeof(PyNumberMethods));
-
- (PyUFunc_Type).tp_call = (ternaryfunc)scipy_ufunc_call;
- (PyUFunc_Type).tp_name = _scipy_ufunc_str;
-}
-
-static char numeric_alter_doc[] = "alter_numeric() update the behavior of Numeric objects.\n\n 1. Change coercion rules so that multiplying by a scalar does not upcast.\n 2. Add index and mask slicing capability to Numeric arrays.\n 3. Add .M attribute to Numeric arrays for returning a Matrix 4. (TODO) Speed enhancements.\n\nThis call changes the behavior for ALL Numeric arrays currently defined\n and to be defined in the future. The old behavior can be restored for ALL\n arrays using numeric_restore().";
-
-static PyObject *numeric_behavior_alter(PyObject *self, PyObject *args)
-{
-
- if (!PyArg_ParseTuple ( args, "")) return NULL;
-
- scipy_numeric_save();
- scipy_numeric_alter();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-static char numeric_restore_doc[] = "restore_numeric() restore the default behavior of Numeric objects.\n\n SEE alter_numeric.\n";
-
-static PyObject *numeric_behavior_restore(PyObject *self, PyObject *args)
-{
-
- if (!PyArg_ParseTuple ( args, "")) return NULL;
- scipy_numeric_restore();
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-
-/* Initialization function for the module (*must* be called initArray) */
-static struct PyMethodDef methods[] = {
- {"alter_numeric", numeric_behavior_alter, METH_VARARGS,
- numeric_alter_doc},
- {"restore_numeric", numeric_behavior_restore, METH_VARARGS,
- numeric_restore_doc},
- {NULL, NULL, 0} /* sentinel */
-};
-
-DL_EXPORT(void) initfastumath(void) {
- PyObject *m, *d, *s, *f1;
- double pinf, pzero, nan;
-
- /* Create the module and add the functions */
- m = Py_InitModule("fastumath", methods);
-
- /* Import the array and ufunc objects */
- import_array();
- import_ufunc();
-
- /* Add some symbolic constants to the module */
- d = PyModule_GetDict(m);
-
- s = PyString_FromString("2.3");
- PyDict_SetItemString(d, "__version__", s);
- Py_DECREF(s);
-
- /* Load the ufunc operators into the array module's namespace */
- InitOperators(d);
-
- /* Import Fastumath module */
- scipy_SetNumericOps(d);
-
- PyDict_SetItemString(d, "pi", s = PyFloat_FromDouble(atan(1.0) * 4.0));
- Py_DECREF(s);
- PyDict_SetItemString(d, "e", s = PyFloat_FromDouble(exp(1.0)));
- Py_DECREF(s);
- pinf = pinf_init();
- PyDict_SetItemString(d, "PINF", s = PyFloat_FromDouble(pinf));
- Py_DECREF(s);
- PyDict_SetItemString(d, "NINF", s = PyFloat_FromDouble(-pinf));
- Py_DECREF(s);
- pzero = pzero_init();
- PyDict_SetItemString(d, "PZERO", s = PyFloat_FromDouble(pzero));
- Py_DECREF(s);
- PyDict_SetItemString(d, "NZERO", s = PyFloat_FromDouble(-pzero));
- Py_DECREF(s);
- nan = pinf / pinf;
- PyDict_SetItemString(d, "NAN", s = PyFloat_FromDouble(nan));
- Py_DECREF(s);
-
- f1 = PyDict_GetItemString(d, "conjugate"); /* Borrowed reference */
-
- /* Setup the array object's numerical structures */
- PyArray_SetNumericOps(d);
-
- PyDict_SetItemString(d, "conj", f1); /* shorthand for conjugate */
-
- /* Check for errors */
- if (PyErr_Occurred())
- Py_FatalError("can't initialize module fastumath");
-}
-
diff --git a/base/include/scipy/arrayobject.h b/base/include/scipy/arrayobject.h
new file mode 100644
index 000000000..7136f5c0b
--- /dev/null
+++ b/base/include/scipy/arrayobject.h
@@ -0,0 +1,1204 @@
+
+/* This expects the following variables to be defined (besides
+ the usual ones from pyconfig.h
+
+ SIZEOF_LONG_DOUBLE -- sizeof(long double) or sizeof(double) if no
+ long double is present on platform.
+ CHAR_BIT -- number of bits in a char (usually 8)
+ (should be in limits.h)
+*/
+
+#ifndef Py_ARRAYOBJECT_H
+#define Py_ARRAYOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "config.h"
+
+/* There are several places in the code where an array of dimensions is */
+/* allocated statically. This is the size of that static allocation. */
+
+#define MAX_DIMS 40
+
+/* Used for Converter Functions "O&" code in ParseTuple */
+#define PY_FAIL 0
+#define PY_SUCCEED 1
+
+#define NUMERIC_VERSION 0x0300
+
+ /* Some platforms don't define bool, long long, or long double.
+ Handle that here.
+ */
+
+#ifdef PY_LONG_LONG
+typedef PY_LONG_LONG longlong;
+typedef unsigned PY_LONG_LONG ulonglong;
+# ifdef _MSC_VER
+# define LONGLONG_FMT "%I64d"
+# define ULONGLONG_FMT "%I64u"
+# define LONGLONG_SUFFIX(x) (x##i64)
+# define ULONGLONG_SUFFIX(x) (x##Ui64)
+# else
+ /* #define LONGLONG_FMT "%lld" Another possible variant
+ #define ULONGLONG_FMT "%llu"
+
+ #define LONGLONG_FMT "%qd" -- BSD perhaps?
+ #define ULONGLONG_FMT "%qu"
+ */
+# define LONGLONG_FMT "%Ld"
+# define ULONGLONG_FMT "%Lu"
+# define LONGLONG_SUFFIX(x) (x##LL)
+# define ULONGLONG_SUFFIX(x) (x##ULL)
+# endif
+#else
+typedef long longlong;
+typedef unsigned long ulonglong;
+# define LONGLONG_SUFFIX(x) (x##L)
+# define ULONGLONG_SUFFIX(x) (x##UL)
+#endif
+
+
+typedef unsigned char bool;
+#define false 0
+#define true 1
+
+#if SIZEOF_LONG_DOUBLE==SIZEOF_DOUBLE
+ typedef double longdouble;
+ #define LONGDOUBLE_FMT "g"
+#else
+ typedef long double longdouble;
+ #define LONGDOUBLE_FMT "Lg"
+#endif
+
+#ifndef Py_USING_UNICODE
+#define Py_UNICODE char
+#endif
+
+
+typedef signed char byte;
+typedef unsigned char ubyte;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+
+typedef struct { float real, imag; } cfloat;
+typedef struct { double real, imag; } cdouble;
+typedef struct {longdouble real, imag;} clongdouble;
+
+enum PyArray_TYPES { PyArray_BOOL=0,
+ PyArray_BYTE, PyArray_UBYTE,
+ PyArray_SHORT, PyArray_USHORT,
+ PyArray_INT, PyArray_UINT,
+ PyArray_LONG, PyArray_ULONG,
+ PyArray_LONGLONG, PyArray_ULONGLONG,
+ PyArray_FLOAT, PyArray_DOUBLE, PyArray_LONGDOUBLE,
+ PyArray_CFLOAT, PyArray_CDOUBLE, PyArray_CLONGDOUBLE,
+ PyArray_OBJECT=17,
+ PyArray_STRING, PyArray_UNICODE,
+ PyArray_VOID,
+ PyArray_NTYPES,
+ PyArray_NOTYPE,
+};
+
+ /* How many floating point types are there */
+#define PyArray_NUM_FLOATTYPE 3
+
+
+ /* We need to match intp to a signed integer of the same size as
+ a pointer variable. uintp to the equivalent unsigned integer
+ */
+
+
+ /* These characters correspond to the array type and the
+ struct module */
+
+ /* except 'p' -- signed integer for pointer type */
+
+enum PyArray_TYPECHAR { PyArray_BOOLLTR = '?',
+ PyArray_BYTELTR = 'b',
+ PyArray_UBYTELTR = 'B',
+ PyArray_SHORTLTR = 'h',
+ PyArray_USHORTLTR = 'H',
+ PyArray_INTLTR = 'i',
+ PyArray_UINTLTR = 'I',
+ PyArray_LONGLTR = 'l',
+ PyArray_ULONGLTR = 'L',
+ PyArray_LONGLONGLTR = 'q',
+ PyArray_ULONGLONGLTR = 'Q',
+ PyArray_FLOATLTR = 'f',
+ PyArray_DOUBLELTR = 'd',
+ PyArray_LONGDOUBLELTR = 'g',
+ PyArray_CFLOATLTR = 'F',
+ PyArray_CDOUBLELTR = 'D',
+ PyArray_CLONGDOUBLELTR = 'G',
+ PyArray_OBJECTLTR = 'O',
+ PyArray_STRINGLTR = 'S',
+ PyArray_UNICODELTR = 'U',
+ PyArray_VOIDLTR = 'V',
+
+ /* No Descriptor, just a define -- this let's
+ Python users specify an array of integers
+ large enough to hold a pointer on the platform*/
+ PyArray_INTPLTR = 'p',
+ PyArray_UINTPLTR = 'P',
+
+ PyArray_GENSIGNED = 'i',
+ PyArray_GENUNSIGNED = 'u',
+ PyArray_GENFLOAT = 'f',
+ PyArray_GENCOMPLEX = 'c'
+};
+
+ /* Define bit-width array types and typedefs */
+
+#define MAKEFLOAT(x) x.
+
+#define MAX_INT8 127
+#define MIN_INT8 -128
+#define MAX_UINT8 255
+#define MAX_INT16 32767
+#define MIN_INT16 -32768
+#define MAX_UINT16 65535
+#define MAX_INT32 2147483647
+#define MIN_INT32 (-MAX_INT32 - 1)
+#define MAX_UINT32 4294967295U
+#define MAX_INT64 LONGLONG_SUFFIX(9223372036854775807)
+#define MIN_INT64 (-MAX_INT64 - LONGLONG_SUFFIX(1))
+#define MAX_UINT64 ULONGLONG_SUFFIX(18446744073709551615)
+#define MAX_INT128 LONGLONG_SUFFIX(85070591730234615865843651857942052864)
+#define MIN_INT128 (-MAX_INT128 - LONGLONG_SUFFIX(1))
+#define MAX_UINT128 ULONGLONG_SUFFIX(170141183460469231731687303715884105728)
+#define MAX_INT256 LONGLONG_SUFFIX(57896044618658097711785492504343953926634992332820282019728792003956564819967)
+#define MIN_INT256 (-MAX_INT256 - LONGLONG_SUFFIX(1))
+#define MAX_UINT256 ULONGLONG_SUFFIX(115792089237316195423570985008687907853269984665640564039457584007913129639935)
+
+#define Bool bool;
+
+ /* Need to find the number of bits for each type and
+ make definitions accordingly.
+
+ C states that sizeof(char) == 1 by definition
+
+ So, just using the sizeof keyword won't help.
+
+ It also looks like Python itself uses sizeof(char) quite a
+ bit, which by definition should be 1 all the time.
+
+ Idea: Make Use of CHAR_BIT which should tell us how many
+ BITS per CHARACTER
+ */
+
+ /* Include platform definitions -- These are in the C89/90 standard */
+#include <limits.h>
+#define MAX_BYTE SCHAR_MAX
+#define MIN_BYTE SCHAR_MIN
+#define MAX_UBYTE UCHAR_MAX
+#define MAX_SHORT SHRT_MAX
+#define MIN_SHORT SHRT_MIN
+#define MAX_USHORT USHRT_MAX
+#define MAX_INT INT_MAX
+#ifndef INT_MIN
+#define INT_MIN (-INT_MAX - 1)
+#endif
+#define MIN_INT INT_MIN
+#define MAX_UINT UINT_MAX
+#define MAX_LONG LONG_MAX
+#define MIN_LONG LONG_MIN
+#define MAX_ULONG ULONG_MAX
+
+#define SIZEOF_LONGDOUBLE SIZEOF_LONG_DOUBLE
+#define SIZEOF_LONGLONG SIZEOF_LONG_LONG
+#define BITSOF_BOOL sizeof(bool)*CHAR_BIT
+#define BITSOF_CHAR CHAR_BIT
+#define BITSOF_SHORT (SIZEOF_SHORT*CHAR_BIT)
+#define BITSOF_INT (SIZEOF_INT*CHAR_BIT)
+#define BITSOF_LONG (SIZEOF_LONG*CHAR_BIT)
+#define BITSOF_LONGLONG (SIZEOF_LONGLONG*CHAR_BIT)
+#define BITSOF_FLOAT (SIZEOF_FLOAT*CHAR_BIT)
+#define BITSOF_DOUBLE (SIZEOF_DOUBLE*CHAR_BIT)
+#define BITSOF_LONGDOUBLE (SIZEOF_LONGDOUBLE*CHAR_BIT)
+
+
+#if BITSOF_LONG == 8
+#define PyArray_INT8 PyArray_LONG
+#define PyArray_UINT8 PyArray_ULONG
+ typedef long Int8;
+ typedef unsigned long UInt8;
+#define STRBITSOF_LONG "8"
+#elif BITSOF_LONG == 16
+#define PyArray_INT16 PyArray_LONG
+#define PyArray_UINT16 PyArray_ULONG
+ typedef long Int16;
+ typedef unsigned long UInt16;
+#define STRBITSOF_LONG "16"
+#elif BITSOF_LONG == 32
+#define PyArray_INT32 PyArray_LONG
+#define PyArray_UINT32 PyArray_ULONG
+ typedef long Int32;
+ typedef unsigned long UInt32;
+#define STRBITSOF_LONG "32"
+#elif BITSOF_LONG == 64
+#define PyArray_INT64 PyArray_LONG
+#define PyArray_UINT64 PyArray_ULONG
+ typedef long Int64;
+ typedef unsigned long UInt64;
+#define STRBITSOF_LONG "64"
+#elif BITSOF_LONG == 128
+#define PyArray_INT128 PyArray_LONG
+#define PyArray_UINT128 PyArray_ULONG
+ typedef long Int128;
+ typedef unsigned long UInt128;
+#define STRBITSOF_LONG "128"
+#endif
+
+#if BITSOF_LONGLONG == 8
+# ifndef PyArray_INT8
+# define PyArray_INT8 PyArray_LONGLONG
+# define PyArray_UINT8 PyArray_ULONGLONG
+ typedef longlong Int8;
+ typedef ulonglong UInt8;
+# endif
+# define MAX_LONGLONG MAX_INT8
+# define MIN_LONGLONG MIN_INT8
+# define MAX_ULONGLONG MAX_UINT8
+#define STRBITSOF_LONGLONG "8"
+#elif BITSOF_LONGLONG == 16
+# ifndef PyArray_INT16
+# define PyArray_INT16 PyArray_LONGLONG
+# define PyArray_UINT16 PyArray_ULONGLONG
+ typedef longlong Int16;
+ typedef ulonglong UInt16;
+# endif
+# define MAX_LONGLONG MAX_INT16
+# define MIN_LONGLONG MIN_INT16
+# define MAX_ULONGLONG MAX_UINT16
+#define STRBITSOF_LONGLONG "16"
+#elif BITSOF_LONGLONG == 32
+# ifndef PyArray_INT32
+# define PyArray_INT32 PyArray_LONGLONG
+# define PyArray_UINT32 PyArray_ULONGLONG
+ typedef longlong Int32;
+ typedef ulonglong UInt32;
+# endif
+# define MAX_LONGLONG MAX_INT32
+# define MIN_LONGLONG MIN_INT32
+# define MAX_ULONGLONG MAX_UINT32
+#define STRBITSOF_LONGLONG "32"
+#elif BITSOF_LONGLONG == 64
+# ifndef PyArray_INT64
+# define PyArray_INT64 PyArray_LONGLONG
+# define PyArray_UINT64 PyArray_ULONGLONG
+ typedef longlong Int64;
+ typedef ulonglong UInt64;
+# endif
+# define MAX_LONGLONG MAX_INT64
+# define MIN_LONGLONG MIN_INT64
+# define MAX_ULONGLONG MAX_UINT64
+#define STRBITSOF_LONGLONG "64"
+#elif BITSOF_LONGLONG == 128
+# ifndef PyArray_INT128
+# define PyArray_INT128 PyArray_LONGLONG
+# define PyArray_UINT128 PyArray_ULONGLONG
+ typedef longlong Int128;
+ typedef ulonglong UInt128;
+# endif
+# define MAX_LONGLONG MAX_INT128
+# define MIN_LONGLONG MIN_INT128
+# define MAX_ULONGLONG MAX_UINT128
+#define STRBITSOF_LONGLONG "128"
+#elif BITSOF_LONGLONG == 256
+# define PyArray_INT256 PyArray_LONGLONG
+# define PyArray_UINT256 PyArray_ULONGLONG
+ typedef longlong Int256;
+ typedef ulonglong UInt256;
+# define MAX_LONGLONG MAX_INT256
+# define MIN_LONGLONG MIN_INT256
+# define MAX_ULONGLONG MAX_UINT256
+#define STRBITSOF_LONGLONG "256"
+#endif
+
+#if BITSOF_INT == 8
+#ifndef PyArray_INT8
+#define PyArray_INT8 PyArray_INT
+#define PyArray_UINT8 PyArray_UINT
+ typedef int Int8;
+ typedef unsigned int UInt8;
+#endif
+#define STRBITSOF_INT "8"
+#elif BITSOF_INT == 16
+#ifndef PyArray_INT16
+#define PyArray_INT16 PyArray_INT
+#define PyArray_UINT16 PyArray_UINT
+ typedef int Int16;
+ typedef unsigned int UInt16;
+#endif
+#define STRBITSOF_INT "16"
+#elif BITSOF_INT == 32
+#ifndef PyArray_INT32
+#define PyArray_INT32 PyArray_INT
+#define PyArray_UINT32 PyArray_UINT
+ typedef int Int32;
+ typedef unsigned int UInt32;
+#endif
+#define STRBITSOF_INT "32"
+#elif BITSOF_INT == 64
+#ifndef PyArray_INT64
+#define PyArray_INT64 PyArray_INT
+#define PyArray_UINT64 PyArray_UINT
+ typedef int Int64;
+ typedef unsigned int UInt64;
+#endif
+#define STRBITSOF_INT "64"
+#elif BITSOF_INT == 128
+#ifndef PyArray_INT128
+#define PyArray_INT128 PyArray_INT
+#define PyArray_UINT128 PyArray_UINT
+ typedef int Int128;
+ typedef unsigned int UInt128;
+#endif
+#define STRBITSOF_INT "128"
+#endif
+
+#if BITSOF_SHORT == 8
+#ifndef PyArray_INT8
+#define PyArray_INT8 PyArray_SHORT
+#define PyArray_UINT8 PyArray_USHORT
+ typedef short Int8;
+ typedef unsigned short UInt8;
+#endif
+#define STRBITSOF_SHORT "8"
+#elif BITSOF_SHORT == 16
+#ifndef PyArray_INT16
+#define PyArray_INT16 PyArray_SHORT
+#define PyArray_UINT16 PyArray_USHORT
+ typedef short Int16;
+ typedef unsigned short UInt16;
+#endif
+#define STRBITSOF_SHORT "16"
+#elif BITSOF_SHORT == 32
+#ifndef PyArray_INT32
+#define PyArray_INT32 PyArray_SHORT
+#define PyArray_UINT32 PyArray_USHORT
+ typedef short Int32;
+ typedef unsigned short UInt32;
+#endif
+#define STRBITSOF_SHORT "32"
+#elif BITSOF_SHORT == 64
+#ifndef PyArray_INT64
+#define PyArray_INT64 PyArray_SHORT
+#define PyArray_UINT64 PyArray_USHORT
+ typedef short Int64;
+ typedef unsigned short UInt64;
+#endif
+#define STRBITSOF_SHORT "64"
+#elif BITSOF_SHORT == 128
+#ifndef PyArray_INT128
+#define PyArray_INT128 PyArray_SHORT
+#define PyArray_UINT128 PyArray_USHORT
+ typedef short Int128;
+ typedef unsigned short UInt128;
+#endif
+#define STRBITSOF_SHORT "128"
+#endif
+
+
+#if BITSOF_CHAR == 8
+#ifndef PyArray_INT8
+#define PyArray_INT8 PyArray_BYTE
+#define PyArray_UINT8 PyArray_UBYTE
+ typedef signed char Int8;
+ typedef unsigned char UInt8;
+#endif
+#define STRBITSOF_CHAR "8"
+#elif BITSOF_CHAR == 16
+#ifndef PyArray_INT16
+#define PyArray_INT16 PyArray_BYTE
+#define PyArray_UINT16 PyArray_UBYTE
+ typedef signed char Int16;
+ typedef unsigned char UInt16;
+#endif
+#define STRBITSOF_CHAR "16"
+#elif BITSOF_CHAR == 32
+#ifndef PyArray_INT32
+#define PyArray_INT32 PyArray_BYTE
+#define PyArray_UINT32 PyArray_UBYTE
+ typedef signed char Int32;
+ typedef unsigned char UInt32;
+#endif
+#define STRBITSOF_CHAR "32"
+#elif BITSOF_CHAR == 64
+#ifndef PyArray_INT64
+#define PyArray_INT64 PyArray_BYTE
+#define PyArray_UINT64 PyArray_UBYTE
+ typedef signed char Int64;
+ typedef unsigned char UInt64;
+#endif
+#define STRBITSOF_CHAR "64"
+#elif BITSOF_CHAR == 128
+#ifndef PyArray_INT128
+#define PyArray_INT128 PyArray_BYTE
+#define PyArray_UINT128 PyArray_UBYTE
+ typedef signed char Int128;
+ typedef unsigned char UInt128;
+#endif
+#define STRBITSOF_CHAR "128"
+#endif
+
+
+
+#if BITSOF_DOUBLE == 16
+#define STRBITSOF_DOUBLE "16"
+#define STRBITSOF_CDOUBLE "32"
+#ifndef PyArray_FLOAT16
+#define PyArray_FLOAT16 PyArray_DOUBLE
+#define PyArray_COMPLEX32 PyArray_CDOUBLE
+ typedef double Float16;
+ typedef cdouble Complex32;
+#endif
+#elif BITSOF_DOUBLE == 32
+#define STRBITSOF_DOUBLE "32"
+#define STRBITSOF_CDOUBLE "64"
+#ifndef PyArray_FLOAT32
+#define PyArray_FLOAT32 PyArray_DOUBLE
+#define PyArray_COMPLEX64 PyArray_CDOUBLE
+ typedef double Float32;
+ typedef cdouble Complex64;
+#endif
+#elif BITSOF_DOUBLE == 64
+#define STRBITSOF_DOUBLE "64"
+#define STRBITSOF_CDOUBLE "128"
+#ifndef PyArray_FLOAT64
+#define PyArray_FLOAT64 PyArray_DOUBLE
+#define PyArray_COMPLEX128 PyArray_CDOUBLE
+ typedef double Float64;
+ typedef cdouble Complex128;
+#endif
+#elif BITSOF_DOUBLE == 80
+#define STRBITSOF_DOUBLE "80"
+#define STRBITSOF_CDOUBLE "160"
+#ifndef PyArray_FLOAT80
+#define PyArray_FLOAT80 PyArray_DOUBLE
+#define PyArray_COMPLEX160 PyArray_CDOUBLE
+ typedef double Float80
+ typedef cdouble Complex160
+#endif
+#elif BITSOF_DOUBLE == 96
+#define STRBITSOF_DOUBLE "96"
+#define STRBITSOF_CDOUBLE "192"
+#ifndef PyArray_FLOAT96
+#define PyArray_FLOAT96 PyArray_DOUBLE
+#define PyArray_COMPLEX192 PyArray_CDOUBLE
+ typedef double Float96;
+ typedef cdouble Complex192;
+#endif
+#elif BITSOF_DOUBLE == 128
+#define STRBITSOF_DOUBLE "128"
+#define STRBITSOF_CDOUBLE "256"
+#ifndef PyArray_FLOAT128
+#define PyArray_FLOAT128 PyArray_DOUBLE
+#define PyArray_COMPLEX256 PyArray_CDOUBLE
+ typedef double Float128;
+ typedef cdouble Complex256;
+#endif
+#endif
+
+
+
+#if BITSOF_FLOAT == 16
+#define STRBITSOF_FLOAT "16"
+#define STRBITSOF_CFLOAT "32"
+#ifndef PyArray_FLOAT16
+#define PyArray_FLOAT16 PyArray_FLOAT
+#define PyArray_COMPLEX32 PyArray_CFLOAT
+ typedef float Float16;
+ typedef cfloat Complex32;
+#endif
+#elif BITSOF_FLOAT == 32
+#define STRBITSOF_FLOAT "32"
+#define STRBITSOF_CFLOAT "64"
+#ifndef PyArray_FLOAT32
+#define PyArray_FLOAT32 PyArray_FLOAT
+#define PyArray_COMPLEX64 PyArray_CFLOAT
+ typedef float Float32;
+ typedef cfloat Complex64;
+#endif
+#elif BITSOF_FLOAT == 64
+#define STRBITSOF_FLOAT "64"
+#define STRBITSOF_CFLOAT "128"
+#ifndef PyArray_FLOAT64
+#define PyArray_FLOAT64 PyArray_FLOAT
+#define PyArray_COMPLEX128 PyArray_CFLOAT
+ typedef float Float64;
+ typedef cfloat Complex128;
+#endif
+#elif BITSOF_FLOAT == 80
+#define STRBITSOF_FLOAT "80"
+#define STRBITSOF_CFLOAT "160"
+#ifndef PyArray_FLOAT80
+#define PyArray_FLOAT80 PyArray_FLOAT
+#define PyArray_COMPLEX160 PyArray_CFLOAT
+ typedef float Float80
+ typedef cfloat Complex160
+#endif
+#elif BITSOF_FLOAT == 96
+#define STRBITSOF_FLOAT "96"
+#define STRBITSOF_CFLOAT "192"
+#ifndef PyArray_FLOAT96
+#define PyArray_FLOAT96 PyArray_FLOAT
+#define PyArray_COMPLEX192 PyArray_CFLOAT
+ typedef float Float96;
+ typedef cfloat Complex192;
+#endif
+#elif BITSOF_FLOAT == 128
+#define STRBITSOF_FLOAT "128"
+#define STRBITSOF_CFLOAT "256"
+#ifndef PyArray_FLOAT128
+#define PyArray_FLOAT128 PyArray_FLOAT
+#define PyArray_COMPLEX256 PyArray_CFLOAT
+ typedef float Float128;
+ typedef cfloat Complex256;
+#endif
+#endif
+
+
+#if BITSOF_LONGDOUBLE == 16
+#define STRBITSOF_LONGDOUBLE "16"
+#define STRBITSOF_CLONGDOUBLE "32"
+#ifndef PyArray_FLOAT16
+#define PyArray_FLOAT16 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX32 PyArray_CLONGDOUBLE
+ typedef longdouble Float16;
+ typedef clongdouble Complex32;
+#endif
+#elif BITSOF_LONGDOUBLE == 32
+#define STRBITSOF_LONGDOUBLE "32"
+#define STRBITSOF_CLONGDOUBLE "64"
+#ifndef PyArray_FLOAT32
+#define PyArray_FLOAT32 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX64 PyArray_CLONGDOUBLE
+ typedef longdouble Float32;
+ typedef clongdouble Complex64;
+#endif
+#elif BITSOF_LONGDOUBLE == 64
+#define STRBITSOF_LONGDOUBLE "64"
+#define STRBITSOF_CLONGDOUBLE "128"
+#ifndef PyArray_FLOAT64
+#define PyArray_FLOAT64 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX128 PyArray_CLONGDOUBLE
+ typedef longdouble Float64;
+ typedef clongdouble Complex128;
+#endif
+#elif BITSOF_LONGDOUBLE == 80
+#define STRBITSOF_LONGDOUBLE "80"
+#define STRBITSOF_CLONGDOUBLE "160"
+#ifndef PyArray_FLOAT80
+#define PyArray_FLOAT80 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX160 PyArray_CLONGDOUBLE
+ typedef longdouble Float80
+ typedef clongdouble Complex160
+#endif
+#elif BITSOF_LONGDOUBLE == 96
+#define STRBITSOF_LONGDOUBLE "96"
+#define STRBITSOF_CLONGDOUBLE "192"
+#ifndef PyArray_FLOAT96
+#define PyArray_FLOAT96 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX192 PyArray_CLONGDOUBLE
+ typedef longdouble Float96;
+ typedef clongdouble Complex192;
+#endif
+#elif BITSOF_LONGDOUBLE == 128
+#define STRBITSOF_LONGDOUBLE "128"
+#define STRBITSOF_CLONGDOUBLE "256"
+#ifndef PyArray_FLOAT128
+#define PyArray_FLOAT128 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX256 PyArray_CLONGDOUBLE
+ typedef longdouble Float128;
+ typedef clongdouble Complex256;
+#endif
+#elif BITSOF_LONGDOUBLE == 256
+#define STRBITSOF_LONGDOUBLE "256"
+#define STRBITSOF_CLONGDOUBLE "512"
+#define PyArray_FLOAT256 PyArray_LONGDOUBLE
+#define PyArray_COMPLEX512 PyArray_CLONGDOUBLE
+ typedef longdouble Float256;
+ typedef clongdouble Complex512;
+#endif
+
+
+ /* End of typedefs for numarray style bit-width names */
+
+/* This is to typedef Intp to the appropriate pointer size for this platform.
+ * Py_intptr_t, Py_uintptr_t are defined in pyport.h. */
+typedef Py_intptr_t intp;
+typedef Py_uintptr_t uintp;
+
+#if SIZEOF_PY_INTPTR_T == SIZEOF_INT
+ #define PyArray_INTP PyArray_INT
+ #define PyArray_UINTP PyArray_UINT
+ #define PyIntpArrType_Type PyIntArrType_Type
+ #define PyUIntpArrType_Type PyUIntArrType_Type
+ #define MAX_INTP MAX_INT
+ #define MIN_INTP MIN_INT
+ #define MAX_UINTP MAX_UINT
+#elif SIZEOF_PY_INTPTR_T == SIZEOF_LONG
+ #define PyArray_INTP PyArray_LONG
+ #define PyArray_UINTP PyArray_ULONG
+ #define PyIntpArrType_Type PyLongArrType_Type
+ #define PyUIntpArrType_Type PyULongArrType_Type
+ #define MAX_INTP MAX_LONG
+ #define MIN_INTP MIN_LONG
+ #define MAX_UINTP MAX_ULONG
+#elif defined(PY_LONG_LONG) && (SIZEOF_PY_INTPTR_T == SIZEOF_LONG_LONG)
+ #define PyArray_INTP PyArray_LONGLONG
+ #define PyArray_UINTP PyArray_ULONGLONG
+ #define PyIntpArrType_Type PyLongLongArrType_Type
+ #define PyUIntpArrType_Type PyULongLongArrType_Type
+ #define MAX_INTP MAX_LONGLONG
+ #define MIN_INTP MIN_LONGLONG
+ #define MAX_UINTP MAX_ULONGLONG
+#endif
+
+#define ERR(str) fprintf(stderr, #str); fflush(stderr);
+#define ERR2(str) fprintf(stderr, str); fflush(stderr);
+
+ /* Macros to define how array, and dimension/strides data is
+ allocated.
+ */
+
+ /* Data buffer */
+#define PyDataMem_NEW(size) ((char *)malloc(size))
+ /* #define PyArrayMem_NEW(size) PyMem_NEW(char, size)*/
+#define PyDataMem_FREE(ptr) free(ptr)
+#define PyDataMem_XFREE(ptr) if (ptr) free(ptr)
+ /* #define PyArrayMem_FREE(ptr) PyMem_Free(ptr) */
+#define PyDataMem_RENEW(ptr,size) ((char *)realloc(ptr,size))
+
+ /* Dimensions and strides */
+#define PyDimMem_NEW(size) ((intp *)malloc(size*sizeof(intp)))
+#define PyDimMem_FREE(ptr) free(ptr)
+#define PyDimMem_XFREE(ptr) if (ptr) free(ptr)
+#define PyDimMem_RENEW(ptr,size) ((intp *)realloc(ptr,size*sizeof(intp)))
+
+
+struct PyArrayObject; /* Forward */
+
+typedef PyObject *(PyArray_UnaryFunc)(struct PyArrayObject *, PyObject *);
+typedef PyObject *(PyArray_BinaryFunc)(struct PyArrayObject *, PyObject *, \
+ PyObject *);
+
+ /* These must deal with unaligned and unbyteswapped data if necessary */
+typedef PyObject * (PyArray_GetItemFunc) (char *, struct PyArrayObject *);
+typedef int (PyArray_SetItemFunc)(PyObject *, char *, struct PyArrayObject *);
+
+typedef int (PyArray_CompareFunc)(const void *, const void *,
+ struct PyArrayObject *);
+typedef int (PyArray_CopySwapNFunc)(void *, void *, intp, int, int);
+typedef int (PyArray_CopySwapFunc)(void *, void *, int, int);
+typedef int (PyArray_NonzeroFunc)(void *, struct PyArrayObject *);
+
+
+ /* These assume aligned and byteswapped data -- a buffer will be
+ used before or contiguous data will be obtained
+ */
+typedef int (PyArray_ArgFunc)(void*, intp, intp*, struct PyArrayObject *);
+typedef int (PyArray_DotFunc)(char *, int, char *, int,
+ char *, int, struct PyArrayObject *);
+typedef int (PyArray_VectorUnaryFunc)(void *, void *, intp,
+ struct PyArrayObject *,
+ struct PyArrayObject *);
+typedef int (PyArray_ScanFunc)(FILE *, void *, int, char *);
+
+
+typedef struct {
+ /* Functions to cast to all other standard types*/
+ PyArray_VectorUnaryFunc *cast[PyArray_NTYPES];
+
+ /* Functions to get and set items with standard
+ Python types -- not array scalars */
+ PyArray_GetItemFunc *getitem;
+ PyArray_SetItemFunc *setitem;
+
+ /* Function to compare items */
+ PyArray_CompareFunc *compare;
+
+ /* Function to select largest */
+ PyArray_ArgFunc *argmax;
+
+ /* Function to compute dot product */
+ PyArray_DotFunc *dotfunc;
+
+ /* Function to scan an ASCII file and
+ place a single value plus possible separator */
+ PyArray_ScanFunc *scanfunc;
+
+ /* Copy and/or swap data. Memory areas may not overlap */
+ /* Use memmove first if they might */
+ PyArray_CopySwapNFunc *copyswapn;
+ PyArray_CopySwapFunc *copyswap;
+
+ /* Function to determine if data is zero or not */
+ PyArray_NonzeroFunc *nonzero;
+
+ PyTypeObject *typeobj; /* the type object for this type */
+ int type_num; /* number representing this type */
+ int elsize; /* element size for this type --
+ or 0 if variable */
+ int alignment; /* alignment needed for this type */
+ char type; /* character representing this type */
+
+} PyArray_Descr;
+
+
+typedef struct PyArrayObject {
+ PyObject_HEAD
+ char *data; /* pointer to raw data buffer */
+ int nd; /* number of dimensions, also called ndim */
+ intp *dimensions; /* size in each dimension */
+ intp *strides; /* bytes to jump to get to the
+ next element in each dimension */
+ PyObject *base; /* This object should be decref'd
+ upon deletion of array */
+ /* For views it points to the original array */
+ /* For creation from buffer object it points
+ to an object that shold be decref'd on
+ deletion */
+ /* For UPDATEIFCOPY flag this is an array
+ to-be-updated upon deletion of this one */
+ PyArray_Descr *descr; /* Pointer to type structure */
+ int flags; /* Flags describing array -- see below*/
+ int itemsize; /* needed for Flexible size arrays:
+ CHAR, UNICODE, and VOID arrays
+ */
+ PyObject *weakreflist; /* For weakreferences */
+
+} PyArrayObject;
+
+#define fortran fortran_ /* For some compilers */
+
+typedef struct { /* Just the type_num and itemsize variables
+ for use in the TypeNum Converter function */
+ int type_num;
+ int itemsize;
+ int fortran; /* Set to 1 if fortran-defined strides is desired */
+} PyArray_Typecode;
+
+typedef struct {
+ intp *ptr;
+ int len;
+} PyArray_Dims;
+
+
+/* Mirrors buffer object to ptr */
+
+typedef struct {
+ PyObject_HEAD
+ PyObject *base;
+ void *ptr;
+ intp len;
+ int flags;
+} PyArray_Chunk;
+
+/* Array flags */
+#define CONTIGUOUS 1 /* means c-style contiguous (last index
+ varies the fastest) data elements right
+ after each other. */
+
+ /* All 0-d arrays are CONTIGUOUS and FORTRAN
+ contiguous. If a 1-d array is CONTIGUOUS
+ it is also FORTRAN contiguous
+ */
+
+ /* Not used -- always assumed
+#define OWN_DIMENSIONS 2
+#define OWN_STRIDES 4
+ */
+
+#define OWN_DATA 8
+
+#define FORTRAN 0x020 /* set if array is a contiguous Fortran array */
+ /* first index varies the fastest in memory
+ (strides array is reverse of C-contiguous
+ array)*/
+
+ /* array never has these two set -- FromAny flags only */
+#define FORCECAST 0x040
+#define ENSURECOPY 0x080
+
+#define ALIGNED 0x100
+#define NOTSWAPPED 0x200
+#define WRITEABLE 0x400
+
+ /* Flag used in creating a new array, not set in the array */
+
+ /* If this flags is set, then base contains a pointer to
+ an array of the same size that should be updated with the
+ current contents of this array when this array is deallocated
+ */
+#define UPDATEIFCOPY 0x1000
+
+
+/* Size of internal buffers used for alignment */
+#define PyArray_BUFSIZE 10000*sizeof(double)
+#define PyArray_MIN_BUFSIZE 5
+#define PyArray_MAX_BUFSIZE MAX_INT32
+#define MAXBUFNUM 1024
+
+
+#define BEHAVED_FLAGS ALIGNED | NOTSWAPPED | WRITEABLE
+#define BEHAVED_FLAGS_RO ALIGNED | NOTSWAPPED
+#define CARRAY_FLAGS CONTIGUOUS | BEHAVED_FLAGS
+#define FARRAY_FLAGS FORTRAN | BEHAVED_FLAGS
+#define DEFAULT_FLAGS CARRAY_FLAGS
+
+#define UPDATE_ALL_FLAGS CONTIGUOUS | FORTRAN | ALIGNED
+
+
+/*
+ * C API: consists of Macros and functions. The MACROS are defined here.
+ */
+
+
+#define PyArray_CHKFLAGS(m, FLAGS) \
+ ((((PyArrayObject *)(m))->flags & (FLAGS)) == (FLAGS))
+#define PyArray_ISCONTIGUOUS(m) PyArray_CHKFLAGS(m, CONTIGUOUS)
+#define PyArray_ISONESEGMENT(m) (PyArray_CHKFLAGS(m, CONTIGUOUS) || \
+ PyArray_CHKFLAGS(m, FORTRAN))
+#define PyArray_ISWRITEABLE(m) PyArray_CHKFLAGS(m, WRITEABLE)
+
+#define PyArray_ISCARRAY(m) PyArray_CHKFLAGS(m, CARRAY_FLAGS)
+#define PyArray_ISFARRAY(m) PyArray_CHKFLAGS(m, FARRAY_FLAGS)
+#define PyArray_ISBEHAVED(m) PyArray_CHKFLAGS(m, BEHAVED_FLAGS)
+#define PyArray_ISBEHAVED_RO(m) PyArray_CHKFLAGS(m, BEHAVED_FLAGS_RO)
+
+
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+
+ /* Useful if a and b have to be evaluated. */
+
+#define tMAX(a,b,typ) {typ _x_=(a); typ _y_=(b); _x_>_y_ ? _x_ : _y_}
+#define tMIN(a,b,typ) {typ _x_=(a); typ _y_=(b); _x_<_y_ ? _x_ : _y_}
+
+#if defined(ALLOW_THREADS)
+#define BEGIN_THREADS Py_BEGIN_ALLOW_THREADS
+#define END_THREADS Py_END_ALLOW_THREADS
+#define END_THREADS_FAIL Py_UNBLOCK_THREADS
+#define ALLOW_C_API_DEF PyGILState_STATE __save__;
+#define ALLOW_C_API __save__ = PyGILState_Ensure();
+#define DISABLE_C_API PyGILState_Release(__save__);
+#else
+#define BEGIN_THREADS
+#define END_THREADS
+#define END_THREADS_FAIL
+#define ALLOW_C_API_DEF
+#define ALLOW_C_API
+#define DISABLE_C_API
+#endif
+
+typedef struct {
+ PyObject_HEAD
+ int nd_m1; /* number of dimensions - 1 */
+ intp index, size;
+ intp coordinates[MAX_DIMS];/* N-dimensional loop */
+ intp dims_m1[MAX_DIMS]; /* ao->dimensions - 1 */
+ intp strides[MAX_DIMS]; /* ao->strides or fake */
+ intp backstrides[MAX_DIMS];/* how far to jump back */
+ intp factors[MAX_DIMS]; /* shape factors */
+ PyArrayObject *ao;
+ char *dataptr; /* pointer to current item*/
+ unsigned char contiguous;
+} PyArrayIterObject;
+
+
+/* Iterator API */
+#define PyArrayIter_Check(op) PyObject_TypeCheck(op, &PyArrayIter_Type)
+
+#define PyArray_ITER_RESET(it) { \
+ it->index = 0; \
+ it->dataptr = it->ao->data; \
+ memset(it->coordinates, 0, (it->nd_m1+1)*sizeof(intp)); \
+}
+
+
+#define PyArray_ITER_NEXT(it) { \
+ it->index++; \
+ if (it->contiguous) it->dataptr += it->ao->itemsize; \
+ else { \
+ int _i_; \
+ for (_i_ = it->nd_m1; _i_ >= 0; _i_--) { \
+ if (it->coordinates[_i_] < \
+ it->dims_m1[_i_]) { \
+ it->coordinates[_i_]++; \
+ it->dataptr += it->strides[_i_]; \
+ break; \
+ } \
+ else { \
+ it->coordinates[_i_] = 0; \
+ it->dataptr -= it->backstrides[_i_]; \
+ } \
+ } \
+ } \
+}
+
+#define PyArray_ITER_GOTO(it, destination) { \
+ int _i_; \
+ it->index = 0; \
+ it->dataptr = it->ao->data; \
+ for (_i_ = it->nd_m1; _i_>=0; _i_--) { \
+ it->dataptr += destination[_i_] * \
+ it->strides[_i_]; \
+ it->coordinates[_i_] = destination[_i_]; \
+ it->index += destination[_i_] * \
+ ( _i_==it->nd_m1 ? 1 : \
+ it->dims_m1[i+1]+1) ; \
+ } \
+ }
+
+#define PyArray_ITER_GOTO1D(it, ind) { \
+ int _i_; \
+ intp _lind_ = (intp) (ind); \
+ it->index = _lind_; \
+ if (it->contiguous) \
+ it->dataptr = it->ao->data + (ind) * \
+ it->ao->itemsize; \
+ else { \
+ it->dataptr = it->ao->data; \
+ for (_i_ = it->nd_m1; _i_>=0; _i_--) { \
+ it->dataptr += (_lind_ / it->factors[_i_]) \
+ * it->strides[_i_]; \
+ _lind_ %= it->factors[_i_]; \
+ } \
+ } \
+}
+
+/* Not constructed anywhere. Just serves as a standard type that
+ PyArray_Broadcast expects.
+
+ Any object passed to PyArray_Broadcast must be binary compatible with
+ this structure.
+*/
+
+
+typedef struct {
+ PyObject_HEAD
+
+ int numiter; /* number of iters */
+ intp size; /* broadcasted size */
+ intp index; /* current index */
+ int nd; /* number of dims */
+ intp dimensions[MAX_DIMS]; /* dimensions */
+ PyArrayIterObject *iters[MAX_DIMS]; /* iterators */
+} PyArrayMultiIterObject;
+
+
+/* Store the information needed for fancy-indexing over an array */
+
+typedef struct {
+ PyObject_HEAD
+ /* Multi-iterator portion --- needs to be present in this order to
+ work with PyArray_Broadcast */
+
+ int numiter; /* number of index-array
+ iterators */
+ intp size; /* size of broadcasted
+ result */
+ intp index; /* current index */
+ int nd; /* number of dims */
+ intp dimensions[MAX_DIMS]; /* dimensions */
+ PyArrayIterObject *iters[MAX_DIMS]; /* index object
+ iterators */
+ PyArrayIterObject *ait; /* flat Iterator for
+ underlying array */
+
+ /* flat iterator for subspace (when numiter < nd) */
+ PyArrayIterObject *subspace;
+
+ /* if subspace iteration, then this is the array of
+ axes in the underlying array represented by the
+ index objects */
+ int iteraxes[MAX_DIMS];
+ /* if subspace iteration, the these are the coordinates
+ to the start of the subspace.
+ */
+ intp bscoord[MAX_DIMS];
+
+
+ PyObject *indexobj; /* reference to
+ creating obj */
+ int view;
+ int consec;
+ char *dataptr;
+
+} PyArrayMapIterObject;
+
+
+/* Map Iterator API */
+#define PyArrayMapIter_Check(op) PyObject_TypeCheck(op, &PyArrayMapIter_Type)
+
+
+#define PyArray_NDIM(obj) (((PyArrayObject *)(obj))->nd)
+#define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, FORTRAN) && (PyArray_NDIM(m) > 1))
+#define PyArray_DATA(obj) (((PyArrayObject *)(obj))->data)
+#define PyArray_DIMS(obj) (((PyArrayObject *)(obj))->dimensions)
+#define PyArray_STRIDES(obj) (((PyArrayObject *)(obj))->strides)
+#define PyArray_DIM(obj,n) (((PyArrayObject *)(obj))->dimensions[n])
+#define PyArray_STRIDE(obj,n) (((PyArrayObject *)(obj))->strides[n])
+#define PyArray_BASE(obj) (((PyArrayObject *)(obj))->base)
+#define PyArray_DESCR(obj) (((PyArrayObject *)(obj))->descr)
+#define PyArray_FLAGS(obj) (((PyArrayObject *)(obj))->flags)
+#define PyArray_ITEMSIZE(obj) (((PyArrayObject *)(obj))->itemsize)
+#define PyArray_TYPE(obj) (((PyArrayObject *)(obj))->descr->type_num)
+#define PyArray_GETITEM(obj,itemptr) \
+ ((PyArrayObject *)(obj))->descr->getitem((char *)itemptr, \
+ (PyArrayObject *)obj);
+#define PyArray_SETITEM(obj,itemptr,v) \
+ (obj)->descr->setitem((PyObject *)v,(char *)(itemptr), \
+ (PyArrayObject *)(obj));
+
+
+#define PyTypeNum_ISBOOL(type) (type == PyArray_BOOL)
+#define PyTypeNum_ISUNSIGNED(type) ((type == PyArray_UBYTE) || \
+ (type == PyArray_USHORT) || \
+ (type == PyArray_UINT) || \
+ (type == PyArray_ULONG) || \
+ (type == PyArray_ULONGLONG))
+
+#define PyTypeNum_ISSIGNED(type) ((type == PyArray_BYTE) || \
+ (type == PyArray_SHORT) || \
+ (type == PyArray_INT) || \
+ (type == PyArray_LONG) || \
+ (type == PyArray_LONGLONG))
+
+#define PyTypeNum_ISINTEGER(type) ((type >= PyArray_BYTE) && \
+ (type <= PyArray_ULONGLONG))
+
+#define PyTypeNum_ISFLOAT(type) ((type >= PyArray_FLOAT) && \
+ (type <= PyArray_LONGDOUBLE))
+
+#define PyTypeNum_ISNUMBER(type) (type <= PyArray_CLONGDOUBLE)
+
+#define PyTypeNum_ISSTRING(type) ((type == PyArray_UCHAR) || \
+ (type == PyArray_UNICODE))
+
+#define PyTypeNum_ISCOMPLEX(type) ((type >= PyArray_CFLOAT) && \
+ (type <= PyArray_CLONGDOUBLE))
+
+#define PyTypeNum_ISPYTHON(type) ((type == PyArray_LONG) || \
+ (type == PyArray_DOUBLE) || \
+ (type == PyArray_CDOUBLE) || \
+ (type == PyArray_OBJECT ))
+
+#define PyTypeNum_ISFLEXIBLE(type) ((type==PyArray_STRING) || \
+ (type==PyArray_UNICODE) || \
+ (type==PyArray_VOID))
+
+#define PyTypeNum_ISOBJECT(type) ((type) == PyArray_OBJECT)
+
+#define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj))
+#define PyArray_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(PyArray_TYPE(obj))
+#define PyArray_ISSIGNED(obj) PyTypeNum_ISSIGNED(PyArray_TYPE(obj))
+#define PyArray_ISINTEGER(obj) PyTypeNum_ISINTEGER(PyArray_TYPE(obj))
+#define PyArray_ISFLOAT(obj) PyTypeNum_ISFLOAT(PyArray_TYPE(obj))
+#define PyArray_ISNUMBER(obj) PyTypeNum_ISNUMBER(PyArray_TYPE(obj))
+#define PyArray_ISSTRING(obj) PyTypeNum_ISSTRING(PyArray_TYPE(obj))
+#define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj))
+#define PyArray_ISPYTHONTYPE(obj) PyTypeNum_ISPYTHONTYPE(PyArray_TYPE(obj))
+#define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj))
+#define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj))
+
+/* Object arrays ignore notswapped flag */
+#define PyArray_ISNOTSWAPPED(m) (PyArray_CHKFLAGS(m, NOTSWAPPED) || \
+ PyArray_ISOBJECT(m))
+
+
+ /* Often, rather than always convert to an array,
+ we may want to delegate behavior for other objects passed in
+ */
+
+ /*
+
+#define Py_DELEGATE(op, name) \
+ if (PyObject_HasAttrString(op, #name)) { \
+ PyObject *ret=NULL; \
+ PyObject *meth=PyObject_GetAttrString(op, #name); \
+ if (PyCallable_Check(meth)) { \
+ ret = PyObject_CallObject(meth, NULL); \
+ } \
+ Py_XDECREF(meth); \
+ return ret; \
+ }
+
+#define Py_DELEGATE_ARGS(op, name, args) \
+ if (PyObject_HasAttrString(op, #name)) { \
+ PyObject *ret=NULL; \
+ PyObject *meth=PyObject_GetAttrString(op, #name); \
+ if (PyCallable_Check(meth)) { \
+ ret = PyObject_CallObject(meth, args); \
+ } \
+ Py_XDECREF(args); \
+ Py_XDECREF(meth); \
+ return ret; \
+ }
+
+#define Py_DELEGATE_ARGS_KWDS(op, name, args, kwds) \
+ if (PyObject_HasAttrString(op, #name)) { \
+ PyObject *ret=NULL; \
+ PyObject *meth=PyObject_GetAttrString(op, #name); \
+ if (PyCallable_Check(meth)) { \
+ ret = PyObject_Call(meth, args, kwds); \
+ } \
+ Py_XDECREF(args); \
+ Py_XDECREF(meth); \
+ return ret; \
+ }
+ */
+
+
+ /* Includes the "function" C-API -- these are all stored in a
+ list of pointers --- one for each file
+ The two lists are concatenated into one in multiarray.
+
+ They are available as import_array()
+ */
+
+#include "__multiarray_api.h"
+
+
+ /* C-API that requries previous API to be defined */
+
+#define PyArray_Check(op) (PyObject_TypeCheck((op), &PyArray_Type))
+#define PyArray_CheckExact(op) ((op)->ob_type == &PyArray_Type)
+
+#define PyArray_CheckScalar(m) (PyObject_TypeCheck((m), \
+ &PyGenericArrType_Type) \
+ || ((PyArray_Check((m))) && \
+ (((PyArrayObject *)(m))->nd == 0)))
+#define PyArray_IsScalar(obj, cls) \
+ (PyObject_TypeCheck((obj), &Py##cls##ArrType_Type))
+#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? Py_INCREF(m), m : \
+ (PyArrayObject *)(PyArray_ContiguousFromObject((PyObject *)(m), \
+ PyArray_TYPE(m), 0, 0)))
+
+#define PyArray_SIZE(m) PyArray_MultiplyList(PyArray_DIMS(m), PyArray_NDIM(m))
+#define PyArray_NBYTES(m) (PyArray_ITEMSIZE(m) * PyArray_SIZE(m))
+#define PyArray_FROM_O(m) PyArray_FromAny(m, NULL, 0, 0, 0)
+#define PyArray_FROM_OF(m,flags) PyArray_FromAny(m, NULL, 0, 0, flags)
+#define REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt)
+#define MAX_ELSIZE 2*SIZEOF_LONGDOUBLE
+
+ /*Compatibility with old Numeric stuff -- don't use in new code */
+
+#define PyArray_UNSIGNED_TYPES
+#define PyArray_SBYTE PyArray_BYTE
+#define PyArray_CHAR PyArray_BYTE
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !Py_ARRAYOBJECT_H */
diff --git a/base/include/scipy/ufuncobject.h b/base/include/scipy/ufuncobject.h
new file mode 100644
index 000000000..6e55aa7f0
--- /dev/null
+++ b/base/include/scipy/ufuncobject.h
@@ -0,0 +1,279 @@
+#ifndef Py_UFUNCOBJECT_H
+#define Py_UFUNCOBJECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_ARGS 40
+
+typedef void (*PyUFuncGenericFunction) (char **, intp *, intp *, void *);
+
+typedef struct {
+ PyObject_HEAD
+ int nin, nout, nargs;
+ int identity;
+ PyUFuncGenericFunction *functions;
+ void **data;
+ int ntypes;
+ int check_return;
+ char *name, *types;
+ char *doc;
+ void *ptr;
+ PyObject *obj;
+} PyUFuncObject;
+
+#include "arrayobject.h"
+
+#define UFUNC_ERR_IGNORE 0
+#define UFUNC_ERR_WARN 1
+#define UFUNC_ERR_RAISE 2
+#define UFUNC_ERR_CALL 3
+
+ /* Python side integer mask */
+
+#define UFUNC_MASK_DIVIDEBYZERO 0x03
+#define UFUNC_MASK_OVERFLOW 0x0c
+#define UFUNC_MASK_UNDERFLOW 0x30
+#define UFUNC_MASK_INVALID 0xc0
+
+#define UFUNC_SHIFT_DIVIDEBYZERO 0
+#define UFUNC_SHIFT_OVERFLOW 2
+#define UFUNC_SHIFT_UNDERFLOW 4
+#define UFUNC_SHIFT_INVALID 6
+
+
+/* platform-dependent code translates floating point
+ status to an integer sum of these values
+*/
+#define UFUNC_FPE_DIVIDEBYZERO 1
+#define UFUNC_FPE_OVERFLOW 2
+#define UFUNC_FPE_UNDERFLOW 4
+#define UFUNC_FPE_INVALID 8
+
+#define UFUNC_DEFAULT_ERROR 0 /* Default error mode */
+
+ /* Only internal -- not exported, yet*/
+typedef struct {
+ /* Multi-iterator portion --- needs to be present in this order
+ to work with PyArray_Broadcast */
+ PyObject_HEAD
+ int numiter;
+ intp size;
+ intp index;
+ int nd;
+ intp dimensions[MAX_DIMS];
+ PyArrayIterObject *iters[MAX_ARGS];
+ /* End of Multi-iterator portion */
+
+ /* The ufunc */
+ PyUFuncObject *ufunc;
+
+ /* The error handling */
+ int errormask; /* Integer showing desired error handling */
+ PyObject *errobj; /* currently a tuple with
+ (string, func or None)
+ */
+
+ /* Specific function and data to use */
+ PyUFuncGenericFunction function;
+ void *funcdata;
+
+ /* Loop method */
+ int meth;
+
+ /* Whether or not to swap */
+ int swap[MAX_ARGS];
+
+ /* Buffers for the loop */
+ void *buffer[MAX_ARGS];
+ int bufsize;
+ int bufcnt;
+ void *dptr[MAX_ARGS];
+
+ /* For casting */
+ void *castbuf[MAX_ARGS];
+ PyArray_VectorUnaryFunc *cast[MAX_ARGS];
+
+ /* usually points to buffer but when a cast is to be
+ done it switches for that argument to castbuf.
+ */
+ void *bufptr[MAX_ARGS];
+
+ /* Steps filled in from iters or sizeof(item)
+ depending on loop method.
+ */
+ intp steps[MAX_ARGS];
+
+
+} PyUFuncLoopObject;
+
+/* Could make this more clever someday */
+#define UFUNC_MAXIDENTITY 32
+
+typedef struct {
+ PyObject_HEAD
+ PyArrayIterObject *it;
+ PyArrayObject *ret;
+ PyArrayIterObject *rit; /* Needed for Accumulate */
+ int outsize;
+ intp index;
+ intp size;
+ char idptr[UFUNC_MAXIDENTITY];
+
+ /* The ufunc */
+ PyUFuncObject *ufunc;
+
+ /* The error handling */
+ int errormask;
+ PyObject *errobj;
+
+ PyUFuncGenericFunction function;
+ void *funcdata;
+ int meth;
+ int swap;
+
+ void *buffer;
+ int bufsize;
+
+ void *castbuf;
+ PyArray_VectorUnaryFunc *cast;
+
+ void *bufptr[3];
+ intp steps[3];
+
+ intp N;
+ int instrides;
+ int insize;
+ char *inptr;
+
+ /* For copying small arrays */
+ PyObject *decref;
+
+} PyUFuncReduceObject;
+
+#define PyUFunc_Unbounded 120
+#define PyUFunc_One 1
+#define PyUFunc_Zero 0
+#define PyUFunc_None -1
+
+
+typedef struct {
+ int nin;
+ int nout;
+ PyObject *callable;
+} PyUFunc_PyFuncData;
+
+
+
+
+#include "__ufunc_api.h"
+
+#define UFUNC_ERRMASK_NAME "_UFUNC_ERRMASK"
+#define UFUNC_ERRFUNC_NAME "_UFUNC_ERRFUNC"
+#define UFUNC_BUFSIZE_NAME "_UFUNC_BUFSIZE"
+
+#define UFUNC_CHECK_ERROR() \
+ if (loop->errormask && \
+ PyUFunc_checkfperr(loop->errormask, \
+ loop->errobj)) \
+ goto fail
+
+/* This code checks the IEEE status flags in a platform-dependent way */
+/* Adapted from Numarray */
+
+/* OSF/Alpha (Tru64) ---------------------------------------------*/
+#if defined(__osf__) && defined(__alpha)
+
+#include <machine/fpu.h>
+
+#define UFUNC_CHECK_STATUS(ret) { \
+ unsigned long fpstatus; \
+ \
+ fpstatus = ieee_get_fp_control(); \
+ /* clear status bits as well as disable exception mode if on */ \
+ ieee_set_fp_control( 0 ); \
+ ret = ((IEEE_STATUS_DZE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((IEEE_STATUS_OVF & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((IEEE_STATUS_UNF & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((IEEE_STATUS_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ }
+
+/* MS Windows -----------------------------------------------------*/
+#elif defined(_MSC_VER)
+
+#include <float.h>
+
+#define UFUNC_CHECK_STATUS(ret) { \
+ int fpstatus = (int) _clear87(); \
+ \
+ ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ }
+
+
+/* Solaris --------------------------------------------------------*/
+/* --------ignoring SunOS ieee_flags approach, someone else can
+** deal with that! */
+#elif defined(sun)
+#include <ieeefp.h>
+
+#define UFUNC_CHECK_STATUS(ret) { \
+ int fpstatus; \
+ \
+ fpstatus = (int) fpgetsticky(); \
+ ret = ((FP_X_DZ & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((FP_X_OFL & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((FP_X_UFL & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((FP_X_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ (void) fpsetsticky(0); \
+ }
+
+#elif defined(linux) || defined(darwin) || defined(__CYGWIN__)
+
+#if defined(__GLIBC__) || defined(darwin)
+#include <fenv.h>
+#elif defined(__CYGWIN__)
+#include <mingw/fenv.h>
+#endif
+
+#define UFUNC_CHECK_STATUS(ret) { \
+ int fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW | \
+ FE_UNDERFLOW | FE_INVALID); \
+ ret = ((FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ (void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW | \
+ FE_UNDERFLOW | FE_INVALID); \
+}
+
+#elif defined(AIX)
+
+#include <float.h>
+#include <fpxcp.h>
+
+#define UFUNC_CHECK_STATUS(ret) { \
+ fpflag_t fpstatus; \
+ \
+ fpstatus = fp_read_flag();
+ ret = ((FP_DIV_BY_ZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((FP_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((FP_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((FP_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0);
+ fp_clr_flag( FP_DIV_BY_ZERO | FP_OVERFLOW | FP_UNDERFLOW | FP_INVALID); \
+}
+
+#else
+
+#define UFUNC_CHECK_STATUS(ret) ret = 0;
+
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_UFUNCOBJECT_H */
diff --git a/base/isnan.c b/base/isnan.c
deleted file mode 100644
index c5719d283..000000000
--- a/base/isnan.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* isnan()
- * signbit()
- * isfinite()
- *
- * Floating point numeric utilities
- *
- *
- *
- * SYNOPSIS:
- *
- * double ceil(), floor(), frexp(), ldexp(); --- gone
- * int signbit(), isnan(), isfinite();
- * double x, y;
- * int expnt, n;
- *
- * y = floor(x); -gone
- * y = ceil(x); -gone
- * y = frexp( x, &expnt ); -gone
- * y = ldexp( x, n ); -gone
- * n = signbit(x);
- * n = isnan(x);
- * n = isfinite(x);
- *
- *
- *
- * DESCRIPTION:
- *
- * All four routines return a double precision floating point
- * result.
- *
- * floor() returns the largest integer less than or equal to x.
- * It truncates toward minus infinity.
- *
- * ceil() returns the smallest integer greater than or equal
- * to x. It truncates toward plus infinity.
- *
- * frexp() extracts the exponent from x. It returns an integer
- * power of two to expnt and the significand between 0.5 and 1
- * to y. Thus x = y * 2**expn.
- *
- * ldexp() multiplies x by 2**n.
- *
- * signbit(x) returns 1 if the sign bit of x is 1, else 0.
- *
- * These functions are part of the standard C run time library
- * for many but not all C compilers. The ones supplied are
- * written in C for either DEC or IEEE arithmetic. They should
- * be used only if your compiler library does not already have
- * them.
- *
- * The IEEE versions assume that denormal numbers are implemented
- * in the arithmetic. Some modifications will be required if
- * the arithmetic has abrupt rather than gradual underflow.
- */
-
-
-/*
-Cephes Math Library Release 2.3: March, 1995
-Copyright 1984, 1995 by Stephen L. Moshier
-*/
-
-
-#include "mconf_lite.h"
-
-#ifdef UNK
-#undef UNK
-#if BIGENDIAN
-#define MIEEE 1
-#else
-#define IBMPC 1
-#endif
-#endif
-
-
-/* Return 1 if the sign bit of x is 1, else 0. */
-
-#if !defined(signbit)
-int signbit(x)
-double x;
-{
-union
- {
- double d;
- short s[4];
- int i[2];
- } u;
-
-u.d = x;
-
-if( sizeof(int) == 4 )
- {
-#ifdef IBMPC
- return( u.i[1] < 0 );
-#endif
-#ifdef DEC
- return( u.s[3] < 0 );
-#endif
-#ifdef MIEEE
- return( u.i[0] < 0 );
-#endif
- }
-else
- {
-#ifdef IBMPC
- return( u.s[3] < 0 );
-#endif
-#ifdef DEC
- return( u.s[3] < 0 );
-#endif
-#ifdef MIEEE
- return( u.s[0] < 0 );
-#endif
- }
-}
-#endif
-
-/* Return 1 if x is a number that is Not a Number, else return 0. */
-
-#if !defined(isnan)
-int isnan(x)
-double x;
-{
-#ifdef NANS
-union
- {
- double d;
- unsigned short s[4];
- unsigned int i[2];
- } u;
-
-u.d = x;
-
-if( sizeof(int) == 4 )
- {
-#ifdef IBMPC
- if( ((u.i[1] & 0x7ff00000) == 0x7ff00000)
- && (((u.i[1] & 0x000fffff) != 0) || (u.i[0] != 0)))
- return 1;
-#endif
-#ifdef DEC
- if( (u.s[1] & 0x7fff) == 0)
- {
- if( (u.s[2] | u.s[1] | u.s[0]) != 0 )
- return(1);
- }
-#endif
-#ifdef MIEEE
- if( ((u.i[0] & 0x7ff00000) == 0x7ff00000)
- && (((u.i[0] & 0x000fffff) != 0) || (u.i[1] != 0)))
- return 1;
-#endif
- return(0);
- }
-else
- { /* size int not 4 */
-#ifdef IBMPC
- if( (u.s[3] & 0x7ff0) == 0x7ff0)
- {
- if( ((u.s[3] & 0x000f) | u.s[2] | u.s[1] | u.s[0]) != 0 )
- return(1);
- }
-#endif
-#ifdef DEC
- if( (u.s[3] & 0x7fff) == 0)
- {
- if( (u.s[2] | u.s[1] | u.s[0]) != 0 )
- return(1);
- }
-#endif
-#ifdef MIEEE
- if( (u.s[0] & 0x7ff0) == 0x7ff0)
- {
- if( ((u.s[0] & 0x000f) | u.s[1] | u.s[2] | u.s[3]) != 0 )
- return(1);
- }
-#endif
- return(0);
- } /* size int not 4 */
-
-#else
-/* No NANS. */
-return(0);
-#endif
-}
-#endif
-
-
-/* Return 1 if x is not infinite and is not a NaN. */
-
-#if !defined(isfinite)
-int isfinite(x)
-double x;
-{
-#ifdef INFINITIES
-union
- {
- double d;
- unsigned short s[4];
- unsigned int i[2];
- } u;
-
-u.d = x;
-
-if( sizeof(int) == 4 )
- {
-#ifdef IBMPC
- if( (u.i[1] & 0x7ff00000) != 0x7ff00000)
- return 1;
-#endif
-#ifdef DEC
- if( (u.s[3] & 0x7fff) != 0)
- return 1;
-#endif
-#ifdef MIEEE
- if( (u.i[0] & 0x7ff00000) != 0x7ff00000)
- return 1;
-#endif
- return(0);
- }
-else
- {
-#ifdef IBMPC
- if( (u.s[3] & 0x7ff0) != 0x7ff0)
- return 1;
-#endif
-#ifdef DEC
- if( (u.s[3] & 0x7fff) != 0)
- return 1;
-#endif
-#ifdef MIEEE
- if( (u.s[0] & 0x7ff0) != 0x7ff0)
- return 1;
-#endif
- return(0);
- }
-#else
-/* No INFINITY. */
-return(1);
-#endif
-}
-#endif
diff --git a/base/mconf_lite.h b/base/mconf_lite.h
deleted file mode 100644
index 41c33fdb5..000000000
--- a/base/mconf_lite.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-#if defined(USE_MCONF_LITE_BE)
-#include "mconf_lite_BE.h"
-#else
-#include "mconf_lite_LE.h"
-#endif
diff --git a/base/mconf_lite_BE.h b/base/mconf_lite_BE.h
deleted file mode 100644
index 0c6f2a3e0..000000000
--- a/base/mconf_lite_BE.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* mconf_lite.h
- *
- * Common include file for math routines
- *
- *
- *
- * SYNOPSIS:
- *
- * #include "mconf_lite.h"
- *
- *
- *
- * DESCRIPTION:
- *
- * The file also includes a conditional assembly definition
- * for the type of computer arithmetic (IEEE, DEC, Motorola
- * IEEE, or UNKnown).
- *
- * For Digital Equipment PDP-11 and VAX computers, certain
- * IBM systems, and others that use numbers with a 56-bit
- * significand, the symbol DEC should be defined. In this
- * mode, most floating point constants are given as arrays
- * of octal integers to eliminate decimal to binary conversion
- * errors that might be introduced by the compiler.
- *
- * For little-endian computers, such as IBM PC, that follow the
- * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
- * Std 754-1985), the symbol IBMPC should be defined. These
- * numbers have 53-bit significands. In this mode, constants
- * are provided as arrays of hexadecimal 16 bit integers.
- *
- * Big-endian IEEE format is denoted MIEEE. On some RISC
- * systems such as Sun SPARC, double precision constants
- * must be stored on 8-byte address boundaries. Since integer
- * arrays may be aligned differently, the MIEEE configuration
- * may fail on such machines.
- *
- * To accommodate other types of computer arithmetic, all
- * constants are also provided in a normal decimal radix
- * which one can hope are correctly converted to a suitable
- * format by the available C language compiler. To invoke
- * this mode, define the symbol UNK.
- *
- * An important difference among these modes is a predefined
- * set of machine arithmetic constants for each. The numbers
- * MACHEP (the machine roundoff error), MAXNUM (largest number
- * represented), and several other parameters are preset by
- * the configuration symbol. Check the file const.c to
- * ensure that these values are correct for your computer.
- *
- * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
- * may fail on many systems. Verify that they are supposed
- * to work on your computer.
- */
-
-/*
-Cephes Math Library Release 2.3: June, 1995
-Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
-
-Modified to handle just the parts necessary for isnan to work.
-*/
-
-
-/* Type of computer arithmetic */
-
-/* PDP-11, Pro350, VAX:
- */
-/* #define DEC 1 */
-
-/* Not sure about these pdp defines */
-#if defined(vax) || defined(__vax__) || defined(decvax) || \
- defined(__decvax__) || defined(pro350) || defined(pdp11)
-#define DEC 1
-
-#elif defined(ns32000) || defined(sun386) || \
- defined(i386) || defined(MIPSEL) || defined(_MIPSEL) || \
- defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \
- defined(sequent) || defined(i386) || \
- defined(__ns32000__) || defined(__sun386__) || defined(__i386__)
-#define IBMPC 1 /* Intel IEEE, low order words come first */
-#define BIGENDIAN 0
-
-#elif defined(sel) || defined(pyr) || defined(mc68000) || defined (m68k) || \
- defined(is68k) || defined(tahoe) || defined(ibm032) || \
- defined(ibm370) || defined(MIPSEB) || defined(_MIPSEB) || \
- defined(__convex__) || defined(DGUX) || defined(hppa) || \
- defined(apollo) || defined(_CRAY) || defined(__hppa) || \
- defined(__hp9000) || defined(__hp9000s300) || \
- defined(__hp9000s700) || defined(__AIX) || defined(_AIX) || \
- defined(__pyr__) || defined(__mc68000__) || defined(__sparc) ||\
- defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT)
-#define MIEEE 1 /* Motorola IEEE, high order words come first */
-#define BIGENDIAN 1
-
-#else
-#define UNK 1 /* Machine not known */
-#define BIGENDIAN 1 /* This is a BE file */
-#endif
-
-
-/* Define to ask for infinity support, else undefine. */
-#define INFINITIES 1
-
-/* Define to ask for support of numbers that are Not-a-Number,
- else undefine. This may automatically define INFINITIES in some files. */
-#define NANS 1
-
-/* Define to distinguish between -0.0 and +0.0. */
-#define MINUSZERO 1
-
-#if !defined(signbit)
-int signbit(double);
-#endif
-#if !defined(isnan)
-int isnan(double);
-#endif
-#if !defined(isfinite)
-int isfinite(double);
-#endif
diff --git a/base/mconf_lite_LE.h b/base/mconf_lite_LE.h
deleted file mode 100644
index f7d7041df..000000000
--- a/base/mconf_lite_LE.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* mconf_lite.h
- *
- * Common include file for math routines
- *
- *
- *
- * SYNOPSIS:
- *
- * #include "mconf_lite.h"
- *
- *
- *
- * DESCRIPTION:
- *
- * The file also includes a conditional assembly definition
- * for the type of computer arithmetic (IEEE, DEC, Motorola
- * IEEE, or UNKnown).
- *
- * For Digital Equipment PDP-11 and VAX computers, certain
- * IBM systems, and others that use numbers with a 56-bit
- * significand, the symbol DEC should be defined. In this
- * mode, most floating point constants are given as arrays
- * of octal integers to eliminate decimal to binary conversion
- * errors that might be introduced by the compiler.
- *
- * For little-endian computers, such as IBM PC, that follow the
- * IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
- * Std 754-1985), the symbol IBMPC should be defined. These
- * numbers have 53-bit significands. In this mode, constants
- * are provided as arrays of hexadecimal 16 bit integers.
- *
- * Big-endian IEEE format is denoted MIEEE. On some RISC
- * systems such as Sun SPARC, double precision constants
- * must be stored on 8-byte address boundaries. Since integer
- * arrays may be aligned differently, the MIEEE configuration
- * may fail on such machines.
- *
- * To accommodate other types of computer arithmetic, all
- * constants are also provided in a normal decimal radix
- * which one can hope are correctly converted to a suitable
- * format by the available C language compiler. To invoke
- * this mode, define the symbol UNK.
- *
- * An important difference among these modes is a predefined
- * set of machine arithmetic constants for each. The numbers
- * MACHEP (the machine roundoff error), MAXNUM (largest number
- * represented), and several other parameters are preset by
- * the configuration symbol. Check the file const.c to
- * ensure that these values are correct for your computer.
- *
- * Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
- * may fail on many systems. Verify that they are supposed
- * to work on your computer.
- */
-
-/*
-Cephes Math Library Release 2.3: June, 1995
-Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
-
-Modified to handle just the parts necessary for isnan to work.
-*/
-
-
-/* Type of computer arithmetic */
-
-/* PDP-11, Pro350, VAX:
- */
-/* #define DEC 1 */
-
-/* Not sure about these pdp defines */
-#if defined(vax) || defined(__vax__) || defined(decvax) || \
- defined(__decvax__) || defined(pro350) || defined(pdp11)
-#define DEC 1
-
-#elif defined(ns32000) || defined(sun386) || \
- defined(i386) || defined(MIPSEL) || defined(_MIPSEL) || \
- defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || defined(__alpha) || \
- defined(sequent) || defined(i386) || \
- defined(__ns32000__) || defined(__sun386__) || defined(__i386__)
-#define IBMPC 1 /* Intel IEEE, low order words come first */
-#define BIGENDIAN 0
-
-#elif defined(sel) || defined(pyr) || defined(mc68000) || defined (m68k) || \
- defined(is68k) || defined(tahoe) || defined(ibm032) || \
- defined(ibm370) || defined(MIPSEB) || defined(_MIPSEB) || \
- defined(__convex__) || defined(DGUX) || defined(hppa) || \
- defined(apollo) || defined(_CRAY) || defined(__hppa) || \
- defined(__hp9000) || defined(__hp9000s300) || \
- defined(__hp9000s700) || defined(__AIX) || defined(_AIX) || \
- defined(__pyr__) || defined(__mc68000__) || defined(__sparc) ||\
- defined(_IBMR2) || defined (BIT_ZERO_ON_LEFT)
-#define MIEEE 1 /* Motorola IEEE, high order words come first */
-#define BIGENDIAN 1
-
-#else
-#define UNK 1 /* Machine not known */
-#define BIGENDIAN 0 /* This is a LE file */
-#endif
-
-
-/* Define to ask for infinity support, else undefine. */
-#define INFINITIES 1
-
-/* Define to ask for support of numbers that are Not-a-Number,
- else undefine. This may automatically define INFINITIES in some files. */
-#define NANS 1
-
-/* Define to distinguish between -0.0 and +0.0. */
-#define MINUSZERO 1
-
-#if !defined(signbit)
-int signbit(double);
-#endif
-#if !defined(isnan)
-int isnan(double);
-#endif
-#if !defined(isfinite)
-int isfinite(double);
-#endif
diff --git a/base/numerix.h b/base/numerix.h
deleted file mode 100644
index a4134b40a..000000000
--- a/base/numerix.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#if !defined(_NUMERIX_)
-#define _NUMERIX_
-
-#if defined(NUMARRAY)
-# include "numarray/arrayobject.h"
-#else
-# include "Numeric/arrayobject.h"
-#endif
-
-#if defined(NUMARRAY)
-# define NX_ZERO(a) PyArray_Zero(a)
-#else
-# define NX_ZERO(a) (a)->descr->zero
-#endif
-
-#if defined(NUMARRAY)
-# define NX_ONE(a) PyArray_One(a)
-#else
-# define NX_ONE(a) (a)->descr->one
-#endif
-
-#if defined(NUMARRAY)
-# define NX_GETITEM(a, ptr) (a)->descr->_get((a), ((char*)ptr)-(a)->data)
-#else
-# define NX_GETITEM(a, ptr) (a)->descr->getitem(ptr)
-#endif
-
-#if defined(NUMARRAY)
-# define NX_SETITEM(a, ptr, value) (a)->descr->_set((a), ((char*)ptr)-(a)->data, value)
-#else
-# define NX_SETITEM(a, ptr, value) (a)->descr->setitem(value, ptr)
-#endif
-
-#endif
diff --git a/base/setup_scipy_base.py b/base/setup_scipy_base.py
deleted file mode 100755
index 12614f0f0..000000000
--- a/base/setup_scipy_base.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/env python
-import os, sys
-from glob import glob
-
-def configuration(parent_package='',parent_path=None):
- from scipy_distutils.system_info import get_info, dict_append
- from scipy_distutils.core import Extension
- from scipy_distutils.misc_util import get_path,default_config_dict,dot_join
- from scipy_distutils.misc_util import get_path,default_config_dict,\
- dot_join,SourceGenerator
- from distutils.dep_util import newer
- from distutils.file_util import copy_file
-
- package = 'scipy_base'
- local_path = get_path(__name__,parent_path)
- config = default_config_dict(package,parent_package)
-
- # extra_compile_args -- trying to find something that is binary compatible
- # with msvc for returning Py_complex from functions
- extra_compile_args=[]
-
- # fastumath module
- # scipy_base.fastumath module
- umath_c_sources = ['fastumathmodule.c',
- 'fastumath_unsigned.inc',
- 'fastumath_nounsigned.inc',
- '_scipy_mapping.c',
- '_scipy_number.c']
- umath_c_sources = [os.path.join(local_path,x) for x in umath_c_sources]
- umath_c = os.path.join(local_path,'fastumathmodule.c')
- sources = [umath_c, os.path.join(local_path,'isnan.c')]
- define_macros = []
- undef_macros = []
- libraries = []
- if sys.byteorder == "little":
- define_macros.append(('USE_MCONF_LITE_LE',None))
- else:
- define_macros.append(('USE_MCONF_LITE_BE',None))
- if sys.platform in ['win32']:
- undef_macros.append('HAVE_INVERSE_HYPERBOLIC')
- else:
- libraries.append('m')
- define_macros.append(('HAVE_INVERSE_HYPERBOLIC',None))
-
- ext_args = {'name':dot_join(package,'fastumath'),
- 'sources':sources,
- 'define_macros': define_macros,
- 'undef_macros': undef_macros,
- 'libraries': libraries,
- 'extra_compile_args': extra_compile_args,
- 'depends': umath_c_sources}
- config['ext_modules'].append(Extension(**ext_args))
-
- # _compiled_base module
-
- sources = ['_compiled_base.c']
- sources = [os.path.join(local_path,x) for x in sources]
- ext_args = {}
- dict_append(ext_args,
- name=dot_join(package,'_compiled_base'),
- sources = sources,
- )
- config['ext_modules'].append(Extension(**ext_args))
-
-
- # display_test module
- sources = [os.path.join(local_path,'src','display_test.c')]
- x11 = get_info('x11')
- if x11:
- x11['define_macros'] = [('HAVE_X11',None)]
- ext = Extension(dot_join(package,'display_test'), sources, **x11)
- config['ext_modules'].append(ext)
-
- return config
-
-if __name__ == '__main__':
- from scipy_base_version import scipy_base_version
- print 'scipy_base Version',scipy_base_version
- from scipy_distutils.core import setup
-
- setup(version = scipy_base_version,
- maintainer = "SciPy Developers",
- maintainer_email = "scipy-dev@scipy.org",
- description = "SciPy base module",
- url = "http://www.scipy.org",
- license = "SciPy License (BSD Style)",
- **configuration(parent_path='')
- )