NumCpp  2.4.2
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::boostPythonInterface::BoostNdarrayHelper< dtype > Class Template Reference

Helper class for ndarray. More...

#include <BoostNumpyNdarrayHelper.hpp>

Public Types

enum class  Order { F , C }
 C or Fortran ordering from python. More...
 

Public Member Functions

 BoostNdarrayHelper (boost::python::tuple inShape)
 
 BoostNdarrayHelper (const boost::python::numpy::ndarray &inArray)
 
const boost::python::numpy::ndarray & getArray () noexcept
 
boost::python::numpy::matrix getArrayAsMatrix ()
 
uint8 numDimensions () noexcept
 
dtype & operator() (uint32 index)
 
dtype & operator() (uint32 index1, uint32 index2)
 
Order order ()
 
void printArray1D ()
 
void printArray2D ()
 
const std::vector< Py_intptr_t > & shape () noexcept
 
bool shapeEqual (BoostNdarrayHelper &otherNdarrayHelper)
 
uint32 size ()
 
const std::vector< uint32 > & strides ()
 

Detailed Description

template<typename dtype>
class nc::boostPythonInterface::BoostNdarrayHelper< dtype >

Helper class for ndarray.

Member Enumeration Documentation

◆ Order

template<typename dtype >
enum nc::boostPythonInterface::BoostNdarrayHelper::Order
strong

C or Fortran ordering from python.

Enumerator

Constructor & Destructor Documentation

◆ BoostNdarrayHelper() [1/2]

template<typename dtype >
nc::boostPythonInterface::BoostNdarrayHelper< dtype >::BoostNdarrayHelper ( const boost::python::numpy::ndarray &  inArray)
inlineexplicit

Constructor

Parameters
inArrayndarray

◆ BoostNdarrayHelper() [2/2]

template<typename dtype >
nc::boostPythonInterface::BoostNdarrayHelper< dtype >::BoostNdarrayHelper ( boost::python::tuple  inShape)
inlineexplicit

Constructor

Parameters
inShape

Member Function Documentation

◆ getArray()

template<typename dtype >
const boost::python::numpy::ndarray& nc::boostPythonInterface::BoostNdarrayHelper< dtype >::getArray ( )
inlinenoexcept

Returns the internaly held ndarray

Returns
reference to the held ndarray

◆ getArrayAsMatrix()

template<typename dtype >
boost::python::numpy::matrix nc::boostPythonInterface::BoostNdarrayHelper< dtype >::getArrayAsMatrix ( )
inline

Returns the internaly held ndarray as a numpy matrix

Returns
matrix

◆ numDimensions()

template<typename dtype >
uint8 nc::boostPythonInterface::BoostNdarrayHelper< dtype >::numDimensions ( )
inlinenoexcept

Returns the number of dimensions of the array

Returns
num dimensions

◆ operator()() [1/2]

template<typename dtype >
dtype& nc::boostPythonInterface::BoostNdarrayHelper< dtype >::operator() ( uint32  index)
inline

1D access operator

Parameters
index
Returns
dtype

◆ operator()() [2/2]

template<typename dtype >
dtype& nc::boostPythonInterface::BoostNdarrayHelper< dtype >::operator() ( uint32  index1,
uint32  index2 
)
inline

2D access operator

Parameters
index1
index2
Returns
dtype

◆ order()

template<typename dtype >
Order nc::boostPythonInterface::BoostNdarrayHelper< dtype >::order ( )
inline

Returns the memory order of the array (C or Fortran)

Returns
Order

◆ printArray1D()

template<typename dtype >
void nc::boostPythonInterface::BoostNdarrayHelper< dtype >::printArray1D ( )
inline

Prints a 1D array

◆ printArray2D()

template<typename dtype >
void nc::boostPythonInterface::BoostNdarrayHelper< dtype >::printArray2D ( )
inline

Prints a 2D array

◆ shape()

template<typename dtype >
const std::vector<Py_intptr_t>& nc::boostPythonInterface::BoostNdarrayHelper< dtype >::shape ( )
inlinenoexcept

Returns the shape of the array

Returns
vector

◆ shapeEqual()

template<typename dtype >
bool nc::boostPythonInterface::BoostNdarrayHelper< dtype >::shapeEqual ( BoostNdarrayHelper< dtype > &  otherNdarrayHelper)
inline

Returns if the shapes of the two array helpers are equal

Parameters
otherNdarrayHelper
Returns
boolean

◆ size()

template<typename dtype >
uint32 nc::boostPythonInterface::BoostNdarrayHelper< dtype >::size ( )
inline

Returns the size of the array

Returns
size

◆ strides()

template<typename dtype >
const std::vector<uint32>& nc::boostPythonInterface::BoostNdarrayHelper< dtype >::strides ( )
inline

Returns the strides of the array

Returns
vector

The documentation for this class was generated from the following file: