numpy
2.0.0
|
#include "Python.h"
#include "npy_config.h"
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include "numpy/arrayscalars.h"
#include "npy_pycompat.h"
#include "numpy/halffloat.h"
#include "templ_common.h"
Defines | |
#define | _UMATHMODULE |
#define | NPY_NO_DEPRECATED_API NPY_API_VERSION |
#define | PY_ARRAY_UNIQUE_SYMBOL _npy_umathmodule_ARRAY_API |
#define | NO_IMPORT_ARRAY |
#define | NPY_SIZEOF_BYTE 1 |
#define | name @_ctype_floor_divide @name@_ctype_divide |
#define | name |
#define | name @_ctype_@oper@(arg1, arg2, out) *(out) = (arg1) @op@ (arg2) |
#define | name @_ctype_add(a, b, outp) *(outp) = (a) + (b) |
#define | name @_ctype_subtract(a, b, outp) *(outp) = (a) - (b) |
#define | name @_ctype_multiply(a, b, outp) *(outp) = (a) * (b) |
#define | name @_ctype_divide(a, b, outp) *(outp) = (a) / (b) |
#define | name @_ctype_true_divide @name@_ctype_divide |
#define | half_ctype_add(a, b, outp) |
#define | half_ctype_subtract(a, b, outp) |
#define | half_ctype_multiply(a, b, outp) |
#define | half_ctype_divide(a, b, outp) |
#define | half_ctype_true_divide half_ctype_divide |
#define | name |
#define | name |
#define | name |
#define | name |
#define | name @_ctype_true_divide @name@_ctype_divide |
#define | name |
#define | name |
#define | name @_ctype_absolute @name@_ctype_positive |
#define | name @_ctype_invert(a, out) *(out) = ~a; |
#define | _IS_ZERO(x) (x == 0) |
#define | name @_@oper@ NULL |
#define | name @_@oper@ NULL |
#define | name @_invert NULL |
#define | NONZERO_NAME(prefix) prefix##nonzero |
#define | _IS_NONZERO(x) (x != 0) |
#define | def_cmp_ @oper@(arg1, arg2) (arg1 @op@ arg2) |
#define | cmplx_cmp_ |
#define | def_half_cmp_ @oper@(arg1, arg2) @halfop@(arg1, arg2) |
Functions | |
static void name | _ctype_add (@type @a,@type @b,@type @*out) |
static void name | _ctype_subtract (@type @a,@type @b,@type @*out) |
static void name | _ctype_multiply (@type @a,@type @b,@type @*out) |
static void name | _ctype_divide (@type @a,@type @b,@type @*out) |
static void name | _ctype_remainder (@type @a,@type @b,@type @*out) |
static void name | _ctype_power (@type @a,@type @b,@type @*out) |
static void name | _ctype_floor_divide (@type @a,@type @b,@type @*out) |
static void name | _ctype_divmod (@type @a,@type @b,@type @*out1,@type @*out2) |
static void | half_ctype_floor_divide (npy_half a, npy_half b, npy_half *out) |
static void | half_ctype_remainder (npy_half a, npy_half b, npy_half *out) |
static void | half_ctype_divmod (npy_half a, npy_half b, npy_half *out1, npy_half *out2) |
static void | half_ctype_power (npy_half a, npy_half b, npy_half *out) |
static void name | _ctype_negative (@type @a,@type @*out) |
static void | half_ctype_negative (npy_half a, npy_half *out) |
static void name | _ctype_positive (@type @a,@type @*out) |
static void name | _ctype_absolute (@type @a,@type @*out) |
static void | half_ctype_absolute (npy_half a, npy_half *out) |
static void name | _ctype_absolute (@type @a,@rtype @*out) |
static int _ name | _convert_to_ctype (PyObject *a,@type @*arg1) |
static int _ name | _convert2_to_ctypes (PyObject *a,@type @*arg1, PyObject *b,@type @*arg2) |
static PyObject *name _ | oper (PyObject *a, PyObject *b) |
static PyObject *name | _power (PyObject *a, PyObject *b, PyObject *NPY_UNUSED(c)) |
static PyObject *name _ | oper (PyObject *a) |
static int | NONZERO_NAME (@name @_)(PyObject *a) |
static int | emit_complexwarning (void) |
static PyObject *name | _int (PyObject *obj) |
static NPY_INLINE PyObject *name _ | which (PyObject *obj) |
static PyObject *name | _richcompare (PyObject *self, PyObject *other, int cmp_op) |
NPY_NO_EXPORT void | add_scalarmath (void) |
static int | get_functions (PyObject *mm) |
NPY_NO_EXPORT int | initscalarmath (PyObject *m) |
Variables | |
static type(* | _basic_ )(@type @) |
static npy_half(* | _basic_half_sqrt )(npy_half) |
static npy_half(* | _basic_half_fmod )(npy_half, npy_half) |
static PyNumberMethods name | _as_number |
#define _IS_NONZERO | ( | x | ) | (x != 0) |
#define _IS_ZERO | ( | x | ) | (x == 0) |
#define _UMATHMODULE |
that does not go through the ufunc machinery
but still supports error-modes.
#define cmplx_cmp_ |
@oper@(arg1, arg2) ((arg1.real == arg2.real) ? \ arg1.imag @op@ arg2.imag : \ arg1.real @op@ arg2.real)
oper = le, ge, lt, gt, eq, ne# #op = <=, >=, <, >, ==, !=# #halfop = npy_half_le, npy_half_ge, npy_half_lt,
<blockquote class="last"> npy_half_gt, npy_half_eq, npy_half_ne#</blockquote>
#define def_half_cmp_ @oper@(arg1, arg2) @halfop@(arg1, arg2) |
#define half_ctype_add | ( | a, | |
b, | |||
outp | |||
) |
*(outp) = \ npy_float_to_half(npy_half_to_float(a) + npy_half_to_float(b))
#define half_ctype_divide | ( | a, | |
b, | |||
outp | |||
) |
*(outp) = \ npy_float_to_half(npy_half_to_float(a) / npy_half_to_float(b))
#define half_ctype_multiply | ( | a, | |
b, | |||
outp | |||
) |
*(outp) = \ npy_float_to_half(npy_half_to_float(a) * npy_half_to_float(b))
#define half_ctype_subtract | ( | a, | |
b, | |||
outp | |||
) |
*(outp) = \ npy_float_to_half(npy_half_to_float(a) - npy_half_to_float(b))
#define name @_ctype_floor_divide @name@_ctype_divide |
Referenced by datetimetype_repr(), form(), and timedeltatype_repr().
#define name |
@_ctype_true_divide(a, b, out) \ *(out) = ((@otyp@) (a)) / ((@otyp@) (b));
#define name @_ctype_add(a, b, outp) *(outp) = (a) + (b) |
#define name @_ctype_subtract(a, b, outp) *(outp) = (a) - (b) |
#define name @_ctype_multiply(a, b, outp) *(outp) = (a) * (b) |
#define name @_ctype_divide(a, b, outp) *(outp) = (a) / (b) |
#define name @_ctype_true_divide @name@_ctype_divide |
#define name |
@_ctype_add(a, b, outp) do{ \ (outp)->real = (a).real + (b).real; \ (outp)->imag = (a).imag + (b).imag; \ } while(0)
#define name |
@_ctype_subtract(a, b, outp) do{ \ (outp)->real = (a).real - (b).real; \ (outp)->imag = (a).imag - (b).imag; \ } while(0)
#define name |
@_ctype_multiply(a, b, outp) do{ \ (outp)->real = (a).real * (b).real - (a).imag * (b).imag; \ (outp)->imag = (a).real * (b).imag + (a).imag * (b).real; \ } while(0)
#define name |
@_ctype_divide(a, b, outp) do{ \ @rtype@ in1r = (a).real; \ @rtype@ in1i = (a).imag; \ @rtype@ in2r = (b).real; \ @rtype@ in2i = (b).imag; \ @rtype@ in2r_abs = npy_fabs@c@(in2r); \ @rtype@ in2i_abs = npy_fabs@c@(in2i); \ if (in2r_abs >= in2i_abs) { \ if (in2r_abs == 0 && in2i_abs == 0) { \ \ (outp)->real = in1r/in2r_abs; \ (outp)->imag = in1i/in2i_abs; \ } \ else { \ @rtype@ rat = in2i/in2r; \ @rtype@ scl = 1.0@c@/(in2r + in2i*rat); \ (outp)->real = (in1r + in1i*rat)*scl; \ (outp)->imag = (in1i - in1r*rat)*scl; \ } \ } \ else { \ @rtype@ rat = in2r/in2i; \ @rtype@ scl = 1.0@c@/(in2i + in2r*rat); \ (outp)->real = (in1r*rat + in1i)*scl; \ (outp)->imag = (in1i*rat - in1r)*scl; \ } \ } while(0)
#define name @_ctype_true_divide @name@_ctype_divide |
#define name |
@_ctype_floor_divide(a, b, outp) do { \ @rname@_ctype_floor_divide( \ ((a).real*(b).real + (a).imag*(b).imag), \ ((b).real*(b).real + (b).imag*(b).imag), \ &((outp)->real)); \ (outp)->imag = 0; \ } while(0)
#define name |
@_ctype_divmod(a, b, out, out2) { \ @name@_ctype_floor_divide(a, b, out); \ @name@_ctype_remainder(a, b, out2); \ }
#define name @_ctype_absolute @name@_ctype_positive |
#define name @_ctype_invert(a, out) *(out) = ~a; |
#define name @_invert NULL |
#define NO_IMPORT_ARRAY |
#define NONZERO_NAME | ( | prefix | ) | prefix##nonzero |
#define NPY_NO_DEPRECATED_API NPY_API_VERSION |
#define NPY_SIZEOF_BYTE 1 |
#define PY_ARRAY_UNIQUE_SYMBOL _npy_umathmodule_ARRAY_API |
static int _ name _convert2_to_ctypes | ( | PyObject * | a, |
@type @* | arg1, | ||
PyObject * | b, | ||
@type @* | arg2 | ||
) | [static] |
static int _ name _convert_to_ctype | ( | PyObject * | a, |
@type @* | arg1 | ||
) | [static] |
static void name _ctype_absolute | ( | @type @ | a, |
@type @* | out | ||
) | [static] |
static void name _ctype_absolute | ( | @type @ | a, |
@rtype @* | out | ||
) | [static] |
static void name _ctype_add | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
static void name _ctype_divide | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
static void name _ctype_divmod | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out1, | ||
@type @* | out2 | ||
) | [static] |
static void name _ctype_floor_divide | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
static void name _ctype_multiply | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
static void name _ctype_negative | ( | @type @ | a, |
@type @* | out | ||
) | [static] |
#uns = (0,1)*5,0*3#
References NPY_PRIORITY, PyArray_CanCastSafely(), PyArray_CastScalarDirect(), PyArray_DescrFromTypeObject(), PyArray_GetPriority(), PyArray_IsScalar, PyArray_ScalarFromObject(), PyArrayScalar_VAL, TYPE, and _PyArray_Descr::type_num.
static void name _ctype_positive | ( | @type @ | a, |
@type @* | out | ||
) | [static] |
static void name _ctype_power | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
</blockquote>
References c, and npy_divmod().
static void name _ctype_remainder | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
static void name _ctype_subtract | ( | @type @ | a, |
@type @ | b, | ||
@type @* | out | ||
) | [static] |
<blockquote> PyLong_FromLongLong, PyLong_FromUnsignedLongLong, PyLong_FromDouble*7#</blockquote> </blockquote>
static PyObject* name _richcompare | ( | PyObject * | self, |
PyObject * | other, | ||
int | cmp_op | ||
) | [static] |
#simp = def*10, def_half, def*3, cmplx*3#
NPY_NO_EXPORT void add_scalarmath | ( | void | ) |
static int emit_complexwarning | ( | void | ) | [static] |
static int get_functions | ( | PyObject * | mm | ) | [static] |
static void half_ctype_absolute | ( | npy_half | a, |
npy_half * | out | ||
) | [static] |
static void half_ctype_divmod | ( | npy_half | a, |
npy_half | b, | ||
npy_half * | out1, | ||
npy_half * | out2 | ||
) | [static] |
static void half_ctype_floor_divide | ( | npy_half | a, |
npy_half | b, | ||
npy_half * | out | ||
) | [static] |
static void half_ctype_negative | ( | npy_half | a, |
npy_half * | out | ||
) | [static] |
static void half_ctype_power | ( | npy_half | a, |
npy_half | b, | ||
npy_half * | out | ||
) | [static] |
static void half_ctype_remainder | ( | npy_half | a, |
npy_half | b, | ||
npy_half * | out | ||
) | [static] |
NPY_NO_EXPORT int initscalarmath | ( | PyObject * | ) |
static int NONZERO_NAME | ( | @name @ | _ | ) | [static] |
<blockquote class="first"> long, ulong, longlong, ulonglong)*13,</blockquote>
(half, float, double, longdouble)*2#
<blockquote class="first"> Long, ULong,LongLong,ULongLong)*13,</blockquote>
(Half, Float, Double, LongDouble)*2#
<blockquote class="first"> npy_long, npy_ulong, npy_longlong, npy_ulonglong)*13,</blockquote>
(npy_half, npy_float, npy_double, npy_longdouble)*2#
<blockquote class="first"> npy_long, npy_ulong, npy_longlong, npy_ulonglong)*12,</blockquote>
npy_float*4, npy_double*6, (npy_half, npy_float, npy_double, npy_longdouble,
<blockquote> npy_cfloat, npy_cdouble, npy_clongdouble)*6,</blockquote>
(npy_half, npy_float, npy_double, npy_longdouble)*2#
<blockquote class="first"> Long, ULong, LongLong, ULongLong)*12,</blockquote>
Float*4, Double*6, (Half, Float, Double, LongDouble,
<blockquote> CFloat, CDouble, CLongDouble)*6,</blockquote>
(Half, Float, Double, LongDouble)*2#
</blockquote>
<blockquote class="first"> long, ulong, longlong, ulonglong, half, float, double, longdouble, cfloat, cdouble, clongdouble)*3,</blockquote>
byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong#
<blockquote class="first"> npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble)*3,</blockquote>
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong#
<blockquote class="first"> npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble)*2,</blockquote>
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_float, npy_double, npy_longdouble,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong#
<blockquote class="first"> Long, ULong, LongLong, ULongLong, Half, Float, Double, LongDouble, CFloat, CDouble, CLongDouble)*2,</blockquote>
Byte, UByte, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, Half, Float, Double, LongDouble, Float, Double, LongDouble,
Byte, UByte, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong#
oper = negative*17, positive*17, absolute*17, invert*10#
static NPY_INLINE PyObject* name _ which | ( | PyObject * | obj | ) | [static] |
<blockquote> PyLong_FromDouble*7, PyFloat_FromDouble*17#</blockquote> </blockquote>
PyNumberMethods name _as_number [static] |
static void(* _basic_)(@type @*,@type @*,@type @*) [static] |
Referenced by half_ctype_power().
npy_half(* _basic_half_fmod)(npy_half, npy_half) [static] |
npy_half(* _basic_half_sqrt)(npy_half) [static] |