SOArrayPolicy
SOArrayPolicy
Section titled “SOArrayPolicy”#include <layout.hh>struct SOArrayPolicyDefined in src/lib/ncarray/layout.hh:667
Inherits:
LayoutPolicy< SOArrayPolicy >
The SOArrayPolicy implements PEP3118 compliance with the addition of a suboffsets field.
List of all members
Section titled “List of all members”| 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 |
Inherited from LayoutPolicy
Section titled “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 |
Public Methods
Section titled “Public Methods”| 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. |
SOArrayPolicy
Section titled “SOArrayPolicy”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
Section titled “SOArrayPolicy”SOArrayPolicy(const SOArrayPolicy & other) = defaultDefined in src/lib/ncarray/layout.hh:680
Defaulted constructor.
SOArrayPolicy
Section titled “SOArrayPolicy”noexcept
SOArrayPolicy(SOArrayPolicy && other) noexcept = defaultDefined in src/lib/ncarray/layout.hh:681
Defaulted constructor.
advance
Section titled “advance”const inline
inline NCA_HD void * advance(void * data, ssize_t axis, ssize_t index) constDefined 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
Parameters
Section titled “Parameters”-
dataThe pointer to the current position in the array. -
axisThe current axis being traversed. -
indexThe current index along the traversed axis.
Returns
Section titled “Returns”The pointer to the next item in the array.
advance
Section titled “advance”const inline
inline NCA_HD const void * advance(const void * data, ssize_t axis, ssize_t index) constDefined 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
Parameters
Section titled “Parameters”-
dataThe pointer to the current position in the array. -
axisThe current axis being traversed. -
indexThe current index along the traversed axis.
Returns
Section titled “Returns”The const pointer to the next item in the array.
advance
Section titled “advance”const inline
template<typename Coords> inline NCA_HD void * advance(void * data, const Coords & coords) constDefined 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
Parameters
Section titled “Parameters”-
dataThe pointer to the current position in the array. -
coordsThe coordinates specifying the indices of all axes to traverse.
Returns
Section titled “Returns”The pointer to the specified item in the array.
advance
Section titled “advance”const inline
template<typename Coords> inline NCA_HD const void * advance(const void * data, const Coords & coords) constDefined 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
Parameters
Section titled “Parameters”-
dataThe pointer to the current position in the array. -
coordsThe coordinates specifying the indices of all axes to traverse.
Returns
Section titled “Returns”The pointer to the specified item in the array.
suboffsets
Section titled “suboffsets”const inline
inline NCA_HD const ssize_t * suboffsets() constDefined in src/lib/ncarray/layout.hh:809
The pointer to the underlying suboffsets metadata.
Returns
Section titled “Returns”The pointer to the underlying suboffsets metadata.
suboffset
Section titled “suboffset”const inline
inline NCA_HD ssize_t suboffset(ssize_t dim) constDefined in src/lib/ncarray/layout.hh:819
The suboffset of a given axis of an array.
Parameters
Section titled “Parameters”dimA dimension to check the shape of.
Returns
Section titled “Returns”The suboffset of that dimension.
is_pointer_impl
Section titled “is_pointer_impl”const inline
inline NCA_HD bool is_pointer_impl(ssize_t axis) constDefined in src/lib/ncarray/layout.hh:831
Returns whether a given axis is a pointer axis.
Parameters
Section titled “Parameters”Theaxis to check if its a pointer axis.
Returns
Section titled “Returns”Whether that axis is a pointer axis.
get_offset_impl
Section titled “get_offset_impl”const inline
inline NCA_HDMetadata::value_type get_offset_impl(ssize_t axis) constDefined in src/lib/ncarray/layout.hh:841
The offset getter called by the generic version of the base class.
Parameters
Section titled “Parameters”axisThe axis to return the offset for.
Returns
Section titled “Returns”The offset of that axis.
layout_repr
Section titled “layout_repr”const inline
inline NCA_HD const char * layout_repr() constDefined in src/lib/ncarray/layout.hh:850
Returns the string representation of this Layout policy.
Returns
Section titled “Returns”the string representation of this Layout policy.
is_contiguous_impl
Section titled “is_contiguous_impl”const inline
inline NCA_HD bool is_contiguous_impl() constDefined in src/lib/ncarray/layout.hh:861
Determines whether the layout is contiguous by checking for pointer axes.
Returns
Section titled “Returns”Whether there are no pointer axes.
Protected Attributes
Section titled “Protected Attributes”| Return | Name | Description |
|---|---|---|
Metadata |
m_suboffsets |
m_suboffsets
Section titled “m_suboffsets”Metadata m_suboffsetsDefined in src/lib/ncarray/layout.hh:871