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 "numpy/npy_3kcompat.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 "numpyos.h"

Defines

#define PY_SSIZE_T_CLEAN
#define NPY_NO_DEPRECATED_API
#define _MULTIARRAYMODULE
#define NPY_NO_PREFIX
#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 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 BITSOF_CFLOAT   2*BITSOF_FLOAT
#define BITSOF_CDOUBLE   2*BITSOF_DOUBLE
#define BITSOF_CLONGDOUBLE   2*BITSOF_LONGDOUBLE
#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, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void TYPE _to_HALF (@type @*ip, npy_half *op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_ TYPE (npy_half *ip,@type @*op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void TYPE _to_HALF (@itype @*ip, npy_half *op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_ TYPE (npy_half *ip,@itype @*op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void CLONGDOUBLE_to_HALF (longdouble *ip, npy_half *op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_CLONGDOUBLE (npy_half *ip, longdouble *op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void FROMTYPE _to_BOOL (@fromtype @*ip, Bool *op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void HALF_to_BOOL (npy_half *ip, Bool *op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void BOOL_to_ TOTYPE (Bool *ip,@totype @*op, intp n, PyArrayObject *NPY_UNUSED(aip), PyArrayObject *NPY_UNUSED(aop))
static void FROMTYPE _to_OBJECT (@fromtype @*ip, PyObject **op, intp n, PyArrayObject *aip, PyArrayObject *NPY_UNUSED(aop))
static void OBJECT_to_ TOTYPE (PyObject **ip,@totype @*op, intp n, PyArrayObject *_NPY_UNUSED @TOTYPE @(aip), PyArrayObject *aop)
static void from _to_ to (@fromtyp @*ip,@totyp @*op, 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, 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, Bool *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static void fname _copyswapn (void *dst, intp dstride, void *src, intp sstride, 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, intp dstride, void *src, intp sstride, 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, intp dstride, PyObject **src, intp sstride, 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, intp dstride, char *src, intp sstride, intp n, int NPY_UNUSED(swap), PyArrayObject *arr)
static void VOID_copyswapn (char *dst, intp dstride, char *src, intp sstride, intp n, int swap, PyArrayObject *arr)
static void VOID_copyswap (char *dst, char *src, int swap, PyArrayObject *arr)
static void UNICODE_copyswapn (char *dst, intp dstride, char *src, intp sstride, 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 Bool fname _nonzero (char *ip, PyArrayObject *ap)
static Bool Py_STRING_ISSPACE (char ch)
static Bool STRING_nonzero (char *ip, PyArrayObject *ap)
static Bool UNICODE_nonzero (PyArray_UCS4 *ip, PyArrayObject *ap)
static Bool OBJECT_nonzero (PyObject **ip, PyArrayObject *ap)
static Bool VOID_nonzero (char *ip, PyArrayObject *ap)
static int BOOL_compare (Bool *ip1, 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 (PyArray_UCS4 *ip1, PyArray_UCS4 *ip2, PyArrayObject *ap)
static int VOID_compare (char *ip1, char *ip2, PyArrayObject *ap)
static int fname _argmax (@type @*ip, intp n, intp *max_ind, PyArrayObject *NPY_UNUSED(aip))
static int OBJECT_argmax (PyObject **ip, intp n, intp *max_ind, PyArrayObject *NPY_UNUSED(aip))
static int fname _argmax (@type @*ip, intp n, intp *max_ind, PyArrayObject *aip)
static void BOOL_dot (char *ip1, intp is1, char *ip2, intp is2, char *op, intp n, void *NPY_UNUSED(ignore))
static void name _dot (char *ip1, intp is1, char *ip2, intp is2, char *op, 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, intp is1, char *ip2, intp is2, char *op, intp n, void *NPY_UNUSED(ignore))
static void OBJECT_fill (PyObject **buffer, intp length, void *NPY_UNUSED(ignored))
static void NAME _fill (@typ @*buffer, intp length, void *NPY_UNUSED(ignored))
static void HALF_fill (npy_half *buffer, npy_intp length, void *NPY_UNUSED(ignored))
static void NAME _fill (@typ @*buffer, intp length, void *NPY_UNUSED(ignore))
static void OBJECT_fillwithscalar (PyObject **buffer, intp length, PyObject **value, void *NPY_UNUSED(ignored))
static void NAME _fillwithscalar (@typ @*buffer, intp length,@typ @*value, void *NPY_UNUSED(ignored))
static void name _fastclip (@type @*in, intp ni,@type @*min,@type @*max,@type @*out)
static void name _fastputmask (@type @*in, Bool *mask, intp ni,@type @*vals, intp nv)
static int name _fasttake (@type @*dest,@type @*src, intp *indarray, intp nindarray, intp n_outer, intp m_middle, intp nelem, NPY_CLIPMODE clipmode)
static void _init_datetime_descr (PyArray_Descr *descr)
NPY_NO_EXPORT PyArray_DescrPyArray_DescrFromType (int type)
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 **

Referenced by OBJECT_fill().

#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
#define _MULTIARRAYMODULE
#define _NONZERO (   a)    ((a) != 0)

* NONZERO **

#define _NPY_UNUSEDBOOL   NPY_UNUSED
end repeat*
#define _NPY_UNUSEDBYTE   NPY_UNUSED
#define _NPY_UNUSEDCDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDCFLOAT   NPY_UNUSED
#define _NPY_UNUSEDCLONGDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDDATETIME   NPY_UNUSED
#define _NPY_UNUSEDDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDFLOAT   NPY_UNUSED
#define _NPY_UNUSEDHALF   NPY_UNUSED
#define _NPY_UNUSEDHALF   NPY_UNUSED
#define _NPY_UNUSEDINT   NPY_UNUSED
#define _NPY_UNUSEDLONG   NPY_UNUSED
#define _NPY_UNUSEDLONGDOUBLE   NPY_UNUSED
#define _NPY_UNUSEDLONGLONG   NPY_UNUSED
#define _NPY_UNUSEDSHORT   NPY_UNUSED
#define _NPY_UNUSEDSTRING
#define _NPY_UNUSEDTIMEDELTA   NPY_UNUSED
#define _NPY_UNUSEDUBYTE   NPY_UNUSED
#define _NPY_UNUSEDUINT   NPY_UNUSED
#define _NPY_UNUSEDULONG   NPY_UNUSED
#define _NPY_UNUSEDULONGLONG   NPY_UNUSED
#define _NPY_UNUSEDUNICODE
#define _NPY_UNUSEDUSHORT   NPY_UNUSED
#define _NPY_UNUSEDVOID
#define BITSOF_BYTE   CHAR_BIT
#define BITSOF_CDOUBLE   2*BITSOF_DOUBLE
#define BITSOF_CFLOAT   2*BITSOF_FLOAT
#define BITSOF_CLONGDOUBLE   2*BITSOF_LONGDOUBLE
#define BITSOF_INTP   CHAR_BIT*SIZEOF_PY_INTPTR_T
#define BOOL_fill   NULL

* FILL **

#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 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 BOOL_compare(), and ufunc_frompyfunc().

#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 = float, double, longdouble#</blockquote>
#define NPY_NO_DEPRECATED_API
#define NPY_NO_PREFIX
#define OBJECT_fastclip   NULL
end repeat*
#define OBJECT_fastputmask   NULL
end repeat*
#define OBJECT_fasttake   NULL
end repeat*
#define PY_SSIZE_T_CLEAN
#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 WHITELEN   6
#define WHITESPACE   " \t\n\r\v\f"
end repeat*

Function Documentation

static int fname _argmax ( @type @*  ip,
intp  n,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, float, double, longdouble, datetime, timedelta#
System Message: WARNING/2 (<string>, line 9) 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 BOOL_compare().

static int fname _argmax ( @type @*  ip,
intp  n,
intp max_ind,
PyArrayObject aip 
) [static]
begin repeat <blockquote> fname = STRING, UNICODE# type = char, PyArray_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 = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, datetime, timedelta#

Referenced by BOOL_compare().

static int C TYPE _compare ( @type @*  pa,
@type @*  pb 
) [static]

References TRUE.

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, PyArrayObject::descr, and _PyArray_Descr::elsize.

static void fname _copyswap ( void *  dst,
void *  src,
int  swap,
void *  NPY_UNUSEDarr 
) [static]

copy first if needed

<

copy first if needed

References PyArray_ArrFuncs::copyswapn, PyArrayObject::descr, _PyArray_Descr::f, and NPY_TITLE_KEY.

static void fname _copyswapn ( void *  dst,
intp  dstride,
void *  src,
intp  sstride,
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 = short, ushort, int, uint, long, ulong, longlong, ulonglong, npy_half, float,
double, longdouble, datetime, timedelta#

</blockquote>

end repeat*
begin repeat <blockquote> fname = CFLOAT, CDOUBLE, CLONGDOUBLE# type = cfloat, cdouble, clongdouble# #fsize = FLOAT, DOUBLE, LONGDOUBLE#</blockquote>

copy first if needed

static void fname _copyswapn ( void *  dst,
intp  dstride,
void *  src,
intp  sstride,
intp  n,
int   NPY_UNUSEDswap,
void *  NPY_UNUSEDarr 
) [static]
end repeat*
begin repeat <blockquote> fname = BOOL, BYTE, UBYTE# type = Bool, byte, ubyte#</blockquote>

ignore swap

static void name _dot ( char *  ip1,
intp  is1,
char *  ip2,
intp  is2,
char *  op,
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 = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#
#out = long, ulong, long, ulong, long, ulong, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#

</blockquote>

begin repeat <blockquote> name = CFLOAT, CDOUBLE, CLONGDOUBLE# type = float, double, longdouble#</blockquote>
static void name _fastclip ( @type @*  in,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, datetime, timedelta#
System Message: WARNING/2 (<string>, line 9) 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 = cfloat, cdouble, clongdouble#</blockquote>
static void name _fastputmask ( @type @*  in,
Bool *  mask,
intp  ni,
@type @*  vals,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, timedelta#

</blockquote>

static int name _fasttake ( @type @*  dest,
@type @*  src,
intp indarray,
intp  nindarray,
intp  n_outer,
intp  m_middle,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, timedelta#

</blockquote>

static void NAME _fill ( @typ @*  buffer,
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#
#typ = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#

</blockquote>

static void NAME _fill ( @typ @*  buffer,
intp  length,
void *  NPY_UNUSEDignore 
) [static]
begin repeat <blockquote> #NAME = CFLOAT, CDOUBLE, CLONGDOUBLE# #typ = cfloat, cdouble, clongdouble#</blockquote>
static void NAME _fillwithscalar ( @typ @*  buffer,
intp  length,
@typ @*  value,
void *  NPY_UNUSEDignored 
) [static]
begin repeat <blockquote> #NAME = BOOL, BYTE, UBYTE# #typ = Bool, byte, 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#
#typ = short, ushort, int, uint, long, ulong, longlong, ulonglong,
npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, 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 = byte, ubyte, short, ushort, int, uint, long, ulong, longlong,
ulonglong, datetime, timedelta#
System Message: WARNING/2 (<string>, line 6) Definition list ends without a blank line; unexpected unindent.

#func = (l, ul)*5, l, l# #btype = (long, ulong)*5, long, long#

end repeat*
begin repeat <blockquote> fname=FLOAT,DOUBLE,LONGDOUBLE# type=float,double,longdouble#</blockquote>

References c.

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 = Bool, byte, ubyte, short, ushort, int, long, uint, ulong,
longlong, ulonglong, npy_half, float, double#
System Message: WARNING/2 (<string>, line 13) Definition list ends without a blank line; unexpected unindent.
#type1 = long*7, ulong*2, longlong, ulonglong, npy_half, float, double# kind = Bool, Byte, UByte, Short, UShort, Int, Long, UInt, ULong,

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

<blockquote> LongLong, ULongLong, Half, Float, Double#</blockquote> </blockquote>

end repeat*
begin repeat <blockquote> TYPE = CFLOAT, CDOUBLE# type = float, double#</blockquote>

References kind().

Referenced by OBJECT_dot(), and TYPE().

static void _init_datetime_descr ( PyArray_Descr descr) [static]
end repeat*

FIXME There is no error check here and no way to indicate an error until the metadata turns up NULL.

static 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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, datetime, timedelta#
System Message: WARNING/2 (<string>, line 9) 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=cfloat, cdouble, 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_UNUSEDignore2 
) [static]
begin repeat
fname = BYTE, UBYTE# type = byte, ubyte# #btype = int, uint# #format = "d", "u"#
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 = short, ushort, int, uint, long, ulong, longlong, ulonglong# #format = "hd", "hu", "d", "u", "ld", "lu", LONGLONG_FMT, ULONGLONG_FMT#
end repeat*
begin repeat
fname = FLOAT, DOUBLE, LONGDOUBLE# type = float, double, longdouble#
static int TYPE _setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
end repeat*
begin repeat <blockquote> TYPE = CFLOAT, CDOUBLE, CLONGDOUBLE# type = float, double, longdouble# kind = CFloat, CDouble, CLongDouble#</blockquote>

<

ensures alignment

Referenced by _to_BOOL().

static void FROMTYPE _to_BOOL ( @fromtype @*  ip,
Bool *  op,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#

</blockquote>

begin repeat <blockquote> #FROMTYPE = CFLOAT, CDOUBLE, CLONGDOUBLE# #fromtype = cfloat, cdouble, clongdouble#</blockquote>

References _setitem(), and TOTYPE().

Referenced by OBJECT_dot().

static void TYPE _to_HALF ( @type @*  ip,
npy_half op,
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 = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, longdouble, datetime, timedelta#

</blockquote>

static void TYPE _to_HALF ( @itype @*  ip,
npy_half op,
intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
begin repeat <blockquote> TYPE = FLOAT, DOUBLE, CFLOAT, CDOUBLE# type = 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,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,

longlong, ulonglong, npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char, PyObject *, datetime, timedelta#

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

References Bool, and NumPyOS_ascii_ftolf().

Referenced by OBJECT_dot().

static int BOOL_compare ( Bool *  ip1,
Bool *  ip2,
PyArrayObject NPY_UNUSEDap 
) [static]
static void BOOL_dot ( char *  ip1,
intp  is1,
char *  ip2,
intp  is2,
char *  op,
intp  n,
void *  NPY_UNUSEDignore 
) [static]

* DOT **

dot means inner product

Referenced by BOOL_compare().

static int BOOL_fromstr ( char *  str,
Bool *  ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]
static int BOOL_scan ( FILE *  fp,
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 ( longdouble *  ip,
npy_half op,
intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
static PyObject* DATETIME_getitem ( char *  ip,
PyArrayObject ap 
) [static]

Get the datetime units metadata

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*
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*
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*
static void HALF_to_BOOL ( npy_half ip,
Bool *  op,
intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
end repeat*
static void HALF_to_CLONGDOUBLE ( npy_half ip,
longdouble *  op,
intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
static PyObject* LONGDOUBLE_getitem ( char *  ip,
PyArrayObject ap 
) [static]
end repeat*
These return array scalars which are different than other date-types.

References PyArrayObject::descr, and _PyArray_Descr::elsize.

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

ensure alignment

References byte_swap_vector(), PyArray_ISNOTSWAPPED, and PyArray_UCS4.

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,
intp  n,
intp max_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
end repeat*
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.

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

ignore swap

static void OBJECT_dot ( char *  ip1,
intp  is1,
char *  ip2,
intp  is2,
char *  op,
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 _getitem(), _to_BOOL(), and _to_OBJECT().

static void OBJECT_fill ( PyObject **  buffer,
intp  length,
void *  NPY_UNUSEDignored 
) [static]
this requires buffer to be filled with objects or NULL

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

static void OBJECT_fillwithscalar ( PyObject **  buffer,
intp  length,
PyObject **  value,
void *  NPY_UNUSEDignored 
) [static]
end repeat*
this requires buffer to be filled with objects or NULL
static PyObject* OBJECT_getitem ( char *  ip,
PyArrayObject ap 
) [static]
static Bool OBJECT_nonzero ( PyObject **  ip,
PyArrayObject ap 
) [static]
static int OBJECT_setitem ( PyObject *  op,
char *  ov,
PyArrayObject ap 
) [static]
static Bool Py_STRING_ISSPACE ( char  ch) [static]
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
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)

NPY_NO_EXPORT PyArray_Descr* PyArray_DescrFromType ( int  type)
Get the PyArray_Descr structure for a type.

This needs to not raise an error so that PyArray_DescrFromType(NPY_NOTYPE) works for backwards-compatible C-API
Make sure dtype metadata is initialized for DATETIME

Referenced by _array_find_python_scalar_type(), _descr_from_subtype(), _equivalent_fields(), _signbit_set(), apply_business_day_count(), array_subscript_nice(), business_day_offset(), dtype_kind_to_simplified_ordering(), get_nbo_datetime_to_string_transfer_function(), new_array_for_sum(), object_ufunc_type_resolution(), PyArray_ArgMax(), PyArray_As1D(), PyArray_DescrFromTypeObject(), and PyUFunc_MultiplicationTypeResolution().

NPY_NO_EXPORT int set_typeinfo ( PyObject *  dict)

* SETUP TYPE INFO **

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#
System Message: WARNING/2 (<string>, line 5) Definition list ends without a blank line; unexpected unindent.
#uname = BOOL, BYTE*2, SHORT*2, INT*2, INTP*2, LONG*2, LONGLONG*2# #Name = Bool, Byte, UByte, Short, UShort, Int, UInt, Intp, UIntp,

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

<blockquote> Long, ULong, LongLong, ULongLong#</blockquote>

System Message: WARNING/2 (<string>, line 8) Block quote ends without a blank line; unexpected unindent.
type = Bool, byte, ubyte, short, ushort, int, uint, intp, uintp,
long, ulong, longlong, ulonglong#
#max= 1, MAX_BYTE, MAX_UBYTE, MAX_SHORT, MAX_USHORT, MAX_INT,
PyLong_FromUnsignedLong(MAX_UINT), PyLong_FromLongLong((longlong) MAX_INTP), PyLong_FromUnsignedLongLong((ulonglong) MAX_UINTP), MAX_LONG, PyLong_FromUnsignedLong((unsigned long) MAX_ULONG), PyLong_FromLongLong((longlong) MAX_LONGLONG), PyLong_FromUnsignedLongLong((ulonglong) MAX_ULONGLONG)#
#min = 0, MIN_BYTE, 0, MIN_SHORT, 0, MIN_INT, 0,
PyLong_FromLongLong((longlong) MIN_INTP), 0, MIN_LONG, 0, PyLong_FromLongLong((longlong) MIN_LONGLONG),0#
System Message: WARNING/2 (<string>, line 19) 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, float, double, longdouble, cfloat, cdouble, 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

Referenced by Py_STRING_ISSPACE().

static void STRING_copyswap ( char *  dst,
char *  src,
int   NPY_UNUSEDswap,
PyArrayObject arr 
) [static]
static void STRING_copyswapn ( char *  dst,
intp  dstride,
char *  src,
intp  sstride,
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 Bool STRING_nonzero ( char *  ip,
PyArrayObject ap 
) [static]
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 type().

static void from _to_ to ( @fromtyp @*  ip,
@totyp @*  op,
intp  n,
PyArrayObject aip,
PyArrayObject aop 
) [static]
end repeat*
begin repeat <blockquote> #from = STRING*23, UNICODE*23, VOID*23# #fromtyp = char*69# to = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME, TIMEDELTA)*3# #totyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char, datetime, timedelta)*3# #oskip = (1*18,aop->descr->elsize*3,1*2)*3# #convert = 1*18, 0*3, 1*2, 1*18, 0*3, 1*2, 0*23# #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 = char*20, char*20, char*20# #from = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,

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

<blockquote> LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA)*3#</blockquote>

System Message: WARNING/2 (<string>, line 8) Block quote ends without a blank line; unexpected unindent.
#fromtyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, timedelta)*3#

</blockquote>

convert from Python object to needed one

<

&#64;convert&#64;

static void FROMTYPE _to_ TOTYPE ( @fromtype @*  ip,
@totype @*  op,
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 = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#

</blockquote>

begin repeat1 <blockquote>

#FROMTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#fromtype = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#

</blockquote>

end repeat1*
begin repeat1 <blockquote> #FROMTYPE = CFLOAT, CDOUBLE, CLONGDOUBLE# #fromtype = float, double, longdouble#</blockquote>
end repeat*
begin repeat <blockquote> TOTYPE = CFLOAT,CDOUBLE,CLONGDOUBLE# #totype = float, double, longdouble#</blockquote>
begin repeat1
#FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
#fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, float, double, longdouble, datetime, timedelta#
end repeat1*
end repeat*
begin repeat <blockquote> TOTYPE = CFLOAT,CDOUBLE,CLONGDOUBLE# #totype = float, double, longdouble#</blockquote>
begin repeat1
#FROMTYPE = CFLOAT,CDOUBLE,CLONGDOUBLE# #fromtype = float, double, longdouble#

References Bool, and npy_half_iszero().

Referenced by _to_BOOL().

static void OBJECT_to_ TOTYPE ( PyObject **  ip,
@totype @*  op,
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 = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char, datetime, timedelta#
System Message: WARNING/2 (<string>, line 11) Definition list ends without a blank line; unexpected unindent.
#skip = 1*18, aop->descr->elsize*3, 1*2# </blockquote>

References npy_double_to_half(), and NumPyOS_ascii_strtod().

static void BOOL_to_ TOTYPE ( Bool *  ip,
@totype @*  op,
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 = byte, ubyte, short, ushort, int, uint, long, ulong,
longlong, ulonglong, npy_half, float, double, longdouble, datetime, timedelta#
System Message: WARNING/2 (<string>, line 8) 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#

static u type MyPyLong_AsUnsigned Type ( PyObject *  obj) [static]
begin repeat
type = long, longlong# Type = Long, LongLong#
static void HALF_to_ TYPE ( npy_half ip,
@type @*  op,
intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]
static void HALF_to_ TYPE ( npy_half ip,
@itype @*  op,
intp  n,
PyArrayObject NPY_UNUSEDaip,
PyArrayObject NPY_UNUSEDaop 
) [static]

References _getitem().

static int UNICODE_compare ( PyArray_UCS4 *  ip1,
PyArray_UCS4 *  ip2,
PyArrayObject ap 
) [static]
unicode type
static void UNICODE_copyswap ( char *  dst,
char *  src,
int  swap,
PyArrayObject arr 
) [static]
static void UNICODE_copyswapn ( char *  dst,
intp  dstride,
char *  src,
intp  sstride,
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

create new empty unicode object of length mysize*2
reset length of unicode object to ucs2size

static Bool UNICODE_nonzero ( PyArray_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.
create buffer and copy
copy data to a buffer

static void VOID_copyswap ( char *  dst,
char *  src,
int  swap,
PyArrayObject arr 
) [static]

References type().

static void VOID_copyswapn ( char *  dst,
intp  dstride,
char *  src,
intp  sstride,
intp  n,
int  swap,
PyArrayObject arr 
) [static]
static PyObject* VOID_getitem ( char *  ip,
PyArrayObject ap 
) [static]
VOID

get the names from the fields dictionary
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 Bool VOID_nonzero ( char *  ip,
PyArrayObject ap 
) [static]
if we have fields, then nonzero only if all sub-fields are nonzero.
static int VOID_setitem ( PyObject *  op,
char *  ip,
PyArrayObject ap 
) [static]

get the names from the fields dictionary
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, PyArray_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 9) Definition list ends without a blank line; unexpected unindent.
#sort = 1*18, 0*3# #num = 1*15, 2*3, 1*3# #fromtyp = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,

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

<blockquote>

longlong, ulonglong, npy_half, float, double, longdouble, float, double, longdouble, PyObject *, datetime, timedelta#

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

</blockquote>

System Message: WARNING/2 (<string>, line 14) 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 20) 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 20); backlink Inline substitution_reference start-string without end-string.
System Message: WARNING/2 (<string>, line 20); backlink Inline emphasis start-string without end-string.
System Message: WARNING/2 (<string>, line 20); 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
}
NPY_NO_EXPORT PyArray_Descr from _Descr [static]
Initial value:
 {
    PyObject_HEAD_INIT(&PyArrayDescr_Type)
    &Py@NAME@ArrType_Type,
    PyArray_@from@LTR,
    PyArray_@from@LTR,
    '@endian@',
    0,
    PyArray_@from@,
    0,
    _ALIGN(@align@),
    NULL,
    NULL,
    NULL,
    &_Py@NAME@_ArrFuncs,
    NULL,
}
FIXME: check for PY3K

Referenced by OBJECT_fill().

char _letter_to_num[_MAX_LETTER] [static]