numpy 2.0.0
|
Go to the source code of this file.
Defines | |
#define | PyArray_EQUIVALENTLY_ITERABLE(arr1, arr2) |
#define | PyArray_TRIVIALLY_ITERABLE(arr) |
#define | PyArray_PREPARE_TRIVIAL_ITERATION(arr, count, data, stride) |
#define | PyArray_TRIVIALLY_ITERABLE_PAIR(arr1, arr2) |
#define | PyArray_PREPARE_TRIVIAL_PAIR_ITERATION(arr1, arr2, count, data1, data2, stride1, stride2) |
#define | PyArray_TRIVIALLY_ITERABLE_TRIPLE(arr1, arr2, arr3) |
#define | PyArray_PREPARE_TRIVIAL_TRIPLE_ITERATION(arr1, arr2, arr3, count, data1, data2, data3, stride1, stride2, stride3) |
Typedefs | |
typedef void( | PyArray_StridedTransferFn )(char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, void *transferdata) |
Functions | |
NPY_NO_EXPORT void | PyArray_FreeStridedTransferData (void *transferdata) |
NPY_NO_EXPORT void * | PyArray_CopyStridedTransferData (void *transferdata) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedCopyFn (npy_intp aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp itemsize) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedCopySwapFn (npy_intp aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp itemsize) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedCopySwapPairFn (npy_intp aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp itemsize) |
NPY_NO_EXPORT int | PyArray_GetStridedZeroPadCopyFn (int aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp src_itemsize, npy_intp dst_itemsize, PyArray_StridedTransferFn **outstransfer, void **outtransferdata) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedNumericCastFn (npy_intp aligned, npy_intp src_stride, npy_intp dst_stride, int src_type_num, int dst_type_num) |
NPY_NO_EXPORT int | PyArray_GetDTypeTransferFunction (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, PyArray_StridedTransferFn **out_stransfer, void **out_transferdata, int *out_needs_api) |
NPY_NO_EXPORT npy_intp | PyArray_TransferNDimToStrided (npy_intp ndim, char *dst, npy_intp dst_stride, char *src, npy_intp *src_strides, npy_intp src_strides_inc, npy_intp *coords, npy_intp coords_inc, npy_intp *shape, npy_intp shape_inc, npy_intp count, npy_intp src_itemsize, PyArray_StridedTransferFn *stransfer, void *transferdata) |
NPY_NO_EXPORT npy_intp | PyArray_TransferStridedToNDim (npy_intp ndim, char *dst, npy_intp *dst_strides, npy_intp dst_strides_inc, char *src, npy_intp src_stride, npy_intp *coords, npy_intp coords_inc, npy_intp *shape, npy_intp shape_inc, npy_intp count, npy_intp src_itemsize, PyArray_StridedTransferFn *stransfer, void *transferdata) |
#define PyArray_EQUIVALENTLY_ITERABLE | ( | arr1, | |
arr2 | |||
) |
( \ PyArray_NDIM(arr1) == PyArray_NDIM(arr2) && \ PyArray_CompareLists(PyArray_DIMS(arr1), \ PyArray_DIMS(arr2), \ PyArray_NDIM(arr1)) && \ (arr1->flags&(NPY_CONTIGUOUS|NPY_FORTRAN)) == \ (arr2->flags&(NPY_CONTIGUOUS|NPY_FORTRAN)) \ )
<blockquote>
</blockquote>
char *data; npy_intp count, stride;
PyArray_PREPARE_TRIVIAL_ITERATION(self, count, data, stride);
// Use the data pointer
data += stride;
}
<blockquote> Create iterator, etc...</blockquote>
char *data1, *data2; npy_intp count, stride1, stride2;
// Use the data1 and data2 pointers
data1 += stride1; data2 += stride2;
}
<blockquote> Create iterator, etc...</blockquote>
#define PyArray_PREPARE_TRIVIAL_ITERATION | ( | arr, | |
count, | |||
data, | |||
stride | |||
) |
count = PyArray_SIZE(arr), \ data = PyArray_BYTES(arr), \ stride = ((PyArray_NDIM(arr) == 0) ? 0 : \ (PyArray_CHKFLAGS(arr, NPY_FORTRAN) ? \ PyArray_STRIDE(arr, 0) : \ PyArray_STRIDE(arr, \ PyArray_NDIM(arr)-1)))
#define PyArray_PREPARE_TRIVIAL_PAIR_ITERATION | ( | arr1, | |
arr2, | |||
count, | |||
data1, | |||
data2, | |||
stride1, | |||
stride2 | |||
) |
{ \ npy_intp size1 = PyArray_SIZE(arr1); \ npy_intp size2 = PyArray_SIZE(arr2); \ count = ((size1 > size2) || size1 == 0) ? size1 : size2; \ data1 = PyArray_BYTES(arr1); \ data2 = PyArray_BYTES(arr2); \ stride1 = (size1 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr1, NPY_FORTRAN) ? \ PyArray_STRIDE(arr1, 0) : \ PyArray_STRIDE(arr1, \ PyArray_NDIM(arr1)-1))); \ stride2 = (size2 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr2, NPY_FORTRAN) ? \ PyArray_STRIDE(arr2, 0) : \ PyArray_STRIDE(arr2, \ PyArray_NDIM(arr2)-1))); \ }
#define PyArray_PREPARE_TRIVIAL_TRIPLE_ITERATION | ( | arr1, | |
arr2, | |||
arr3, | |||
count, | |||
data1, | |||
data2, | |||
data3, | |||
stride1, | |||
stride2, | |||
stride3 | |||
) |
{ \ npy_intp size1 = PyArray_SIZE(arr1); \ npy_intp size2 = PyArray_SIZE(arr2); \ npy_intp size3 = PyArray_SIZE(arr3); \ count = ((size1 > size2) || size1 == 0) ? size1 : size2; \ count = ((size3 > count) || size3 == 0) ? size3 : count; \ data1 = PyArray_BYTES(arr1); \ data2 = PyArray_BYTES(arr2); \ data3 = PyArray_BYTES(arr3); \ stride1 = (size1 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr1, NPY_FORTRAN) ? \ PyArray_STRIDE(arr1, 0) : \ PyArray_STRIDE(arr1, \ PyArray_NDIM(arr1)-1))); \ stride2 = (size2 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr2, NPY_FORTRAN) ? \ PyArray_STRIDE(arr2, 0) : \ PyArray_STRIDE(arr2, \ PyArray_NDIM(arr2)-1))); \ stride3 = (size3 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr3, NPY_FORTRAN) ? \ PyArray_STRIDE(arr3, 0) : \ PyArray_STRIDE(arr3, \ PyArray_NDIM(arr3)-1))); \ }
#define PyArray_TRIVIALLY_ITERABLE | ( | arr | ) |
( \ PyArray_NDIM(arr) <= 1 || \ PyArray_CHKFLAGS(arr, NPY_CONTIGUOUS) || \ PyArray_CHKFLAGS(arr, NPY_FORTRAN) \ )
#define PyArray_TRIVIALLY_ITERABLE_PAIR | ( | arr1, | |
arr2 | |||
) |
(\ PyArray_TRIVIALLY_ITERABLE(arr1) && \ (PyArray_NDIM(arr2) == 0 || \ PyArray_EQUIVALENTLY_ITERABLE(arr1, arr2) || \ (PyArray_NDIM(arr1) == 0 && \ PyArray_TRIVIALLY_ITERABLE(arr2) \ ) \ ) \ )
#define PyArray_TRIVIALLY_ITERABLE_TRIPLE | ( | arr1, | |
arr2, | |||
arr3 | |||
) |
(\ PyArray_TRIVIALLY_ITERABLE(arr1) && \ ((PyArray_NDIM(arr2) == 0 && \ (PyArray_NDIM(arr3) == 0 || \ PyArray_EQUIVALENTLY_ITERABLE(arr1, arr3) \ ) \ ) || \ (PyArray_EQUIVALENTLY_ITERABLE(arr1, arr2) && \ (PyArray_NDIM(arr3) == 0 || \ PyArray_EQUIVALENTLY_ITERABLE(arr1, arr3) \ ) \ ) || \ (PyArray_NDIM(arr1) == 0 && \ PyArray_TRIVIALLY_ITERABLE(arr2) && \ (PyArray_NDIM(arr3) == 0 || \ PyArray_EQUIVALENTLY_ITERABLE(arr2, arr3) \ ) \ ) \ ) \ )
typedef void( PyArray_StridedTransferFn)(char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, void *transferdata) |
NPY_NO_EXPORT void* PyArray_CopyStridedTransferData | ( | void * | transferdata | ) |
NPY_NO_EXPORT void PyArray_FreeStridedTransferData | ( | void * | transferdata | ) |
Referenced by _field_transfer_data_copy(), _n_to_n_data_free(), and get_subarray_transfer_function().
NPY_NO_EXPORT int PyArray_GetDTypeTransferFunction | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
PyArray_Descr * | src_dtype, | ||
PyArray_Descr * | dst_dtype, | ||
int | move_references, | ||
PyArray_StridedTransferFn ** | out_stransfer, | ||
void ** | out_transferdata, | ||
int * | out_needs_api | ||
) |
PyArray_FreeStridedTransferData
function when the transfer function is no longer required.
PyArray_FreeStridedTransferData
on this data. Referenced by _strided_to_strided_subarray_broadcast_withrefs(), and get_n_to_n_transfer_function().
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedCopyFn | ( | npy_intp | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | itemsize | ||
) |
<
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedCopySwapFn | ( | npy_intp | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | itemsize | ||
) |
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedCopySwapPairFn | ( | npy_intp | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | itemsize | ||
) |
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedNumericCastFn | ( | npy_intp | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
int | src_type_num, | ||
int | dst_type_num | ||
) |
</blockquote>
</blockquote>
NPY_NO_EXPORT int PyArray_GetStridedZeroPadCopyFn | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | src_itemsize, | ||
npy_intp | dst_itemsize, | ||
PyArray_StridedTransferFn ** | outstransfer, | ||
void ** | outtransferdata | ||
) |
NPY_NO_EXPORT npy_intp PyArray_TransferNDimToStrided | ( | npy_intp | ndim, |
char * | dst, | ||
npy_intp | dst_stride, | ||
char * | src, | ||
npy_intp * | src_strides, | ||
npy_intp | src_strides_inc, | ||
npy_intp * | coords, | ||
npy_intp | coords_inc, | ||
npy_intp * | shape, | ||
npy_intp | shape_inc, | ||
npy_intp | count, | ||
npy_intp | src_itemsize, | ||
PyArray_StridedTransferFn * | stransfer, | ||
void * | data | ||
) |
NPY_NO_EXPORT npy_intp PyArray_TransferStridedToNDim | ( | npy_intp | ndim, |
char * | dst, | ||
npy_intp * | dst_strides, | ||
npy_intp | dst_strides_inc, | ||
char * | src, | ||
npy_intp | src_stride, | ||
npy_intp * | coords, | ||
npy_intp | coords_inc, | ||
npy_intp * | shape, | ||
npy_intp | shape_inc, | ||
npy_intp | count, | ||
npy_intp | src_itemsize, | ||
PyArray_StridedTransferFn * | stransfer, | ||
void * | transferdata | ||
) |
Referenced by npyiter_coalesce_axes().