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, NpyAuxData *transferdata) |
typedef void( | PyArray_MaskedStridedTransferFn )(char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_mask *mask, npy_intp mask_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *transferdata) |
Functions | |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedCopyFn (int aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp itemsize) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedCopySwapFn (int aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp itemsize) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedCopySwapPairFn (int 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, NpyAuxData **outtransferdata) |
NPY_NO_EXPORT PyArray_StridedTransferFn * | PyArray_GetStridedNumericCastFn (int aligned, npy_intp src_stride, npy_intp dst_stride, int src_type_num, int dst_type_num) |
NPY_NO_EXPORT int | PyArray_GetDTypeCopySwapFn (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *dtype, PyArray_StridedTransferFn **outstransfer, NpyAuxData **outtransferdata) |
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, NpyAuxData **out_transferdata, int *out_needs_api) |
NPY_NO_EXPORT int | PyArray_GetMaskedDTypeTransferFunction (int aligned, npy_intp src_stride, npy_intp dst_stride, npy_intp mask_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, PyArray_Descr *mask_dtype, int move_references, PyArray_MaskedStridedTransferFn **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api) |
NPY_NO_EXPORT int | PyArray_CastRawArrays (npy_intp count, char *src, char *dst, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references) |
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, NpyAuxData *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, NpyAuxData *transferdata) |
NPY_NO_EXPORT npy_intp | PyArray_TransferMaskedStridedToNDim (npy_intp ndim, char *dst, npy_intp *dst_strides, npy_intp dst_strides_inc, char *src, npy_intp src_stride, npy_mask *mask, npy_intp mask_stride, npy_intp *coords, npy_intp coords_inc, npy_intp *shape, npy_intp shape_inc, npy_intp count, npy_intp src_itemsize, PyArray_MaskedStridedTransferFn *stransfer, NpyAuxData *data) |
#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_ARRAY_C_CONTIGUOUS| \ NPY_ARRAY_F_CONTIGUOUS)) == \ (arr2->flags&(NPY_ARRAY_C_CONTIGUOUS| \ NPY_ARRAY_F_CONTIGUOUS)) \ )
<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_ARRAY_F_CONTIGUOUS) ? \ 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_ARRAY_F_CONTIGUOUS) ? \ PyArray_STRIDE(arr1, 0) : \ PyArray_STRIDE(arr1, \ PyArray_NDIM(arr1)-1))); \ stride2 = (size2 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr2, NPY_ARRAY_F_CONTIGUOUS) ? \ 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_ARRAY_F_CONTIGUOUS) ? \ PyArray_STRIDE(arr1, 0) : \ PyArray_STRIDE(arr1, \ PyArray_NDIM(arr1)-1))); \ stride2 = (size2 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr2, NPY_ARRAY_F_CONTIGUOUS) ? \ PyArray_STRIDE(arr2, 0) : \ PyArray_STRIDE(arr2, \ PyArray_NDIM(arr2)-1))); \ stride3 = (size3 == 1 ? 0 : \ (PyArray_CHKFLAGS(arr3, NPY_ARRAY_F_CONTIGUOUS) ? \ PyArray_STRIDE(arr3, 0) : \ PyArray_STRIDE(arr3, \ PyArray_NDIM(arr3)-1))); \ }
#define PyArray_TRIVIALLY_ITERABLE | ( | arr | ) |
( \ PyArray_NDIM(arr) <= 1 || \ PyArray_CHKFLAGS(arr, NPY_ARRAY_C_CONTIGUOUS) || \ PyArray_CHKFLAGS(arr, NPY_ARRAY_F_CONTIGUOUS) \ )
#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_MaskedStridedTransferFn)(char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_mask *mask, npy_intp mask_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *transferdata) |
typedef void( PyArray_StridedTransferFn)(char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *transferdata) |
NPY_NO_EXPORT int PyArray_CastRawArrays | ( | npy_intp | count, |
char * | src, | ||
char * | dst, | ||
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
PyArray_Descr * | src_dtype, | ||
PyArray_Descr * | dst_dtype, | ||
int | move_references | ||
) |
NPY_NO_EXPORT int PyArray_GetDTypeCopySwapFn | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
PyArray_Descr * | dtype, | ||
PyArray_StridedTransferFn ** | outstransfer, | ||
NpyAuxData ** | outtransferdata | ||
) |
Referenced by get_nbo_cast_transfer_function(), and get_nbo_datetime_to_string_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, | ||
NpyAuxData ** | 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_one_to_n_with_finish(), and get_nbo_datetime_to_string_transfer_function().
NPY_NO_EXPORT int PyArray_GetMaskedDTypeTransferFunction | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | mask_stride, | ||
PyArray_Descr * | src_dtype, | ||
PyArray_Descr * | dst_dtype, | ||
PyArray_Descr * | mask_dtype, | ||
int | move_references, | ||
PyArray_MaskedStridedTransferFn ** | out_stransfer, | ||
NpyAuxData ** | out_transferdata, | ||
int * | out_needs_api | ||
) |
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedCopyFn | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | itemsize | ||
) |
<
Referenced by _null_to_strided_set_bool_one().
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedCopySwapFn | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | itemsize | ||
) |
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedCopySwapPairFn | ( | int | aligned, |
npy_intp | src_stride, | ||
npy_intp | dst_stride, | ||
npy_intp | itemsize | ||
) |
NPY_NO_EXPORT PyArray_StridedTransferFn* PyArray_GetStridedNumericCastFn | ( | int | 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, | ||
NpyAuxData ** | outtransferdata | ||
) |
NPY_NO_EXPORT npy_intp PyArray_TransferMaskedStridedToNDim | ( | npy_intp | ndim, |
char * | dst, | ||
npy_intp * | dst_strides, | ||
npy_intp | dst_strides_inc, | ||
char * | src, | ||
npy_intp | src_stride, | ||
npy_uint8 * | mask, | ||
npy_intp | mask_stride, | ||
npy_intp * | coords, | ||
npy_intp | coords_inc, | ||
npy_intp * | shape, | ||
npy_intp | shape_inc, | ||
npy_intp | count, | ||
npy_intp | src_itemsize, | ||
PyArray_MaskedStridedTransferFn * | stransfer, | ||
NpyAuxData * | data | ||
) |
Referenced by npyiter_coalesce_axes().
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, | ||
NpyAuxData * | 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, | ||
NpyAuxData * | data | ||
) |