numpy
2.0.0
|
#include "Python.h"
#include "npy_config.h"
#include "npy_pycompat.h"
#include "numpy/ufuncobject.h"
#include "ufunc_type_resolution.h"
#define _UMATHMODULE |
#define NPY_NO_DEPRECATED_API NPY_API_VERSION |
static int dtype_kind_to_simplified_ordering | ( | char | kind | ) | [static] |
References PyArray_DescrFromType(), and _PyArray_Descr::type_num.
static PyArray_Descr* ensure_dtype_nbo | ( | PyArray_Descr * | type | ) | [static] |
Referenced by PyUFunc_AdditionTypeResolver(), PyUFunc_MultiplicationTypeResolver(), and unmasked_ufunc_loop_as_masked().
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] |
References NPY_MAXARGS, set_ufunc_loop_data_types(), should_use_min_scalar(), and ufunc_loop_matches().
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>
References ensure_dtype_nbo(), NPY_TIMEDELTA, and PyArray_DESCR.
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 PyArray_free.
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 | ||
) |
References _loop1d_info::arg_types, _loop1d_info::next, NpyCapsule_AsVoidPtr(), PyArray_DESCR, PyTypeNum_ISUSERDEF, set_ufunc_loop_data_types(), and ufunc_loop_matches().
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_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_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 | ||
) |
References PyArray_ResultType().
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().
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>
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 | ||
) | [static] |
Referenced by linear_search_userloop_type_resolver(), PyUFunc_DefaultMaskedInnerLoopSelector(), and ufunc_loop_matches().
static int should_use_min_scalar | ( | PyArrayObject ** | op, |
int | nop | ||
) | [static] |
Referenced by linear_search_userloop_type_resolver().
static PyArray_Descr* timedelta_dtype_with_copied_meta | ( | PyArray_Descr * | dtype | ) | [static] |
References PyUFunc_SimpleBinaryOperationTypeResolver().
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] |
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, | ||
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().
Referenced by linear_search_userloop_type_resolver(), and PyUFunc_DefaultMaskedInnerLoopSelector().
static NpyAuxData* ufunc_masker_data_clone | ( | NpyAuxData * | data | ) | [static] |
References PyArray_CanCastTypeTo(), PyArray_DESCR, PyArray_DescrFromType(), and _PyArray_Descr::type.
static void unmasked_ufunc_loop_as_masked | ( | char ** | dataptrs, |
npy_intp * | strides, | ||
char * | mask, | ||
npy_intp | mask_stride, | ||
npy_intp | loopsize, | ||
NpyAuxData * | innerloopdata | ||
) | [static] |
References ensure_dtype_nbo(), PyArray_DESCR, and PyArray_DescrFromType().