μHAL (v2.8.19)
Part of the IPbus software repository
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
array Class Reference

#include </builds/ipbus/ipbus-software/uhal/python/pybind11-python2/include/pybind11/numpy.h>

Inheritance diagram for array:
[legend]
Collaboration diagram for array:
[legend]

Public Types

enum  { c_style = detail::npy_api::NPY_ARRAY_C_CONTIGUOUS_ , f_style = detail::npy_api::NPY_ARRAY_F_CONTIGUOUS_ , forcecast = detail::npy_api::NPY_ARRAY_FORCECAST_ }
 
enum  { c_style = detail::npy_api::NPY_ARRAY_C_CONTIGUOUS_ , f_style = detail::npy_api::NPY_ARRAY_F_CONTIGUOUS_ , forcecast = detail::npy_api::NPY_ARRAY_FORCECAST_ }
 
using ShapeContainer = detail::any_container< ssize_t >
 
using StridesContainer = detail::any_container< ssize_t >
 
using ShapeContainer = detail::any_container< ssize_t >
 
using StridesContainer = detail::any_container< ssize_t >
 

Public Member Functions

 array ()
 
 array (const pybind11::dtype &dt, ShapeContainer shape, StridesContainer strides, const void *ptr=nullptr, handle base=handle())
 
 array (const pybind11::dtype &dt, ShapeContainer shape, const void *ptr=nullptr, handle base=handle())
 
template<typename T , typename = detail::enable_if_t<std::is_integral<T>::value && !std::is_same<bool, T>::value>>
 array (const pybind11::dtype &dt, T count, const void *ptr=nullptr, handle base=handle())
 
template<typename T >
 array (ShapeContainer shape, StridesContainer strides, const T *ptr, handle base=handle())
 
template<typename T >
 array (ShapeContainer shape, const T *ptr, handle base=handle())
 
template<typename T >
 array (ssize_t count, const T *ptr, handle base=handle())
 
 array (const buffer_info &info, handle base=handle())
 
pybind11::dtype dtype () const
 Array descriptor (dtype) More...
 
ssize_t size () const
 Total number of elements. More...
 
ssize_t itemsize () const
 Byte size of a single element. More...
 
ssize_t nbytes () const
 Total number of bytes. More...
 
ssize_t ndim () const
 Number of dimensions. More...
 
object base () const
 Base object. More...
 
const ssize_tshape () const
 Dimensions of the array. More...
 
ssize_t shape (ssize_t dim) const
 Dimension along a given axis. More...
 
const ssize_tstrides () const
 Strides of the array. More...
 
ssize_t strides (ssize_t dim) const
 Stride along a given axis. More...
 
int flags () const
 Return the NumPy array flags. More...
 
bool writeable () const
 If set, the array is writeable (otherwise the buffer is read-only) More...
 
bool owndata () const
 If set, the array owns the data (will be freed when the array is deleted) More...
 
template<typename... Ix>
const void * data (Ix... index) const
 Pointer to the contained data. More...
 
template<typename... Ix>
void * mutable_data (Ix... index)
 Mutable pointer to the contained data. More...
 
template<typename... Ix>
ssize_t offset_at (Ix... index) const
 Byte offset from beginning of the array to a given index (full or partial). More...
 
ssize_t offset_at () const
 
template<typename... Ix>
ssize_t index_at (Ix... index) const
 Item count from beginning of the array to a given index (full or partial). More...
 
template<typename T , ssize_t Dims = -1>
detail::unchecked_mutable_reference< T, Dims > mutable_unchecked () &
 Returns a proxy object that provides access to the array's data without bounds or dimensionality checking. More...
 
template<typename T , ssize_t Dims = -1>
detail::unchecked_reference< T, Dims > unchecked () const &
 Returns a proxy object that provides const access to the array's data without bounds or dimensionality checking. More...
 
array squeeze ()
 Return a new view with all of the dimensions of length 1 removed. More...
 
void resize (ShapeContainer new_shape, bool refcheck=true)
 Resize array to given shape If refcheck is true and more that one reference exist to this array then resize will succeed only if it makes a reshape, i.e. More...
 
array reshape (ShapeContainer new_shape)
 Optional order parameter omitted, to be added as needed. More...
 
array view (const std::string &dtype)
 Create a view of an array in a different data type. More...
 
 array ()
 
 array (const pybind11::dtype &dt, ShapeContainer shape, StridesContainer strides, const void *ptr=nullptr, handle base=handle())
 
 array (const pybind11::dtype &dt, ShapeContainer shape, const void *ptr=nullptr, handle base=handle())
 
template<typename T , typename = detail::enable_if_t<std::is_integral<T>::value && !std::is_same<bool, T>::value>>
 array (const pybind11::dtype &dt, T count, const void *ptr=nullptr, handle base=handle())
 
template<typename T >
 array (ShapeContainer shape, StridesContainer strides, const T *ptr, handle base=handle())
 
template<typename T >
 array (ShapeContainer shape, const T *ptr, handle base=handle())
 
template<typename T >
 array (ssize_t count, const T *ptr, handle base=handle())
 
 array (const buffer_info &info, handle base=handle())
 
pybind11::dtype dtype () const
 Array descriptor (dtype) More...
 
ssize_t size () const
 Total number of elements. More...
 
ssize_t itemsize () const
 Byte size of a single element. More...
 
ssize_t nbytes () const
 Total number of bytes. More...
 
ssize_t ndim () const
 Number of dimensions. More...
 
object base () const
 Base object. More...
 
const ssize_tshape () const
 Dimensions of the array. More...
 
ssize_t shape (ssize_t dim) const
 Dimension along a given axis. More...
 
const ssize_tstrides () const
 Strides of the array. More...
 
ssize_t strides (ssize_t dim) const
 Stride along a given axis. More...
 
int flags () const
 Return the NumPy array flags. More...
 
bool writeable () const
 If set, the array is writeable (otherwise the buffer is read-only) More...
 
bool owndata () const
 If set, the array owns the data (will be freed when the array is deleted) More...
 
template<typename... Ix>
const void * data (Ix... index) const
 Pointer to the contained data. More...
 
template<typename... Ix>
void * mutable_data (Ix... index)
 Mutable pointer to the contained data. More...
 
template<typename... Ix>
ssize_t offset_at (Ix... index) const
 Byte offset from beginning of the array to a given index (full or partial). More...
 
ssize_t offset_at () const
 
template<typename... Ix>
ssize_t index_at (Ix... index) const
 Item count from beginning of the array to a given index (full or partial). More...
 
template<typename T , ssize_t Dims = -1>
detail::unchecked_mutable_reference< T, Dims > mutable_unchecked () &
 Returns a proxy object that provides access to the array's data without bounds or dimensionality checking. More...
 
template<typename T , ssize_t Dims = -1>
detail::unchecked_reference< T, Dims > unchecked () const &
 Returns a proxy object that provides const access to the array's data without bounds or dimensionality checking. More...
 
array squeeze ()
 Return a new view with all of the dimensions of length 1 removed. More...
 
void resize (ShapeContainer new_shape, bool refcheck=true)
 Resize array to given shape If refcheck is true and more that one reference exist to this array then resize will succeed only if it makes a reshape, i.e. More...
 
array reshape (ShapeContainer new_shape)
 Optional order parameter omitted, to be added as needed. More...
 
array view (const std::string &dtype)
 Create a view of an array in a different data type. More...
 
- Public Member Functions inherited from buffer
buffer_info request (bool writable=false) const
 
buffer_info request (bool writable=false) const
 
- Public Member Functions inherited from object
 object ()=default
 
 PYBIND11_DEPRECATED ("Use reinterpret_borrow<object>() or reinterpret_steal<object>()") object(handle h
 
 object (const object &o)
 Copy constructor; always increases the reference count. More...
 
 object (object &&other) noexcept
 Move constructor; steals the object from other and preserves its reference count. More...
 
 ~object ()
 Destructor; automatically calls handle::dec_ref() More...
 
handle release ()
 \rst Resets the internal pointer to nullptr without decreasing the object's reference count. More...
 
objectoperator= (const object &other)
 
objectoperator= (object &&other) noexcept
 
template<typename T >
cast () const &
 
template<typename T >
cast () &&
 
 object (handle h, borrowed_t)
 
 object (handle h, stolen_t)
 
 object ()=default
 
 PYBIND11_DEPRECATED ("Use reinterpret_borrow<object>() or reinterpret_steal<object>()") object(handle h
 
 object (const object &o)
 Copy constructor; always increases the reference count. More...
 
 object (object &&other) noexcept
 Move constructor; steals the object from other and preserves its reference count. More...
 
 ~object ()
 Destructor; automatically calls handle::dec_ref() More...
 
handle release ()
 \rst Resets the internal pointer to nullptr without decreasing the object's reference count. More...
 
objectoperator= (const object &other)
 
objectoperator= (object &&other) noexcept
 
template<typename T >
cast () const &
 
template<typename T >
cast () &&
 
 object (handle h, borrowed_t)
 
 object (handle h, stolen_t)
 
template<typename T >
cast () const &
 
template<typename T >
cast () &&
 
template<>
void cast () const &
 
template<>
void cast () &&
 
- Public Member Functions inherited from handle
 handle ()=default
 The default constructor creates a handle with a nullptr-valued pointer. More...
 
 handle (PyObject *ptr)
 Creates a handle from the given raw Python object pointer. More...
 
PyObject * ptr () const
 Return the underlying PyObject * pointer. More...
 
PyObject *& ptr ()
 
const handleinc_ref () const &
 \rst Manually increase the reference count of the Python object. More...
 
const handledec_ref () const &
 \rst Manually decrease the reference count of the Python object. More...
 
template<typename T >
cast () const
 \rst Attempt to cast the Python object into the given C++ type. More...
 
 operator bool () const
 Return true when the handle wraps a valid Python object. More...
 
bool operator== (const handle &h) const
 \rst Deprecated: Check that the underlying pointers are the same. More...
 
bool operator!= (const handle &h) const
 
bool check () const
 
 handle ()=default
 The default constructor creates a handle with a nullptr-valued pointer. More...
 
template<typename T , detail::enable_if_t< detail::is_pyobj_ptr_or_nullptr_t< T >::value, int > = 0>
 handle (T ptr)
 Enable implicit conversion from PyObject * and nullptr. More...
 
template<typename T , detail::enable_if_t< detail::all_of< detail::none_of< std::is_base_of< handle, T >, detail::is_pyobj_ptr_or_nullptr_t< T > >, std::is_convertible< T, PyObject * > >::value, int > = 0>
 handle (T &obj)
 Enable implicit conversion through T::operator PyObject *(). More...
 
PyObject * ptr () const
 Return the underlying PyObject * pointer. More...
 
PyObject *& ptr ()
 
const handleinc_ref () const &
 \rst Manually increase the reference count of the Python object. More...
 
const handledec_ref () const &
 \rst Manually decrease the reference count of the Python object. More...
 
template<typename T >
cast () const
 \rst Attempt to cast the Python object into the given C++ type. More...
 
 operator bool () const
 Return true when the handle wraps a valid Python object. More...
 
bool operator== (const handle &h) const
 \rst Deprecated: Check that the underlying pointers are the same. More...
 
bool operator!= (const handle &h) const
 
bool check () const
 
template<>
void cast () const
 

Static Public Member Functions

static array ensure (handle h, int ExtraFlags=0)
 Ensure that the argument is a NumPy array In case of an error, nullptr is returned and the Python error is cleared. More...
 
static array ensure (handle h, int ExtraFlags=0)
 Ensure that the argument is a NumPy array In case of an error, nullptr is returned and the Python error is cleared. More...
 
- Static Public Member Functions inherited from handle
static std::size_t inc_ref_counter ()
 

Protected Member Functions

void fail_dim_check (ssize_t dim, const std::string &msg) const
 
template<typename... Ix>
ssize_t byte_offset (Ix... index) const
 
void check_writeable () const
 
template<typename... Ix>
void check_dimensions (Ix... index) const
 
void check_dimensions_impl (ssize_t, const ssize_t *) const
 
template<typename... Ix>
void check_dimensions_impl (ssize_t axis, const ssize_t *shape, ssize_t i, Ix... index) const
 
void fail_dim_check (ssize_t dim, const std::string &msg) const
 
template<typename... Ix>
ssize_t byte_offset (Ix... index) const
 
void check_writeable () const
 
template<typename... Ix>
void check_dimensions (Ix... index) const
 
void check_dimensions_impl (ssize_t, const ssize_t *) const
 
template<typename... Ix>
void check_dimensions_impl (ssize_t axis, const ssize_t *shape, ssize_t i, Ix... index) const
 

Static Protected Member Functions

static PyObject * raw_array (PyObject *ptr, int ExtraFlags=0)
 Create array from any object – always returns a new reference. More...
 
static PyObject * raw_array (PyObject *ptr, int ExtraFlags=0)
 Create array from any object – always returns a new reference. More...
 

Friends

template<typename , typename >
struct detail::npy_format_descriptor
 
template<typename , typename >
struct detail::npy_format_descriptor
 

Additional Inherited Members

- Public Attributes inherited from object
bool is_borrowed: handle(h) { if (is_borrowed) { inc_ref()
 
- Protected Attributes inherited from handle
PyObject * m_ptr = nullptr
 

Detailed Description

Definition at line 655 of file numpy.h.

Member Typedef Documentation

◆ ShapeContainer [1/2]

using array::ShapeContainer = detail::any_container<ssize_t>

Definition at line 667 of file numpy.h.

◆ ShapeContainer [2/2]

using array::ShapeContainer = detail::any_container<ssize_t>

Definition at line 694 of file numpy.h.

◆ StridesContainer [1/2]

using array::StridesContainer = detail::any_container<ssize_t>

Definition at line 668 of file numpy.h.

◆ StridesContainer [2/2]

using array::StridesContainer = detail::any_container<ssize_t>

Definition at line 695 of file numpy.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
c_style 
f_style 
forcecast 

Definition at line 659 of file numpy.h.

◆ anonymous enum

anonymous enum
Enumerator
c_style 
f_style 
forcecast 

Definition at line 686 of file numpy.h.

Constructor & Destructor Documentation

◆ array() [1/16]

array::array ( )
inline

Definition at line 665 of file numpy.h.

◆ array() [2/16]

array::array ( const pybind11::dtype &  dt,
ShapeContainer  shape,
StridesContainer  strides,
const void *  ptr = nullptr,
handle  base = handle() 
)
inline

◆ array() [3/16]

array::array ( const pybind11::dtype &  dt,
ShapeContainer  shape,
const void *  ptr = nullptr,
handle  base = handle() 
)
inline

Definition at line 724 of file numpy.h.

◆ array() [4/16]

template<typename T , typename = detail::enable_if_t<std::is_integral<T>::value && !std::is_same<bool, T>::value>>
array::array ( const pybind11::dtype &  dt,
count,
const void *  ptr = nullptr,
handle  base = handle() 
)
inline

Definition at line 733 of file numpy.h.

◆ array() [5/16]

template<typename T >
array::array ( ShapeContainer  shape,
StridesContainer  strides,
const T *  ptr,
handle  base = handle() 
)
inline

Definition at line 737 of file numpy.h.

◆ array() [6/16]

template<typename T >
array::array ( ShapeContainer  shape,
const T *  ptr,
handle  base = handle() 
)
inline

Definition at line 741 of file numpy.h.

◆ array() [7/16]

template<typename T >
array::array ( ssize_t  count,
const T *  ptr,
handle  base = handle() 
)
inlineexplicit

Definition at line 745 of file numpy.h.

◆ array() [8/16]

array::array ( const buffer_info info,
handle  base = handle() 
)
inlineexplicit

Definition at line 748 of file numpy.h.

◆ array() [9/16]

array::array ( )
inline

Definition at line 692 of file numpy.h.

◆ array() [10/16]

array::array ( const pybind11::dtype &  dt,
ShapeContainer  shape,
StridesContainer  strides,
const void *  ptr = nullptr,
handle  base = handle() 
)
inline

◆ array() [11/16]

array::array ( const pybind11::dtype &  dt,
ShapeContainer  shape,
const void *  ptr = nullptr,
handle  base = handle() 
)
inline

Definition at line 751 of file numpy.h.

◆ array() [12/16]

template<typename T , typename = detail::enable_if_t<std::is_integral<T>::value && !std::is_same<bool, T>::value>>
array::array ( const pybind11::dtype &  dt,
count,
const void *  ptr = nullptr,
handle  base = handle() 
)
inline

Definition at line 760 of file numpy.h.

◆ array() [13/16]

template<typename T >
array::array ( ShapeContainer  shape,
StridesContainer  strides,
const T *  ptr,
handle  base = handle() 
)
inline

Definition at line 764 of file numpy.h.

◆ array() [14/16]

template<typename T >
array::array ( ShapeContainer  shape,
const T *  ptr,
handle  base = handle() 
)
inline

Definition at line 768 of file numpy.h.

◆ array() [15/16]

template<typename T >
array::array ( ssize_t  count,
const T *  ptr,
handle  base = handle() 
)
inlineexplicit

Definition at line 772 of file numpy.h.

◆ array() [16/16]

array::array ( const buffer_info info,
handle  base = handle() 
)
inlineexplicit

Definition at line 775 of file numpy.h.

Member Function Documentation

◆ base() [1/2]

object array::base ( ) const
inline

Base object.

Definition at line 773 of file numpy.h.

References handle::m_ptr.

◆ base() [2/2]

object array::base ( ) const
inline

Base object.

Definition at line 800 of file numpy.h.

References handle::m_ptr.

◆ byte_offset() [1/2]

template<typename... Ix>
ssize_t array::byte_offset ( Ix...  index) const
inlineprotected

◆ byte_offset() [2/2]

template<typename... Ix>
ssize_t array::byte_offset ( Ix...  index) const
inlineprotected

Definition at line 978 of file numpy.h.

References check_dimensions(), and strides().

◆ check_dimensions() [1/2]

template<typename... Ix>
void array::check_dimensions ( Ix...  index) const
inlineprotected

Definition at line 963 of file numpy.h.

References check_dimensions_impl(), and shape().

Referenced by byte_offset().

◆ check_dimensions() [2/2]

template<typename... Ix>
void array::check_dimensions ( Ix...  index) const
inlineprotected

Definition at line 990 of file numpy.h.

References check_dimensions_impl(), and shape().

◆ check_dimensions_impl() [1/4]

template<typename... Ix>
void array::check_dimensions_impl ( ssize_t  axis,
const ssize_t shape,
ssize_t  i,
Ix...  index 
) const
inlineprotected

Definition at line 970 of file numpy.h.

References check_dimensions_impl(), and shape().

◆ check_dimensions_impl() [2/4]

template<typename... Ix>
void array::check_dimensions_impl ( ssize_t  axis,
const ssize_t shape,
ssize_t  i,
Ix...  index 
) const
inlineprotected

Definition at line 997 of file numpy.h.

References check_dimensions_impl(), and shape().

◆ check_dimensions_impl() [3/4]

void array::check_dimensions_impl ( ssize_t  ,
const ssize_t  
) const
inlineprotected

Definition at line 967 of file numpy.h.

Referenced by check_dimensions(), and check_dimensions_impl().

◆ check_dimensions_impl() [4/4]

void array::check_dimensions_impl ( ssize_t  ,
const ssize_t  
) const
inlineprotected

Definition at line 994 of file numpy.h.

◆ check_writeable() [1/2]

void array::check_writeable ( ) const
inlineprotected

Definition at line 956 of file numpy.h.

References writeable().

Referenced by mutable_data().

◆ check_writeable() [2/2]

void array::check_writeable ( ) const
inlineprotected

Definition at line 983 of file numpy.h.

References writeable().

◆ data() [1/2]

template<typename... Ix>
const void * array::data ( Ix...  index) const
inline

Pointer to the contained data.

If index is not provided, points to the beginning of the buffer. May throw if the index would lead to out of bounds access.

Definition at line 813 of file numpy.h.

References handle::m_ptr, and offset_at().

Referenced by array_t< T, ExtraFlags >::at(), array_t< T, ExtraFlags >::data(), and unchecked().

◆ data() [2/2]

template<typename... Ix>
const void * array::data ( Ix...  index) const
inline

Pointer to the contained data.

If index is not provided, points to the beginning of the buffer. May throw if the index would lead to out of bounds access.

Definition at line 840 of file numpy.h.

References handle::m_ptr, and offset_at().

◆ dtype() [1/2]

pybind11::dtype array::dtype ( ) const
inline

Array descriptor (dtype)

Definition at line 752 of file numpy.h.

References handle::m_ptr.

Referenced by type_caster< Type, typename eigen_tensor_helper< Type >::ValidType >::load().

◆ dtype() [2/2]

pybind11::dtype array::dtype ( ) const
inline

Array descriptor (dtype)

Definition at line 779 of file numpy.h.

References handle::m_ptr.

◆ ensure() [1/2]

static array array::ensure ( handle  h,
int  ExtraFlags = 0 
)
inlinestatic

Ensure that the argument is a NumPy array In case of an error, nullptr is returned and the Python error is cleared.

Definition at line 933 of file numpy.h.

References handle::ptr(), and raw_array().

Referenced by type_caster< Type, enable_if_t< is_eigen_dense_plain< Type >::value > >::load(), and type_caster< Type, typename eigen_tensor_helper< Type >::ValidType >::load().

◆ ensure() [2/2]

static array array::ensure ( handle  h,
int  ExtraFlags = 0 
)
inlinestatic

Ensure that the argument is a NumPy array In case of an error, nullptr is returned and the Python error is cleared.

Definition at line 960 of file numpy.h.

References handle::ptr(), and raw_array().

◆ fail_dim_check() [1/2]

void array::fail_dim_check ( ssize_t  dim,
const std::string &  msg 
) const
inlineprotected

◆ fail_dim_check() [2/2]

void array::fail_dim_check ( ssize_t  dim,
const std::string &  msg 
) const
inlineprotected

Definition at line 972 of file numpy.h.

References ndim().

◆ flags() [1/2]

int array::flags ( ) const
inline

Return the NumPy array flags.

Definition at line 798 of file numpy.h.

References handle::m_ptr.

Referenced by array().

◆ flags() [2/2]

int array::flags ( ) const
inline

Return the NumPy array flags.

Definition at line 825 of file numpy.h.

References handle::m_ptr.

◆ index_at() [1/2]

template<typename... Ix>
ssize_t array::index_at ( Ix...  index) const
inline

Item count from beginning of the array to a given index (full or partial).

May throw if the index would lead to out of bounds access.

Definition at line 841 of file numpy.h.

References itemsize(), and offset_at().

◆ index_at() [2/2]

template<typename... Ix>
ssize_t array::index_at ( Ix...  index) const
inline

Item count from beginning of the array to a given index (full or partial).

May throw if the index would lead to out of bounds access.

Definition at line 868 of file numpy.h.

References itemsize(), and offset_at().

◆ itemsize() [1/2]

ssize_t array::itemsize ( ) const
inline

Byte size of a single element.

Definition at line 762 of file numpy.h.

References handle::m_ptr.

Referenced by index_at(), and nbytes().

◆ itemsize() [2/2]

ssize_t array::itemsize ( ) const
inline

Byte size of a single element.

Definition at line 789 of file numpy.h.

References handle::m_ptr.

◆ mutable_data() [1/2]

template<typename... Ix>
void * array::mutable_data ( Ix...  index)
inline

Mutable pointer to the contained data.

If index is not provided, points to the beginning of the buffer. May throw if the index would lead to out of bounds access. May throw if the array is not writeable.

Definition at line 821 of file numpy.h.

References check_writeable(), handle::m_ptr, and offset_at().

Referenced by array_t< T, ExtraFlags >::mutable_at(), array_t< T, ExtraFlags >::mutable_data(), vectorize_returned_array< Func, Return, Args >::mutable_data(), and mutable_unchecked().

◆ mutable_data() [2/2]

template<typename... Ix>
void * array::mutable_data ( Ix...  index)
inline

Mutable pointer to the contained data.

If index is not provided, points to the beginning of the buffer. May throw if the index would lead to out of bounds access. May throw if the array is not writeable.

Definition at line 848 of file numpy.h.

References check_writeable(), handle::m_ptr, and offset_at().

◆ mutable_unchecked() [1/2]

template<typename T , ssize_t Dims = -1>
detail::unchecked_mutable_reference< T, Dims > array::mutable_unchecked ( ) &
inline

Returns a proxy object that provides access to the array's data without bounds or dimensionality checking.

Will throw if the array is missing the writeable flag. Use with care: the array must not be destroyed or reshaped for the duration of the returned object, and the caller must take care not to access invalid dimensions or dimension indices.

Definition at line 852 of file numpy.h.

References mutable_data(), ndim(), PYBIND11_SILENCE_MSVC_C4127, shape(), and strides().

◆ mutable_unchecked() [2/2]

template<typename T , ssize_t Dims = -1>
detail::unchecked_mutable_reference< T, Dims > array::mutable_unchecked ( ) &
inline

Returns a proxy object that provides access to the array's data without bounds or dimensionality checking.

Will throw if the array is missing the writeable flag. Use with care: the array must not be destroyed or reshaped for the duration of the returned object, and the caller must take care not to access invalid dimensions or dimension indices.

Definition at line 879 of file numpy.h.

References mutable_data(), ndim(), shape(), and strides().

◆ nbytes() [1/2]

ssize_t array::nbytes ( ) const
inline

Total number of bytes.

Definition at line 767 of file numpy.h.

References itemsize(), and size().

◆ nbytes() [2/2]

ssize_t array::nbytes ( ) const
inline

Total number of bytes.

Definition at line 794 of file numpy.h.

References itemsize(), and size().

◆ ndim() [1/2]

ssize_t array::ndim ( ) const
inline

◆ ndim() [2/2]

ssize_t array::ndim ( ) const
inline

Number of dimensions.

Definition at line 797 of file numpy.h.

References handle::m_ptr.

◆ offset_at() [1/4]

ssize_t array::offset_at ( ) const
inline

Definition at line 836 of file numpy.h.

Referenced by data(), index_at(), array_t< T, ExtraFlags >::index_at(), and mutable_data().

◆ offset_at() [2/4]

ssize_t array::offset_at ( ) const
inline

Definition at line 863 of file numpy.h.

◆ offset_at() [3/4]

template<typename... Ix>
ssize_t array::offset_at ( Ix...  index) const
inline

Byte offset from beginning of the array to a given index (full or partial).

May throw if the index would lead to out of bounds access.

Definition at line 829 of file numpy.h.

References byte_offset(), fail_dim_check(), and ndim().

◆ offset_at() [4/4]

template<typename... Ix>
ssize_t array::offset_at ( Ix...  index) const
inline

Byte offset from beginning of the array to a given index (full or partial).

May throw if the index would lead to out of bounds access.

Definition at line 856 of file numpy.h.

References byte_offset(), fail_dim_check(), and ndim().

◆ owndata() [1/2]

bool array::owndata ( ) const
inline

If set, the array owns the data (will be freed when the array is deleted)

Definition at line 806 of file numpy.h.

References handle::m_ptr.

◆ owndata() [2/2]

bool array::owndata ( ) const
inline

If set, the array owns the data (will be freed when the array is deleted)

Definition at line 833 of file numpy.h.

References handle::m_ptr.

◆ raw_array() [1/2]

static PyObject * array::raw_array ( PyObject *  ptr,
int  ExtraFlags = 0 
)
inlinestaticprotected

Create array from any object – always returns a new reference.

Definition at line 980 of file numpy.h.

References handle::ptr().

Referenced by ensure().

◆ raw_array() [2/2]

static PyObject * array::raw_array ( PyObject *  ptr,
int  ExtraFlags = 0 
)
inlinestaticprotected

Create array from any object – always returns a new reference.

Definition at line 1007 of file numpy.h.

References handle::ptr().

◆ reshape() [1/2]

array array::reshape ( ShapeContainer  new_shape)
inline

Optional order parameter omitted, to be added as needed.

Definition at line 905 of file numpy.h.

References handle::m_ptr.

◆ reshape() [2/2]

array array::reshape ( ShapeContainer  new_shape)
inline

Optional order parameter omitted, to be added as needed.

Definition at line 932 of file numpy.h.

References handle::m_ptr.

◆ resize() [1/2]

void array::resize ( ShapeContainer  new_shape,
bool  refcheck = true 
)
inline

Resize array to given shape If refcheck is true and more that one reference exist to this array then resize will succeed only if it makes a reshape, i.e.

original size doesn't change

Definition at line 888 of file numpy.h.

References handle::m_ptr.

◆ resize() [2/2]

void array::resize ( ShapeContainer  new_shape,
bool  refcheck = true 
)
inline

Resize array to given shape If refcheck is true and more that one reference exist to this array then resize will succeed only if it makes a reshape, i.e.

original size doesn't change

Definition at line 915 of file numpy.h.

References handle::m_ptr.

◆ shape() [1/4]

const ssize_t * array::shape ( ) const
inline

Dimensions of the array.

Definition at line 776 of file numpy.h.

References handle::m_ptr.

Referenced by array(), check_dimensions(), check_dimensions_impl(), EigenProps< Type_ >::conformable(), mutable_unchecked(), shape(), size(), and unchecked().

◆ shape() [2/4]

const ssize_t * array::shape ( ) const
inline

Dimensions of the array.

Definition at line 803 of file numpy.h.

References handle::m_ptr.

◆ shape() [3/4]

ssize_t array::shape ( ssize_t  dim) const
inline

Dimension along a given axis.

Definition at line 779 of file numpy.h.

References fail_dim_check(), ndim(), and shape().

◆ shape() [4/4]

ssize_t array::shape ( ssize_t  dim) const
inline

Dimension along a given axis.

Definition at line 806 of file numpy.h.

References fail_dim_check(), ndim(), and shape().

◆ size() [1/2]

ssize_t array::size ( ) const
inline

Total number of elements.

Definition at line 757 of file numpy.h.

References ndim(), and shape().

Referenced by nbytes().

◆ size() [2/2]

ssize_t array::size ( ) const
inline

Total number of elements.

Definition at line 784 of file numpy.h.

References ndim(), and shape().

◆ squeeze() [1/2]

array array::squeeze ( )
inline

Return a new view with all of the dimensions of length 1 removed.

Definition at line 880 of file numpy.h.

References handle::m_ptr.

◆ squeeze() [2/2]

array array::squeeze ( )
inline

Return a new view with all of the dimensions of length 1 removed.

Definition at line 907 of file numpy.h.

References handle::m_ptr.

◆ strides() [1/4]

const ssize_t * array::strides ( ) const
inline

Strides of the array.

Definition at line 787 of file numpy.h.

References handle::m_ptr.

Referenced by array(), byte_offset(), EigenProps< Type_ >::conformable(), mutable_unchecked(), strides(), and unchecked().

◆ strides() [2/4]

const ssize_t * array::strides ( ) const
inline

Strides of the array.

Definition at line 814 of file numpy.h.

References handle::m_ptr.

◆ strides() [3/4]

ssize_t array::strides ( ssize_t  dim) const
inline

Stride along a given axis.

Definition at line 790 of file numpy.h.

References fail_dim_check(), ndim(), and strides().

◆ strides() [4/4]

ssize_t array::strides ( ssize_t  dim) const
inline

Stride along a given axis.

Definition at line 817 of file numpy.h.

References fail_dim_check(), ndim(), and strides().

◆ unchecked() [1/2]

template<typename T , ssize_t Dims = -1>
detail::unchecked_reference< T, Dims > array::unchecked ( ) const &
inline

Returns a proxy object that provides const access to the array's data without bounds or dimensionality checking.

Unlike mutable_unchecked(), this does not require that the underlying array have the writable flag. Use with care: the array must not be destroyed or reshaped for the duration of the returned object, and the caller must take care not to access invalid dimensions or dimension indices.

Definition at line 870 of file numpy.h.

References data(), ndim(), PYBIND11_SILENCE_MSVC_C4127, shape(), and strides().

◆ unchecked() [2/2]

template<typename T , ssize_t Dims = -1>
detail::unchecked_reference< T, Dims > array::unchecked ( ) const &
inline

Returns a proxy object that provides const access to the array's data without bounds or dimensionality checking.

Unlike mutable_unchecked(), this does not require that the underlying array have the writable flag. Use with care: the array must not be destroyed or reshaped for the duration of the returned object, and the caller must take care not to access invalid dimensions or dimension indices.

Definition at line 897 of file numpy.h.

References data(), ndim(), shape(), and strides().

◆ view() [1/2]

array array::view ( const std::string &  dtype)
inline

Create a view of an array in a different data type.

This function may fundamentally reinterpret the data in the array. It is the responsibility of the caller to ensure that this is safe. Only supports the dtype argument, the type argument is omitted, to be added as needed.

Definition at line 921 of file numpy.h.

References dtype::from_args(), handle::m_ptr, handle::ptr(), and object::release().

◆ view() [2/2]

array array::view ( const std::string &  dtype)
inline

Create a view of an array in a different data type.

This function may fundamentally reinterpret the data in the array. It is the responsibility of the caller to ensure that this is safe. Only supports the dtype argument, the type argument is omitted, to be added as needed.

Definition at line 948 of file numpy.h.

References dtype::from_args(), handle::m_ptr, handle::ptr(), and object::release().

◆ writeable() [1/2]

bool array::writeable ( ) const
inline

If set, the array is writeable (otherwise the buffer is read-only)

Definition at line 801 of file numpy.h.

References handle::m_ptr.

Referenced by check_writeable().

◆ writeable() [2/2]

bool array::writeable ( ) const
inline

If set, the array is writeable (otherwise the buffer is read-only)

Definition at line 828 of file numpy.h.

References handle::m_ptr.

Friends And Related Function Documentation

◆ detail::npy_format_descriptor [1/2]

template<typename , typename >
friend struct detail::npy_format_descriptor
friend

Definition at line 943 of file numpy.h.

◆ detail::npy_format_descriptor [2/2]

template<typename , typename >
struct detail::npy_format_descriptor
friend

Definition at line 970 of file numpy.h.


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