numpy  2.0.0
src/multiarray/arraytypes.c.src File Reference
#include "Python.h"
#include "structmember.h"
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_pycompat.h"
#include "numpy/npy_math.h"
#include "numpy/halffloat.h"
#include "npy_config.h"
#include "npy_sort.h"
#include "common.h"
#include "ctors.h"
#include "usertypes.h"
#include "_datetime.h"
#include "arrayobject.h"
#include "numpyos.h"

Defines

#define PY_SSIZE_T_CLEAN
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define _MULTIARRAYMODULE
#define __ALIGNED(obj, sz)   ((((size_t) obj) % (sz))==0)
#define _NPY_UNUSEDBOOL   NPY_UNUSED
#define _NPY_UNUSEDBYTE   NPY_UNUSED
#define _NPY_UNUSEDUBYTE   NPY_UNUSED
#define _NPY_UNUSEDSHORT   NPY_UNUSED
#define _NPY_UNUSEDUSHORT   NPY_UNUSED
#define _NPY_UNUSEDINT   NPY_UNUSED
#define _NPY_UNUSEDUINT   NPY_UNUSED
#define _NPY_UNUSEDLONG   NPY_UNUSED
#define _NPY_UNUSEDULONG   NPY_UNUSED
#define _NPY_UNUSEDLONGLONG   NPY_UNUSED
#define _NPY_UNUSEDULONGLONG   NPY_UNUSED
#define _NPY_UNUSEDHALF   NPY_UNUSED
#define _NPY_UNUSEDFLOAT   NPY_UNUSED
#define _NPY_UNUSEDDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDLONGDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDCFLOAT   NPY_UNUSED
#define _NPY_UNUSEDCDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDCLONGDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDDATETIME   NPY_UNUSED
#define _NPY_UNUSEDTIMEDELTA   NPY_UNUSED
#define _NPY_UNUSEDHALF   NPY_UNUSED
#define _NPY_UNUSEDSTRING
#define _NPY_UNUSEDVOID
#define _NPY_UNUSEDUNICODE
#define fname   @_scan NULL
#define fname   @_fromstr NULL
#define _NONZERO(a)   ((a) != 0)
#define WHITESPACE   " \t\n\r\v\f"
#define WHITELEN   6
#define PyArray_UCS4_ISSPACE(ch)   Py_STRING_ISSPACE((char)ch)
#define LT(a, b)   ((a) < (b) || ((b) != (b) && (a) ==(a)))
#define _LESS_THAN_OR_EQUAL(a, b)   ((a) <= (b))
#define VOID_argmax   NULL
#define VOID_argmin   NULL
#define BOOL_fill   NULL
#define _LESS_THAN(a, b)   ((a) < (b))
#define _GREATER_THAN(a, b)   ((a) > (b))
#define _HALF_LESS_THAN(a, b)   (!npy_half_isnan(a) && npy_half_lt_nonan(a, b))
#define _HALF_GREATER_THAN(a, b)   (!npy_half_isnan(a) && npy_half_lt_nonan(b, a))
#define OBJECT_fastclip   NULL
#define OBJECT_fastputmask   NULL
#define OBJECT_fasttake   NULL
#define _ALIGN(type)   offsetof(struct {char c; type v;}, v)
#define _MAX_LETTER   128
#define BITSOF_INTP   CHAR_BIT*SIZEOF_PY_INTPTR_T
#define BITSOF_BYTE   CHAR_BIT
#define SETTYPE(name)

Functions

static double MyPyFloat_AsDouble (PyObject *obj)
static npy_half MyPyFloat_AsHalf (PyObject *obj)
static PyObject * MyPyFloat_FromHalf (npy_half h)
static type MyPyLong_As Type (PyObject *obj)
static PyObject *TYPE _getitem (char *ip, PyArrayObject *ap)
static int TYPE _setitem (PyObject *op, char *ov, PyArrayObject *ap)
static PyObject * LONGDOUBLE_getitem (char *ip, PyArrayObject *ap)
static int LONGDOUBLE_setitem (PyObject *op, char *ov, PyArrayObject *ap)
static PyObject * CLONGDOUBLE_getitem (char *ip, PyArrayObject *ap)
static PyObject * UNICODE_getitem (char *ip, PyArrayObject *ap)
static int UNICODE_setitem (PyObject *op, char *ov, PyArrayObject *ap)
static PyObject * STRING_getitem (char *ip, PyArrayObject *ap)
static int STRING_setitem (PyObject *op, char *ov, PyArrayObject *ap)
static PyObject * OBJECT_getitem (char *ip, PyArrayObject *ap)
static int OBJECT_setitem (PyObject *op, char *ov, PyArrayObject *ap)
static PyObject * VOID_getitem (char *ip, PyArrayObject *ap)
NPY_NO_EXPORT int PyArray_CopyObject (PyArrayObject *, PyObject *)
static int VOID_setitem (PyObject *op, char *ip, PyArrayObject *ap)
static PyObject * DATETIME_getitem (char *ip, PyArrayObject *ap)
static PyObject * TIMEDELTA_getitem (char *ip, PyArrayObject *ap)
static int DATETIME_setitem (PyObject *op, char *ov, PyArrayObject *ap)
static int TIMEDELTA_setitem (PyObject *op, char *ov, PyArrayObject *ap)
static void FROMTYPE _to_ TOTYPE (@fromtype @*ip,@totype @*op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void TYPE _to_HALF (@type @*ip, npy_half *op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_ TYPE (npy_half *ip,@type @*op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void TYPE _to_HALF (@itype @*ip, npy_half *op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_ TYPE (npy_half *ip,@itype @*op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void CLONGDOUBLE_to_HALF (npy_longdouble *ip, npy_half *op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_CLONGDOUBLE (npy_half *ip, npy_longdouble *op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void FROMTYPE _to_BOOL (@fromtype @*ip, npy_bool *op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_BOOL (npy_half *ip, npy_bool *op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void BOOL_to_ TOTYPE (npy_bool *ip,@totype @*op, npy_intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void FROMTYPE _to_OBJECT (@fromtype @*ip, PyObject **op, npy_intp n, PyArrayObject *aip, PyArrayObject *NPY_UNUSED(aop))
static void OBJECT_to_ TOTYPE (PyObject **ip,@totype @*op, npy_intp n, PyArrayObject *_NPY_UNUSED @TOTYPE @(aip), PyArrayObject *aop)
static void from _to_ to (@fromtyp @*ip,@totyp @*op, npy_intp n, PyArrayObject *aip, PyArrayObject *aop)
static int fname _scan (FILE *fp,@type @*ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignored))
static int HALF_scan (FILE *fp, npy_half *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignored))
static int fname _scan (FILE *fp,@type @*ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignore2))
static int BOOL_scan (FILE *fp, npy_bool *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignore2))
static int fname _fromstr (char *str,@type @*ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static int HALF_fromstr (char *str, npy_half *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static int BOOL_fromstr (char *str, npy_bool *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static void fname _copyswapn (void *dst, npy_intp dstride, void *src, npy_intp sstride, npy_intp n, int swap, void *NPY_UNUSED(arr))
static void fname _copyswap (void *dst, void *src, int swap, void *NPY_UNUSED(arr))
static void fname _copyswapn (void *dst, npy_intp dstride, void *src, npy_intp sstride, npy_intp n, int NPY_UNUSED(swap), void *NPY_UNUSED(arr))
static void fname _copyswap (void *dst, void *src, int NPY_UNUSED(swap), void *NPY_UNUSED(arr))
static void OBJECT_copyswapn (PyObject **dst, npy_intp dstride, PyObject **src, npy_intp sstride, npy_intp n, int NPY_UNUSED(swap), void *NPY_UNUSED(arr))
static void OBJECT_copyswap (PyObject **dst, PyObject **src, int NPY_UNUSED(swap), void *NPY_UNUSED(arr))
static void STRING_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride, npy_intp n, int NPY_UNUSED(swap), PyArrayObject *arr)
static void VOID_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride, npy_intp n, int swap, PyArrayObject *arr)
static void VOID_copyswap (char *dst, char *src, int swap, PyArrayObject *arr)
static void UNICODE_copyswapn (char *dst, npy_intp dstride, char *src, npy_intp sstride, npy_intp n, int swap, PyArrayObject *arr)
static void STRING_copyswap (char *dst, char *src, int NPY_UNUSED(swap), PyArrayObject *arr)
static void UNICODE_copyswap (char *dst, char *src, int swap, PyArrayObject *arr)
static npy_bool fname _nonzero (char *ip, PyArrayObject *ap)
static npy_bool Py_STRING_ISSPACE (char ch)
static npy_bool STRING_nonzero (char *ip, PyArrayObject *ap)
static npy_bool UNICODE_nonzero (npy_ucs4 *ip, PyArrayObject *ap)
static npy_bool OBJECT_nonzero (PyObject **ip, PyArrayObject *ap)
static npy_bool VOID_nonzero (char *ip, PyArrayObject *ap)
static int BOOL_compare (npy_bool *ip1, npy_bool *ip2, PyArrayObject *NPY_UNUSED(ap))
static int TYPE _compare (@type @*pa,@type @*pb, PyArrayObject *NPY_UNUSED(ap))
static int TYPE _compare (@type @*pa,@type @*pb)
static int HALF_compare (npy_half *pa, npy_half *pb, PyArrayObject *NPY_UNUSED(ap))
static int OBJECT_compare (PyObject **ip1, PyObject **ip2, PyArrayObject *NPY_UNUSED(ap))
static int STRING_compare (char *ip1, char *ip2, PyArrayObject *ap)
static int UNICODE_compare (npy_ucs4 *ip1, npy_ucs4 *ip2, PyArrayObject *ap)
static int VOID_compare (char *ip1, char *ip2, PyArrayObject *ap)
static int fname _argmax (@type @*ip, npy_intp n, npy_intp *max_ind, PyArrayObject *NPY_UNUSED(aip))
static int fname _argmin (@type @*ip, npy_intp n, npy_intp *min_ind, PyArrayObject *NPY_UNUSED(aip))
static int OBJECT_argmax (PyObject **ip, npy_intp n, npy_intp *max_ind, PyArrayObject *NPY_UNUSED(aip))
static int fname _argmax (@type @*ip, npy_intp n, npy_intp *max_ind, PyArrayObject *aip)
static int OBJECT_argmin (PyObject **ip, npy_intp n, npy_intp *min_ind, PyArrayObject *NPY_UNUSED(aip))
static int fname _argmin (@type @*ip, npy_intp n, npy_intp *min_ind, PyArrayObject *aip)
static void BOOL_dot (char *ip1, npy_intp is1, char *ip2, npy_intp is2, char *op, npy_intp n, void *NPY_UNUSED(ignore))
static void name _dot (char *ip1, npy_intp is1, char *ip2, npy_intp is2, char *op, npy_intp n, void *NPY_UNUSED(ignore))
static void HALF_dot (char *ip1, npy_intp is1, char *ip2, npy_intp is2, char *op, npy_intp n, void *NPY_UNUSED(ignore))
static void OBJECT_dot (char *ip1, npy_intp is1, char *ip2, npy_intp is2, char *op, npy_intp n, void *NPY_UNUSED(ignore))
static void OBJECT_fill (PyObject **buffer, npy_intp length, void *NPY_UNUSED(ignored))
static void NAME _fill (@type @*buffer, npy_intp length, void *NPY_UNUSED(ignored))
static void HALF_fill (npy_half *buffer, npy_intp length, void *NPY_UNUSED(ignored))
static void NAME _fill (@type @*buffer, npy_intp length, void *NPY_UNUSED(ignore))
static void OBJECT_fillwithscalar (PyObject **buffer, npy_intp length, PyObject **value, void *NPY_UNUSED(ignored))
static void NAME _fillwithscalar (@type @*buffer, npy_intp length,@type @*value, void *NPY_UNUSED(ignored))
static void name _fastclip (@type @*in, npy_intp ni,@type @*min,@type @*max,@type @*out)
static void name _fastputmask (@type @*in, npy_bool *mask, npy_intp ni,@type @*vals, npy_intp nv)
static int name _fasttake (@type @*dest,@type @*src, npy_intp *indarray, npy_intp nindarray, npy_intp n_outer, npy_intp m_middle, npy_intp nelem, NPY_CLIPMODE clipmode)
NPY_NO_EXPORT PyArray_DescrPyArray_DescrFromType (int type)
static NpyAuxDatadatetime_dtype_metadata_clone (NpyAuxData *data)
int initialize_builtin_datetime_metadata (void)
NPY_NO_EXPORT int set_typeinfo (PyObject *dict)

Variables

static PyArray_ArrFuncs _Py NAME _ArrFuncs
static PyArray_Descr from _Descr
static char _letter_to_num [_MAX_LETTER]
static PyArray_Descr_builtin_descrs []

Define Documentation

#define __ALIGNED (   obj,
  sz 
)    ((((size_t) obj) % (sz))==0)
OBJECT
#define _ALIGN (   type)    offsetof(struct {char c; type v;}, v)

* SETUP FUNCTION POINTERS **

#define _GREATER_THAN (   a,
 
)    ((a) > (b))
#define _HALF_GREATER_THAN (   a,
 
)    (!npy_half_isnan(a) && npy_half_lt_nonan(b, a))
#define _HALF_LESS_THAN (   a,
 
)    (!npy_half_isnan(a) && npy_half_lt_nonan(a, b))
In fastclip, 'b' was already checked for NaN, so the half comparison only needs to check 'a' for NaN.
#define _LESS_THAN (   a,
 
)    ((a) < (b))
end repeat*

* FASTCLIP **

#define _LESS_THAN_OR_EQUAL (   a,
 
)    ((a) <= (b))

* ARGFUNC **

#define _MAX_LETTER   128
end repeat*
#define _NONZERO (   a)    ((a) != 0)

* NONZERO **

end repeat*
#define _NPY_UNUSEDINT   NPY_UNUSED
#define _NPY_UNUSEDVOID
#define BITSOF_BYTE   CHAR_BIT
#define BITSOF_INTP   CHAR_BIT*SIZEOF_PY_INTPTR_T
#define BOOL_fill   NULL

* FILL **

#define fname   @_scan NULL
begin repeat
fname = CFLOAT, CDOUBLE, CLONGDOUBLE,
OBJECT, STRING, UNICODE, VOID, DATETIME, TIMEDELTA#
begin repeat
fname = CFLOAT, CDOUBLE, CLONGDOUBLE,
OBJECT, STRING, UNICODE, VOID#

Referenced by HALF_compare(), and ufunc_frompyfunc().

#define fname   @_fromstr NULL
begin repeat
fname = CFLOAT, CDOUBLE, CLONGDOUBLE,
OBJECT, STRING, UNICODE, VOID, DATETIME, TIMEDELTA#
begin repeat
fname = CFLOAT, CDOUBLE, CLONGDOUBLE,
OBJECT, STRING, UNICODE, VOID#
#define LT (   a,
 
)    ((a) < (b) || ((b) != (b) && (a) ==(a)))
end repeat*
float types
The real/complex comparison functions are compatible with the new sort order for nans introduced in numpy 1.4.0. All nan values now compare larger than non-nan values and are sorted to the end. The comparison order is: <blockquote> <blockquote> Real: [R, nan] Complex: [R + Rj, R + nanj, nan + Rj, nan + nanj]</blockquote>
where complex values with the same nan placements are sorted according to the non-nan part if it exists. If both the real and imaginary parts of complex types are non-nan the order is the same as the real parts unless they happen to be equal, in which case the order is that of the imaginary parts. </blockquote>
begin repeat <blockquote> TYPE = FLOAT, DOUBLE, LONGDOUBLE# #type = npy_float, npy_double, npy_longdouble#</blockquote>
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define OBJECT_fastclip   NULL
end repeat*
#define OBJECT_fastputmask   NULL
end repeat*
#define OBJECT_fasttake   NULL
end repeat*
#define PyArray_UCS4_ISSPACE (   ch)    Py_STRING_ISSPACE((char)ch)
#define SETTYPE (   name)
Value:
Py_INCREF(&Py##name##ArrType_Type);         \
    PyDict_SetItemString(infodict, #name,       \
            (PyObject *)&Py##name##ArrType_Type)
#define VOID_argmax   NULL
end repeat*
#define VOID_argmin   NULL
end repeat*
#define WHITELEN   6
#define WHITESPACE   " \t\n\r\v\f"
end repeat*

Function Documentation

static int fname _argmax ( @type @*  ip,
npy_intp  n,
npy_intp max_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
begin repeat <blockquote>

fname = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 15) Definition list ends without a blank line; unexpected unindent.
#isfloat = 0*11, 1*7, 0*2# #isnan = nop*11, npy_half_isnan, npy_isnan*6, nop*2# #le = _LESS_THAN_OR_EQUAL*11, npy_half_le, _LESS_THAN_OR_EQUAL*8# #iscomplex = 0*15, 1*3, 0*2# #incr = ip++*15, ip+=2*3, ip++*2# </blockquote>
Propagate nans, similarly as max() and min()

<

negated, for correct nan handling
static int fname _argmax ( @type @*  ip,
npy_intp  n,
npy_intp max_ind,
PyArrayObject aip 
) [static]
begin repeat <blockquote> fname = STRING, UNICODE# #type = npy_char, npy_ucs4#</blockquote>
static int fname _argmin ( @type @*  ip,
npy_intp  n,
npy_intp min_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
end repeat*
begin repeat <blockquote>

fname = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 15) Definition list ends without a blank line; unexpected unindent.
#isfloat = 0*11, 1*7, 0*2# #isnan = nop*11, npy_half_isnan, npy_isnan*6, nop*2# #le = _LESS_THAN_OR_EQUAL*11, npy_half_le, _LESS_THAN_OR_EQUAL*8# #iscomplex = 0*15, 1*3, 0*2# #incr = ip++*15, ip+=2*3, ip++*2# </blockquote>
Propagate nans, similarly as max() and min()

<

negated, for correct nan handling

Referenced by OBJECT_dot().

static int fname _argmin ( @type @*  ip,
npy_intp  n,
npy_intp min_ind,
PyArrayObject aip 
) [static]
begin repeat <blockquote> fname = STRING, UNICODE# #type = npy_char, npy_ucs4#</blockquote>
static int TYPE _compare ( @type @*  pa,
@type @*  pb,
PyArrayObject NPY_UNUSEDap 
) [static]
integer types
begin repeat
TYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, DATETIME, TIMEDELTA#
#type = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_datetime, npy_timedelta#

Referenced by HALF_compare().

static int C TYPE _compare ( @type @*  pa,
@type @*  pb 
) [static]
static void fname _copyswap ( void *  dst,
void *  src,
int  swap,
void *  NPY_UNUSEDarr 
) [static]
copy first if needed

<

copy first if needed
static void fname _copyswap ( void *  dst,
void *  src,
int   NPY_UNUSEDswap,
void *  NPY_UNUSEDarr 
) [static]
copy first if needed
ignore swap

References _unaligned_strided_byte_copy(), c, and PyArray_DESCR.

static void fname _copyswapn ( void *  dst,
npy_intp  dstride,
void *  src,
npy_intp  sstride,
npy_intp  n,
int  swap,
void *  NPY_UNUSEDarr 
) [static]
end repeat*

* COPYSWAPN **

begin repeat <blockquote>

fname = SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#fsize = SHORT, SHORT, INT, INT,
LONG, LONG, LONGLONG, LONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

end repeat*
begin repeat <blockquote> fname = CFLOAT, CDOUBLE, CLONGDOUBLE# #fsize = FLOAT, DOUBLE, LONGDOUBLE# #type = npy_cfloat, npy_cdouble, npy_clongdouble#</blockquote>
copy first if needed
static void fname _copyswapn ( void *  dst,
npy_intp  dstride,
void *  src,
npy_intp  sstride,
npy_intp  n,
int   NPY_UNUSEDswap,
void *  NPY_UNUSEDarr 
) [static]
end repeat*
begin repeat <blockquote>

fname = BOOL,
BYTE, UBYTE#
#type = npy_bool,
npy_byte, npy_ubyte#

</blockquote>

ignore swap
static void name _dot ( char *  ip1,
npy_intp  is1,
char *  ip2,
npy_intp  is2,
char *  op,
npy_intp  n,
void *  NPY_UNUSEDignore 
) [static]
begin repeat <blockquote>

name = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
#out = npy_long, npy_ulong, npy_long, npy_ulong, npy_long, npy_ulong,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

begin repeat <blockquote> name = CFLOAT, CDOUBLE, CLONGDOUBLE# #type = npy_float, npy_double, npy_longdouble#</blockquote>
static void name _fastclip ( @type @*  in,
npy_intp  ni,
@type @*  min,
@type @*  max,
@type @*  out 
) [static]
begin repeat <blockquote>

name = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 13) Definition list ends without a blank line; unexpected unindent.
#isfloat = 0*11, 1*4, 0*2# #isnan = nop*11, npy_half_isnan, npy_isnan*3, nop*2# #lt = _LESS_THAN*11, _HALF_LESS_THAN, _LESS_THAN*5# #gt = _GREATER_THAN*11, _HALF_GREATER_THAN, _GREATER_THAN*5# </blockquote>
end repeat*
begin repeat <blockquote> name = CFLOAT, CDOUBLE, CLONGDOUBLE# #type = npy_cfloat, npy_cdouble, npy_clongdouble#</blockquote>
static void name _fastputmask ( @type @*  in,
npy_bool mask,
npy_intp  ni,
@type @*  vals,
npy_intp  nv 
) [static]

* FASTPUTMASK **

begin repeat <blockquote>

name = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_bool, npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_datetime, npy_timedelta#

</blockquote>

static int name _fasttake ( @type @*  dest,
@type @*  src,
npy_intp indarray,
npy_intp  nindarray,
npy_intp  n_outer,
npy_intp  m_middle,
npy_intp  nelem,
NPY_CLIPMODE  clipmode 
) [static]

* FASTTAKE **

begin repeat <blockquote>

name = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_datetime, npy_timedelta#

</blockquote>

We don't know what axis we're operating on, so don't report it in case of an error.
static void NAME _fill ( @type @*  buffer,
npy_intp  length,
void *  NPY_UNUSEDignored 
) [static]
begin repeat <blockquote>

#NAME = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

static void NAME _fill ( @type @*  buffer,
npy_intp  length,
void *  NPY_UNUSEDignore 
) [static]
begin repeat <blockquote> #NAME = CFLOAT, CDOUBLE, CLONGDOUBLE# #type = npy_cfloat, npy_cdouble, npy_clongdouble#</blockquote>
static void NAME _fillwithscalar ( @type @*  buffer,
npy_intp  length,
@type @*  value,
void *  NPY_UNUSEDignored 
) [static]
begin repeat <blockquote> #NAME = BOOL, BYTE, UBYTE# #type = npy_bool, npy_byte, npy_ubyte#</blockquote>
end repeat*
begin repeat <blockquote>

#NAME = SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_datetime, npy_timedelta#

</blockquote>

static int fname _fromstr ( char *  str,
@type @*  ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]
end repeat*

* FROMSTR **

begin repeat
fname = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, DATETIME, TIMEDELTA#
#type = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 8) Definition list ends without a blank line; unexpected unindent.

#func = (l, ul)*5, l, l# #btype = (npy_long, npy_ulong)*5, npy_long, npy_long#

end repeat*
begin repeat <blockquote> fname = FLOAT, DOUBLE, LONGDOUBLE# #type = npy_float, npy_double, npy_longdouble#</blockquote>
static PyObject *TYPE _getitem ( char *  ip,
PyArrayObject ap 
) [static]
end repeat*

* GETITEM AND SETITEM **

begin repeat <blockquote>

TYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, LONG, UINT, ULONG,
LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE#
#func1 = PyBool_FromLong, PyInt_FromLong*6, PyLong_FromUnsignedLong*2,
PyLong_FromLongLong, PyLong_FromUnsignedLongLong, MyPyFloat_FromHalf, PyFloat_FromDouble*2#
#func2 = PyObject_IsTrue, MyPyLong_AsLong*6, MyPyLong_AsUnsignedLong*2,
MyPyLong_AsLongLong, MyPyLong_AsUnsignedLongLong, MyPyFloat_AsHalf, MyPyFloat_AsDouble*2#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_long, npy_uint, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double#
#type1 = long*7, npy_ulong*2, npy_longlong, npy_ulonglong,
npy_half, npy_float, npy_double#
kind = Bool, Byte, UByte, Short, UShort, Int, Long, UInt, ULong,
LongLong, ULongLong, Half, Float, Double#

</blockquote>

end repeat*
begin repeat <blockquote> TYPE = CFLOAT, CDOUBLE# #type = npy_float, npy_double#</blockquote>

References kind(), and PyArray_IsScalar.

Referenced by TOTYPE().

static npy_bool fname _nonzero ( char *  ip,
PyArrayObject ap 
) [static]
begin repeat <blockquote>

fname = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 13) Definition list ends without a blank line; unexpected unindent.
#isfloat = 0*11, 1*4, 0*2# #nonzero = _NONZERO*11, !npy_half_iszero, _NONZERO*5# </blockquote>
end repeat*
begin repeat <blockquote> fname = CFLOAT, CDOUBLE, CLONGDOUBLE# #type = npy_cfloat, npy_cdouble, npy_clongdouble#</blockquote>
Don't worry about swapping for integer types, since we are just testing for equality with 0. For float types, the signed zeros require us to swap.
static int fname _scan ( FILE *  fp,
@type @*  ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignored 
) [static]
end repeat*

* SCAN **

The first ignore argument is for backwards compatibility. Should be removed when the API version is bumped up.
begin repeat
fname = SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG#
#type = npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong#
#format = "hd", "hu", "d", "u",
"ld", "lu", NPY_LONGLONG_FMT, NPY_ULONGLONG_FMT#
end repeat*
begin repeat
fname = FLOAT, DOUBLE, LONGDOUBLE# #type = npy_float, npy_double, npy_longdouble#
static int fname _scan ( FILE *  fp,
@type @*  ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignore2 
) [static]
begin repeat
fname = BYTE, UBYTE# #type = npy_byte, npy_ubyte# #btype = npy_int, npy_uint# #format = "d", "u"#
static int NAME _setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
end repeat*
begin repeat <blockquote> #NAME = CFLOAT, CDOUBLE, CLONGDOUBLE# #type = npy_cfloat, npy_cdouble, npy_clongdouble# #ftype = npy_float, npy_double, npy_longdouble# kind = CFloat, CDouble, CLongDouble#</blockquote>

<

ensures alignment

Referenced by _to_BOOL(), and TOTYPE().

static void FROMTYPE _to_BOOL ( @fromtype @*  ip,
npy_bool op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
begin repeat <blockquote>

#FROMTYPE = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#fromtype = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

begin repeat <blockquote> #FROMTYPE = CFLOAT, CDOUBLE, CLONGDOUBLE# #fromtype = npy_cfloat, npy_cdouble, npy_clongdouble#</blockquote>

References _setitem(), and TOTYPE().

Referenced by HALF_dot().

static void TYPE _to_HALF ( @type @*  ip,
npy_half op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat1*
end repeat*
begin repeat <blockquote>

TYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
LONGLONG, ULONGLONG, LONGDOUBLE, DATETIME, TIMEDELTA#
#type = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

static void TYPE _to_HALF ( @itype @*  ip,
npy_half op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
begin repeat <blockquote> TYPE = FLOAT, DOUBLE, CFLOAT, CDOUBLE# name = float, double, float, double# #itype = npy_uint32, npy_uint64, npy_uint32, npy_uint64# #iscomplex = 0, 0, 1, 1#</blockquote>
static void FROMTYPE _to_OBJECT ( @fromtype @*  ip,
PyObject **  op,
npy_intp  n,
PyArrayObject aip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat1*
end repeat*
begin repeat <blockquote>

#FROMTYPE = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, OBJECT, DATETIME, TIMEDELTA#
#fromtype = npy_bool,

npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_char, npy_char, npy_char, PyObject *, npy_datetime, npy_timedelta#

System Message: WARNING/2 (<string>, line 11); backlink Inline emphasis start-string without end-string.
System Message: WARNING/2 (<string>, line 17) Definition list ends without a blank line; unexpected unindent.
#skip = 1*18, PyArray_DESCR(aip)->elsize*3, 1*3# </blockquote>

Referenced by HALF_dot().

static int BOOL_compare ( npy_bool ip1,
npy_bool ip2,
PyArrayObject NPY_UNUSEDap 
) [static]

* COMPARE **

boolean type
static void BOOL_dot ( char *  ip1,
npy_intp  is1,
char *  ip2,
npy_intp  is2,
char *  op,
npy_intp  n,
void *  NPY_UNUSEDignore 
) [static]

* DOT **

dot means inner product
static int BOOL_fromstr ( char *  str,
npy_bool ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]
static int BOOL_scan ( FILE *  fp,
npy_bool ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignore2 
) [static]
end repeat*

References c.

static PyObject* CLONGDOUBLE_getitem ( char *  ip,
PyArrayObject ap 
) [static]
static void CLONGDOUBLE_to_HALF ( npy_longdouble ip,
npy_half op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
static NpyAuxData* datetime_dtype_metadata_clone ( NpyAuxData data) [static]
A clone function for the datetime dtype metadata
static PyObject* DATETIME_getitem ( char *  ip,
PyArrayObject ap 
) [static]
Get the datetime units metadata

References PyArray_DESCR, and PyArray_ISNOTSWAPPED.

static int DATETIME_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
ensure alignment
Get the datetime units metadata
Convert the object into a NumPy datetime
Copy the value into the output
static int HALF_compare ( npy_half pa,
npy_half pb,
PyArrayObject NPY_UNUSEDap 
) [static]
end repeat*

References _compare(), fname, PyArray_DESCR, PyArray_free, and PyArray_malloc.

static void HALF_dot ( char *  ip1,
npy_intp  is1,
char *  ip2,
npy_intp  is2,
char *  op,
npy_intp  n,
void *  NPY_UNUSEDignore 
) [static]
end repeat*

References _to_BOOL(), and _to_OBJECT().

static void HALF_fill ( npy_half buffer,
npy_intp  length,
void *  NPY_UNUSEDignored 
) [static]
end repeat*
static int HALF_fromstr ( char *  str,
npy_half ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]
end repeat*
static int HALF_scan ( FILE *  fp,
npy_half ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignored 
) [static]
end repeat*

References _strided_byte_swap().

static void HALF_to_BOOL ( npy_half ip,
npy_bool op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
static void HALF_to_CLONGDOUBLE ( npy_half ip,
npy_longdouble op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
Initializes the c_metadata field for the _builtin_descrs DATETIME and TIMEDELTA.
Allocate memory for the metadata
Initialize the base aux data
Set to the default metadata
static PyObject* LONGDOUBLE_getitem ( char *  ip,
PyArrayObject ap 
) [static]
end repeat*
These return array scalars which are different than other date-types.

References PyArray_DESCR, and PyArray_Scalar().

static int LONGDOUBLE_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
static double MyPyFloat_AsDouble ( PyObject *  obj) [static]

* PYTHON TYPES TO C TYPES **

References NPY_NAN.

Referenced by MyPyFloat_AsHalf().

static npy_half MyPyFloat_AsHalf ( PyObject *  obj) [static]
static PyObject* MyPyFloat_FromHalf ( npy_half  h) [static]

References npy_half_to_double().

static int OBJECT_argmax ( PyObject **  ip,
npy_intp  n,
npy_intp max_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
end repeat*
static int OBJECT_argmin ( PyObject **  ip,
npy_intp  n,
npy_intp min_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
static int OBJECT_compare ( PyObject **  ip1,
PyObject **  ip2,
PyArrayObject NPY_UNUSEDap 
) [static]
object type
ALIGNMENT NOTE: It seems that PyArray_Sort is already handling the alignment of pointers, so it doesn't need to be handled here.

References NPY_FALSE, and NPY_TRUE.

static void OBJECT_copyswap ( PyObject **  dst,
PyObject **  src,
int   NPY_UNUSEDswap,
void *  NPY_UNUSEDarr 
) [static]
static void OBJECT_copyswapn ( PyObject **  dst,
npy_intp  dstride,
PyObject **  src,
npy_intp  sstride,
npy_intp  n,
int   NPY_UNUSEDswap,
void *  NPY_UNUSEDarr 
) [static]
end repeat*
ignore swap

References NPY_TRUE, and Py_STRING_ISSPACE().

static void OBJECT_dot ( char *  ip1,
npy_intp  is1,
char *  ip2,
npy_intp  is2,
char *  op,
npy_intp  n,
void *  NPY_UNUSEDignore 
) [static]
end repeat*
ALIGNMENT NOTE: np.dot, np.inner etc. enforce that the array is BEHAVED before getting to this point, so unaligned pointers aren't handled here.

References _argmin(), _Descr, ArrType_Type, PyArrayDescr_Type, and suff().

static void OBJECT_fill ( PyObject **  buffer,
npy_intp  length,
void *  NPY_UNUSEDignored 
) [static]
this requires buffer to be filled with objects or NULL
static void OBJECT_fillwithscalar ( PyObject **  buffer,
npy_intp  length,
PyObject **  value,
void *  NPY_UNUSEDignored 
) [static]
end repeat*
this requires buffer to be filled with objects or NULL

References ArrType_Type, and PyArrayDescr_Type.

static PyObject* OBJECT_getitem ( char *  ip,
PyArrayObject ap 
) [static]
static npy_bool OBJECT_nonzero ( PyObject **  ip,
PyArrayObject ap 
) [static]
static int OBJECT_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
static npy_bool Py_STRING_ISSPACE ( char  ch) [static]

Referenced by OBJECT_copyswapn().

NPY_NO_EXPORT int PyArray_CopyObject ( PyArrayObject dest,
PyObject *  src_object 
)
Special code to mimic Numeric behavior for character arrays.
Get either an array object we can copy from, or its parameters if there isn't a convenient array available.
If it's not an array, either assign from a sequence or as a scalar
If the input is scalar
If there's one dest element and src is a Python scalar
TODO: switch to SAME_KIND casting
Otherwise use the dtype's setitem function
If there are more than enough dims, use AssignFromSequence because it can handle this style of broadcasting.
Otherwise convert to an array and do an array-based copy
If it's an array, do a move (handling possible overlapping data)

Referenced by array_ass_sub_simple(), and array_getfield().

NPY_NO_EXPORT int set_typeinfo ( PyObject *  dict)

* SETUP TYPE INFO **

This function is called during numpy module initialization, and is used to initialize internal dtype tables.
Add cast functions for the new types
begin repeat <blockquote>

#name1 = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID, DATETIME,TIMEDELTA#

</blockquote>

begin repeat1 <blockquote> #name2 = HALF, DATETIME, TIMEDELTA#</blockquote>
end repeat1*
end repeat*
begin repeat <blockquote>

name = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, INTP, UINTP, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID, DATETIME,TIMEDELTA#

</blockquote>

end repeat*
begin repeat
name = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, STRING, UNICODE, VOID, DATETIME, TIMEDELTA#
end repeat*
Set a dictionary with type information
begin repeat <blockquote>

name = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, INTP, UINTP, LONG, ULONG, LONGLONG, ULONGLONG#
#uname = BOOL,
BYTE*2, SHORT*2, INT*2, INTP*2, LONG*2, LONGLONG*2#
#Name = Bool,
Byte, UByte, Short, UShort, Int, UInt, Intp, UIntp, Long, ULong, LongLong, ULongLong#
#type = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_intp, npy_uintp, npy_long, npy_ulong, npy_longlong, npy_ulonglong#
#max= 1,
NPY_MAX_BYTE, NPY_MAX_UBYTE, NPY_MAX_SHORT, NPY_MAX_USHORT, NPY_MAX_INT, PyLong_FromUnsignedLong(NPY_MAX_UINT), PyLong_FromLongLong((npy_longlong) NPY_MAX_INTP), PyLong_FromUnsignedLongLong((npy_ulonglong) NPY_MAX_UINTP), NPY_MAX_LONG, PyLong_FromUnsignedLong((npy_ulong) NPY_MAX_ULONG), PyLong_FromLongLong((npy_longlong) NPY_MAX_LONGLONG), PyLong_FromUnsignedLongLong((npy_ulonglong) NPY_MAX_ULONGLONG)#
#min = 0, NPY_MIN_BYTE, 0, NPY_MIN_SHORT, 0, NPY_MIN_INT, 0,
PyLong_FromLongLong((npy_longlong) NPY_MIN_INTP), 0, NPY_MIN_LONG, 0, PyLong_FromLongLong((npy_longlong) NPY_MIN_LONGLONG), 0#
System Message: WARNING/2 (<string>, line 32) Definition list ends without a blank line; unexpected unindent.
#cx = i*6, N, N, N, l, N, N, N# #cn = i*7, N, i, l, i, N, i# </blockquote>
end repeat*
begin repeat <blockquote>

#type = npy_half, npy_float, npy_double, npy_longdouble,
npy_cfloat, npy_cdouble, npy_clongdouble#
name = HALF, FLOAT, DOUBLE, LONGDOUBLE,
CFLOAT, CDOUBLE, CLONGDOUBLE#
#Name = Half, Float, Double, LongDouble,
CFloat, CDouble, CLongDouble#

</blockquote>

end repeat*
static int STRING_compare ( char *  ip1,
char *  ip2,
PyArrayObject ap 
) [static]
string type
static void STRING_copyswap ( char *  dst,
char *  src,
int   NPY_UNUSEDswap,
PyArrayObject arr 
) [static]
static void STRING_copyswapn ( char *  dst,
npy_intp  dstride,
char *  src,
npy_intp  sstride,
npy_intp  n,
int   NPY_UNUSEDswap,
PyArrayObject arr 
) [static]
static PyObject* STRING_getitem ( char *  ip,
PyArrayObject ap 
) [static]
STRING
can handle both NULL-terminated and not NULL-terminated cases will truncate all ending NULLs in returned string.
Will eliminate NULLs at the end
static npy_bool STRING_nonzero ( char *  ip,
PyArrayObject ap 
) [static]

References PyArray_free, and PyArray_malloc.

static int STRING_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
Handle case of assigning from an array scalar
If string lenth is smaller than room in array Then fill the rest of the element size with NULL
static PyObject* TIMEDELTA_getitem ( char *  ip,
PyArrayObject ap 
) [static]
Get the datetime units metadata
static int TIMEDELTA_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
ensure alignment
Get the datetime units metadata
Convert the object into a NumPy datetime
Copy the value into the output

References npy_half_to_float().

static void from _to_ to ( @fromtyp @*  ip,
@totyp @*  op,
npy_intp  n,
PyArrayObject aip,
PyArrayObject aop 
) [static]
end repeat*
begin repeat <blockquote>
#from = STRING*23, UNICODE*23, VOID*23# #fromtyp = npy_char*69# to = (BOOL,

System Message: ERROR/3 (<string>, line 6) Unexpected indentation.

<blockquote> BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME, TIMEDELTA)*3#</blockquote>

System Message: WARNING/2 (<string>, line 12) Block quote ends without a blank line; unexpected unindent.
#totyp = (npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_char, npy_char, npy_char, npy_datetime, npy_timedelta)*3#
#oskip = 1*18,(PyArray_DESCR(aop)->elsize)*3,1*2,
1*18,(PyArray_DESCR(aop)->elsize)*3,1*2, 1*18,(PyArray_DESCR(aop)->elsize)*3,1*2#
#convert = 1*18, 0*3, 1*2,
1*18, 0*3, 1*2, 0*23#
System Message: WARNING/2 (<string>, line 25) Definition list ends without a blank line; unexpected unindent.
#convstr = (Int*9, Long*2, Float*4, Complex*3, Tuple*3, Long*2)*3# </blockquote>
end repeat*
begin repeat <blockquote>
to = STRING*20, UNICODE*20, VOID*20# #totyp = npy_char*20, npy_char*20, npy_char*20# #from = (BOOL,

System Message: ERROR/3 (<string>, line 6) Unexpected indentation.

<blockquote> BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA)*3#</blockquote>

System Message: WARNING/2 (<string>, line 11) Block quote ends without a blank line; unexpected unindent.
#fromtyp = (npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_datetime, npy_timedelta)*3#

</blockquote>

Referenced by TOTYPE().

static void FROMTYPE _to_ TOTYPE ( @fromtype @*  ip,
@totype @*  op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]

* TYPE TO TYPE CONVERSIONS **

Assumes contiguous, and aligned, from and to
begin repeat <blockquote>

TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#totype = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

begin repeat1 <blockquote>

#FROMTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#fromtype = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

end repeat1*
begin repeat1 <blockquote> #FROMTYPE = CFLOAT, CDOUBLE, CLONGDOUBLE# #fromtype = npy_float, npy_double, npy_longdouble#</blockquote>
end repeat*
begin repeat <blockquote> TOTYPE = CFLOAT, CDOUBLE,CLONGDOUBLE# #totype = npy_float, npy_double, npy_longdouble#</blockquote>
begin repeat1
#FROMTYPE = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#fromtype = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
end repeat1*
end repeat*
begin repeat <blockquote> TOTYPE = CFLOAT,CDOUBLE,CLONGDOUBLE# #totype = npy_float, npy_double, npy_longdouble#</blockquote>
begin repeat1
#FROMTYPE = CFLOAT,CDOUBLE,CLONGDOUBLE# #fromtype = npy_float, npy_double, npy_longdouble#

References NPY_FALSE.

Referenced by _to_BOOL().

static void BOOL_to_ TOTYPE ( npy_bool ip,
@totype @*  op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
begin repeat
TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#totype = npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 10) Definition list ends without a blank line; unexpected unindent.

#one = 1*10, NPY_HALF_ONE, 1*5# #zero = 0*10, NPY_HALF_ZERO, 0*5#

References _getitem(), _setitem(), PyArray_DESCR, and to().

static void OBJECT_to_ TOTYPE ( PyObject **  ip,
@totype @*  op,
npy_intp  n,
PyArrayObject *_NPY_UNUSED @TOTYPE aip,
PyArrayObject aop 
) [static]
begin repeat <blockquote>

TOTYPE = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME, TIMEDELTA#
#totype = npy_bool,
npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_cfloat, npy_cdouble, npy_clongdouble, npy_char, npy_char, npy_char, npy_datetime, npy_timedelta#
System Message: WARNING/2 (<string>, line 17) Definition list ends without a blank line; unexpected unindent.
#skip = 1*18, PyArray_DESCR(aop)->elsize*3, 1*2# </blockquote>
static type MyPyLong_AsUnsigned Type ( PyObject *  obj) [static]
begin repeat <blockquote> Type = Long, LongLong# #type = npy_long, npy_longlong#</blockquote>
end repeat*
begin repeat <blockquote> Type = Long, LongLong# #type = npy_ulong, npy_ulonglong#</blockquote>
static void HALF_to_ TYPE ( npy_half ip,
@type @*  op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
static void HALF_to_ TYPE ( npy_half ip,
@itype @*  op,
npy_intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
static int UNICODE_compare ( npy_ucs4 *  ip1,
npy_ucs4 *  ip2,
PyArrayObject ap 
) [static]
unicode type

References npy_half_to_float().

static void UNICODE_copyswap ( char *  dst,
char *  src,
int  swap,
PyArrayObject arr 
) [static]
static void UNICODE_copyswapn ( char *  dst,
npy_intp  dstride,
char *  src,
npy_intp  sstride,
npy_intp  n,
int  swap,
PyArrayObject arr 
) [static]
n is the number of unicode characters to swap
static PyObject* UNICODE_getitem ( char *  ip,
PyArrayObject ap 
) [static]
UNICODE
static npy_bool UNICODE_nonzero ( npy_ucs4 *  ip,
PyArrayObject ap 
) [static]
static int UNICODE_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
Sequence_Size might have returned an error
Fill in the rest of the space with 0
static int VOID_compare ( char *  ip1,
char *  ip2,
PyArrayObject ap 
) [static]
void type
If fields are defined, then compare on first field and if equal compare on second field. Continue until done or comparison results in not_equal.
Must align data passed on to sub-comparisons. Also must swap data based on to sub-comparisons.
Compare on the first-field. If equal, then compare on the second-field, etc.
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
create buffer and copy
copy data to a buffer
static void VOID_copyswap ( char *  dst,
char *  src,
int  swap,
PyArrayObject arr 
) [static]
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
static void VOID_copyswapn ( char *  dst,
npy_intp  dstride,
char *  src,
npy_intp  sstride,
npy_intp  n,
int  swap,
PyArrayObject arr 
) [static]
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
static PyObject* VOID_getitem ( char *  ip,
PyArrayObject ap 
) [static]
VOID
get the names from the fields dictionary
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
update alignment based on offset
return an array of the basic type
default is to return buffer object pointing to current item a view of it
static npy_bool VOID_nonzero ( char *  ip,
PyArrayObject ap 
) [static]
if we have fields, then nonzero only if all sub-fields are nonzero.
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
static int VOID_setitem ( PyObject *  op,
char *  ip,
PyArrayObject ap 
) [static]
get the names from the fields dictionary
TODO: temporarily modifying the array like this
is bad coding style, should be changed.
remember to update alignment flags
copy into an array of the same basic type
Default is to use buffer interface to set item

Variable Documentation

static PyArray_ArrFuncs _Py NAME _ArrFuncs [static]
Disable harmless compiler warning "4116: unnamed type definition in parentheses" which is caused by the _ALIGN macro.
begin repeat <blockquote>
#from = VOID, STRING, UNICODE# suff = void, string, unicode# #sort = 0, 1, 1# #align = char, char, npy_ucs4# #NAME = Void, String, Unicode# #endian = |, |, =#

System Message: WARNING/2 (<string>, line 3); backlink Inline substitution_reference start-string without end-string.
System Message: WARNING/2 (<string>, line 3); backlink Inline substitution_reference start-string without end-string.

</blockquote>

end repeat*
begin repeat <blockquote>

#from = BOOL,
BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, OBJECT, DATETIME, TIMEDELTA#
suff = bool,
byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, half, float, double, longdouble, cfloat, cdouble, clongdouble, object, datetime, timedelta#
System Message: WARNING/2 (<string>, line 15) Definition list ends without a blank line; unexpected unindent.
#sort = 1*18, 0*3# #num = 1*15, 2*3, 1*3# #fromtype = npy_bool,

System Message: ERROR/3 (<string>, line 18) Unexpected indentation.

<blockquote>

npy_byte, npy_ubyte, npy_short, npy_ushort, npy_int, npy_uint, npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_half, npy_float, npy_double, npy_longdouble, npy_float, npy_double, npy_longdouble, PyObject *, npy_datetime, npy_timedelta#

System Message: WARNING/2 (<string>, line 18); backlink Inline emphasis start-string without end-string.

</blockquote>

System Message: WARNING/2 (<string>, line 23) Block quote ends without a blank line; unexpected unindent.
#NAME = Bool,
Byte, UByte, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, Half, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object, Datetime, Timedelta#
kind = GENBOOL,
SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, FLOATING, FLOATING, FLOATING, FLOATING, COMPLEX, COMPLEX, COMPLEX, OBJECT, DATETIME, TIMEDELTA#
System Message: WARNING/2 (<string>, line 35) Definition list ends without a blank line; unexpected unindent.
#endian = |*3, =*15, |, =*2# #isobject= 0*18,NPY_OBJECT_DTYPE_FLAGS,0*2#

System Message: WARNING/2 (<string>, line 35); backlink Inline substitution_reference start-string without end-string.
System Message: WARNING/2 (<string>, line 35); backlink Inline emphasis start-string without end-string.
System Message: WARNING/2 (<string>, line 35); backlink Inline substitution_reference start-string without end-string.

</blockquote>

Initial value:
 {
    &BOOL_Descr,
    &BYTE_Descr,
    &UBYTE_Descr,
    &SHORT_Descr,
    &USHORT_Descr,
    &INT_Descr,
    &UINT_Descr,
    &LONG_Descr,
    &ULONG_Descr,
    &LONGLONG_Descr,
    &ULONGLONG_Descr,
    &FLOAT_Descr,
    &DOUBLE_Descr,
    &LONGDOUBLE_Descr,
    &CFLOAT_Descr,
    &CDOUBLE_Descr,
    &CLONGDOUBLE_Descr,
    &OBJECT_Descr,
    &STRING_Descr,
    &UNICODE_Descr,
    &VOID_Descr,
    &DATETIME_Descr,
    &TIMEDELTA_Descr,
    &HALF_Descr
}
FIXME: check for PY3K

Referenced by OBJECT_dot().

char _letter_to_num[_MAX_LETTER] [static]