Skip to content

SOArrayPolicy

#include <layout.hh>
struct SOArrayPolicy

Defined in src/lib/ncarray/layout.hh:667

Inherits: LayoutPolicy< SOArrayPolicy >

The SOArrayPolicy implements PEP3118 compliance with the addition of a suboffsets field.

Name Kind Owner
SOArrayPolicy function Declared here
SOArrayPolicy function Declared here
SOArrayPolicy function Declared here
advance function Declared here
advance function Declared here
advance function Declared here
advance function Declared here
suboffsets function Declared here
suboffset function Declared here
is_pointer_impl function Declared here
get_offset_impl function Declared here
layout_repr function Declared here
is_contiguous_impl function Declared here
m_suboffsets variable Declared here
is_pointer_axis function Inherited from LayoutPolicy
is_contiguous_impl function Inherited from LayoutPolicy
advance function Inherited from LayoutPolicy
advance function Inherited from LayoutPolicy
advance function Inherited from LayoutPolicy
advance function Inherited from LayoutPolicy
shape function Inherited from LayoutPolicy
shape function Inherited from LayoutPolicy
ndim function Inherited from LayoutPolicy
size function Inherited from LayoutPolicy
strides function Inherited from LayoutPolicy
stride function Inherited from LayoutPolicy
layout_repr function Inherited from LayoutPolicy
build_new_axes function Inherited from LayoutPolicy
get_offset function Inherited from LayoutPolicy
layout_matches function Inherited from LayoutPolicy
m_shape variable Inherited from LayoutPolicy
m_strides variable Inherited from LayoutPolicy
m_pointer_axis variable Inherited from LayoutPolicy
Kind Name Description
function is_pointer_axis const inline Helper function to determine whether a given axis contains pointers. If true, this axis is a “double pointer” or involves suboffsets, etc. depending on the specialization.
function is_contiguous_impl const inline Check if any pointer axes exist.
function advance const inline The advance function takes a pointer to the current position in the array as well as an axis and index. Using this information, and the knowledge of the array layout it will move the pointer forward one data unit, accounting for strides, offsets, pointer jumps and so on.
function advance const inline The advance function takes a pointer to the current position in the array as well as an axis and index. Using this information, and the knowledge of the array layout it will move the pointer forward one data unit, accounting for strides, offsets, pointer jumps and so on.
function advance const inline The advance function overload takes a pointer to the current position in the array as well as a Coords (StaticCoords) object. The coords object provides multiple indices for multiple axes to traverse at once.
function advance const inline The advance function overload takes a pointer to the current position in the array as well as a Coords (StaticCoords) object. The coords object provides multiple indices for multiple axes to traverse at once.
function shape const inline The pointer to the underlying shape metadata.
function shape const inline The shape of a given axis of an array.
function ndim const inline The total number of dimensions.
function size const inline The total number of elements in the array.
function strides const inline The pointer to the underlying strides metadata.
function stride const inline The strides along a given axis of an array.
function layout_repr const inline The repr functions return a string to identify the layout policy when writing out string representations of the array.
function build_new_axes const inline Provided a set of indexing arguments construct the description of the new axes given the layout specification.
function get_offset const inline The offset/suboffset along a given axis of an array.
function layout_matches const inline Check whether another array’s layout matches my own.
variable m_shape
variable m_strides
variable m_pointer_axis
Return Name Description
NCA_HD SOArrayPolicy inline The Metadata struct defaults values to 0 - this works for NCArray. For suboffsets based classes, we want the value to be -1. Flipping the suboffset back on requires explicitly setting it.
SOArrayPolicy Defaulted constructor.
SOArrayPolicy noexcept Defaulted constructor.
NCA_HD void * advance const inline The advance function takes a pointer to the current position in the array as well as an axis and index. Using this information, and the knowledge of the array layout it will move the pointer forward one data unit, accounting for strides, offsets, pointer jumps and so on.
NCA_HD const void * advance const inline The advance function takes a pointer to the current position in the array as well as an axis and index. Using this information, and the knowledge of the array layout it will move the pointer forward one data unit, accounting for strides, offsets, pointer jumps and so on.
NCA_HD void * advance const inline The advance function overload takes a pointer to the current position in the array as well as a Coords (StaticCoords) object. The coords object provides multiple indices for multiple axes to traverse at once.
NCA_HD const void * advance const inline The advance function overload takes a pointer to the current position in the array as well as a Coords (StaticCoords) object. The coords object provides multiple indices for multiple axes to traverse at once.
NCA_HD const ssize_t * suboffsets const inline The pointer to the underlying suboffsets metadata.
NCA_HD ssize_t suboffset const inline The suboffset of a given axis of an array.
NCA_HD bool is_pointer_impl const inline Returns whether a given axis is a pointer axis.
NCA_HDMetadata::value_type get_offset_impl const inline The offset getter called by the generic version of the base class.
NCA_HD const char * layout_repr const inline Returns the string representation of this Layout policy.
NCA_HD bool is_contiguous_impl const inline Determines whether the layout is contiguous by checking for pointer axes.

inline

inline NCA_HD SOArrayPolicy()

Defined in src/lib/ncarray/layout.hh:674

The Metadata struct defaults values to 0 - this works for NCArray. For suboffsets based classes, we want the value to be -1. Flipping the suboffset back on requires explicitly setting it.


SOArrayPolicy(const SOArrayPolicy & other) = default

Defined in src/lib/ncarray/layout.hh:680

Defaulted constructor.


noexcept

SOArrayPolicy(SOArrayPolicy && other) noexcept = default

Defined in src/lib/ncarray/layout.hh:681

Defaulted constructor.


const inline

inline NCA_HD void * advance(void * data, ssize_t axis, ssize_t index) const

Defined in src/lib/ncarray/layout.hh:701

The advance function takes a pointer to the current position in the array as well as an axis and index. Using this information, and the knowledge of the array layout it will move the pointer forward one data unit, accounting for strides, offsets, pointer jumps and so on.

Via the revised buffer protocol specification in PEP3118, a “suboffset” greater than or equal to 0 indicates that the value on that axis is a pointer. The specific value dictates how many bytes to add to it AFTER dereferencing. Negative suboffsets mean no-pointer axis, and no special dereferencing

  • data The pointer to the current position in the array.

  • axis The current axis being traversed.

  • index The current index along the traversed axis.

The pointer to the next item in the array.


const inline

inline NCA_HD const void * advance(const void * data, ssize_t axis, ssize_t index) const

Defined in src/lib/ncarray/layout.hh:726

The advance function takes a pointer to the current position in the array as well as an axis and index. Using this information, and the knowledge of the array layout it will move the pointer forward one data unit, accounting for strides, offsets, pointer jumps and so on.

Via the revised buffer protocol specification in PEP3118, a “suboffset” greater than or equal to 0 indicates that the value on that axis is a pointer. The specific value dictates how many bytes to add to it AFTER dereferencing. Negative suboffsets mean no-pointer axis, and no special dereferencing

  • data The pointer to the current position in the array.

  • axis The current axis being traversed.

  • index The current index along the traversed axis.

The const pointer to the next item in the array.


const inline

template<typename Coords> inline NCA_HD void * advance(void * data, const Coords & coords) const

Defined in src/lib/ncarray/layout.hh:754

The advance function overload takes a pointer to the current position in the array as well as a Coords (StaticCoords) object. The coords object provides multiple indices for multiple axes to traverse at once.

Via the revised buffer protocol specification in PEP3118, a “suboffset” greater than or equal to 0 indicates that the value on that axis is a pointer. The specific value dictates how many bytes to add to it AFTER dereferencing. Negative suboffsets mean no-pointer axis, and no special dereferencing

  • data The pointer to the current position in the array.

  • coords The coordinates specifying the indices of all axes to traverse.

The pointer to the specified item in the array.


const inline

template<typename Coords> inline NCA_HD const void * advance(const void * data, const Coords & coords) const

Defined in src/lib/ncarray/layout.hh:785

The advance function overload takes a pointer to the current position in the array as well as a Coords (StaticCoords) object. The coords object provides multiple indices for multiple axes to traverse at once.

Via the revised buffer protocol specification in PEP3118, a “suboffset” greater than or equal to 0 indicates that the value on that axis is a pointer. The specific value dictates how many bytes to add to it AFTER dereferencing. Negative suboffsets mean no-pointer axis, and no special dereferencing

  • data The pointer to the current position in the array.

  • coords The coordinates specifying the indices of all axes to traverse.

The pointer to the specified item in the array.


const inline

inline NCA_HD const ssize_t * suboffsets() const

Defined in src/lib/ncarray/layout.hh:809

The pointer to the underlying suboffsets metadata.

The pointer to the underlying suboffsets metadata.


const inline

inline NCA_HD ssize_t suboffset(ssize_t dim) const

Defined in src/lib/ncarray/layout.hh:819

The suboffset of a given axis of an array.

  • dim A dimension to check the shape of.

The suboffset of that dimension.


const inline

inline NCA_HD bool is_pointer_impl(ssize_t axis) const

Defined in src/lib/ncarray/layout.hh:831

Returns whether a given axis is a pointer axis.

  • The axis to check if its a pointer axis.

Whether that axis is a pointer axis.


const inline

inline NCA_HDMetadata::value_type get_offset_impl(ssize_t axis) const

Defined in src/lib/ncarray/layout.hh:841

The offset getter called by the generic version of the base class.

  • axis The axis to return the offset for.

The offset of that axis.


const inline

inline NCA_HD const char * layout_repr() const

Defined in src/lib/ncarray/layout.hh:850

Returns the string representation of this Layout policy.

the string representation of this Layout policy.


const inline

inline NCA_HD bool is_contiguous_impl() const

Defined in src/lib/ncarray/layout.hh:861

Determines whether the layout is contiguous by checking for pointer axes.

Whether there are no pointer axes.

Return Name Description
Metadata m_suboffsets

Metadata m_suboffsets

Defined in src/lib/ncarray/layout.hh:871