numpy  2.0.0
src/multiarray/arraytypes.c.src File Reference
#include "Python.h"
#include "structmember.h"
#include "numpy/npy_common.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 "lowlevel_strided_loops.h"
#include "usertypes.h"
#include "_datetime.h"
#include "arrayobject.h"
#include "alloc.h"
#include "numpyos.h"
#include <string.h>
#include "cblasfuncs.h"
#include "npy_cblas.h"
#include <limits.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 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 npy_longlong npy_strtoll (const char *str, char **endptr, int base)
static npy_ulonglong npy_strtoull (const char *str, char **endptr, int base)
static PyObject *TYPE _getitem (void *input, void *vap)
static int TYPE _setitem (PyObject *op, void *ov, void *vap)
static NPY_INLINE npy_longdouble string_to_long_double (PyObject *op)
static PyObject * LONGDOUBLE_getitem (void *ip, void *ap)
static int LONGDOUBLE_setitem (PyObject *op, void *ov, void *vap)
static PyObject * CLONGDOUBLE_getitem (void *ip, void *ap)
static PyObject * UNICODE_getitem (void *ip, void *vap)
static int UNICODE_setitem (PyObject *op, void *ov, void *vap)
static PyObject * STRING_getitem (void *ip, void *vap)
static int STRING_setitem (PyObject *op, void *ov, void *vap)
static PyObject * OBJECT_getitem (void *ip, void *NPY_UNUSED(ap))
static int OBJECT_setitem (PyObject *op, void *ov, void *NPY_UNUSED(ap))
static PyObject * VOID_getitem (void *input, void *vap)
NPY_NO_EXPORT int PyArray_CopyObject (PyArrayObject *, PyObject *)
static int VOID_setitem (PyObject *op, void *input, void *vap)
static PyObject * DATETIME_getitem (void *ip, void *vap)
static PyObject * TIMEDELTA_getitem (void *ip, void *vap)
static int DATETIME_setitem (PyObject *op, void *ov, void *vap)
static int TIMEDELTA_setitem (PyObject *op, void *ov, void *vap)
static void FROMTYPE _to_ TOTYPE (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void TYPE _to_HALF (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void HALF_to_ TYPE (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void CLONGDOUBLE_to_HALF (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void HALF_to_CLONGDOUBLE (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void FROMTYPE _to_BOOL (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void HALF_to_BOOL (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *NPY_UNUSED(aop))
static void FROMTYPE _to_OBJECT (void *input, void *output, npy_intp n, void *vaip, void *NPY_UNUSED(aop))
static void OBJECT_to_ TOTYPE (void *input, void *output, npy_intp n, void *NPY_UNUSED(aip), void *aop)
static void from _to_ to (void *input, void *output, npy_intp n, void *vaip, void *aop)
static int fname _scan (FILE *fp,@type @*ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(ignored))
static int LONGDOUBLE_scan (FILE *fp, npy_longdouble *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, void *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static int LONGDOUBLE_fromstr (char *str, void *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static int HALF_fromstr (char *str, void *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
static int BOOL_fromstr (char *str, void *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 BOOL_argmax (npy_bool *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 *NPY_UNUSED(aip))
static int BOOL_argmin (npy_bool *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 *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)
NPY_NO_EXPORT void name _dot (char *ip1, npy_intp is1, char *ip2, npy_intp is2, char *op, npy_intp n, void *NPY_UNUSED(ignore))
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 HALF_dot (char *ip1, npy_intp is1, char *ip2, npy_intp is2, char *op, npy_intp n, void *NPY_UNUSED(ignore))
static void CLONGDOUBLE_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 int small_correlate (const char *d_, npy_intp dstride, npy_intp nd, enum NPY_TYPES dtype, const char *k_, npy_intp kstride, npy_intp nk, enum NPY_TYPES ktype, char *out_, npy_intp ostride)
NPY_NO_EXPORT PyArray_DescrPyArray_DescrFromType (int type)
static NpyAuxDatadatetime_dtype_metadata_clone (NpyAuxData *data)
NPY_NO_EXPORT 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

Referenced by BOOL_fromstr().

#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 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 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)

Referenced by small_correlate().

#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 = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
#type = 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 13) Definition list ends without a blank line; unexpected unindent.
#isfloat = 0*10, 1*7, 0*2# #isnan = nop*10, npy_half_isnan, npy_isnan*6, nop*2# #le = _LESS_THAN_OR_EQUAL*10, npy_half_le, _LESS_THAN_OR_EQUAL*8# #iscomplex = 0*14, 1*3, 0*2# #incr = ip++*14, 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]
begin repeat <blockquote>

fname = BYTE, UBYTE, SHORT, USHORT, INT, UINT,
LONG, ULONG, LONGLONG, ULONGLONG, HALF, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE#
#type = 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#
System Message: WARNING/2 (<string>, line 11) Definition list ends without a blank line; unexpected unindent.
#isfloat = 0*10, 1*7# #isnan = nop*10, npy_half_isnan, npy_isnan*6# #le = _LESS_THAN_OR_EQUAL*10, npy_half_le, _LESS_THAN_OR_EQUAL*6# #iscomplex = 0*14, 1*3# #incr = ip++*14, ip+=2*3# </blockquote>
end repeat*
begin repeat <blockquote> fname = DATETIME, TIMEDELTA# #type = npy_datetime, npy_timedelta#</blockquote>
Propagate nans, similarly as max() and min()

<

negated, for correct nan handling
NPY_DATETIME_NAT is smaller than every other value, we skip it for consistency with min().
All NaTs: return 0
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>

References PyArray_CGT.

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#
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
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 
)

* DOT **

dot means inner product
******************** MAYBE USE CBLAS ****************************
begin repeat <blockquote> name = FLOAT, DOUBLE# #type = npy_float, npy_double# #prefix = s, d#</blockquote>
end repeat*
begin repeat <blockquote> name = CFLOAT, CDOUBLE# #ctype = npy_cfloat, npy_cdouble# #type = npy_float, npy_double# #prefix = c, z#</blockquote>
begin repeat <blockquote>

name = 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#
#out = npy_long, npy_ulong, npy_long, npy_ulong, npy_long, npy_ulong,
npy_long, npy_ulong, npy_longlong, npy_ulonglong, npy_longdouble, npy_datetime, npy_timedelta#

</blockquote>

<

could make this double
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>
Visual Studio 2015 loop vectorizer handles NaN in an unexpected manner, see: https://github.com/numpy/numpy/issues/7601
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>

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

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>

References ArrType_Type, and PyArrayDescr_Type.

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>

References _to_BOOL().

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,
void *  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#
#func = (PyOS_strtol, PyOS_strtoul)*4, npy_strtoll, npy_strtoull,
npy_strtoll*2#
#btype = (npy_long, npy_ulong)*4, npy_longlong, npy_ulonglong,
npy_longlong*2#
end repeat*
begin repeat <blockquote> fname = FLOAT, DOUBLE# #type = npy_float, npy_double#</blockquote>
static PyObject *TYPE _getitem ( void *  input,
void *  vap 
) [static]

* 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().

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# #type = npy_float, npy_double#

References _unaligned_strided_byte_copy().

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,
void *  ov,
void *  vap 
) [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().

static void FROMTYPE _to_BOOL ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  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 _fill().

static void TYPE _to_HALF ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  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>

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 ( void *  input,
void *  output,
npy_intp  n,
void *  vaip,
void *  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>
static int BOOL_argmax ( npy_bool ip,
npy_intp  n,
npy_intp max_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
memcmp like logical_and on i386 is maybe slower for small arrays
static int BOOL_argmin ( npy_bool ip,
npy_intp  n,
npy_intp min_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
end repeat*
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]
end repeat*
********************** NO CBLAS VERSIONS ************************
static int BOOL_fromstr ( char *  str,
void *  ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]

References __ALIGNED, and NPY_COPY_PYOBJECT_PTR.

static int BOOL_scan ( FILE *  fp,
npy_bool ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignore2 
) [static]
end repeat*
static void CLONGDOUBLE_dot ( char *  ip1,
npy_intp  is1,
char *  ip2,
npy_intp  is2,
char *  op,
npy_intp  n,
void *  NPY_UNUSEDignore 
) [static]
static PyObject* CLONGDOUBLE_getitem ( void *  ip,
void *  ap 
) [static]
static void CLONGDOUBLE_to_HALF ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  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 ( void *  ip,
void *  vap 
) [static]
Get the datetime units metadata
static int DATETIME_setitem ( PyObject *  op,
void *  ov,
void *  vap 
) [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,
void *  ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]
static int HALF_scan ( FILE *  fp,
npy_half ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignored 
) [static]
static void HALF_to_BOOL ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  NPY_UNUSEDaop 
) [static]
end repeat*
static void HALF_to_CLONGDOUBLE ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  NPY_UNUSEDaop 
) [static]
Initializes the c_metadata field for the _builtin_descrs DATETIME and TIMEDELTA.
must not be static, gcc 4.1.2 on redhat 5 then miscompiles this function see gh-5163
Allocate memory for the metadata
Initialize the base aux data
Set to the default metadata
static int LONGDOUBLE_fromstr ( char *  str,
void *  ip,
char **  endptr,
PyArray_Descr NPY_UNUSEDignore 
) [static]
end repeat*
static PyObject* LONGDOUBLE_getitem ( void *  ip,
void *  ap 
) [static]
These return array scalars which are different than other date-types.
static int LONGDOUBLE_scan ( FILE *  fp,
npy_longdouble ip,
void *  NPY_UNUSEDignore,
PyArray_Descr NPY_UNUSEDignored 
) [static]
end repeat*

References _unaligned_strided_byte_copy().

static int LONGDOUBLE_setitem ( PyObject *  op,
void *  ov,
void *  vap 
) [static]
ensure alignment
In case something funny happened in PyArray_IsScalar
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 npy_longlong npy_strtoll ( const char *  str,
char **  endptr,
int  base 
) [static]
end repeat*
ok on 64 bit posix
static npy_ulonglong npy_strtoull ( const char *  str,
char **  endptr,
int  base 
) [static]
ok on 64 bit posix

References PyArray_DESCR, PyArray_ISBEHAVED_RO, and PyArray_ISNOTSWAPPED.

static int OBJECT_argmax ( PyObject **  ip,
npy_intp  n,
npy_intp max_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
end repeat*
Skip over all leading NULL entries
Found first non-NULL entry
static int OBJECT_argmin ( PyObject **  ip,
npy_intp  n,
npy_intp min_ind,
PyArrayObject NPY_UNUSEDaip 
) [static]
Skip over all leading NULL entries
Found first non-NULL entry
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,
npy_intp  dstride,
PyObject **  src,
npy_intp  sstride,
npy_intp  n,
int   NPY_UNUSEDswap,
void *  NPY_UNUSEDarr 
) [static]
end repeat*
ignore swap
static void OBJECT_dot ( char *  ip1,
npy_intp  is1,
char *  ip2,
npy_intp  is2,
char *  op,
npy_intp  n,
void *  NPY_UNUSEDignore 
) [static]
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.
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
static PyObject* OBJECT_getitem ( void *  ip,
void *  NPY_UNUSEDap 
) [static]
static npy_bool OBJECT_nonzero ( PyObject **  ip,
PyArrayObject ap 
) [static]
static int OBJECT_setitem ( PyObject *  op,
void *  ov,
void *  NPY_UNUSEDap 
) [static]

References PyArray_Dims::ptr, and PyDimMem_FREE.

static npy_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
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_subscript().

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#
System Message: WARNING/2 (<string>, line 9) Definition list ends without a blank line; unexpected unindent.
#num = 1, 1, 1, 1, 2, 2, 2# </blockquote>
end repeat*
NPY_NO_EXPORT int small_correlate ( const char *  d_,
npy_intp  dstride,
npy_intp  nd,
enum NPY_TYPES  dtype,
const char *  k_,
npy_intp  kstride,
npy_intp  nk,
enum NPY_TYPES  ktype,
char *  out_,
npy_intp  ostride 
)

* small correlate **

Compute correlation of data with with small kernels Calling a BLAS dot product for the inner loop of the correlation is overkill for small kernels. It is faster to compute it directly. Intended to be used by _pyarray_correlate so no input verifications is done especially it does not handle the boundaries, they should be handled by the caller. Returns 0 if kernel is considered too large or types are not supported, then the regular array dot should be used to process the data.

d_, dstride, nd, dtype: data pointer, its stride in bytes, number of
elements and type of data
k_, kstride, nk, ktype: kernel pointer, its stride in bytes, number of
elements and type of data
System Message: WARNING/2 (<string>, line 14) Definition list ends without a blank line; unexpected unindent.
out_, ostride: output data pointer and its stride in bytes

Docutils System Messages

System Message: ERROR/3 (<string>, line 10); backlink Unknown target name: "d".
System Message: ERROR/3 (<string>, line 12); backlink Unknown target name: "k".
System Message: ERROR/3 (<string>, line 14); backlink Unknown target name: "out".
only handle small kernels and uniform types
begin repeat
Float types
#type = npy_float, npy_double# TYPE = NPY_FLOAT, NPY_DOUBLE#
unroll inner loop to optimize register usage of the kernel
begin repeat1
#ksz_outer = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11#
begin repeat2
#ksz = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11#
load kernel
end repeat2*
begin repeat2
#ksz = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11#
end repeat2*
end repeat1*
end repeat*

References SETTYPE.

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 ( void *  ip,
void *  vap 
) [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]
static int STRING_setitem ( PyObject *  op,
void *  ov,
void *  vap 
) [static]
Handle case of assigning from an array scalar
If string length is smaller than room in array Then fill the rest of the element size with NULL
static NPY_INLINE npy_longdouble string_to_long_double ( PyObject *  op) [static]
end repeat*
Probably wasn't a string, try converting it via a python double
static PyObject* TIMEDELTA_getitem ( void *  ip,
void *  vap 
) [static]
Get the datetime units metadata
static int TIMEDELTA_setitem ( PyObject *  op,
void *  ov,
void *  vap 
) [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 ( void *  input,
void *  output,
npy_intp  n,
void *  vaip,
void *  vaop 
) [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>

References _strided_byte_swap(), and _unaligned_strided_byte_copy().

static void FROMTYPE _to_ TOTYPE ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  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
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#

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#

Referenced by _to_BOOL().

static void OBJECT_to_ TOTYPE ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  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>

References npy_double_to_half(), and NumPyOS_ascii_ftolf().

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 ( void *  input,
void *  output,
npy_intp  n,
void *  NPY_UNUSEDaip,
void *  NPY_UNUSEDaop 
) [static]

References NPY_FALSE.

static int UNICODE_compare ( npy_ucs4 *  ip1,
npy_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,
npy_intp  dstride,
char *  src,
npy_intp  sstride,
npy_intp  n,
int  swap,
PyArrayObject arr 
) [static]
static PyObject* UNICODE_getitem ( void *  ip,
void *  vap 
) [static]
UNICODE
static npy_bool UNICODE_nonzero ( npy_ucs4 *  ip,
PyArrayObject ap 
) [static]
static int UNICODE_setitem ( PyObject *  op,
void *  ov,
void *  vap 
) [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.
descr is the only field checked by compare or copyswap
create buffer and copy
create buffer and copy

References blas_stride(), and NPY_CBLAS_CHUNK.

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 ( void *  input,
void *  vap 
) [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,
void *  input,
void *  vap 
) [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 = |, |, =# #flags = 0, 0, NPY_NEEDS_INIT#

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*1, 1*2# #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
char _letter_to_num[_MAX_LETTER] [static]