numpy 2.0.0
|
#include "Python.h"
#include "numpy/noprefix.h"
#include "numpy/ufuncobject.h"
#include "numpy/arrayscalars.h"
#include "numpy/npy_3kcompat.h"
#include "numpy/halffloat.h"
Defines | |
#define | NPY_NO_DEPRECATED_API |
#define | 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 | name |
#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_subtract(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_divide(a, b, outp) *(outp) = npy_float_to_half(npy_half_to_float(a) / npy_half_to_float(b)) |
#define | half_ctype_true_divide half_ctype_divide |
#define | half_ctype_floor_divide(a, b, outp) *(outp) = npy_float_to_half(_basic_float_floor(npy_half_to_float(a) / npy_half_to_float(b))) |
#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) |
#define | RETVAL |
Functions | |
static int | ulonglong_overflow (ulonglong NPY_UNUSED(a), ulonglong NPY_UNUSED(b)) |
static int | slonglong_overflow (longlong a0, longlong b0) |
static void name | _ctype_add (@name @a,@name @b,@name @*out) |
static void name | _ctype_subtract (@name @a,@name @b,@name @*out) |
static void name | _ctype_multiply (@name @a,@name @b,@name @*out) |
static void name | _ctype_divide (@name @a,@name @b,@name @*out) |
static void name | _ctype_remainder (@name @a,@name @b,@name @*out) |
static void name | _ctype_power (@name @a,@name @b,@name @*out) |
static void | half_ctype_remainder (npy_half a, npy_half b, npy_half *out) |
static void name | _ctype_power (npy_ @name @a, npy_ @name @b, npy_ @name @*out) |
static void name | _ctype_negative (npy_ @name @a, npy_ @name @*out) |
static void | half_ctype_negative (npy_half a, npy_half *out) |
static void name | _ctype_negative (@name @a,@name @*out) |
static void name | _ctype_positive (npy_ @name @a, npy_ @name @*out) |
static void name | _ctype_positive (@name @a,@name @*out) |
static void name | _ctype_absolute (@name @a,@name @*out) |
static void | half_ctype_absolute (npy_half a, npy_half *out) |
static void name | _ctype_absolute (@name @a,@rname @*out) |
static int _ name | _convert_to_ctype (PyObject *a, npy_ @name @*arg1) |
static int _ name | _convert2_to_ctypes (PyObject *a, npy_ @name @*arg1, PyObject *b, npy_ @name @*arg2) |
static int _ name | _convert2_to_ctypes (PyObject *a,@name @*arg1, PyObject *b,@name @*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 () |
static PyObject *name | _int (PyObject *obj) |
static PyObject *name _ | which (PyObject *obj) |
static PyObject *name | _richcompare (PyObject *self, PyObject *other, int cmp_op) |
static void | add_scalarmath (void) |
static int | get_functions (void) |
static PyObject * | alter_pyscalars (PyObject *NPY_UNUSED(dummy), PyObject *args) |
static PyObject * | restore_pyscalars (PyObject *NPY_UNUSED(dummy), PyObject *args) |
static PyObject * | use_pythonmath (PyObject *NPY_UNUSED(dummy), PyObject *args) |
static PyObject * | use_scalarmath (PyObject *NPY_UNUSED(dummy), PyObject *args) |
PyMODINIT_FUNC | initscalarmath (void) |
Variables | |
static name(* | _basic_ )(@name @) |
static npy_half(* | _basic_half_floor )(npy_half) |
static npy_half(* | _basic_half_sqrt )(npy_half) |
static npy_half(* | _basic_half_fmod )(npy_half, npy_half) |
static PyNumberMethods name | _as_number |
static void * | saved_tables_arrtype [9] |
static void * | saved_tables [9] |
char | doc_alterpyscalars [] = "" |
char | doc_restorepyscalars [] = "" |
char | doc_usepythonmath [] = "" |
char | doc_usescalarmath [] = "" |
static struct PyMethodDef | methods [] |
#define _IS_NONZERO | ( | x | ) | (x != 0) |
#define _IS_ZERO | ( | x | ) | (x ==0) |
#define cmplx_cmp_ |
@oper@(arg1, arg2) ((arg1.real == arg2.real) ? \ arg1.imag @op@ arg2.imag : \ arg1.real @op@ arg2.real)
#define def_cmp_ @oper@(arg1, arg2) (arg1 @op@ arg2) |
#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_floor_divide | ( | a, | |
b, | |||
outp | |||
) | *(outp) = npy_float_to_half(_basic_float_floor(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 half_ctype_true_divide half_ctype_divide |
#define name @_ctype_invert(a, out) *(out) = ~a; |
#define name @_ctype_add(a, b, outp) *(outp) = a + b |
#define name |
@_ctype_true_divide(a, b, out) \ *(out) = ((@otyp@) (a)) / ((@otyp@) (b));
#define name |
@_ctype_floor_divide(a, b, outp) do { \ (outp)->real = _basic_@rtype@_floor \ (((a).real*(b).real + (a).imag*(b).imag) / \ ((b).real*(b).real + (b).imag*(b).imag)); \ (outp)->imag = 0; \ } while(0)
#define name @_ctype_true_divide @name@_ctype_divide |
#define name |
@_ctype_divide(a, b, outp) do{ \ @rtype@ d = (b).real*(b).real + (b).imag*(b).imag; \ if (d != 0) { \ (outp)->real = ((a).real*(b).real + (a).imag*(b).imag)/d; \ (outp)->imag = ((a).imag*(b).real - (a).real*(b).imag)/d; \ } \ else { \ (outp)->real = (a).real/d; \ (outp)->imag = (a).imag/d; \ } \ } 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_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) *(outp) = a * b |
#define name @_ctype_divide(a, b, outp) *(outp) = a / b |
#define name |
@_ctype_add(a, b, outp) do{ \ (outp)->real = (a).real + (b).real; \ (outp)->imag = (a).imag + (b).imag; \ } while(0)
#define name @_invert NULL |
#define name @_ctype_subtract(a, b, outp) *(outp) = a - b |
#define name @_ctype_floor_divide @name@_ctype_divide |
Referenced by _ctype_divide(), _ctype_power(), datetimetype_repr(), datetimetype_str(), and timedeltatype_repr().
#define name @_ctype_absolute @name@_ctype_positive |
#define name |
#define name @_ctype_@oper@(arg1, arg2, out) *(out) = (arg1) @op@ (arg2) |
#define name @_ctype_true_divide @name@_ctype_divide |
#define name @_@oper@ NULL |
#define name @_@oper@ NULL |
#define name |
@_ctype_divmod(a, b, out, out2) { \ @name@_ctype_floor_divide(a, b, out); \ @name@_ctype_remainder(a, b, out2); \ }
#define NONZERO_NAME | ( | prefix | ) | prefix##nonzero |
#define NPY_NO_DEPRECATED_API |
that does not go through the ufunc machinery
but still supports error-modes.
#define RETVAL |
#define SIZEOF_BYTE 1 |
static int _ name _convert2_to_ctypes | ( | PyObject * | a, |
npy_ @name @* | arg1, | ||
PyObject * | b, | ||
npy_ @name @* | arg2 | ||
) | [static] |
static int _ name _convert2_to_ctypes | ( | PyObject * | a, |
@name @* | arg1, | ||
PyObject * | b, | ||
@name @* | arg2 | ||
) | [static] |
static int _ name _convert_to_ctype | ( | PyObject * | a, |
npy_ @name @* | arg1 | ||
) | [static] |
Referenced by half_ctype_negative().
static void name _ctype_absolute | ( | @name @ | a, |
@rname @* | out | ||
) | [static] |
static void name _ctype_absolute | ( | @name @ | a, |
@name @* | out | ||
) | [static] |
References oper(), and PyArray_Type.
static void name _ctype_add | ( | @name @ | a, |
@name @ | b, | ||
@name @* | out | ||
) | [static] |
static void name _ctype_divide | ( | @name @ | a, |
@name @ | b, | ||
@name @* | out | ||
) | [static] |
References _ctype_multiply(), and name.
static void name _ctype_multiply | ( | @name @ | a, |
@name @ | b, | ||
@name @* | out | ||
) | [static] |
Referenced by _ctype_divide().
static void name _ctype_negative | ( | npy_ @name @ | a, |
npy_ @name @* | out | ||
) | [static] |
#uns = (0,1)*5,0*3#
static void name _ctype_negative | ( | @name @ | a, |
@name @* | out | ||
) | [static] |
static void name _ctype_positive | ( | npy_ @name @ | a, |
npy_ @name @* | out | ||
) | [static] |
static void name _ctype_positive | ( | @name @ | a, |
@name @* | out | ||
) | [static] |
static void name _ctype_power | ( | @name @ | a, |
@name @ | b, | ||
@name @* | out | ||
) | [static] |
<
static void name _ctype_power | ( | npy_ @name @ | a, |
npy_ @name @ | b, | ||
npy_ @name @* | out | ||
) | [static] |
static void name _ctype_remainder | ( | @name @ | a, |
@name @ | b, | ||
@name @* | out | ||
) | [static] |
static void name _ctype_subtract | ( | @name @ | a, |
@name @ | b, | ||
@name @* | out | ||
) | [static] |
static PyObject* name _int | ( | PyObject * | obj | ) | [static] |
static PyObject* name _power | ( | PyObject * | a, |
PyObject * | b, | ||
PyObject * | NPY_UNUSEDc | ||
) | [static] |
#otyp=float*4, double*6, half, float, double, longdouble, cfloat, cdouble, clongdouble# #OName=Float*4, Double*6, Half, Float, Double, LongDouble, CFloat, CDouble, CLongDouble# #isint=(1,0)*5,0*7# #cmplx=0*14,1*3# #iszero=_IS_ZERO*10, npy_half_iszero, _IS_ZERO*6# #zero=0*10, NPY_HALF_ZERO, 0*6# #one=1*10, NPY_HALF_ONE, 1*6#
static PyObject* name _richcompare | ( | PyObject * | self, |
PyObject * | other, | ||
int | cmp_op | ||
) | [static] |
<
<
<
static void add_scalarmath | ( | void | ) | [static] |
static PyObject* alter_pyscalars | ( | PyObject * | NPY_UNUSEDdummy, |
PyObject * | args | ||
) | [static] |
static int emit_complexwarning | ( | ) | [static] |
static int get_functions | ( | void | ) | [static] |
PyMODINIT_FUNC initscalarmath | ( | void | ) |
static int NONZERO_NAME | ( | @name @ | _ | ) | [static] |
#simp=1*14,0*3# #nonzero=_IS_NONZERO*10, !npy_half_iszero, _IS_NONZERO*6#
static PyObject* name _ oper | ( | PyObject * | a, |
PyObject * | b | ||
) | [static] |
<blockquote class="first"> divmod*10, floor_divide*10, lshift*10, rshift*10, and*10, or*10, xor*10, true_divide*10,</blockquote>
add*7, subtract*7, multiply*7, divide*7, floor_divide*7, true_divide*7, divmod*4, remainder*4#
<blockquote class="first"> float*4, double*6,</blockquote>
(half, float, double, longdouble, cfloat, cdouble, clongdouble)*6, (half, float, double, longdouble)*2#
<blockquote class="first"> Float*4, Double*6,</blockquote>
(Half, Float, Double, LongDouble, CFloat, CDouble, CLongDouble)*6, (Half, Float, Double, LongDouble)*2#
Referenced by _ctype_absolute(), and _power().
static PyObject *name _ oper | ( | PyObject * | obj | ) | [static] |
oper=negative*17, positive*17, absolute*17, invert*10#
static PyObject* restore_pyscalars | ( | PyObject * | NPY_UNUSEDdummy, |
PyObject * | args | ||
) | [static] |
static int slonglong_overflow | ( | longlong | a0, |
longlong | b0 | ||
) | [static] |
static int ulonglong_overflow | ( | ulonglong | NPY_UNUSEDa, |
ulonglong | NPY_UNUSEDb | ||
) | [static] |
static PyObject* use_pythonmath | ( | PyObject * | NPY_UNUSEDdummy, |
PyObject * | args | ||
) | [static] |
static PyObject* use_scalarmath | ( | PyObject * | NPY_UNUSEDdummy, |
PyObject * | args | ||
) | [static] |
static PyObject* name _ which | ( | PyObject * | obj | ) | [static] |
PyNumberMethods name _as_number [static] |
static void(* _basic_)(@name @*,@name @*,@name @*) [static] |
Referenced by _ctype_power().
npy_half(* _basic_half_floor)(npy_half) [static] |
npy_half(* _basic_half_fmod)(npy_half, npy_half) [static] |
npy_half(* _basic_half_sqrt)(npy_half) [static] |
char doc_alterpyscalars[] = "" |
char doc_restorepyscalars[] = "" |
char doc_usepythonmath[] = "" |
char doc_usescalarmath[] = "" |
struct PyMethodDef methods[] [static] |
{ {"alter_pythonmath", (PyCFunction) alter_pyscalars, METH_VARARGS, doc_alterpyscalars}, {"restore_pythonmath", (PyCFunction) restore_pyscalars, METH_VARARGS, doc_restorepyscalars}, {"use_pythonmath", (PyCFunction) use_pythonmath, METH_VARARGS, doc_usepythonmath}, {"use_scalarmath", (PyCFunction) use_scalarmath, METH_VARARGS, doc_usescalarmath}, {NULL, NULL, 0, NULL} }
void* saved_tables[9] [static] |
void* saved_tables_arrtype[9] [static] |