numpy 2.0.0
src/multiarray/usertypes.h File Reference

Go to the source code of this file.

Functions

NPY_NO_EXPORT void PyArray_InitArrFuncs (PyArray_ArrFuncs *f)
NPY_NO_EXPORT int PyArray_RegisterCanCast (PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar)
NPY_NO_EXPORT int PyArray_RegisterDataType (PyArray_Descr *descr)
NPY_NO_EXPORT int PyArray_RegisterCastFunc (PyArray_Descr *descr, int totype, PyArray_VectorUnaryFunc *castfunc)

Variables

NPY_NO_EXPORT PyArray_Descr ** userdescrs

Function Documentation

NPY_NO_EXPORT void PyArray_InitArrFuncs ( PyArray_ArrFuncs f)
Initialize arrfuncs to NULL

References PyArray_ArrFuncs::cast.

NPY_NO_EXPORT int PyArray_RegisterCanCast ( PyArray_Descr descr,
int  totype,
NPY_SCALARKIND  scalar 
)
Register a type number indicating that a descriptor can be cast
to it safely

If we were to allow this, the casting lookup table for built-in types needs to be modified, as cancastto is not checked for them.
register with cancastto These lists won't be freed once created -- they become part of the data-type
register with cancastscalarkindto

References PyArray_ArrFuncs::cancastto, _PyArray_Descr::f, and PyArray_NOTYPE.

NPY_NO_EXPORT int PyArray_RegisterCastFunc ( PyArray_Descr descr,
int  totype,
PyArray_VectorUnaryFunc castfunc 
)
Register Casting Function
Replaces any function currently stored.

References PyArray_ArrFuncs::castdict, and _PyArray_Descr::f.

NPY_NO_EXPORT int PyArray_RegisterDataType ( PyArray_Descr descr)
returns typenum to associate with this type >=PyArray_USERDEF. needs the userdecrs table and PyArray_NUMUSER variables defined in arraytypes.inc
Register Data type
Does not change the reference count of descr

See if this type is already registered

References _PyArray_Descr::type_num, and userdescrs.


Variable Documentation

NPY_NO_EXPORT PyArray_Descr** userdescrs