diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2010-12-01 17:17:35 -0800 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-12-01 20:02:15 -0700 |
commit | db128ccbf60470b0f50eeb97c5885ac253e08c31 (patch) | |
tree | b8eb013120bfef0b8d734f7c1fd122c08273e7ff | |
parent | 15c68128fea5618902c62c62436e2bad1eb865b7 (diff) | |
download | numpy-db128ccbf60470b0f50eeb97c5885ac253e08c31.tar.gz |
ENH: core: Implement half/float16 umath loops
-rw-r--r-- | numpy/core/code_generators/generate_umath.py | 107 | ||||
-rw-r--r-- | numpy/core/code_generators/numpy_api.py | 6 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.c.src | 390 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.h | 904 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.h.src | 22 | ||||
-rw-r--r-- | numpy/core/src/umath/umathmodule.c.src | 23 | ||||
-rw-r--r-- | numpy/core/tests/test_half.py | 78 |
7 files changed, 1094 insertions, 436 deletions
diff --git a/numpy/core/code_generators/generate_umath.py b/numpy/core/code_generators/generate_umath.py index 5d19534e4..905a3e27f 100644 --- a/numpy/core/code_generators/generate_umath.py +++ b/numpy/core/code_generators/generate_umath.py @@ -31,10 +31,16 @@ class TypeDescription(object): The typecode(s) of the inputs. out : str or None, optional The typecode(s) of the outputs. + astype : dict or None, optional + If astype['x'] is 'y', uses PyUFunc_x_x_As_y_y/PyUFunc_xx_x_As_yy_y + instead of PyUFunc_x_x/PyUFunc_xx_x. """ - def __init__(self, type, f=None, in_=None, out=None): + def __init__(self, type, f=None, in_=None, out=None, astype=None): self.type = type self.func_data = f + if astype is None: + astype = {} + self.astype_dict = astype if in_ is not None: in_ = in_.replace('P', type) self.in_ = in_ @@ -49,8 +55,9 @@ class TypeDescription(object): if self.out is None: self.out = self.type * nout assert len(self.out) == nout + self.astype = self.astype_dict.get(self.type, None) -_fdata_map = dict(f='npy_%sf', d='npy_%s', g='npy_%sl', +_fdata_map = dict(j='npy_%sf', f='npy_%sf', d='npy_%s', g='npy_%sl', F='nc_%sf', D='nc_%s', G='nc_%sl') def build_func_data(types, f): func_data = [] @@ -59,7 +66,7 @@ def build_func_data(types, f): func_data.append(d) return func_data -def TD(types, f=None, in_=None, out=None): +def TD(types, f=None, astype=None, in_=None, out=None): if f is not None: if isinstance(f, str): func_data = build_func_data(types, f) @@ -78,7 +85,7 @@ def TD(types, f=None, in_=None, out=None): out = (None,) * len(types) tds = [] for t, fd, i, o in zip(types, func_data, in_, out): - tds.append(TypeDescription(t, f=fd, in_=i, out=o)) + tds.append(TypeDescription(t, f=fd, in_=i, out=o, astype=astype)) return tds class Ufunc(object): @@ -166,6 +173,7 @@ chartoname = {'?': 'bool', 'L': 'ulong', 'q': 'longlong', 'Q': 'ulonglong', + 'j': 'half', 'f': 'float', 'd': 'double', 'g': 'longdouble', @@ -180,7 +188,7 @@ chartoname = {'?': 'bool', 'P': 'OBJECT', } -all = '?bBhHiIlLqQfdgFDGOMm' +all = '?bBhHiIlLqQjfdgFDGOMm' O = 'O' P = 'P' ints = 'bBhHiIlLqQ' @@ -188,7 +196,7 @@ times = 'Mm' intsO = ints + O bints = '?' + ints bintsO = bints + O -flts = 'fdg' +flts = 'jfdg' fltsO = flts + O fltsP = flts + P cmplx = 'FDG' @@ -217,6 +225,10 @@ for code in 'bhilq': uint64 = english_upper(code) break +# This dictionary describes all the ufunc implementations, generating +# all the function names and their corresponding ufunc signatures. TD is +# an object which expands a list of character codes into an array of +# TypeDescriptions. defdict = { 'add' : Ufunc(2, 1, Zero, @@ -274,7 +286,7 @@ defdict = { Ufunc(2, 1, Zero, docstrings.get('numpy.core.umath.fmod'), TD(ints), - TD(flts, f='fmod'), + TD(flts, f='fmod', astype={'j':'f'}), TD(P, f='fmod'), ), 'square' : @@ -299,7 +311,7 @@ defdict = { Ufunc(2, 1, One, docstrings.get('numpy.core.umath.power'), TD(ints), - TD(inexact, f='pow'), + TD(inexact, f='pow', astype={'j':'f'}), TD(O, f='npy_ObjectPower'), ), 'absolute' : @@ -407,12 +419,12 @@ defdict = { 'logaddexp' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.logaddexp'), - TD(flts, f="logaddexp") + TD(flts, f="logaddexp", astype={'j':'f'}) ), 'logaddexp2' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.logaddexp2'), - TD(flts, f="logaddexp2") + TD(flts, f="logaddexp2", astype={'j':'f'}) ), # FIXME: decide if the times should have the bitwise operations. 'bitwise_and' : @@ -454,177 +466,177 @@ defdict = { 'degrees' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.degrees'), - TD(fltsP, f='degrees'), + TD(fltsP, f='degrees', astype={'j':'f'}), ), 'rad2deg' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.rad2deg'), - TD(fltsP, f='rad2deg'), + TD(fltsP, f='rad2deg', astype={'j':'f'}), ), 'radians' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.radians'), - TD(fltsP, f='radians'), + TD(fltsP, f='radians', astype={'j':'f'}), ), 'deg2rad' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.deg2rad'), - TD(fltsP, f='deg2rad'), + TD(fltsP, f='deg2rad', astype={'j':'f'}), ), 'arccos' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arccos'), - TD(inexact, f='acos'), + TD(inexact, f='acos', astype={'j':'f'}), TD(P, f='arccos'), ), 'arccosh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arccosh'), - TD(inexact, f='acosh'), + TD(inexact, f='acosh', astype={'j':'f'}), TD(P, f='arccosh'), ), 'arcsin' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arcsin'), - TD(inexact, f='asin'), + TD(inexact, f='asin', astype={'j':'f'}), TD(P, f='arcsin'), ), 'arcsinh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arcsinh'), - TD(inexact, f='asinh'), + TD(inexact, f='asinh', astype={'j':'f'}), TD(P, f='arcsinh'), ), 'arctan' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arctan'), - TD(inexact, f='atan'), + TD(inexact, f='atan', astype={'j':'f'}), TD(P, f='arctan'), ), 'arctanh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.arctanh'), - TD(inexact, f='atanh'), + TD(inexact, f='atanh', astype={'j':'f'}), TD(P, f='arctanh'), ), 'cos' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.cos'), - TD(inexact, f='cos'), + TD(inexact, f='cos', astype={'j':'f'}), TD(P, f='cos'), ), 'sin' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.sin'), - TD(inexact, f='sin'), + TD(inexact, f='sin', astype={'j':'f'}), TD(P, f='sin'), ), 'tan' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.tan'), - TD(inexact, f='tan'), + TD(inexact, f='tan', astype={'j':'f'}), TD(P, f='tan'), ), 'cosh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.cosh'), - TD(inexact, f='cosh'), + TD(inexact, f='cosh', astype={'j':'f'}), TD(P, f='cosh'), ), 'sinh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.sinh'), - TD(inexact, f='sinh'), + TD(inexact, f='sinh', astype={'j':'f'}), TD(P, f='sinh'), ), 'tanh' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.tanh'), - TD(inexact, f='tanh'), + TD(inexact, f='tanh', astype={'j':'f'}), TD(P, f='tanh'), ), 'exp' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.exp'), - TD(inexact, f='exp'), + TD(inexact, f='exp', astype={'j':'f'}), TD(P, f='exp'), ), 'exp2' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.exp2'), - TD(inexact, f='exp2'), + TD(inexact, f='exp2', astype={'j':'f'}), TD(P, f='exp2'), ), 'expm1' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.expm1'), - TD(inexact, f='expm1'), + TD(inexact, f='expm1', astype={'j':'f'}), TD(P, f='expm1'), ), 'log' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log'), - TD(inexact, f='log'), + TD(inexact, f='log', astype={'j':'f'}), TD(P, f='log'), ), 'log2' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log2'), - TD(inexact, f='log2'), + TD(inexact, f='log2', astype={'j':'f'}), TD(P, f='log2'), ), 'log10' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log10'), - TD(inexact, f='log10'), + TD(inexact, f='log10', astype={'j':'f'}), TD(P, f='log10'), ), 'log1p' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.log1p'), - TD(inexact, f='log1p'), + TD(inexact, f='log1p', astype={'j':'f'}), TD(P, f='log1p'), ), 'sqrt' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.sqrt'), - TD(inexact, f='sqrt'), + TD(inexact, f='sqrt', astype={'j':'f'}), TD(P, f='sqrt'), ), 'ceil' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.ceil'), - TD(flts, f='ceil'), + TD(flts, f='ceil', astype={'j':'f'}), TD(P, f='ceil'), ), 'trunc' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.trunc'), - TD(flts, f='trunc'), + TD(flts, f='trunc', astype={'j':'f'}), TD(P, f='trunc'), ), 'fabs' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.fabs'), - TD(flts, f='fabs'), + TD(flts, f='fabs', astype={'j':'f'}), TD(P, f='fabs'), ), 'floor' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.floor'), - TD(flts, f='floor'), + TD(flts, f='floor', astype={'j':'f'}), TD(P, f='floor'), ), 'rint' : Ufunc(1, 1, None, docstrings.get('numpy.core.umath.rint'), - TD(inexact, f='rint'), + TD(inexact, f='rint', astype={'j':'f'}), TD(P, f='rint'), ), 'arctan2' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.arctan2'), - TD(flts, f='atan2'), + TD(flts, f='atan2', astype={'j':'f'}), TD(P, f='arctan2'), ), 'remainder' : @@ -636,7 +648,7 @@ defdict = { 'hypot' : Ufunc(2, 1, None, docstrings.get('numpy.core.umath.hypot'), - TD(flts, f='hypot'), + TD(flts, f='hypot', astype={'j':'f'}), TD(P, f='hypot'), ), 'isnan' : @@ -692,7 +704,8 @@ def indent(st,spaces): indented = re.sub(r' +$',r'',indented) return indented -chartotype1 = {'f': 'f_f', +chartotype1 = {'j': 'j_j', + 'f': 'f_f', 'd': 'd_d', 'g': 'g_g', 'F': 'F_F', @@ -701,7 +714,8 @@ chartotype1 = {'f': 'f_f', 'O': 'O_O', 'P': 'O_O_method'} -chartotype2 = {'f': 'ff_f', +chartotype2 = {'j': 'jj_j', + 'f': 'ff_f', 'd': 'dd_d', 'g': 'gg_g', 'F': 'FF_F', @@ -739,8 +753,11 @@ def make_arrays(funcdict): for t in uf.type_descriptions: if t.func_data not in (None, UsesArraysAsData): funclist.append('NULL') - astr = '%s_functions[%d] = PyUFunc_%s;' % \ - (name, k, thedict[t.type]) + astype = '' + if not t.astype is None: + astype = '_As_%s' % thedict[t.astype] + astr = '%s_functions[%d] = PyUFunc_%s%s;' % \ + (name, k, thedict[t.type], astype) code2list.append(astr) if t.type == 'O': astr = '%s_data[%d] = (void *) %s;' % \ diff --git a/numpy/core/code_generators/numpy_api.py b/numpy/core/code_generators/numpy_api.py index 15ced07f2..1356fda8f 100644 --- a/numpy/core/code_generators/numpy_api.py +++ b/numpy/core/code_generators/numpy_api.py @@ -291,6 +291,12 @@ ufunc_funcs_api = { 'PyUFunc_ReplaceLoopBySignature': 30, 'PyUFunc_FromFuncAndDataAndSignature': 31, 'PyUFunc_SetUsesArraysAsData': 32, + 'PyUFunc_j_j': 33, + 'PyUFunc_j_j_As_f_f': 34, + 'PyUFunc_j_j_As_d_d': 35, + 'PyUFunc_jj_j': 36, + 'PyUFunc_jj_j_As_ff_f': 37, + 'PyUFunc_jj_j_As_dd_d': 38, } # List of all the dicts which define the C API diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src index c61d16ae4..023bac74b 100644 --- a/numpy/core/src/umath/loops.c.src +++ b/numpy/core/src/umath/loops.c.src @@ -13,11 +13,13 @@ #include "numpy/noprefix.h" #include "numpy/ufuncobject.h" #include "numpy/npy_math.h" +#include "numpy/halffloat.h" #include "numpy/npy_3kcompat.h" #include "ufunc_object.h" + /* ***************************************************************************** ** UFUNC LOOPS ** @@ -56,13 +58,17 @@ intp i;\ for(i = 0; i < n; i++, ip1 += is1, ip2 += is2, op1 += os1) -#define BINARY_REDUCE_LOOP(TYPE)\ - char *iop1 = args[0], *ip2 = args[1]; \ +#define BINARY_REDUCE_LOOP_INNER\ + char *ip2 = args[1]; \ intp is2 = steps[1]; \ intp n = dimensions[0]; \ intp i; \ - TYPE io1 = *(TYPE *)iop1; \ for(i = 0; i < n; i++, ip2 += is2) + +#define BINARY_REDUCE_LOOP(TYPE)\ + char *iop1 = args[0]; \ + TYPE io1 = *(TYPE *)iop1; \ + BINARY_REDUCE_LOOP_INNER #define BINARY_LOOP_TWO_OUT\ char *ip1 = args[0], *ip2 = args[1], *op1 = args[2], *op2 = args[3];\ @@ -76,9 +82,11 @@ *****************************************************************************/ +typedef float halfUnaryFunc(npy_half x); typedef float floatUnaryFunc(float x); typedef double doubleUnaryFunc(double x); typedef longdouble longdoubleUnaryFunc(longdouble x); +typedef npy_half halfBinaryFunc(npy_half x, npy_half y); typedef float floatBinaryFunc(float x, float y); typedef double doubleBinaryFunc(double x, double y); typedef longdouble longdoubleBinaryFunc(longdouble x, longdouble y); @@ -86,6 +94,39 @@ typedef longdouble longdoubleBinaryFunc(longdouble x, longdouble y); /*UFUNC_API*/ NPY_NO_EXPORT void +PyUFunc_j_j(char **args, intp *dimensions, intp *steps, void *func) +{ + halfUnaryFunc *f = (halfUnaryFunc *)func; + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *(npy_half *)op1 = f(in1); + } +} + +/*UFUNC_API*/ +NPY_NO_EXPORT void +PyUFunc_j_j_As_f_f(char **args, intp *dimensions, intp *steps, void *func) +{ + floatUnaryFunc *f = (floatUnaryFunc *)func; + UNARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + *(npy_half *)op1 = npy_float_to_half(f(in1)); + } +} + +/*UFUNC_API*/ +NPY_NO_EXPORT void +PyUFunc_j_j_As_d_d(char **args, intp *dimensions, intp *steps, void *func) +{ + doubleUnaryFunc *f = (doubleUnaryFunc *)func; + UNARY_LOOP { + const double in1 = npy_half_to_double(*(npy_half *)ip1); + *(npy_half *)op1 = npy_double_to_half(f(in1)); + } +} + +/*UFUNC_API*/ +NPY_NO_EXPORT void PyUFunc_f_f(char **args, intp *dimensions, intp *steps, void *func) { floatUnaryFunc *f = (floatUnaryFunc *)func; @@ -108,6 +149,42 @@ PyUFunc_f_f_As_d_d(char **args, intp *dimensions, intp *steps, void *func) /*UFUNC_API*/ NPY_NO_EXPORT void +PyUFunc_jj_j(char **args, intp *dimensions, intp *steps, void *func) +{ + halfBinaryFunc *f = (halfBinaryFunc *)func; + BINARY_LOOP { + npy_half in1 = *(npy_half *)ip1; + npy_half in2 = *(npy_half *)ip2; + *(npy_half *)op1 = f(in1, in2); + } +} + +/*UFUNC_API*/ +NPY_NO_EXPORT void +PyUFunc_jj_j_As_ff_f(char **args, intp *dimensions, intp *steps, void *func) +{ + floatBinaryFunc *f = (floatBinaryFunc *)func; + BINARY_LOOP { + float in1 = npy_half_to_float(*(npy_half *)ip1); + float in2 = npy_half_to_float(*(npy_half *)ip2); + *(npy_half *)op1 = npy_float_to_half(f(in1, in2)); + } +} + +/*UFUNC_API*/ +NPY_NO_EXPORT void +PyUFunc_jj_j_As_dd_d(char **args, intp *dimensions, intp *steps, void *func) +{ + doubleBinaryFunc *f = (doubleBinaryFunc *)func; + BINARY_LOOP { + double in1 = npy_half_to_double(*(npy_half *)ip1); + double in2 = npy_half_to_double(*(npy_half *)ip2); + *(npy_half *)op1 = npy_double_to_half(f(in1, in2)); + } +} + +/*UFUNC_API*/ +NPY_NO_EXPORT void PyUFunc_ff_f(char **args, intp *dimensions, intp *steps, void *func) { floatBinaryFunc *f = (floatBinaryFunc *)func; @@ -1053,8 +1130,6 @@ NPY_NO_EXPORT void } /**end repeat1**/ -/**end repeat1**/ - /**begin repeat1 * #kind = equal, not_equal, less, less_equal, greater, greater_equal, * logical_and, logical_or# @@ -1322,6 +1397,311 @@ NPY_NO_EXPORT void /**end repeat**/ +/* + ***************************************************************************** + ** HALF-FLOAT LOOPS ** + ***************************************************************************** + */ + + +/**begin repeat + * Arithmetic + * # kind = add, subtract, multiply, divide# + * # OP = +, -, *, /# + */ +NPY_NO_EXPORT void +HALF_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + if(IS_BINARY_REDUCE) { + char *iop1 = args[0]; + float io1 = npy_half_to_float(*(npy_half *)iop1); + BINARY_REDUCE_LOOP_INNER { + io1 @OP@= npy_half_to_float(*(npy_half *)ip2); + } + *((npy_half *)iop1) = npy_float_to_half(io1); + } + else { + BINARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + const float in2 = npy_half_to_float(*(npy_half *)ip2); + *((npy_half *)op1) = npy_float_to_half(in1 @OP@ in2); + } + } +} +/**end repeat**/ + +#define _HALF_LOGICAL_AND(a,b) (!npy_half_iszero(a) && !npy_half_iszero(b)) +#define _HALF_LOGICAL_OR(a,b) (!npy_half_iszero(a) || !npy_half_iszero(b)) +/**begin repeat + * #kind = equal, not_equal, less, less_equal, greater, greater_equal, + * logical_and, logical_or# + * #OP = npy_half_eq, npy_half_ne, npy_half_lt, npy_half_le, npy_half_gt, npy_half_ge, _HALF_LOGICAL_AND, _HALF_LOGICAL_OR# + */ +NPY_NO_EXPORT void +HALF_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + const npy_half in2 = *(npy_half *)ip2; + *((Bool *)op1) = @OP@(in1, in2); + } +} +/**end repeat**/ +#undef _HALF_LOGICAL_AND +#undef _HALF_LOGICAL_OR + +NPY_NO_EXPORT void +HALF_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const int in1 = !npy_half_iszero(*(npy_half *)ip1); + const int in2 = !npy_half_iszero(*(npy_half *)ip2); + *((Bool *)op1)= (in1 && !in2) || (!in1 && in2); + } +} + +NPY_NO_EXPORT void +HALF_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((Bool *)op1) = npy_half_iszero(in1); + } +} + +/**begin repeat + * #kind = isnan, isinf, isfinite, signbit# + * #func = npy_half_isnan, npy_half_isinf, npy_half_isfinite, npy_half_signbit# + **/ +NPY_NO_EXPORT void +HALF_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((Bool *)op1) = @func@(in1) != 0; + } +} +/**end repeat**/ + +NPY_NO_EXPORT void +HALF_spacing(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((npy_half *)op1) = npy_half_spacing(in1); + } +} + +NPY_NO_EXPORT void +HALF_copysign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + const npy_half in2 = *(npy_half *)ip2; + *((npy_half *)op1)= npy_half_copysign(in1, in2); + } +} + +NPY_NO_EXPORT void +HALF_nextafter(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + const npy_half in2 = *(npy_half *)ip2; + *((npy_half *)op1)= npy_half_nextafter(in1, in2); + } +} + +/**begin repeat + * #kind = maximum, minimum# + * #OP = npy_half_ge, npy_half_le# + **/ +NPY_NO_EXPORT void +HALF_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + /* */ + BINARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + const npy_half in2 = *(npy_half *)ip2; + *((npy_half *)op1) = (@OP@(in1, in2) || npy_half_isnan(in1)) ? in1 : in2; + } +} +/**end repeat**/ + +/**begin repeat + * #kind = fmax, fmin# + * #OP = npy_half_ge, npy_half_le# + **/ +NPY_NO_EXPORT void +HALF_@kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + /* */ + BINARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + const npy_half in2 = *(npy_half *)ip2; + *((npy_half *)op1) = (@OP@(in1, in2) || npy_half_isnan(in2)) ? in1 : in2; + } +} +/**end repeat**/ + +NPY_NO_EXPORT void +HALF_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + const float in2 = npy_half_to_float(*(npy_half *)ip2); + *((npy_half *)op1) = npy_float_to_half(npy_floorf(in1/in2)); + } +} + +NPY_NO_EXPORT void +HALF_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + const float in2 = npy_half_to_float(*(npy_half *)ip2); + const float res = npy_fmodf(in1,in2); + if (res && ((in2 < 0) != (res < 0))) { + *((npy_half *)op1) = npy_float_to_half(res + in2); + } + else { + *((npy_half *)op1) = npy_float_to_half(res); + } + } +} + +NPY_NO_EXPORT void +HALF_square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) +{ + UNARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + *((npy_half *)op1) = npy_float_to_half(in1*in1); + } +} + +NPY_NO_EXPORT void +HALF_reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) +{ + UNARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + *((npy_half *)op1) = npy_float_to_half(1/in1); + } +} + +NPY_NO_EXPORT void +HALF_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)) +{ + OUTPUT_LOOP { + *((npy_half *)op1) = NPY_HALF_ONE; + } +} + +NPY_NO_EXPORT void +HALF_conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((npy_half *)op1) = in1; + } +} + +NPY_NO_EXPORT void +HALF_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((npy_half *)op1) = in1&0x7fffu; + } +} + +NPY_NO_EXPORT void +HALF_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((npy_half *)op1) = in1^0x8000u; + } +} + +NPY_NO_EXPORT void +HALF_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + /* Sign of nan is nan */ + UNARY_LOOP { + const npy_half in1 = *(npy_half *)ip1; + *((npy_half *)op1) = npy_half_isnan(in1) ? in1 : + (((in1&0x7fffu) == 0) ? 0 : + (((in1&0x8000u) == 0) ? NPY_HALF_ONE : NPY_HALF_NEGONE)); + } +} + +NPY_NO_EXPORT void +HALF_modf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + float temp; + + UNARY_LOOP_TWO_OUT { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + *((npy_half *)op1) = npy_float_to_half(npy_modff(in1, &temp)); + *((npy_half *)op2) = npy_float_to_half(temp); + } +} + +#ifdef HAVE_FREXPF +NPY_NO_EXPORT void +HALF_frexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + UNARY_LOOP_TWO_OUT { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + *((npy_half *)op1) = npy_float_to_half(frexpf(in1, (int *)op2)); + } +} +#endif + +#ifdef HAVE_LDEXPF +NPY_NO_EXPORT void +HALF_ldexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + BINARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + const int in2 = *(int *)ip2; + *((npy_half *)op1) = npy_float_to_half(ldexpf(in1, in2)); + } +} + +NPY_NO_EXPORT void +HALF_ldexp_long(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) +{ + /* + * Additional loop to handle long integer inputs (cf. #866, #1633). + * long != int on many 64-bit platforms, so we need this second loop + * to handle the default integer type. + */ + BINARY_LOOP { + const float in1 = npy_half_to_float(*(npy_half *)ip1); + const long in2 = *(long *)ip2; + if (((int)in2) == in2) { + /* Range OK */ + *((npy_half *)op1) = npy_float_to_half(ldexpf(in1, ((int)in2))); + } + else { + /* + * Outside int range -- also ldexp will overflow in this case, + * given that exponent has less bits than int. + */ + if (in2 > 0) { + *((npy_half *)op1) = npy_float_to_half(ldexpf(in1, NPY_MAX_INT)); + } + else { + *((npy_half *)op1) = npy_float_to_half(ldexpf(in1, NPY_MIN_INT)); + } + } + } +} +#endif + +#define HALF_true_divide HALF_divide + /* ***************************************************************************** diff --git a/numpy/core/src/umath/loops.h b/numpy/core/src/umath/loops.h index 7cb4b22cc..2d8343b47 100644 --- a/numpy/core/src/umath/loops.h +++ b/numpy/core/src/umath/loops.h @@ -12,6 +12,20 @@ * vim:syntax=c */ +/* + ***************************************************************************** + ** IMPORTANT NOTE for loops.h.src -> loops.h ** + ***************************************************************************** + * The template file loops.h.src is not automatically converted into + * loops.h by the build system. If you edit this file, you must manually + * do the conversion using numpy/distutils/conv_template.py from the + * command line as follows: + * + * $ cd <NumPy source root directory> + * $ python numpy/distutils/conv_template.py numpy/core/src/umath/loops.h.src + * $ + */ + #ifndef _NPY_UMATH_LOOPS_H_ #define _NPY_UMATH_LOOPS_H_ @@ -32,116 +46,116 @@ ***************************************************************************** */ -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 32 +#line 46 NPY_NO_EXPORT void BOOL_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 41 +#line 55 NPY_NO_EXPORT void BOOL_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 41 +#line 55 NPY_NO_EXPORT void BOOL_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 49 +#line 63 NPY_NO_EXPORT void BOOL_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 49 +#line 63 NPY_NO_EXPORT void BOOL_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -155,9 +169,9 @@ BOOL_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data ***************************************************************************** */ -#line 67 +#line 81 -#line 73 +#line 87 #define BYTE_floor_divide BYTE_divide #define BYTE_fmax BYTE_maximum @@ -184,76 +198,76 @@ BYTE_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void BYTE_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void BYTE_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void BYTE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -261,11 +275,11 @@ BYTE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fun NPY_NO_EXPORT void BYTE_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void BYTE_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void BYTE_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -280,7 +294,7 @@ NPY_NO_EXPORT void BYTE_fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 73 +#line 87 #define UBYTE_floor_divide UBYTE_divide #define UBYTE_fmax UBYTE_maximum @@ -307,76 +321,76 @@ UBYTE_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f NPY_NO_EXPORT void UBYTE_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UBYTE_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UBYTE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -384,11 +398,11 @@ UBYTE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void UBYTE_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void UBYTE_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void UBYTE_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -428,9 +442,9 @@ BYTE_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func NPY_NO_EXPORT void UBYTE_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 67 +#line 81 -#line 73 +#line 87 #define SHORT_floor_divide SHORT_divide #define SHORT_fmax SHORT_maximum @@ -457,76 +471,76 @@ SHORT_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f NPY_NO_EXPORT void SHORT_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void SHORT_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void SHORT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -534,11 +548,11 @@ SHORT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void SHORT_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void SHORT_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void SHORT_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -553,7 +567,7 @@ NPY_NO_EXPORT void SHORT_fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 73 +#line 87 #define USHORT_floor_divide USHORT_divide #define USHORT_fmax USHORT_maximum @@ -580,76 +594,76 @@ USHORT_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED( NPY_NO_EXPORT void USHORT_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void USHORT_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void USHORT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -657,11 +671,11 @@ USHORT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f NPY_NO_EXPORT void USHORT_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void USHORT_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void USHORT_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -701,9 +715,9 @@ SHORT_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fun NPY_NO_EXPORT void USHORT_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 67 +#line 81 -#line 73 +#line 87 #define INT_floor_divide INT_divide #define INT_fmax INT_maximum @@ -730,76 +744,76 @@ INT_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fun NPY_NO_EXPORT void INT_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void INT_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void INT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -807,11 +821,11 @@ INT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func NPY_NO_EXPORT void INT_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void INT_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void INT_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -826,7 +840,7 @@ NPY_NO_EXPORT void INT_fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 73 +#line 87 #define UINT_floor_divide UINT_divide #define UINT_fmax UINT_maximum @@ -853,76 +867,76 @@ UINT_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void UINT_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void UINT_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void UINT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -930,11 +944,11 @@ UINT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fun NPY_NO_EXPORT void UINT_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void UINT_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void UINT_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -974,9 +988,9 @@ INT_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func) NPY_NO_EXPORT void UINT_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 67 +#line 81 -#line 73 +#line 87 #define LONG_floor_divide LONG_divide #define LONG_fmax LONG_maximum @@ -1003,76 +1017,76 @@ LONG_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void LONG_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONG_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1080,11 +1094,11 @@ LONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fun NPY_NO_EXPORT void LONG_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void LONG_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void LONG_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1099,7 +1113,7 @@ NPY_NO_EXPORT void LONG_fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 73 +#line 87 #define ULONG_floor_divide ULONG_divide #define ULONG_fmax ULONG_maximum @@ -1126,76 +1140,76 @@ ULONG_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f NPY_NO_EXPORT void ULONG_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONG_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1203,11 +1217,11 @@ ULONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void ULONG_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void ULONG_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void ULONG_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1247,9 +1261,9 @@ LONG_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func NPY_NO_EXPORT void ULONG_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 67 +#line 81 -#line 73 +#line 87 #define LONGLONG_floor_divide LONGLONG_divide #define LONGLONG_fmax LONGLONG_maximum @@ -1276,76 +1290,76 @@ LONGLONG_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSE NPY_NO_EXPORT void LONGLONG_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void LONGLONG_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void LONGLONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1353,11 +1367,11 @@ LONGLONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED NPY_NO_EXPORT void LONGLONG_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void LONGLONG_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void LONGLONG_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1372,7 +1386,7 @@ NPY_NO_EXPORT void LONGLONG_fmod(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 73 +#line 87 #define ULONGLONG_floor_divide ULONGLONG_divide #define ULONGLONG_fmax ULONGLONG_maximum @@ -1399,76 +1413,76 @@ ULONGLONG_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUS NPY_NO_EXPORT void ULONGLONG_invert(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_bitwise_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_bitwise_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_bitwise_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_left_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 105 +#line 119 NPY_NO_EXPORT void ULONGLONG_right_shift(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 115 +#line 129 NPY_NO_EXPORT void ULONGLONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1476,11 +1490,11 @@ ULONGLONG_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSE NPY_NO_EXPORT void ULONGLONG_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void ULONGLONG_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 126 +#line 140 NPY_NO_EXPORT void ULONGLONG_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1528,55 +1542,209 @@ ULONGLONG_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED */ -#line 180 +#line 194 + + +#line 201 +NPY_NO_EXPORT void +HALF_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 201 +NPY_NO_EXPORT void +HALF_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 201 +NPY_NO_EXPORT void +HALF_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 201 +NPY_NO_EXPORT void +HALF_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +#line 210 +NPY_NO_EXPORT void +HALF_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 210 +NPY_NO_EXPORT void +HALF_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 210 +NPY_NO_EXPORT void +HALF_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); +#line 210 +NPY_NO_EXPORT void +HALF_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 210 +NPY_NO_EXPORT void +HALF_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 210 +NPY_NO_EXPORT void +HALF_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 210 +NPY_NO_EXPORT void +HALF_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 210 +NPY_NO_EXPORT void +HALF_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +NPY_NO_EXPORT void +HALF_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +NPY_NO_EXPORT void +HALF_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_signbit(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_copysign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_nextafter(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 224 +NPY_NO_EXPORT void +HALF_spacing(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +#line 232 +NPY_NO_EXPORT void +HALF_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 232 +NPY_NO_EXPORT void +HALF_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +#line 240 +NPY_NO_EXPORT void +HALF_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#line 240 +NPY_NO_EXPORT void +HALF_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +NPY_NO_EXPORT void +HALF_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +NPY_NO_EXPORT void +HALF_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +NPY_NO_EXPORT void +HALF_square(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)); + +NPY_NO_EXPORT void +HALF_reciprocal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)); + + +NPY_NO_EXPORT void +HALF_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(data)); + +NPY_NO_EXPORT void +HALF_conjugate(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +NPY_NO_EXPORT void +HALF_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +NPY_NO_EXPORT void +HALF_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +NPY_NO_EXPORT void +HALF_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + + +NPY_NO_EXPORT void +HALF_modf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); + +#ifdef HAVE_FREXPF +NPY_NO_EXPORT void +HALF_frexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); +#endif + +#ifdef HAVE_LDEXPF +NPY_NO_EXPORT void +HALF_ldexp(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); +NPY_NO_EXPORT void +HALF_ldexp_long(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); +#endif + +#define HALF_true_divide HALF_divide + + +#line 194 + + +#line 201 NPY_NO_EXPORT void FLOAT_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void FLOAT_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void FLOAT_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void FLOAT_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void FLOAT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1587,49 +1755,49 @@ FLOAT_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f NPY_NO_EXPORT void FLOAT_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_signbit(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_copysign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_nextafter(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void FLOAT_spacing(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 218 +#line 232 NPY_NO_EXPORT void FLOAT_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 218 +#line 232 NPY_NO_EXPORT void FLOAT_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 226 +#line 240 NPY_NO_EXPORT void FLOAT_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 226 +#line 240 NPY_NO_EXPORT void FLOAT_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1682,55 +1850,55 @@ FLOAT_ldexp_long(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu #define FLOAT_true_divide FLOAT_divide -#line 180 +#line 194 -#line 187 +#line 201 NPY_NO_EXPORT void DOUBLE_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void DOUBLE_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void DOUBLE_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void DOUBLE_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void DOUBLE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1741,49 +1909,49 @@ DOUBLE_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED( NPY_NO_EXPORT void DOUBLE_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_signbit(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_copysign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_nextafter(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void DOUBLE_spacing(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 218 +#line 232 NPY_NO_EXPORT void DOUBLE_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 218 +#line 232 NPY_NO_EXPORT void DOUBLE_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 226 +#line 240 NPY_NO_EXPORT void DOUBLE_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 226 +#line 240 NPY_NO_EXPORT void DOUBLE_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1836,55 +2004,55 @@ DOUBLE_ldexp_long(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f #define DOUBLE_true_divide DOUBLE_divide -#line 180 +#line 194 -#line 187 +#line 201 NPY_NO_EXPORT void LONGDOUBLE_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void LONGDOUBLE_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void LONGDOUBLE_multiply(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 187 +#line 201 NPY_NO_EXPORT void LONGDOUBLE_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 196 +#line 210 NPY_NO_EXPORT void LONGDOUBLE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -1895,49 +2063,49 @@ LONGDOUBLE_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNU NPY_NO_EXPORT void LONGDOUBLE_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_signbit(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_copysign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_nextafter(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 210 +#line 224 NPY_NO_EXPORT void LONGDOUBLE_spacing(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 218 +#line 232 NPY_NO_EXPORT void LONGDOUBLE_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 218 +#line 232 NPY_NO_EXPORT void LONGDOUBLE_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 226 +#line 240 NPY_NO_EXPORT void LONGDOUBLE_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 226 +#line 240 NPY_NO_EXPORT void LONGDOUBLE_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2005,14 +2173,14 @@ LONGDOUBLE_ldexp_long(char **args, intp *dimensions, intp *steps, void *NPY_UNUS #define CEQ(xr,xi,yr,yi) (xr == yr && xi == yi); #define CNE(xr,xi,yr,yi) (xr != yr || xi != yi); -#line 298 +#line 314 -#line 304 +#line 320 NPY_NO_EXPORT void CFLOAT_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 304 +#line 320 NPY_NO_EXPORT void CFLOAT_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2027,36 +2195,36 @@ CFLOAT_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func) NPY_NO_EXPORT void CFLOAT_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CFLOAT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CFLOAT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CFLOAT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CFLOAT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CFLOAT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CFLOAT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 331 +#line 347 NPY_NO_EXPORT void CFLOAT_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 331 +#line 347 NPY_NO_EXPORT void CFLOAT_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2066,15 +2234,15 @@ CFLOAT_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED( NPY_NO_EXPORT void CFLOAT_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CFLOAT_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CFLOAT_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CFLOAT_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2100,20 +2268,20 @@ CFLOAT__arg(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void CFLOAT_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 374 +#line 390 NPY_NO_EXPORT void CFLOAT_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 374 +#line 390 NPY_NO_EXPORT void CFLOAT_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 382 +#line 398 NPY_NO_EXPORT void CFLOAT_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 382 +#line 398 NPY_NO_EXPORT void CFLOAT_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2121,14 +2289,14 @@ CFLOAT_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); #define CFLOAT_true_divide CFLOAT_divide -#line 298 +#line 314 -#line 304 +#line 320 NPY_NO_EXPORT void CDOUBLE_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 304 +#line 320 NPY_NO_EXPORT void CDOUBLE_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2143,36 +2311,36 @@ CDOUBLE_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func NPY_NO_EXPORT void CDOUBLE_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CDOUBLE_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CDOUBLE_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CDOUBLE_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CDOUBLE_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CDOUBLE_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CDOUBLE_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 331 +#line 347 NPY_NO_EXPORT void CDOUBLE_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 331 +#line 347 NPY_NO_EXPORT void CDOUBLE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2182,15 +2350,15 @@ CDOUBLE_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED NPY_NO_EXPORT void CDOUBLE_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CDOUBLE_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CDOUBLE_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CDOUBLE_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2216,20 +2384,20 @@ CDOUBLE__arg(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) NPY_NO_EXPORT void CDOUBLE_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 374 +#line 390 NPY_NO_EXPORT void CDOUBLE_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 374 +#line 390 NPY_NO_EXPORT void CDOUBLE_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 382 +#line 398 NPY_NO_EXPORT void CDOUBLE_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 382 +#line 398 NPY_NO_EXPORT void CDOUBLE_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2237,14 +2405,14 @@ CDOUBLE_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)) #define CDOUBLE_true_divide CDOUBLE_divide -#line 298 +#line 314 -#line 304 +#line 320 NPY_NO_EXPORT void CLONGDOUBLE_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 304 +#line 320 NPY_NO_EXPORT void CLONGDOUBLE_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2259,36 +2427,36 @@ CLONGDOUBLE_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED( NPY_NO_EXPORT void CLONGDOUBLE_floor_divide(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CLONGDOUBLE_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CLONGDOUBLE_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CLONGDOUBLE_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CLONGDOUBLE_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CLONGDOUBLE_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 322 +#line 338 NPY_NO_EXPORT void CLONGDOUBLE_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 331 +#line 347 NPY_NO_EXPORT void CLONGDOUBLE_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 331 +#line 347 NPY_NO_EXPORT void CLONGDOUBLE_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2298,15 +2466,15 @@ CLONGDOUBLE_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UN NPY_NO_EXPORT void CLONGDOUBLE_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CLONGDOUBLE_isnan(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CLONGDOUBLE_isinf(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 345 +#line 361 NPY_NO_EXPORT void CLONGDOUBLE_isfinite(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2332,20 +2500,20 @@ CLONGDOUBLE__arg(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu NPY_NO_EXPORT void CLONGDOUBLE_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 374 +#line 390 NPY_NO_EXPORT void CLONGDOUBLE_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 374 +#line 390 NPY_NO_EXPORT void CLONGDOUBLE_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 382 +#line 398 NPY_NO_EXPORT void CLONGDOUBLE_fmax(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 382 +#line 398 NPY_NO_EXPORT void CLONGDOUBLE_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2367,121 +2535,121 @@ CLONGDOUBLE_fmin(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(fu ***************************************************************************** */ -#line 406 +#line 422 #define DATETIME_fmax DATETIME_maximum #define DATETIME_fmin DATETIME_minimum -#line 406 +#line 422 #define TIMEDELTA_fmax TIMEDELTA_maximum #define TIMEDELTA_fmin TIMEDELTA_minimum -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); NPY_NO_EXPORT void TIMEDELTA_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 415 +#line 431 NPY_NO_EXPORT void DATETIME_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); @@ -2513,27 +2681,27 @@ TIMEDELTA_mm_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UN ***************************************************************************** */ -#line 450 +#line 466 NPY_NO_EXPORT void OBJECT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 466 NPY_NO_EXPORT void OBJECT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 466 NPY_NO_EXPORT void OBJECT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 466 NPY_NO_EXPORT void OBJECT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 466 NPY_NO_EXPORT void OBJECT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); -#line 450 +#line 466 NPY_NO_EXPORT void OBJECT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func)); diff --git a/numpy/core/src/umath/loops.h.src b/numpy/core/src/umath/loops.h.src index 33dfe882e..d4ec0a78d 100644 --- a/numpy/core/src/umath/loops.h.src +++ b/numpy/core/src/umath/loops.h.src @@ -3,6 +3,20 @@ * vim:syntax=c */ +/* + ***************************************************************************** + ** IMPORTANT NOTE for loops.h.src -> loops.h ** + ***************************************************************************** + * The template file loops.h.src is not automatically converted into + * loops.h by the build system. If you edit this file, you must manually + * do the conversion using numpy/distutils/conv_template.py from the + * command line as follows: + * + * $ cd <NumPy source root directory> + * $ python numpy/distutils/conv_template.py numpy/core/src/umath/loops.h.src + * $ + */ + #ifndef _NPY_UMATH_LOOPS_H_ #define _NPY_UMATH_LOOPS_H_ @@ -172,10 +186,10 @@ U@TYPE@_remainder(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(f /**begin repeat * Float types - * #type = float, double, longdouble# - * #TYPE = FLOAT, DOUBLE, LONGDOUBLE# - * #c = f, , l# - * #C = F, , L# + * #type = npy_half, float, double, longdouble# + * #TYPE = HALF, FLOAT, DOUBLE, LONGDOUBLE# + * #c = f, f, , l# + * #C = F, F, , L# */ diff --git a/numpy/core/src/umath/umathmodule.c.src b/numpy/core/src/umath/umathmodule.c.src index c3da9f3d3..7a76c2b3e 100644 --- a/numpy/core/src/umath/umathmodule.c.src +++ b/numpy/core/src/umath/umathmodule.c.src @@ -155,6 +155,7 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUS static PyUFuncGenericFunction frexp_functions[] = { #ifdef HAVE_FREXPF + HALF_frexp, FLOAT_frexp, #endif DOUBLE_frexp @@ -168,6 +169,7 @@ static void * blank6_data[] = { (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL, (void *)NULL}; static char frexp_signatures[] = { #ifdef HAVE_FREXPF + PyArray_HALF, PyArray_HALF, PyArray_INT, PyArray_FLOAT, PyArray_FLOAT, PyArray_INT, #endif PyArray_DOUBLE, PyArray_DOUBLE, PyArray_INT @@ -184,7 +186,9 @@ static char frexp_signatures[] = { static PyUFuncGenericFunction ldexp_functions[] = { #ifdef HAVE_LDEXPF + HALF_ldexp, FLOAT_ldexp, + LDEXP_LONG(HALF), LDEXP_LONG(FLOAT), #endif DOUBLE_ldexp, @@ -198,7 +202,9 @@ static PyUFuncGenericFunction ldexp_functions[] = { static char ldexp_signatures[] = { #ifdef HAVE_LDEXPF + PyArray_HALF, PyArray_INT, PyArray_HALF, PyArray_FLOAT, PyArray_INT, PyArray_FLOAT, + PyArray_HALF, PyArray_LONG, PyArray_HALF, PyArray_FLOAT, PyArray_LONG, PyArray_FLOAT, #endif PyArray_DOUBLE, PyArray_INT, PyArray_DOUBLE, @@ -212,14 +218,9 @@ static char ldexp_signatures[] = { static void InitOtherOperators(PyObject *dictionary) { PyObject *f; - int num=1; + int num; -#ifdef HAVE_FREXPL - num += 1; -#endif -#ifdef HAVE_FREXPF - num += 1; -#endif + num = sizeof(frexp_functions) / sizeof(frexp_functions[0]); f = PyUFunc_FromFuncAndData(frexp_functions, blank3_data, frexp_signatures, num, 1, 2, PyUFunc_None, "frexp", @@ -228,13 +229,7 @@ InitOtherOperators(PyObject *dictionary) { PyDict_SetItemString(dictionary, "frexp", f); Py_DECREF(f); - num = 2; -#ifdef HAVE_LDEXPL - num += 2; -#endif -#ifdef HAVE_LDEXPF - num += 2; -#endif + num = sizeof(ldexp_functions) / sizeof(ldexp_functions[0]); f = PyUFunc_FromFuncAndData(ldexp_functions, blank6_data, ldexp_signatures, num, 2, 1, PyUFunc_None, "ldexp", "Compute y = x1 * 2**x2.",0); diff --git a/numpy/core/tests/test_half.py b/numpy/core/tests/test_half.py index cbf4221b3..4d61bc28f 100644 --- a/numpy/core/tests/test_half.py +++ b/numpy/core/tests/test_half.py @@ -32,6 +32,12 @@ def test_half_consistency(): b.dtype = uint16 assert_equal(a,b) + # Check some of the ufuncs + assert_equal(np.isnan(a_f16), np.isnan(a_f32)) + assert_equal(np.isinf(a_f16), np.isinf(a_f32)) + assert_equal(np.isfinite(a_f16), np.isfinite(a_f32)) + assert_equal(np.signbit(a_f16), np.signbit(a_f32)) + # Check the range for which all integers can be represented a = np.arange(-2048,2049) a_f16 = np.array(a, dtype=float16) @@ -47,6 +53,7 @@ def test_half_consistency(): assert_(not (a > nan).any()) assert_(not (a >= nan).any()) + def test_half_values(): """Confirms a small number of known half values""" a = np.array([1.0, -1.0, @@ -135,6 +142,8 @@ def test_half_correctness(): "First non-equal is half value %x -> %g != %g" % (a[bad_index], a_f64[bad_index], a_manual[bad_index])) + + def test_half_ordering(): """Make sure comparisons are working right""" @@ -198,3 +207,72 @@ def test_half_funcs(): a = np.arange(10, dtype=float16) for i in range(10): assert_equal(a.item(i),i) + +def test_half_ufuncs(): + """Test the various ufuncs""" + + a = np.array([0,1,2,4,2], dtype=float16) + b = np.array([-2,5,1,4,3], dtype=float16) + c = np.array([0,-1,-np.inf,np.nan,6], dtype=float16) + + assert_equal(np.add(a,b), [-2,6,3,8,5]) + assert_equal(np.subtract(a,b), [2,-4,1,0,-1]) + assert_equal(np.multiply(a,b), [0,5,2,16,6]) + assert_equal(np.divide(a,b), [0,0.199951171875,2,1,0.66650390625]) + + assert_equal(np.equal(a,b), [False,False,False,True,False]) + assert_equal(np.not_equal(a,b), [True,True,True,False,True]) + assert_equal(np.less(a,b), [False,True,False,False,True]) + assert_equal(np.less_equal(a,b), [False,True,False,True,True]) + assert_equal(np.greater(a,b), [True,False,True,False,False]) + assert_equal(np.greater_equal(a,b), [True,False,True,True,False]) + assert_equal(np.logical_and(a,b), [False,True,True,True,True]) + assert_equal(np.logical_or(a,b), [True,True,True,True,True]) + assert_equal(np.logical_xor(a,b), [True,False,False,False,False]) + assert_equal(np.logical_not(a), [True,False,False,False,False]) + + assert_equal(np.isnan(c), [False,False,False,True,False]) + assert_equal(np.isinf(c), [False,False,True,False,False]) + assert_equal(np.isfinite(c), [True,True,False,False,True]) + assert_equal(np.signbit(b), [True,False,False,False,False]) + + assert_equal(np.copysign(b,a), [2,5,1,4,3]) + + all = np.arange(0x7c00, dtype=uint16) # All positive finite #'s + hinf = np.array((np.inf,), dtype=float16) + all_f16 = all.view(dtype=float16) + assert_equal(np.spacing(all_f16[:-1]), all_f16[1:]-all_f16[:-1]) + assert_equal(np.nextafter(all_f16[:-1], hinf), all_f16[1:]) + all |= 0x8000 # switch to negatives + assert_equal(np.spacing(all_f16[1:]), all_f16[:-1]-all_f16[1:]) + assert_equal(np.spacing(all_f16[0]), np.spacing(all_f16[1])) # Also check -0 + assert_equal(np.nextafter(all_f16[1:], hinf), all_f16[:-1]) + + assert_equal(np.maximum(a,b), [0,5,2,4,3]) + x = np.maximum(b,c) + assert_(np.isnan(x[3])) + x[3] = 0 + assert_equal(x, [0,5,1,0,6]) + assert_equal(np.minimum(a,b), [-2,1,1,4,2]) + x = np.minimum(b,c) + assert_(np.isnan(x[3])) + x[3] = 0 + assert_equal(x, [-2,-1,-np.inf,0,3]) + assert_equal(np.fmax(a,b), [0,5,2,4,3]) + assert_equal(np.fmax(b,c), [0,5,1,4,6]) + assert_equal(np.fmin(a,b), [-2,1,1,4,2]) + assert_equal(np.fmin(b,c), [-2,-1,-np.inf,4,3]) + + assert_equal(np.floor_divide(a,b), [0,0,2,1,0]) + assert_equal(np.remainder(a,b), [0,1,0,0,2]) + assert_equal(np.square(b), [4,25,1,16,9]) + assert_equal(np.reciprocal(b), [-0.5,0.199951171875,1,0.25,0.333251953125]) + assert_equal(np.ones_like(b), [1,1,1,1,1]) + assert_equal(np.conjugate(b), b) + assert_equal(np.absolute(b), [2,5,1,4,3]) + assert_equal(np.negative(b), [2,-5,-1,-4,-3]) + assert_equal(np.sign(b), [-1,1,1,1,1]) + assert_equal(np.modf(b), ([0,0,0,0,0],b)) + assert_equal(np.frexp(b), ([-0.5,0.625,0.5,0.5,0.75],[2,3,1,3,2])) + assert_equal(np.ldexp(b,[0,1,2,4,2]), [-2,10,4,64,12]) + |