NumCpp  2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::pybindInterface Namespace Reference

Typedefs

template<typename dtype >
using pbArray = pybind11::array_t< dtype, pybind11::array::c_style >
 
using pbArrayGeneric = pybind11::array
 

Enumerations

enum  ReturnPolicy { ReturnPolicy::COPY, ReturnPolicy::REFERENCE, ReturnPolicy::TAKE_OWNERSHIP }
 Enum for the pybind array return policy. More...
 

Functions

template<typename dtype >
pbArrayGeneric nc2pybind (const NdArray< dtype > &inArray)
 
template<typename dtype >
pbArrayGeneric nc2pybind (NdArray< dtype > &inArray, ReturnPolicy returnPolicy)
 
template<typename dtype >
NdArray< dtype > pybind2nc (pbArray< dtype > &numpyArray)
 
template<typename dtype >
NdArray< dtype > pybind2nc_copy (const pbArray< dtype > &numpyArray)
 

Variables

static const std::map< ReturnPolicy, std::string > returnPolicyStringMap
 

Typedef Documentation

◆ pbArray

template<typename dtype >
using nc::pybindInterface::pbArray = typedef pybind11::array_t<dtype, pybind11::array::c_style>

◆ pbArrayGeneric

using nc::pybindInterface::pbArrayGeneric = typedef pybind11::array

Enumeration Type Documentation

◆ ReturnPolicy

Enum for the pybind array return policy.

Enumerator
COPY 
REFERENCE 
TAKE_OWNERSHIP 

Function Documentation

◆ nc2pybind() [1/2]

template<typename dtype >
pbArrayGeneric nc::pybindInterface::nc2pybind ( const NdArray< dtype > &  inArray)

converts a numcpp NdArray to numpy array using pybind bindings

Parameters
inArraythe input array
Returns
pybind11::array_t

◆ nc2pybind() [2/2]

template<typename dtype >
pbArrayGeneric nc::pybindInterface::nc2pybind ( NdArray< dtype > &  inArray,
ReturnPolicy  returnPolicy 
)

converts a numcpp NdArray to numpy array using pybind bindings

Parameters
inArraythe input array
returnPolicythe return policy
Returns
pybind11::array_t

◆ pybind2nc()

template<typename dtype >
NdArray<dtype> nc::pybindInterface::pybind2nc ( pbArray< dtype > &  numpyArray)

converts a numpy array to a numcpp NdArray using pybind bindings Python will still own the underlying data.

Parameters
numpyArray
Returns
NdArray<dtype>

◆ pybind2nc_copy()

template<typename dtype >
NdArray<dtype> nc::pybindInterface::pybind2nc_copy ( const pbArray< dtype > &  numpyArray)

converts a numpy array to a numcpp NdArray using pybind bindings Python will still own the underlying data.

Parameters
numpyArray
Returns
NdArray<dtype>

Variable Documentation

◆ returnPolicyStringMap

const std::map<ReturnPolicy, std::string> nc::pybindInterface::returnPolicyStringMap
static
Initial value:
= { {ReturnPolicy::COPY, "COPY"},
{ReturnPolicy::REFERENCE, "REFERENCE"},
{ReturnPolicy::TAKE_OWNERSHIP, "TAKE_OWNERSHIP"} }