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

Enumerations

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

Functions

template<typename dtype >
pybind11::array_t< dtype > nc2pybind (NdArray< dtype > &inArray, ReturnPolicy returnPolicy=ReturnPolicy::COPY)
 
template<typename dtype >
NdArray< dtype > pybind2nc (pybind11::array_t< dtype, pybind11::array::c_style > &numpyArray)
 

Variables

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

Enumeration Type Documentation

◆ ReturnPolicy

Enum for the pybind array return policy.

Enumerator
COPY 
REFERENCE 
TAKE_OWNERSHIP 

Function Documentation

◆ nc2pybind()

template<typename dtype >
pybind11::array_t<dtype> nc::pybindInterface::nc2pybind ( NdArray< dtype > &  inArray,
ReturnPolicy  returnPolicy = ReturnPolicy::COPY 
)
inline

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 ( pybind11::array_t< dtype, pybind11::array::c_style > &  numpyArray)
inline

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"} }