numpy
2.0.0
|
#include <Python.h>
#include "structmember.h"
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_config.h"
#include "npy_pycompat.h"
#include "common.h"
#include "number.h"
#include "usertypes.h"
#include "arraytypes.h"
#include "scalartypes.h"
#include "arrayobject.h"
#include "ctors.h"
#include "methods.h"
#include "descriptor.h"
#include "iterators.h"
#include "mapping.h"
#include "getset.h"
#include "sequence.h"
#include "buffer.h"
#include "array_assign.h"
#include "alloc.h"
#include "mem_overlap.h"
#include "numpyos.h"
Defines | |
#define | PY_SSIZE_T_CLEAN |
#define | NPY_NO_DEPRECATED_API NPY_API_VERSION |
#define | _MULTIARRAYMODULE |
#define | CHECK_MEMORY |
#define | SMALL_STRING 2048 |
#define | _rstrip_loop(CMP) |
#define | _reg_loop(CMP) |
Functions | |
NPY_NO_EXPORT npy_intp | PyArray_Size (PyObject *op) |
NPY_NO_EXPORT int | PyArray_SetUpdateIfCopyBase (PyArrayObject *arr, PyArrayObject *base) |
NPY_NO_EXPORT int | PyArray_SetBaseObject (PyArrayObject *arr, PyObject *obj) |
NPY_NO_EXPORT int | PyArray_CopyObject (PyArrayObject *dest, PyObject *src_object) |
NPY_NO_EXPORT int | PyArray_TypeNumFromName (char *str) |
static void | array_dealloc (PyArrayObject *self) |
static char * | extend (char **strp, Py_ssize_t n, Py_ssize_t *maxp) |
static int | dump_data (char **string, Py_ssize_t *n, Py_ssize_t *max_n, char *data, int nd, npy_intp *dimensions, npy_intp *strides, PyArrayObject *self) |
NPY_NO_EXPORT void | PyArray_DebugPrint (PyArrayObject *obj) |
static PyObject * | array_repr_builtin (PyArrayObject *self, int repr) |
NPY_NO_EXPORT void | PyArray_SetStringFunction (PyObject *op, int repr) |
NPY_NO_EXPORT void | PyArray_SetDatetimeParseFunction (PyObject *op) |
static PyObject * | array_repr (PyArrayObject *self) |
static PyObject * | array_str (PyArrayObject *self) |
NPY_NO_EXPORT int | PyArray_CompareUCS4 (npy_ucs4 *s1, npy_ucs4 *s2, size_t len) |
NPY_NO_EXPORT int | PyArray_CompareString (char *s1, char *s2, size_t len) |
NPY_NO_EXPORT int | array_might_be_written (PyArrayObject *obj) |
NPY_NO_EXPORT int | PyArray_FailUnlessWriteable (PyArrayObject *obj, const char *name) |
static int | _myunincmp (npy_ucs4 *s1, npy_ucs4 *s2, int len1, int len2) |
static int | _mystrncmp (char *s1, char *s2, int len1, int len2) |
static void | _rstripw (char *s, int n) |
static void | _unistripw (npy_ucs4 *s, int n) |
static char * | _char_copy_n_strip (char *original, char *temp, int nc) |
static void | _char_release (char *ptr, int nc) |
static char * | _uni_copy_n_strip (char *original, char *temp, int nc) |
static void | _uni_release (char *ptr, int nc) |
static int | _compare_strings (PyArrayObject *result, PyArrayMultiIterObject *multi, int cmp_op, void *func, int rstrip) |
NPY_NO_EXPORT PyObject * | _strings_richcompare (PyArrayObject *self, PyArrayObject *other, int cmp_op, int rstrip) |
static PyObject * | _void_compare (PyArrayObject *self, PyArrayObject *other, int cmp_op) |
NPY_NO_EXPORT PyObject * | array_richcompare (PyArrayObject *self, PyObject *other, int cmp_op) |
NPY_NO_EXPORT int | PyArray_ElementStrides (PyObject *obj) |
NPY_NO_EXPORT npy_bool | PyArray_CheckStrides (int elsize, int nd, npy_intp numbytes, npy_intp offset, npy_intp *dims, npy_intp *newstrides) |
static PyObject * | array_new (PyTypeObject *subtype, PyObject *args, PyObject *kwds) |
static PyObject * | array_iter (PyArrayObject *arr) |
static PyObject * | array_alloc (PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems)) |
static void | array_free (PyObject *v) |
Variables | |
static PyObject * | PyArray_StrFunction = NULL |
static PyObject * | PyArray_ReprFunction = NULL |
NPY_NO_EXPORT PyTypeObject | PyArray_Type |
#define _MULTIARRAYMODULE |
#define _reg_loop | ( | CMP | ) |
{ \ while(size--) { \ val = compfunc((void *)iself->dataptr, \ (void *)iother->dataptr, \ N1, N2); \ *dptr = (val CMP 0); \ PyArray_ITER_NEXT(iself); \ PyArray_ITER_NEXT(iother); \ dptr += 1; \ } \ }
#define _rstrip_loop | ( | CMP | ) |
{ \ void *aptr, *bptr; \ char atemp[SMALL_STRING], btemp[SMALL_STRING]; \ while(size--) { \ aptr = stripfunc(iself->dataptr, atemp, N1); \ if (!aptr) return -1; \ bptr = stripfunc(iother->dataptr, btemp, N2); \ if (!bptr) { \ relfunc(aptr, N1); \ return -1; \ } \ val = compfunc(aptr, bptr, N1, N2); \ *dptr = (val CMP 0); \ PyArray_ITER_NEXT(iself); \ PyArray_ITER_NEXT(iother); \ dptr += 1; \ relfunc(aptr, N1); \ relfunc(bptr, N2); \ } \ }
Referenced by _unistripw().
#define CHECK_MEMORY |
do { \ if (extend(string, *n, max_n) == NULL) { \ ret = -1; \ goto end; \ } \ } while (0)
#define NPY_NO_DEPRECATED_API NPY_API_VERSION |
#define PY_SSIZE_T_CLEAN |
#define SMALL_STRING 2048 |
static char* _char_copy_n_strip | ( | char * | original, |
char * | temp, | ||
int | nc | ||
) | [static] |
Referenced by _mystrncmp().
static void _char_release | ( | char * | ptr, |
int | nc | ||
) | [static] |
References PyArray_DESCR, and PyArray_TYPE.
Referenced by _mystrncmp().
static int _compare_strings | ( | PyArrayObject * | result, |
PyArrayMultiIterObject * | multi, | ||
int | cmp_op, | ||
void * | func, | ||
int | rstrip | ||
) | [static] |
static int _mystrncmp | ( | char * | s1, |
char * | s2, | ||
int | len1, | ||
int | len2 | ||
) | [static] |
<
References _char_copy_n_strip(), _char_release(), _myunincmp(), _uni_copy_n_strip(), _uni_release(), PyArrayIterObject_tag::ao, PyArrayMultiIterObject::iters, PyArray_DATA, PyArray_DESCR, and PyArrayMultiIterObject::size.
static int _myunincmp | ( | npy_ucs4 * | s1, |
npy_ucs4 * | s2, | ||
int | len1, | ||
int | len2 | ||
) | [static] |
References SMALL_STRING.
Referenced by _mystrncmp().
static void _rstripw | ( | char * | s, |
int | n | ||
) | [static] |
<
NPY_NO_EXPORT PyObject* _strings_richcompare | ( | PyArrayObject * | self, |
PyArrayObject * | other, | ||
int | cmp_op, | ||
int | rstrip | ||
) |
<
References dimensions, PyArray_Dims::len, NPY_ANYORDER, NPY_BOOL, NPY_MAXDIMS, PyArray_Dims::ptr, PyArray_DIMS, PyArray_GenericReduceFunction(), PyArray_NDIM, and PyArray_Newshape().
static char* _uni_copy_n_strip | ( | char * | original, |
char * | temp, | ||
int | nc | ||
) | [static] |
Referenced by _mystrncmp().
static void _uni_release | ( | char * | ptr, |
int | nc | ||
) | [static] |
Referenced by _mystrncmp().
static void _unistripw | ( | npy_ucs4 * | s, |
int | n | ||
) | [static] |
static PyObject* _void_compare | ( | PyArrayObject * | self, |
PyArrayObject * | other, | ||
int | cmp_op | ||
) | [static] |
static PyObject* array_alloc | ( | PyTypeObject * | type, |
Py_ssize_t | NPY_UNUSEDnitems | ||
) | [static] |
static void array_dealloc | ( | PyArrayObject * | self | ) | [static] |
<
<
static void array_free | ( | PyObject * | v | ) | [static] |
static PyObject* array_iter | ( | PyArrayObject * | arr | ) | [static] |
NPY_NO_EXPORT int array_might_be_written | ( | PyArrayObject * | obj | ) |
static PyObject* array_new | ( | PyTypeObject * | subtype, |
PyObject * | args, | ||
PyObject * | kwds | ||
) | [static] |
static PyObject* array_repr | ( | PyArrayObject * | self | ) | [static] |
static PyObject* array_repr_builtin | ( | PyArrayObject * | self, |
int | repr | ||
) | [static] |
NPY_NO_EXPORT PyObject* array_richcompare | ( | PyArrayObject * | self, |
PyObject * | other, | ||
int | cmp_op | ||
) |
<blockquote> l = ["a", "b"] assert np.array(l, dtype="S1") == np.array(l, dtype="O")</blockquote>
static PyObject* array_str | ( | PyArrayObject * | self | ) | [static] |
static int dump_data | ( | char ** | string, |
Py_ssize_t * | n, | ||
Py_ssize_t * | max_n, | ||
char * | data, | ||
int | nd, | ||
npy_intp * | dimensions, | ||
npy_intp * | strides, | ||
PyArrayObject * | self | ||
) | [static] |
static char* extend | ( | char ** | strp, |
Py_ssize_t | n, | ||
Py_ssize_t * | maxp | ||
) | [static] |
<
NPY_NO_EXPORT npy_bool PyArray_CheckStrides | ( | int | elsize, |
int | nd, | ||
npy_intp | numbytes, | ||
npy_intp | offset, | ||
npy_intp * | dims, | ||
npy_intp * | newstrides | ||
) |
NPY_NO_EXPORT int PyArray_CompareString | ( | char * | s1, |
char * | s2, | ||
size_t | len | ||
) |
NPY_NO_EXPORT int PyArray_CompareUCS4 | ( | npy_ucs4 * | s1, |
npy_ucs4 * | s2, | ||
size_t | len | ||
) |
NPY_NO_EXPORT int PyArray_CopyObject | ( | PyArrayObject * | dest, |
PyObject * | src_object | ||
) |
Referenced by array_subscript().
NPY_NO_EXPORT void PyArray_DebugPrint | ( | PyArrayObject * | obj | ) |
NPY_NO_EXPORT int PyArray_ElementStrides | ( | PyObject * | obj | ) |
NPY_NO_EXPORT int PyArray_FailUnlessWriteable | ( | PyArrayObject * | obj, |
const char * | name | ||
) |
(and returns -1) if obj is not writeable. It may also do other house-keeping, such as issuing warnings on arrays which are transitioning to become views. Always call this function at some point before writing to an array.
'name' is a name for the array, used to give better error messages. Something like "assignment destination", "output array", or even just "array".
Referenced by _array_from_buffer_3118(), array_imag_get(), array_setfield(), array_subscript(), and map_increment().
NPY_NO_EXPORT int PyArray_SetBaseObject | ( | PyArrayObject * | arr, |
PyObject * | obj | ||
) |
to 'obj'.
Returns 0 on success, -1 on failure.
Referenced by NpyIter_GetShape().
NPY_NO_EXPORT void PyArray_SetDatetimeParseFunction | ( | PyObject * | op | ) |
NPY_NO_EXPORT void PyArray_SetStringFunction | ( | PyObject * | op, |
int | repr | ||
) |
References DEPRECATE_FUTUREWARNING, NPY_ARRAY_WARN_ON_WRITE, PyArray_BASE, PyArray_Check, PyArray_CLEARFLAGS(), and PyArray_FLAGS.
NPY_NO_EXPORT int PyArray_SetUpdateIfCopyBase | ( | PyArrayObject * | arr, |
PyArrayObject * | base | ||
) |
strides, ordering, etc.). This function sets the UPDATEIFCOPY flag and the ->base pointer on 'arr', so that when 'arr' is destructed, it will copy any changes back to 'base'.
Steals a reference to 'base'.
Returns 0 on success, -1 on failure.
NPY_NO_EXPORT npy_intp PyArray_Size | ( | PyObject * | op | ) |
NPY_NO_EXPORT int PyArray_TypeNumFromName | ( | char * | str | ) |
PyObject* PyArray_ReprFunction = NULL [static] |
PyObject* PyArray_StrFunction = NULL [static] |
NPY_NO_EXPORT PyTypeObject PyArray_Type |