numpy  2.0.0
src/multiarray/dtype_transfer.c File Reference
#include "Python.h"
#include "structmember.h"
#include <numpy/arrayobject.h>
#include <numpy/npy_cpu.h>
#include "npy_pycompat.h"
#include "convert_datatype.h"
#include "ctors.h"
#include "_datetime.h"
#include "datetime_strings.h"
#include "shape.h"
#include "lowlevel_strided_loops.h"

Data Structures

struct  _strided_zero_pad_data
struct  _align_wrap_data
struct  _wrap_copy_swap_data
struct  _strided_cast_data
struct  _strided_datetime_cast_data
struct  _one_to_n_data
struct  _n_to_n_data
struct  _subarray_broadcast_offsetrun
struct  _subarray_broadcast_data
struct  _single_field_transfer
struct  _field_transfer_data
struct  _masked_wrapper_transfer_data
struct  _dst_memset_zero_data

Defines

#define PY_SSIZE_T_CLEAN
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define _MULTIARRAYMODULE
#define NPY_LOWLEVEL_BUFFER_BLOCKSIZE   128
#define NPY_DT_DBG_TRACING   0
#define NPY_DT_REF_DBG_TRACING   0
#define NPY_DT_DBG_REFTRACE(msg, ref)

Functions

static int get_decsrcref_transfer_function (int aligned, npy_intp src_stride, PyArray_Descr *src_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static int get_setdstzero_transfer_function (int aligned, npy_intp dst_stride, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
NPY_NO_EXPORT int get_bool_setdstone_transfer_function (npy_intp dst_stride, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *NPY_UNUSED(out_needs_api))
static void _strided_to_strided_move_references (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_copy_references (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static NpyAuxData_strided_zero_pad_data_clone (NpyAuxData *data)
static void _strided_to_strided_zero_pad_copy (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_truncate_copy (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_unicode_copyswap (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
NPY_NO_EXPORT int PyArray_GetStridedZeroPadCopyFn (int aligned, int unicode_swap, npy_intp src_stride, npy_intp dst_stride, npy_intp src_itemsize, npy_intp dst_itemsize, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static void _align_wrap_data_free (NpyAuxData *data)
static NpyAuxData_align_wrap_data_clone (NpyAuxData *data)
static void _strided_to_strided_contig_align_wrap (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_contig_align_wrap_init_dest (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
NPY_NO_EXPORT int wrap_aligned_contig_transfer_function (npy_intp src_itemsize, npy_intp dst_itemsize, PyArray_StridedUnaryOp *tobuffer, NpyAuxData *todata, PyArray_StridedUnaryOp *frombuffer, NpyAuxData *fromdata, PyArray_StridedUnaryOp *wrapped, NpyAuxData *wrappeddata, int init_dest, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static void _wrap_copy_swap_data_free (NpyAuxData *data)
static NpyAuxData_wrap_copy_swap_data_clone (NpyAuxData *data)
static void _strided_to_strided_wrap_copy_swap (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static int wrap_copy_swap_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *dtype, int should_swap, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static void _strided_cast_data_free (NpyAuxData *data)
static NpyAuxData_strided_cast_data_clone (NpyAuxData *data)
static void _aligned_strided_to_strided_cast (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _aligned_strided_to_strided_cast_decref_src (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _aligned_contig_to_contig_cast (char *dst, npy_intp NPY_UNUSED(dst_stride), char *src, npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(itemsize), NpyAuxData *data)
static int get_nbo_cast_numeric_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, int src_type_num, int dst_type_num, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static void _strided_datetime_cast_data_free (NpyAuxData *data)
static NpyAuxData_strided_datetime_cast_data_clone (NpyAuxData *data)
static void _strided_to_strided_datetime_general_cast (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_datetime_cast (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _aligned_strided_to_strided_datetime_cast (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_datetime_to_string (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static void _strided_to_strided_string_to_datetime (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static int get_nbo_cast_datetime_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static int get_nbo_datetime_to_string_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static int get_datetime_to_unicode_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static int get_nbo_string_to_datetime_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static int get_unicode_to_datetime_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static int get_nbo_cast_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api, int *out_needs_wrap)
static int get_cast_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static void _one_to_n_data_free (NpyAuxData *data)
static NpyAuxData_one_to_n_data_clone (NpyAuxData *data)
static void _strided_to_strided_one_to_n (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _strided_to_strided_one_to_n_with_finish (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static int wrap_transfer_function_one_to_n (PyArray_StridedUnaryOp *stransfer_inner, NpyAuxData *data_inner, PyArray_StridedUnaryOp *stransfer_finish_src, NpyAuxData *data_finish_src, npy_intp dst_itemsize, npy_intp N, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static int get_one_to_n_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, npy_intp N, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static void _n_to_n_data_free (NpyAuxData *data)
static NpyAuxData_n_to_n_data_clone (NpyAuxData *data)
static void _strided_to_strided_n_to_n (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *data)
static void _contig_to_contig_n_to_n (char *dst, npy_intp NPY_UNUSED(dst_stride), char *src, npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static int wrap_transfer_function_n_to_n (PyArray_StridedUnaryOp *stransfer_inner, NpyAuxData *data_inner, npy_intp src_stride, npy_intp dst_stride, npy_intp src_itemsize, npy_intp dst_itemsize, npy_intp N, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata)
static int get_n_to_n_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, npy_intp N, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static void _subarray_broadcast_data_free (NpyAuxData *data)
static NpyAuxData_subarray_broadcast_data_clone (NpyAuxData *data)
static void _strided_to_strided_subarray_broadcast (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static void _strided_to_strided_subarray_broadcast_withrefs (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static int get_subarray_broadcast_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, npy_intp src_size, npy_intp dst_size, PyArray_Dims src_shape, PyArray_Dims dst_shape, int move_references, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static int get_subarray_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static void _field_transfer_data_free (NpyAuxData *data)
static NpyAuxData_field_transfer_data_clone (NpyAuxData *data)
static void _strided_to_strided_field_transfer (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static int get_fields_transfer_function (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int move_references, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static int get_decsrcref_fields_transfer_function (int aligned, npy_intp src_stride, PyArray_Descr *src_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static int get_setdestzero_fields_transfer_function (int aligned, npy_intp dst_stride, PyArray_Descr *dst_dtype, PyArray_StridedUnaryOp **out_stransfer, NpyAuxData **out_transferdata, int *out_needs_api)
static void _masked_wrapper_transfer_data_free (NpyAuxData *data)
static NpyAuxData_masked_wrapper_transfer_data_clone (NpyAuxData *data)
static void _strided_masked_wrapper_decsrcref_transfer_function (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_bool *mask, npy_intp mask_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *transferdata)
static void _strided_masked_wrapper_transfer_function (char *dst, npy_intp dst_stride, char *src, npy_intp src_stride, npy_bool *mask, npy_intp mask_stride, npy_intp N, npy_intp src_itemsize, NpyAuxData *transferdata)
static void _null_to_strided_set_bool_one (char *dst, npy_intp dst_stride, char *NPY_UNUSED(src), npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *NPY_UNUSED(data))
static void _null_to_contig_set_bool_one (char *dst, npy_intp NPY_UNUSED(dst_stride), char *NPY_UNUSED(src), npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *NPY_UNUSED(data))
static NpyAuxData_dst_memset_zero_data_clone (NpyAuxData *data)
static void _null_to_strided_memset_zero (char *dst, npy_intp dst_stride, char *NPY_UNUSED(src), npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static void _null_to_contig_memset_zero (char *dst, npy_intp dst_stride, char *NPY_UNUSED(src), npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *data)
static void _null_to_strided_reference_setzero (char *dst, npy_intp dst_stride, char *NPY_UNUSED(src), npy_intp NPY_UNUSED(src_stride), npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *NPY_UNUSED(data))
static void _dec_src_ref_nop (char *NPY_UNUSED(dst), npy_intp NPY_UNUSED(dst_stride), char *NPY_UNUSED(src), npy_intp NPY_UNUSED(src_stride), npy_intp NPY_UNUSED(N), npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *NPY_UNUSED(data))
static void _strided_to_null_dec_src_ref_reference (char *NPY_UNUSED(dst), npy_intp NPY_UNUSED(dst_stride), char *src, npy_intp src_stride, npy_intp N, npy_intp NPY_UNUSED(src_itemsize), NpyAuxData *NPY_UNUSED(data))
NPY_NO_EXPORT int PyArray_GetDTypeCopySwapFn (int aligned, npy_intp src_stride, npy_intp dst_stride, PyArray_Descr *dtype, PyArray_StridedUnaryOp **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_StridedUnaryOp **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_MaskedStridedUnaryOp **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 int PyArray_PrepareOneRawArrayIter (int ndim, npy_intp *shape, char *data, npy_intp *strides, int *out_ndim, npy_intp *out_shape, char **out_data, npy_intp *out_strides)
NPY_NO_EXPORT int PyArray_PrepareTwoRawArrayIter (int ndim, npy_intp *shape, char *dataA, npy_intp *stridesA, char *dataB, npy_intp *stridesB, int *out_ndim, npy_intp *out_shape, char **out_dataA, npy_intp *out_stridesA, char **out_dataB, npy_intp *out_stridesB)
NPY_NO_EXPORT int PyArray_PrepareThreeRawArrayIter (int ndim, npy_intp *shape, char *dataA, npy_intp *stridesA, char *dataB, npy_intp *stridesB, char *dataC, npy_intp *stridesC, int *out_ndim, npy_intp *out_shape, char **out_dataA, npy_intp *out_stridesA, char **out_dataB, npy_intp *out_stridesB, char **out_dataC, npy_intp *out_stridesC)

Define Documentation

#define NPY_DT_DBG_REFTRACE (   msg,
  ref 
)

Referenced by wrap_copy_swap_function().

#define NPY_DT_DBG_TRACING   0
**** PRINTF DEBUG TRACING *********
#define NPY_DT_REF_DBG_TRACING   0
Tracing incref/decref can be very noisy
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION

Function Documentation

static NpyAuxData* _align_wrap_data_clone ( NpyAuxData data) [static]
transfer data copy function
Round up the structure size to 16-byte boundary
Add space for two low level buffers
Allocate the data, and populate it

References NPY_LOWLEVEL_BUFFER_BLOCKSIZE.

static void _aligned_contig_to_contig_cast ( char *  dst,
npy_intp   NPY_UNUSEDdst_stride,
char *  src,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDitemsize,
NpyAuxData data 
) [static]
static void _aligned_strided_to_strided_cast ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _aligned_strided_to_strided_cast_decref_src ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
This one requires src be of type NPY_OBJECT
After casting, decrement the source ref
static void _aligned_strided_to_strided_datetime_cast ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
Apply the scaling
static void _contig_to_contig_n_to_n ( char *  dst,
npy_intp   NPY_UNUSEDdst_stride,
char *  src,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]

References data, NPY_FAIL, and PyArray_malloc.

Referenced by _strided_to_strided_one_to_n().

static void _dec_src_ref_nop ( char *  NPY_UNUSEDdst,
npy_intp   NPY_UNUSEDdst_stride,
char *  NPY_UNUSEDsrc,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp   NPY_UNUSEDN,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData NPY_UNUSEDdata 
) [static]
NOP

References NPY_FAIL.

Referenced by _strided_masked_wrapper_transfer_function().

static NpyAuxData* _dst_memset_zero_data_clone ( NpyAuxData data) [static]
zero-padded data copy function
static NpyAuxData* _field_transfer_data_clone ( NpyAuxData data) [static]
transfer data copy function
Allocate the data and populate it
Copy all the fields transfer data

References NPY_AUXDATA_FREE, NPY_FAIL, and PyArray_free.

static void _field_transfer_data_free ( NpyAuxData data) [static]
transfer data free function
transfer data copy function
Allocate the data and populate it
Clone all the owned auxdata as well
static void _masked_wrapper_transfer_data_free ( NpyAuxData data) [static]
transfer data free function

References NPY_AUXDATA_FREE, and NPY_FAIL.

static NpyAuxData* _n_to_n_data_clone ( NpyAuxData data) [static]
transfer data copy function
Allocate the data, and populate it

References _subarray_broadcast_offsetrun::count, and _subarray_broadcast_offsetrun::offset.

static void _null_to_contig_memset_zero ( char *  dst,
npy_intp  dst_stride,
char *  NPY_UNUSEDsrc,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
static void _null_to_contig_set_bool_one ( char *  dst,
npy_intp   NPY_UNUSEDdst_stride,
char *  NPY_UNUSEDsrc,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData NPY_UNUSEDdata 
) [static]
bool type is one byte, so can just use the char
static void _null_to_strided_memset_zero ( char *  dst,
npy_intp  dst_stride,
char *  NPY_UNUSEDsrc,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
static void _null_to_strided_reference_setzero ( char *  dst,
npy_intp  dst_stride,
char *  NPY_UNUSEDsrc,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData NPY_UNUSEDdata 
) [static]
Release the reference in dst
Set it to zero

References get_subarray_transfer_function().

static void _null_to_strided_set_bool_one ( char *  dst,
npy_intp  dst_stride,
char *  NPY_UNUSEDsrc,
npy_intp   NPY_UNUSEDsrc_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData NPY_UNUSEDdata 
) [static]
******************* DEST BOOL SETONE **************************
bool type is one byte, so can just use the char
static NpyAuxData* _one_to_n_data_clone ( NpyAuxData data) [static]
transfer data copy function
Allocate the data, and populate it
static NpyAuxData* _strided_cast_data_clone ( NpyAuxData data) [static]
strided cast data copy function
static void _strided_cast_data_free ( NpyAuxData data) [static]
strided cast data free function
strided datetime cast data copy function
static void _strided_datetime_cast_data_free ( NpyAuxData data) [static]
strided datetime cast data free function
static void _strided_masked_wrapper_decsrcref_transfer_function ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_bool mask,
npy_intp  mask_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData transferdata 
) [static]
Skip masked values, still calling decsrcref for move_references
Process unmasked values
static void _strided_masked_wrapper_transfer_function ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_bool mask,
npy_intp  mask_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData transferdata 
) [static]
Skip masked values
Process unmasked values

References _dec_src_ref_nop(), _PyArray_Descr::elsize, get_decsrcref_transfer_function(), and NPY_SUCCEED.

static void _strided_to_null_dec_src_ref_reference ( char *  NPY_UNUSEDdst,
npy_intp   NPY_UNUSEDdst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData NPY_UNUSEDdata 
) [static]
Release the reference in src

References NPY_FAIL.

static void _strided_to_strided_contig_align_wrap ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_contig_align_wrap_init_dest ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]

References NPY_FAIL.

static void _strided_to_strided_copy_references ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
Copies references from src to dst
Copy the reference
Claim the reference
Release the reference in dst

References PyArray_malloc.

static void _strided_to_strided_datetime_cast ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
Apply the scaling

Referenced by _strided_to_strided_datetime_to_string().

static void _strided_to_strided_datetime_general_cast ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_datetime_to_string ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
For an error, produce a 'NaT' string
Initialize the destination to all zeros
This may also raise an error, but the caller needs to use PyErr_Occurred().

References _strided_to_strided_datetime_cast().

static void _strided_to_strided_field_transfer ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
Do the transfer a block at a time

References NPY_AUXDATA_FREE, NPY_FAIL, and PyArray_free.

static void _strided_to_strided_move_references ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
********************* COPY REFERENCES **************************
Moves references from src to dst
Release the reference in dst
Move the reference
Set the source reference to NULL
static void _strided_to_strided_n_to_n ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_one_to_n ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_one_to_n_with_finish ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_string_to_datetime ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
Replicating strnlen with memchr, because Mac OS X lacks it
If the string is all full, use the buffer
Otherwise parse the data in place
Convert to the datetime
static void _strided_to_strided_subarray_broadcast ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_subarray_broadcast_withrefs ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_truncate_copy ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_unicode_copyswap ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
Does a strided to strided zero-padded or truncated copy for the case where unicode swapping is needed.
static void _strided_to_strided_wrap_copy_swap ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp   NPY_UNUSEDsrc_itemsize,
NpyAuxData data 
) [static]
static void _strided_to_strided_zero_pad_copy ( char *  dst,
npy_intp  dst_stride,
char *  src,
npy_intp  src_stride,
npy_intp  N,
npy_intp  src_itemsize,
NpyAuxData data 
) [static]
Does a strided to strided zero-padded copy for the case where dst_itemsize > src_itemsize

References npy_bswap4_unaligned().

static NpyAuxData* _strided_zero_pad_data_clone ( NpyAuxData data) [static]
zero-padded data copy function

Referenced by _strided_to_strided_truncate_copy().

transfer data copy function
Allocate the data and populate it
static void _subarray_broadcast_data_free ( NpyAuxData data) [static]
transfer data free function
static NpyAuxData* _wrap_copy_swap_data_clone ( NpyAuxData data) [static]
wrap copy swap data copy function
static void _wrap_copy_swap_data_free ( NpyAuxData data) [static]
wrap copy swap data free function

References _strided_cast_data::aip, and PyArray_malloc.

NPY_NO_EXPORT int get_bool_setdstone_transfer_function ( npy_intp  dst_stride,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  NPY_UNUSEDout_needs_api 
)
Returns a transfer function which sets a boolean type to ones.
Returns NPY_SUCCEED or NPY_FAIL.
Only for the bool type, sets the destination to 1

References get_cast_transfer_function().

static int get_cast_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
int  move_references,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
If all native byte order and doesn't need alignment wrapping, return the function
Otherwise, we have to copy and/or swap to aligned temporaries
Get the copy/swap operation from src
Get the copy/swap operation to dst
Wrap it all up in a new transfer function + data

References data, _PyArray_Descr::elsize, get_decsrcref_transfer_function(), NPY_AUXDATA_FREE, NPY_FAIL, NPY_SUCCEED, PyArray_GetDTypeTransferFunction(), PyDataType_REFCHK, and wrap_transfer_function_one_to_n().

Referenced by get_bool_setdstone_transfer_function().

static int get_datetime_to_unicode_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Get an ASCII string data type, adapted to match the UNICODE one
Get the copy/swap operation to dst
Get the NBO datetime to string aligned contig function
Get the cast operation to dst
Wrap it all up in a new transfer function + data

References NPY_AUXDATA_FREE, and NPY_FAIL.

static int get_decsrcref_fields_transfer_function ( int  aligned,
npy_intp  src_stride,
PyArray_Descr src_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Allocate the data and populate it
NPY_NO_EXPORT int get_decsrcref_transfer_function ( int  aligned,
npy_intp  src_stride,
PyArray_Descr src_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
System Message: ERROR/3 (<string>, line 1) Document or section may not begin with a transition.

System Message: ERROR/3 (<string>, line 1) Document may not end with a transition.
Returns a transfer function which DECREFs any references in src_type.
Returns NPY_SUCCEED or NPY_FAIL.
If there are no references, it's a nop
If it's a single reference, it's one decref
If there are subarrays, need to wrap it
Get a function for contiguous src of the subarray type
If there are fields, need to do each field

References data, NPY_MAXDIMS, npy_stride_sort_item::perm, and PyArray_CreateSortedStridePerm().

Referenced by _strided_masked_wrapper_transfer_function(), and get_cast_transfer_function().

static int get_fields_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
int  move_references,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Handles fields transfer. To call this, at least one of the dtypes must have fields
Copy the src value to all the fields of dst
Allocate the data and populate it
If the references should be removed from src, add another transfer function to do that.
Copy the value of the first field to dst
If DECREF is needed on source fields, may need to process all the fields
Allocate the data and populate it
Special case bool type, the existence of fields implies True

TODO: Perhaps a better behavior would be to combine all the
input fields with an OR? The same would apply to subarrays.
If the src field has references, may need to clear them
Transfer the first field to the output
If the references should be removed from src, add more transfer functions to decrement the references for all the other fields.
Match up the fields to copy
Keeps track of the names we already used
2016-09-19, 1.12 Warn if the field names of the dst and src are not identical, since then behavior will change in 1.13.
If DECREF is needed on source fields, will need to also go through its fields.
Allocate the data and populate it
Use field_count to track additional functions added
static int get_n_to_n_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
int  move_references,
npy_intp  N,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
src_stride and dst_stride are set to contiguous, because subarrays are always contiguous.

References _subarray_broadcast_data::data, _subarray_broadcast_data::data_decsrcref, NPY_AUXDATA_FREE, NPY_FAIL, and PyArray_free.

static int get_nbo_cast_datetime_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
) [static]
Assumes src_dtype and dst_dtype are both datetimes or both timedeltas
Allocate the data for the casting
Special case the datetime (but not timedelta) with the nonlinear units (years and months). For timedelta, an average years and months value is used.
static int get_nbo_cast_numeric_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
int  src_type_num,
int  dst_type_num,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
) [static]
Emit a warning if complex imaginary is being cast away

References _strided_datetime_cast_data::denom, NPY_DATETIME_NAT, and _strided_datetime_cast_data::num.

static int get_nbo_cast_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
int  move_references,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api,
int *  out_needs_wrap 
) [static]
A parameterized type, datetime->datetime sometimes needs casting
Datetime <-> string conversions can be handled specially. The functions may raise an error if the strings have no space, or can't be parsed properly.
Check the data types whose casting functions use API calls
Get the cast function
Allocate the data for the casting
TODO: This is a hack so the cast functions have an array.
The cast functions shouldn't need that. Also, since we always handle byte order conversions, this array should have native byte order.
TODO: This is a hack so the cast functions have an array.
The cast functions shouldn't need that. Also, since we always handle byte order conversions, this array should have native byte order.
If it's aligned and all native byte order, we're all done
Use the contig version if the strides are contiguous or we're telling the caller to wrap the return, because the wrapping uses a contiguous buffer.
static int get_nbo_string_to_datetime_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
) [static]
static int get_one_to_n_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
int  move_references,
npy_intp  N,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
move_references is set to 0, handled in the wrapping transfer fn, src_stride is set to zero, because its 1 to N copying, and dst_stride is set to contiguous, because subarrays are always contiguous.
If the src object will need a DECREF, set src_dtype
static int get_setdestzero_fields_transfer_function ( int  aligned,
npy_intp  dst_stride,
PyArray_Descr dst_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Allocate the data and populate it
NPY_NO_EXPORT int get_setdstzero_transfer_function ( int  aligned,
npy_intp  dst_stride,
PyArray_Descr dst_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Returns a transfer function which zeros out the dest values.
Returns NPY_SUCCEED or NPY_FAIL.
If there are no references, just set the whole thing to zero
If it's exactly one reference, use the decref function
If there are subarrays, need to wrap it
Get a function for contiguous dst of the subarray type
If there are fields, need to do each field
static int get_subarray_broadcast_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
npy_intp  src_size,
npy_intp  dst_size,
PyArray_Dims  src_shape,
PyArray_Dims  dst_shape,
int  move_references,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Allocate the data and populate it
move_references is set to 0, handled in the wrapping transfer fn, src_stride and dst_stride are set to contiguous, as N will always be 1 when it's called.
If the src object will need a DECREF
If the dst object needs a DECREF to set it to NULL
Calculate the broadcasting and set the offsets
Get the dst coord of this index for dimension i
Translate it into a src coord and update src_index
Out of bounds, flag with -1
Set the offset
Run-length encode the result
Stop the run when there's a valid index again
Stop the run when there's a valid index again
Multiply all the offsets by the src item size

References NPY_AUXDATA_FREE.

static int get_subarray_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
int  move_references,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Handles subarray transfer. To call this, at least one of the dtype's subarrays must be non-NULL
Get the subarray shapes and sizes
Just a straight one-element copy.
Copy the src value to all the dst values
If the shapes match exactly, do an n to n copy
Copy the subarray with broadcasting, truncating, and zero-padding as necessary.

Referenced by _null_to_strided_reference_setzero().

static int get_unicode_to_datetime_transfer_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr src_dtype,
PyArray_Descr dst_dtype,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
) [static]
Get an ASCII string data type, adapted to match the UNICODE one
Get the cast operation from src
Get the string to NBO datetime aligned contig function
Get the copy/swap operation to dst
Wrap it all up in a new transfer function + data

Referenced by get_nbo_string_to_datetime_transfer_function().

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 
)
Casts the specified number of elements from 'src' with data type 'src_dtype' to 'dst' with 'dst_dtype'. See PyArray_GetDTypeTransferFunction for more details.
Returns NPY_SUCCEED or NPY_FAIL.
Make sure the copy is reasonable
Check data alignment
Get the function to do the casting
Cast
Cleanup
If needs_api was set to 1, it may have raised a Python exception
NPY_NO_EXPORT int PyArray_GetDTypeCopySwapFn ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr dtype,
PyArray_StridedUnaryOp **  outstransfer,
NpyAuxData **  outtransferdata 
)
*************** DTYPE COPY SWAP FUNCTION ******************
If it's a custom data type, wrap its copy swap function
A straight copy
If it's not complex, one swap
If complex, a paired swap

Referenced by 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_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
)
*************** MAIN DTYPE TRANSFER FUNCTION ******************
If one of the dtypes is NULL, we give back either a src decref function or a dst setzero function
Common special case - number -> number NBO cast
If there are no references and the data types are equivalent, return a simple copy
We can't pass through the aligned flag because it's not appropriate. Consider a size-8 string, it will say it's aligned because strings only need alignment 1, but the copy function wants to know if it's alignment 8.

TODO: Change align from a flag to a "best power of 2 alignment"
which holds the strongest alignment value for all the data which will be used.
First look at the possibilities of just a copy or swap
A custom data type requires that we use its copy/swap
If the sizes and kinds are identical, but they're different custom types, then get a cast function
The special types, which have no or subelement byte-order
Wrap the copy swap function when swapping is necessary
This is a straight copy
This is a straight copy + byte swap
This is a straight copy + element pair byte swap
Handle subarrays
Handle fields
Check for different-sized strings, unicodes, or voids
Otherwise a cast is necessary

Referenced by _strided_to_strided_one_to_n_with_finish(), get_cast_transfer_function(), get_nbo_datetime_to_string_transfer_function(), raw_array_assign_array(), and raw_array_assign_scalar().

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_MaskedStridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata,
int *  out_needs_api 
)
This is identical to PyArray_GetDTypeTransferFunction, but returns a transfer function which also takes a mask as a parameter. The mask is used to determine which values to copy, and data is transfered exactly when mask[i*mask_stride] is true.
If move_references is true, values which are not copied to the destination will still have their source reference decremented.
If mask_dtype is NPY_BOOL or NPY_UINT8, each full element is either transferred or not according to the mask as described above. If dst_dtype and mask_dtype are both struct dtypes, their names must match exactly, and the dtype of each leaf field in mask_dtype must be either NPY_BOOL or NPY_UINT8.
TODO: Add struct-based mask_dtype support later
TODO: Special case some important cases so they're fast
Fall back to wrapping a non-masked transfer function
Create the wrapper function's auxdata
Fill in the auxdata object
If the src object will need a DECREF, get a function to handle that
NPY_NO_EXPORT int PyArray_GetStridedZeroPadCopyFn ( int  aligned,
int  unicode_swap,
npy_intp  src_stride,
npy_intp  dst_stride,
npy_intp  src_itemsize,
npy_intp  dst_itemsize,
PyArray_StridedUnaryOp **  outstransfer,
NpyAuxData **  outtransferdata 
)
Gives back a transfer function and transfer data pair which copies the data from source to dest, truncating it if the data doesn't fit, and padding with zero bytes if there's too much space.
For information on the 'aligned', 'src_stride' and 'dst_stride' parameters see above.
Returns NPY_SUCCEED or NPY_FAIL
NPY_NO_EXPORT int PyArray_PrepareOneRawArrayIter ( int  ndim,
npy_intp shape,
char *  data,
npy_intp strides,
int *  out_ndim,
npy_intp out_shape,
char **  out_data,
npy_intp out_strides 
)
Prepares shape and strides for a simple raw array iteration. This sorts the strides into FORTRAN order, reverses any negative strides, then coalesces axes where possible. The results are filled in the output parameters.
This is intended for simple, lightweight iteration over arrays where no buffering of any kind is needed, and the array may not be stored as a PyArrayObject.
The arrays shape, out_shape, strides, and out_strides must all point to different data.
Returns 0 on success, -1 on failure.
Special case 0 and 1 dimensions
Always make a positive stride
Sort the axes based on the destination strides
Reverse any negative strides
Detect 0-size arrays here
Coalesce any dimensions where possible
Drop axis i
Drop axis j
Coalesce axes i and j
Can't coalesce, go to next i

Referenced by raw_array_assign_scalar().

NPY_NO_EXPORT int PyArray_PrepareThreeRawArrayIter ( int  ndim,
npy_intp shape,
char *  dataA,
npy_intp stridesA,
char *  dataB,
npy_intp stridesB,
char *  dataC,
npy_intp stridesC,
int *  out_ndim,
npy_intp out_shape,
char **  out_dataA,
npy_intp out_stridesA,
char **  out_dataB,
npy_intp out_stridesB,
char **  out_dataC,
npy_intp out_stridesC 
)
The same as PyArray_PrepareOneRawArrayIter, but for three operands instead of one. Any broadcasting of the three operands should have already been done before calling this function, as the ndim and shape is only specified once for all operands.
Only the strides of the first operand are used to reorder the dimensions, no attempt to consider all the strides together is made, as is done in the NpyIter object.
You can use this together with NPY_RAW_ITER_START and NPY_RAW_ITER_THREE_NEXT to handle the looping boilerplate of everything but the innermost loop (which is for idim == 0).
Returns 0 on success, -1 on failure.
Special case 0 and 1 dimensions
Always make a positive stride for the first operand
Sort the axes based on the destination strides
Reverse any negative strides of operand A
Detect 0-size arrays here
Coalesce any dimensions where possible
Drop axis i
Drop axis j
Coalesce axes i and j
Can't coalesce, go to next i
NPY_NO_EXPORT int PyArray_PrepareTwoRawArrayIter ( int  ndim,
npy_intp shape,
char *  dataA,
npy_intp stridesA,
char *  dataB,
npy_intp stridesB,
int *  out_ndim,
npy_intp out_shape,
char **  out_dataA,
npy_intp out_stridesA,
char **  out_dataB,
npy_intp out_stridesB 
)
The same as PyArray_PrepareOneRawArrayIter, but for two operands instead of one. Any broadcasting of the two operands should have already been done before calling this function, as the ndim and shape is only specified once for both operands.
Only the strides of the first operand are used to reorder the dimensions, no attempt to consider all the strides together is made, as is done in the NpyIter object.
You can use this together with NPY_RAW_ITER_START and NPY_RAW_ITER_TWO_NEXT to handle the looping boilerplate of everything but the innermost loop (which is for idim == 0).
Returns 0 on success, -1 on failure.
Special case 0 and 1 dimensions
Always make a positive stride for the first operand
Sort the axes based on the destination strides
Reverse any negative strides of operand A
Detect 0-size arrays here
Coalesce any dimensions where possible
Drop axis i
Drop axis j
Coalesce axes i and j
Can't coalesce, go to next i

Referenced by raw_array_assign_array().

NPY_NO_EXPORT int wrap_aligned_contig_transfer_function ( npy_intp  src_itemsize,
npy_intp  dst_itemsize,
PyArray_StridedUnaryOp tobuffer,
NpyAuxData todata,
PyArray_StridedUnaryOp frombuffer,
NpyAuxData fromdata,
PyArray_StridedUnaryOp wrapped,
NpyAuxData wrappeddata,
int  init_dest,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
)
Wraps an aligned contig to contig transfer function between either copies or byte swaps to temporary buffers.
src_itemsize/dst_itemsize - The sizes of the src and dst datatypes. tobuffer - copy/swap function from src to an aligned contiguous buffer. todata - data for tobuffer frombuffer - copy/swap function from an aligned contiguous buffer to dst. fromdata - data for frombuffer wrapped - contig to contig transfer function being wrapped wrappeddata - data for wrapped init_dest - 1 means to memset the dest buffer to 0 before calling wrapped.
Returns NPY_SUCCEED or NPY_FAIL.
Round up the structure size to 16-byte boundary
Add space for two low level buffers
Allocate the data, and populate it
Set the function and data

Referenced by get_nbo_datetime_to_string_transfer_function().

static int wrap_copy_swap_function ( int  aligned,
npy_intp  src_stride,
npy_intp  dst_stride,
PyArray_Descr dtype,
int  should_swap,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
) [static]
This only gets used for custom data types and for Unicode when swapping
Allocate the data for the copy swap
TODO: This is a hack so the copyswap functions have an array.
The copyswap functions shouldn't need that.

References NPY_COPY_PYOBJECT_PTR, and NPY_DT_DBG_REFTRACE.

static int wrap_transfer_function_n_to_n ( PyArray_StridedUnaryOp stransfer_inner,
NpyAuxData data_inner,
npy_intp  src_stride,
npy_intp  dst_stride,
npy_intp  src_itemsize,
npy_intp  dst_itemsize,
npy_intp  N,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
) [static]
Wraps a transfer function to produce one that copies N contiguous elements of src to N contiguous elements of dst.
If the N subarray elements exactly fit in the strides, then can do a faster contiguous transfer.

References NPY_FAIL, and PyArray_free.

Referenced by _strided_to_strided_one_to_n_with_finish().

static int wrap_transfer_function_one_to_n ( PyArray_StridedUnaryOp stransfer_inner,
NpyAuxData data_inner,
PyArray_StridedUnaryOp stransfer_finish_src,
NpyAuxData data_finish_src,
npy_intp  dst_itemsize,
npy_intp  N,
PyArray_StridedUnaryOp **  out_stransfer,
NpyAuxData **  out_transferdata 
) [static]
Wraps a transfer function to produce one that copies one element of src to N contiguous elements of dst. If stransfer_finish_src is not NULL, it should be a transfer function which just affects src, for example to do a final DECREF operation for references.

Referenced by get_cast_transfer_function().