numpy 2.0.0
src/multiarray/usertypes.c File Reference
#include <Python.h>
#include "structmember.h"
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_config.h"
#include "common.h"
#include "numpy/npy_3kcompat.h"
#include "usertypes.h"

Defines

#define PY_SSIZE_T_CLEAN
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
#define NPY_NO_PREFIX

Functions

static int * _append_new (int *types, int insert)
static Bool _default_nonzero (void *ip, void *arr)
static void _default_copyswapn (void *dst, npy_intp dstride, void *src, npy_intp sstride, npy_intp n, int swap, void *arr)
NPY_NO_EXPORT void PyArray_InitArrFuncs (PyArray_ArrFuncs *f)
NPY_NO_EXPORT int PyArray_RegisterDataType (PyArray_Descr *descr)
NPY_NO_EXPORT int PyArray_RegisterCastFunc (PyArray_Descr *descr, int totype, PyArray_VectorUnaryFunc *castfunc)
NPY_NO_EXPORT int PyArray_RegisterCanCast (PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar)

Variables

NPY_NO_EXPORT PyArray_Descr ** userdescrs = NULL

Define Documentation

#define _MULTIARRAYMODULE
#define NPY_NO_DEPRECATED_API
#include <stdio.h>
#define NPY_NO_PREFIX
#define PY_SSIZE_T_CLEAN

Function Documentation

static int* _append_new ( int *  types,
int  insert 
) [static]
static void _default_copyswapn ( void *  dst,
npy_intp  dstride,
void *  src,
npy_intp  sstride,
npy_intp  n,
int  swap,
void *  arr 
) [static]
static Bool _default_nonzero ( void *  ip,
void *  arr 
) [static]

References TRUE.

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 = NULL