|
numpy
2.0.0
|
#include "Python.h"#include "npy_config.h"#include "npy_pycompat.h"#include "numpy/ufuncobject.h"#include "ufunc_type_resolution.h"#include "common.h"| #define _UMATHMODULE |
| #define NO_IMPORT_ARRAY |
| #define NPY_NO_DEPRECATED_API NPY_API_VERSION |
| #define PY_ARRAY_UNIQUE_SYMBOL _npy_umathmodule_ARRAY_API |
| static int dtype_kind_to_simplified_ordering | ( | char | kind | ) | [static] |
Referenced by set_ufunc_loop_data_types().
| static PyArray_Descr* ensure_dtype_nbo | ( | PyArray_Descr * | type | ) | [static] |
Referenced by PyUFunc_MultiplicationTypeResolver().
| static int find_userloop | ( | PyUFuncObject * | ufunc, |
| PyArray_Descr ** | dtypes, | ||
| PyUFuncGenericFunction * | out_innerloop, | ||
| void ** | out_innerloopdata | ||
| ) | [static] |
| NPY_NO_EXPORT int linear_search_type_resolver | ( | PyUFuncObject * | self, |
| PyArrayObject ** | op, | ||
| NPY_CASTING | input_casting, | ||
| NPY_CASTING | output_casting, | ||
| int | any_object, | ||
| PyArray_Descr ** | out_dtype | ||
| ) |
<blockquote>
</blockquote>
Referenced by PyUFunc_DefaultTypeResolver().
| static int linear_search_userloop_type_resolver | ( | PyUFuncObject * | self, |
| PyArrayObject ** | op, | ||
| NPY_CASTING | input_casting, | ||
| NPY_CASTING | output_casting, | ||
| int | any_object, | ||
| int | use_min_scalar, | ||
| PyArray_Descr ** | out_dtype, | ||
| int * | out_no_castable_output, | ||
| char * | out_err_src_typecode, | ||
| char * | out_err_dst_typecode | ||
| ) | [static] |
| static const char* npy_casting_to_string | ( | NPY_CASTING | casting | ) | [static] |
References NPY_EQUIV_CASTING, NPY_NO_CASTING, NPY_SAFE_CASTING, NPY_SAME_KIND_CASTING, and NPY_UNSAFE_CASTING.
| NPY_NO_EXPORT int PyUFunc_AbsoluteTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
| NPY_NO_EXPORT int PyUFunc_AdditionTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
<blockquote> m8[<A>] + m8[<B>] => m8[gcd(<A>,<B>)] + m8[gcd(<A>,<B>)] m8[<A>] + int => m8[<A>] + m8[<A>] int + m8[<A>] => m8[<A>] + m8[<A>] M8[<A>] + int => M8[<A>] + m8[<A>] int + M8[<A>] => m8[<A>] + M8[<A>] M8[<A>] + m8[<B>] => M8[gcd(<A>,<B>)] + m8[gcd(<A>,<B>)] m8[<A>] + M8[<B>] => m8[gcd(<A>,<B>)] + M8[gcd(<A>,<B>)]</blockquote>
| NPY_NO_EXPORT int PyUFunc_DefaultLegacyInnerLoopSelector | ( | PyUFuncObject * | ufunc, |
| PyArray_Descr ** | dtypes, | ||
| PyUFuncGenericFunction * | out_innerloop, | ||
| void ** | out_innerloopdata, | ||
| int * | out_needs_api | ||
| ) |
<blockquote> like a hash table.</blockquote>
References NPY_OBJECT, NPY_VOID, PyArray_CanCastArrayTo(), PyArray_CanCastTypeTo(), PyArray_DESCR, and PyArray_DescrFromType().
| NPY_NO_EXPORT int PyUFunc_DefaultMaskedInnerLoopSelector | ( | PyUFuncObject * | ufunc, |
| PyArray_Descr ** | dtypes, | ||
| PyArray_Descr * | mask_dtype, | ||
| npy_intp * | NPY_UNUSEDfixed_strides, | ||
| npy_intp | NPY_UNUSEDfixed_mask_stride, | ||
| PyUFunc_MaskedStridedInnerLoopFunc ** | out_innerloop, | ||
| NpyAuxData ** | out_innerloopdata, | ||
| int * | out_needs_api | ||
| ) |
| NPY_NO_EXPORT int PyUFunc_DefaultTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
for the provided ufunc.
Returns 0 on success, -1 on error.
References linear_search_type_resolver(), _tagPyUFuncObject::nin, _tagPyUFuncObject::nout, NPY_SAFE_CASTING, PyArray_DESCR, PyTypeNum_ISOBJECT, and type_tuple_type_resolver().
Referenced by PyUFunc_MultiplicationTypeResolver(), and PyUFunc_SimpleUnaryOperationTypeResolver().
| NPY_NO_EXPORT int PyUFunc_DivisionTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
<blockquote> m8[<A>] / m8[<B>] to m8[gcd(<A>,<B>)] / m8[gcd(<A>,<B>)] -> float64 m8[<A>] / int## to m8[<A>] / int64 -> m8[<A>] m8[<A>] / float## to m8[<A>] / float64 -> m8[<A>]</blockquote>
| NPY_NO_EXPORT int PyUFunc_MixedDivisionTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
References data, _ufunc_masker_data::nargs, npy_memchr(), _ufunc_masker_data::unmasked_innerloop, and _ufunc_masker_data::unmasked_innerloopdata.
| NPY_NO_EXPORT int PyUFunc_MultiplicationTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
<blockquote> int## * m8[<A>] => int64 * m8[<A>] m8[<A>] * int## => m8[<A>] * int64 float## * m8[<A>] => float64 * m8[<A>] m8[<A>] * float## => m8[<A>] * float64</blockquote>
References ensure_dtype_nbo(), _tagPyUFuncObject::name, NPY_DOUBLE, NPY_LONGLONG, NPY_TIMEDELTA, PyArray_DESCR, PyArray_DescrFromType(), PyArray_DescrNewFromType(), PyArray_PromoteTypes(), PyTypeNum_ISDATETIME, PyTypeNum_ISFLOAT, PyTypeNum_ISINTEGER, PyUFunc_DefaultTypeResolver(), PyUFunc_ValidateCasting(), PyUString_ConcatAndDel, PyUString_FromFormat, and PyUString_FromString.
| NPY_NO_EXPORT int PyUFunc_NegativeTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
References NPY_UNSAFE_CASTING, and PyUFunc_SimpleUnaryOperationTypeResolver().
| NPY_NO_EXPORT int PyUFunc_OnesLikeTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | NPY_UNUSEDcasting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
| NPY_NO_EXPORT int PyUFunc_SimpleBinaryComparisonTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
| NPY_NO_EXPORT int PyUFunc_SimpleBinaryOperationTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
Referenced by timedelta_dtype_with_copied_meta().
| NPY_NO_EXPORT int PyUFunc_SimpleUnaryOperationTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
References PyUFunc_DefaultTypeResolver().
Referenced by PyUFunc_NegativeTypeResolver().
| NPY_NO_EXPORT int PyUFunc_SubtractionTypeResolver | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyObject * | type_tup, | ||
| PyArray_Descr ** | out_dtypes | ||
| ) |
<blockquote> m8[<A>] - m8[<B>] => m8[gcd(<A>,<B>)] - m8[gcd(<A>,<B>)] m8[<A>] - int => m8[<A>] - m8[<A>] int - m8[<A>] => m8[<A>] - m8[<A>] M8[<A>] - int => M8[<A>] - m8[<A>] M8[<A>] - m8[<B>] => M8[gcd(<A>,<B>)] - m8[gcd(<A>,<B>)]</blockquote>
References PyArray_DESCR, PyArray_PromoteTypes(), and timedelta_dtype_with_copied_meta().
| NPY_NO_EXPORT int PyUFunc_ValidateCasting | ( | PyUFuncObject * | ufunc, |
| NPY_CASTING | casting, | ||
| PyArrayObject ** | operands, | ||
| PyArray_Descr ** | dtypes | ||
| ) |
the input types, and the output types can be cast to the output operands where provided.
Returns 0 on success, -1 (with exception raised) on validation failure.
References _tagPyUFuncObject::name, _tagPyUFuncObject::nin, _tagPyUFuncObject::nout, npy_casting_to_string(), PyArray_CanCastArrayTo(), PyArray_CanCastTypeTo(), PyArray_DESCR, PyUString_ConcatAndDel, PyUString_FromFormat, and PyUString_FromString.
Referenced by PyUFunc_MultiplicationTypeResolver().
| static int set_ufunc_loop_data_types | ( | PyUFuncObject * | self, |
| PyArrayObject ** | op, | ||
| PyArray_Descr ** | out_dtypes, | ||
| int * | type_nums, | ||
| PyArray_Descr ** | dtypes | ||
| ) | [static] |
References dtype_kind_to_simplified_ordering(), kind(), PyArray_DESCR, and PyArray_NDIM.
Referenced by ufunc_loop_matches().
| static int should_use_min_scalar | ( | PyArrayObject ** | op, |
| int | nop | ||
| ) | [static] |
Referenced by type_tuple_userloop_type_resolver().
| static PyArray_Descr* timedelta_dtype_with_copied_meta | ( | PyArray_Descr * | dtype | ) | [static] |
References PyUFunc_SimpleBinaryOperationTypeResolver().
Referenced by PyUFunc_SubtractionTypeResolver().
| NPY_NO_EXPORT int type_tuple_type_resolver | ( | PyUFuncObject * | self, |
| PyObject * | type_tup, | ||
| PyArrayObject ** | op, | ||
| NPY_CASTING | casting, | ||
| int | any_object, | ||
| PyArray_Descr ** | out_dtype | ||
| ) |
Referenced by PyUFunc_DefaultTypeResolver().
| static int type_tuple_userloop_type_resolver | ( | PyUFuncObject * | self, |
| int | n_specified, | ||
| int * | specified_types, | ||
| PyArrayObject ** | op, | ||
| NPY_CASTING | casting, | ||
| int | any_object, | ||
| int | use_min_scalar, | ||
| PyArray_Descr ** | out_dtype | ||
| ) | [static] |
References NPY_MAXARGS, NPY_NOTYPE, PyArray_DescrConverter(), PyArray_DescrFromType(), PyBytes_AsStringAndSize, PyBytes_Check, should_use_min_scalar(), and _PyArray_Descr::type_num.
| static int ufunc_loop_matches | ( | PyUFuncObject * | self, |
| PyArrayObject ** | op, | ||
| NPY_CASTING | input_casting, | ||
| NPY_CASTING | output_casting, | ||
| int | any_object, | ||
| int | use_min_scalar, | ||
| int * | types, | ||
| PyArray_Descr ** | dtypes, | ||
| int * | out_no_castable_output, | ||
| char * | out_err_src_typecode, | ||
| char * | out_err_dst_typecode | ||
| ) | [static] |
References _loop1d_info::arg_types, _loop1d_info::next, NPY_NOTYPE, NpyCapsule_AsVoidPtr(), PyArray_DESCR, PyTypeNum_ISUSERDEF, and set_ufunc_loop_data_types().
| static NpyAuxData* ufunc_masker_data_clone | ( | NpyAuxData * | data | ) | [static] |
| static void unmasked_ufunc_loop_as_masked | ( | char ** | dataptrs, |
| npy_intp * | strides, | ||
| char * | mask, | ||
| npy_intp | mask_stride, | ||
| npy_intp | loopsize, | ||
| NpyAuxData * | innerloopdata | ||
| ) | [static] |