apybuffer.h

template<typename T>
struct NoDefaultConstructAllocator

Public Types

using value_type = T
using size_type = typename std::allocator<T>::size_type
using difference_type = typename std::allocator<T>::difference_type
using propagate_on_container_move_assignment = std::true_type
using is_always_equal = std::true_type

Public Functions

NoDefaultConstructAllocator() noexcept = default
~NoDefaultConstructAllocator() noexcept = default
inline T *allocate(std::size_t n)
inline T *allocate(std::size_t n, const void *hint)
inline void deallocate(T *p, std::size_t n)
template<typename U>
inline bool operator==(const NoDefaultConstructAllocator<U> &_) noexcept
template<typename U>
inline bool operator!=(const NoDefaultConstructAllocator<U> &_) noexcept
template<typename U>
struct rebind

Public Types

typedef NoDefaultConstructAllocator<U> other
template<typename T, typename Allocator = std::allocator<T>>
class APyBuffer

Subclassed by APyArray< apy_limb_t, APyCFixedArray >, APyArray< apy_limb_t, APyFixedArray >, APyArray< APyFloatData, APyFloatArray >, APyArray< T, ARRAY_TYPE >

Public Types

using vector_type = std::vector<T, Allocator>

Public Functions

inline std::size_t ndim() const noexcept

Retrieve number of array dimensions.

inline std::size_t size() const noexcept

Retrieve array size.

inline const std::vector<std::size_t> &shape() const noexcept

Retrieve array shape.

inline nb::tuple python_get_shape() const

Retrieve array shape (exported to Python)

Protected Functions

inline APyBuffer(const std::vector<std::size_t> &shape, std::size_t itemsize = 1)

APyBuffers are to be inherited from. All fields and constructors are protected.

Base constructor for creating a new APyBuffer

inline APyBuffer(const std::vector<std::size_t> &shape, std::size_t itemsize, vector_type &&v)

Base constructor for creating new APyBuffer stealing data from another vector.

inline Py_buffer get_py_buffer()

Return a Python Buffer structure compatible with the Buffer Protocol.

inline void buffer_resize(const std::vector<std::size_t> shape, std::size_t itemsize)

Resize the underlying buffer without touching its data. Narrowing the buffer will result in loss of data.

Protected Attributes

std::size_t _itemsize
std::vector<std::size_t> _shape
std::size_t _nitems
vector_type _data
std::size_t _ndim
std::vector<std::size_t> _strides