ArrayImpl
ArrayImpl
Section titled “ArrayImpl”#include <ncarray/array_impl.hh>template<typename Layout, typename Storage>class ArrayImplDefined in src/lib/ncarray/array_impl.hh:148
Inherits:
Layout,Storage
The ArrayImpl provides the mean entry point for all array types. It is a templated class inheriting from Layout and Storage classes, allowing it to be customized to different kinds of array setups. E.g. suboffsets and NCArray style classes are both accessed via the ArrayImpl.
The class provides indexing operations as well as utilities such as repr. Class member functions are implemented in array_operations and the two headers must be combined, in the include order, array_impl then array_operations.
List of all members
Section titled “List of all members”| Name | Kind | Owner |
|---|---|---|
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
operator= |
function |
Declared here |
operator= |
function |
Declared here |
operator= |
function |
Declared here |
operator= |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
ArrayImpl |
function |
Declared here |
nbytes |
function |
Declared here |
operator() |
function |
Declared here |
operator[] |
function |
Declared here |
operator[] |
function |
Declared here |
lin_to_md |
function |
Declared here |
md_to_lin |
function |
Declared here |
operator[] |
function |
Declared here |
operator[] |
function |
Declared here |
operator[] |
function |
Declared here |
operator[] |
function |
Declared here |
view_from_indices |
function |
Declared here |
out_from_axes_ptr |
function |
Declared here |
view |
function |
Declared here |
copy_into |
function |
Declared here |
copy_into_astype |
function |
Declared here |
to_contiguous |
function |
Declared here |
is_contiguous |
function |
Declared here |
astype |
function |
Declared here |
fill |
function |
Declared here |
assign |
function |
Declared here |
squeeze |
function |
Declared here |
reshape |
function |
Declared here |
copy_as_shape |
function |
Declared here |
sum |
function |
Declared here |
max |
function |
Declared here |
argmax |
function |
Declared here |
min |
function |
Declared here |
argmin |
function |
Declared here |
mean |
function |
Declared here |
var |
function |
Declared here |
std |
function |
Declared here |
all |
function |
Declared here |
any |
function |
Declared here |
sum |
function |
Declared here |
max |
function |
Declared here |
argmax |
function |
Declared here |
min |
function |
Declared here |
argmin |
function |
Declared here |
mean |
function |
Declared here |
var |
function |
Declared here |
std |
function |
Declared here |
all |
function |
Declared here |
any |
function |
Declared here |
get_scalar |
function |
Declared here |
operator= |
function |
Declared here |
iota |
function |
Declared here |
operator- |
function |
Declared here |
operator++ |
function |
Declared here |
operator-- |
function |
Declared here |
operator! |
function |
Declared here |
operator+ |
function |
Declared here |
operator- |
function |
Declared here |
operator* |
function |
Declared here |
operator/ |
function |
Declared here |
operator% |
function |
Declared here |
operator+= |
function |
Declared here |
operator-= |
function |
Declared here |
operator*= |
function |
Declared here |
operator/= |
function |
Declared here |
operator== |
function |
Declared here |
operator!= |
function |
Declared here |
operator< |
function |
Declared here |
operator<= |
function |
Declared here |
operator> |
function |
Declared here |
operator>= |
function |
Declared here |
operator&& |
function |
Declared here |
| [`operator | `](#operator-34) | |
operator&= |
function |
Declared here |
| [`operator | =`](#operator-36) | function |
begin |
function |
Declared here |
end |
function |
Declared here |
begin |
function |
Declared here |
end |
function |
Declared here |
repr |
function |
Declared here |
iota |
function |
Declared here |
class_name |
function |
Declared here |
repr_recursive |
function |
Declared here |
repr_recursive_dispatched |
function |
Declared here |
StoragePolicy |
typedef |
Declared here |
LayoutPolicy |
typedef |
Declared here |
MemType |
typedef |
Declared here |
VPolicy |
typedef |
Declared here |
OPolicy |
typedef |
Declared here |
ViewType |
typedef |
Declared here |
OwnerType |
typedef |
Declared here |
ExprResult |
typedef |
Declared here |
Iterator |
typedef |
Declared here |
ConstIterator |
typedef |
Declared here |
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
ArrayImpl |
Defaulted constructor. | |
ArrayImpl inline requires std::is_base_of_v<OwnerTag, Storage> |
Copy constructor for owner type arrays. | |
ArrayImpl inline noexcept requires std::is_base_of_v<OwnerTag, Storage> |
Move constructor for owner type arrays. | |
NCA_HD |
ArrayImpl inline requires (!hd_std::is_base_of_v<OwnerTag, Storage>) |
Copy constructor for view/reference type interconversion. |
NCA_HD |
ArrayImpl inline noexcept requires (!hd_std::is_base_of_v<OwnerTag, Storage>) |
Move constructor for view/reference type interconversion. |
NCA_HD |
ArrayImpl inline requires hd_std::is_base_of_v<ViewTag, Storage> |
Universal copy to view constructor. |
NCA_HD |
ArrayImpl inline noexcept requires hd_std::is_base_of_v<ViewTag, Storage> |
Universal move to view constructor. |
ArrayImpl & |
operator= inline requires hd_std::is_base_of_v<OwnerTag, Storage> |
Copy constructor for Owner type arrays. |
ArrayImpl & |
operator= inline noexcept requires hd_std::is_base_of_v<OwnerTag, Storage> |
Move constructor for Owner type arrays. |
NCA_HDArrayImpl & |
operator= inline requires (!hd_std::is_base_of_v<OwnerTag, Storage>) |
Copy constructor for non-Owner type arrays. |
NCA_HDArrayImpl & |
operator= inline noexcept requires (!hd_std::is_base_of_v<OwnerTag, Storage>) |
Move constructor for non-Owner type arrays. |
NCA_HD |
ArrayImpl inline |
Construct a new array (generally view type). This constructor allows passing explicit offsets/suboffsets. |
NCA_HD |
ArrayImpl inline |
Construct a new array (generally view type). |
NCA_HD |
ArrayImpl inline |
Construct a new reference-style array given a shape and datatype. |
ArrayImpl inline |
Construct a new array given a shape and datatype. This will generally be used for Owner type arrays. | |
ArrayImpl inline |
Construct a new array given a shape and datatype. This will generally be used for Owner type arrays. | |
ArrayImpl inline |
Construct a new array given a shape and datatype. This will generally be used for Owner type arrays. | |
ArrayImpl inline |
Expression-materializing constructor. | |
NCA_HD ssize_t |
nbytes const inline |
The total number of bytes contained in the array (shape * itemsize). |
NCA_HDViewType |
operator() const inline requires (sizeof...(Args) >= 0 && (IndexArg<Args> && ...)) |
Variadic, multi-element operator() for indexing to an array view. |
NCA_HDArrayElementProxy |
operator[] inline |
|
NCA_HD const ArrayElementProxy |
operator[] const inline |
|
NCA_HD void |
lin_to_md inline |
Convert a linearized ravel index into a multi-dimensional coords struct. |
NCA_HD ssize_t |
md_to_lin inline |
Convert a multi-dimensional coords struct to a linearized index. |
NCA_HDArrayElementProxy |
operator[] inline |
A single Coords struct operator[] overload to index to proxy reference. |
NCA_HD const ArrayElementProxy |
operator[] const inline |
A single Coords struct operator[] overload to index to proxy reference. |
NCA_HDArrayElementProxy |
operator[] inline |
The initializer list overloader are for indexing down to a proxy reference. |
NCA_HD const ArrayElementProxy |
operator[] const inline |
The initializer list overloader are for indexing down to a proxy reference. |
NCA_HDViewType |
view_from_indices const inline |
Provided a set of indices, construct a new ViewType of array. |
NCA_HD VT |
out_from_axes_ptr const inline |
Traverse a data pointer using per axis specifications for shapes, strides, and offsets/suboffsets etc. |
NCA_HDViewType |
view const inline |
Construct a view of any array. |
void |
copy_into const |
Copy the array’s data into the provided buffer. |
void |
copy_into_astype const |
Copy the array’s data into the provided buffer while casting. |
OwnerType |
to_contiguous const |
Convert an array to a new contiguous array. |
NCA_HD bool |
is_contiguous const inline |
Check whether the array’s current data is a contiguous block. |
OwnerType |
astype const |
Convert an array to an array of a new DType. |
void |
fill |
Fill all elements of an array with the provided value. The array must not be read-only. |
void |
assign |
Fill all elements of an array with the elements of the input array. |
ViewType |
squeeze const inline |
Return a new array view with axes of size 1 “squeezed” (removed). |
NCA_HDViewType |
reshape const inline |
This function for reshaping assumes contiguity. It is user responsibility to ensure that this is true! |
OwnerType |
copy_as_shape const inline |
For non-contiguous arrays, there is no mathematical formula to reshape in the general case. This function provides a copy and reshape utility to return a new array of the specified shape. |
OwnerType |
sum const |
Perform a sum along the set of provided axes. |
OwnerType |
max const |
Calculate the maximum along the set of provided axes. |
OwnerType |
argmax const |
Determine the index of the maximum along the set of provided axes. |
OwnerType |
min const |
Calculate the minimum along the set of provided axes. |
OwnerType |
argmin const |
Determine the index of the minima along the set of provided axes. |
OwnerType |
mean const |
Calculate the mean along the set of provided axes. |
OwnerType |
var const |
Calculate the variance along the set of provided axes. |
OwnerType |
std const |
Calculate the standard deviation along the set of provided axes. |
OwnerType |
all const |
Return true along the provided axes if all values are “truthy.” |
OwnerType |
any const |
Return true along the provided axes if any value is “truthy.” |
Scalar |
sum const |
Perform a sum of all array elements. |
Scalar |
max const |
Find the maximum of all array elements. |
Scalar |
argmax const |
Find the index of the maximum of all array elements. |
Scalar |
min const |
Find the minimum of all array elements. |
Scalar |
argmin const |
Find the index of the minimum of all array elements. |
Scalar |
mean const |
Find the mean of all array elements. |
Scalar |
var const |
Find the variance of all array elements. |
Scalar |
std const |
Find the standard deviation of all array elements. |
Scalar |
all const |
Return truthy if all elements of the array are truthy. |
Scalar |
any const |
Return truthy if any element of the array is truthy. |
Scalar |
get_scalar const inline |
Return the underlying pointer to an array element as a Scalar variant. |
ArrayImpl & |
operator= |
Evaluate an expression object into the array. |
ExprResult |
iota const inline |
Generate an array using the APL-style index generator. |
ExprResult |
operator- const inline |
Return an expression for the negation of the array. |
ArrayImpl & |
operator++ inline |
Inplace increment each element of the array. |
ArrayImpl & |
operator-- inline |
Inplace decrement each element of the array. |
ExprResult |
operator! const inline |
Return an expression for the logical not of the array. |
ExprResult |
operator+ const inline |
Return an expression for the sum of the array and the provided expression. |
ExprResult |
operator- const |
Return an expression for the difference of an expression from the array. |
ExprResult |
operator* const inline |
Return an expression for the product of the array and the provided expression. |
ExprResult |
operator/ const inline |
Return an expression for the quotient of array over the provided expression. |
ExprResult |
operator% const inline |
Return an expression for the remainder (modulo) of array over the provided expression. |
ArrayImpl & |
operator+= inline |
Add an expression into an array inplace. |
ArrayImpl & |
operator-= inline |
Subtract an expression from an array inplace. |
ArrayImpl & |
operator*= inline |
Calculate the product of an expression into an array inplace. |
ArrayImpl & |
operator/= inline |
Divide an expression into an array inplace. |
ExprResult |
operator== const inline |
Return an expression for the elementwise equality test between the expression and array. |
ExprResult |
operator!= const inline |
Return an expression for the elementwise inequality test between the expression and array. |
ExprResult |
operator< const inline |
Return an expression for the elementwise less than test between the expression and array. |
ExprResult |
operator<= const inline |
Return an expression for the elementwise less than or equal test between the expression and array. |
ExprResult |
operator> const inline |
Return an expression for the elementwise greater than test between the expression and array. |
ExprResult |
operator>= const inline |
Return an expression for the elementwise greater than or equal test between the expression and array. |
ExprResult |
operator&& const inline |
Return an expression for the logical AND of the expression and array. |
ExprResult |
[`operator | |
ArrayImpl & |
operator&= inline |
Calculate the logical AND of an expression and array in place. |
ArrayImpl & |
[`operator | =](#operator-36) inline` |
Iterator |
begin |
Construct a non-const Iterator pointing to the first subview of the array. |
Iterator |
end |
Construct a non-const Iterator pointing to the past the last subview of the array. |
ConstIterator |
begin const |
Construct a const Iterator pointing to the first subview of the array. |
ConstIterator |
end const |
Construct a const Iterator pointing to the past the last subview of the array. |
std::string |
repr const inline |
Return a string representation of the data elements of the array. |
ArrayImpl
Section titled “ArrayImpl”ArrayImpl() = defaultDefined in src/lib/ncarray/array_impl.hh:164
Defaulted constructor.
ArrayImpl
Section titled “ArrayImpl”inline requires std::is_base_of_v<OwnerTag, Storage>
inline ArrayImpl(const ArrayImpl & other) requires std::is_base_of_v<OwnerTag, Storage>Defined in src/lib/ncarray/array_impl.hh:184
Copy constructor for owner type arrays.
Unlike the constructors that follow, this is a deep copy. The actual data will be copied!
ArrayImpl
Section titled “ArrayImpl”inline noexcept requires std::is_base_of_v<OwnerTag, Storage>
inline ArrayImpl(ArrayImpl && other) noexcept requires std::is_base_of_v<OwnerTag, Storage>Defined in src/lib/ncarray/array_impl.hh:202
Move constructor for owner type arrays.
ArrayImpl
Section titled “ArrayImpl”inline requires (!hd_std::is_base_of_v<OwnerTag, Storage>)
inline NCA_HD ArrayImpl(const ArrayImpl & other) requires (!hd_std::is_base_of_v<OwnerTag, Storage>)Defined in src/lib/ncarray/array_impl.hh:220
Copy constructor for view/reference type interconversion.
ArrayImpl
Section titled “ArrayImpl”inline noexcept requires (!hd_std::is_base_of_v<OwnerTag, Storage>)
inline NCA_HD ArrayImpl(ArrayImpl && other) noexcept requires (!hd_std::is_base_of_v<OwnerTag, Storage>)Defined in src/lib/ncarray/array_impl.hh:243
Move constructor for view/reference type interconversion.
ArrayImpl
Section titled “ArrayImpl”inline requires hd_std::is_base_of_v<ViewTag, Storage>
template<class OtherStorage> inline NCA_HD ArrayImpl(const ArrayImpl< Layout, OtherStorage > & other) requires hd_std::is_base_of_v<ViewTag, Storage>Defined in src/lib/ncarray/array_impl.hh:269
Universal copy to view constructor.
All array’s can be copy constructed as their corresponding view.
ArrayImpl
Section titled “ArrayImpl”inline noexcept requires hd_std::is_base_of_v<ViewTag, Storage>
template<class OtherStorage> inline NCA_HD ArrayImpl(ArrayImpl< Layout, OtherStorage > && other) noexcept requires hd_std::is_base_of_v<ViewTag, Storage>Defined in src/lib/ncarray/array_impl.hh:287
Universal move to view constructor.
All array’s can be move constructed as their corresponding view.
operator=
Section titled “operator=”inline requires hd_std::is_base_of_v<OwnerTag, Storage>
inline ArrayImpl & operator=(const ArrayImpl & other) requires hd_std::is_base_of_v<OwnerTag, Storage>Defined in src/lib/ncarray/array_impl.hh:306
Copy constructor for Owner type arrays.
operator=
Section titled “operator=”inline noexcept requires hd_std::is_base_of_v<OwnerTag, Storage>
inline ArrayImpl & operator=(ArrayImpl && other) noexcept requires hd_std::is_base_of_v<OwnerTag, Storage>Defined in src/lib/ncarray/array_impl.hh:321
Move constructor for Owner type arrays.
operator=
Section titled “operator=”inline requires (!hd_std::is_base_of_v<OwnerTag, Storage>)
inline NCA_HDArrayImpl & operator=(const ArrayImpl & other) requires (!hd_std::is_base_of_v<OwnerTag, Storage>)Defined in src/lib/ncarray/array_impl.hh:342
Copy constructor for non-Owner type arrays.
operator=
Section titled “operator=”inline noexcept requires (!hd_std::is_base_of_v<OwnerTag, Storage>)
inline NCA_HDArrayImpl & operator=(ArrayImpl && other) noexcept requires (!hd_std::is_base_of_v<OwnerTag, Storage>)Defined in src/lib/ncarray/array_impl.hh:357
Move constructor for non-Owner type arrays.
ArrayImpl
Section titled “ArrayImpl”inline
inline NCA_HD ArrayImpl(void * data_, const Metadata shape_, const Metadata strides_, const Metadata offsets_, DType dtype_, ssize_t pointer_axis_, bool read_only_)Defined in src/lib/ncarray/array_impl.hh:390
Construct a new array (generally view type). This constructor allows passing explicit offsets/suboffsets.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data_ |
void * |
The underlying array data. |
shape_ |
const [Metadata](api-ncarray.md#metadata) |
A pointer to the shape. Should be valid through ndim derefernces. |
strides_ |
const [Metadata](api-ncarray.md#metadata) |
A pointer to the strides. Should be valid through ndim derefernces. |
offsets_ |
const [Metadata](api-ncarray.md#metadata) |
A pointer to the offsets. Should be valid through ndim derefernces. |
dtype_ |
[DType](api-ncarray.md#dtype) |
The datatype of the elements of the new array. |
pointer_axis_ |
ssize_t |
Which if any axis is a pointer axis. |
read_only_ |
bool |
Whether the underlying data is read-only. |
ArrayImpl
Section titled “ArrayImpl”inline
inline NCA_HD ArrayImpl(void * data_, const Metadata::value_type ndim, const Metadata::value_type * shape_, const Metadata::value_type * strides_, DType dtype_, Metadata::value_type pointer_axis_, bool read_only_)Defined in src/lib/ncarray/array_impl.hh:429
Construct a new array (generally view type).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data_ |
void * |
The underlying array data. |
ndim |
const [Metadata::value_type](api-ncarray-FixedMetadata.md#value_type-2) |
The number of dimensions in the array. |
shape_ |
const [Metadata::value_type](api-ncarray-FixedMetadata.md#value_type-2) * |
A pointer to the shape. Should be valid through ndim derefernces. |
strides_ |
const [Metadata::value_type](api-ncarray-FixedMetadata.md#value_type-2) * |
A pointer to the strides. Should be valid through ndim derefernces. |
dtype_ |
[DType](api-ncarray.md#dtype) |
The datatype of the elements of the new array. |
pointer_axis_ |
[Metadata::value_type](api-ncarray-FixedMetadata.md#value_type-2) |
Which if any axis is a pointer axis. |
read_only_ |
bool |
Whether the underlying data is read-only. |
ArrayImpl
Section titled “ArrayImpl”inline
inline NCA_HD ArrayImpl(const std::vector< void * > & data_ptrs, const std::vector< ssize_t > & shape_, const std::vector< ssize_t > & strides_, DType dtype_, Metadata::value_type pointer_axis_, bool read_only_)Defined in src/lib/ncarray/array_impl.hh:469
Construct a new reference-style array given a shape and datatype.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data_ptrs |
const std::vector< void * > & |
A vector of data pointers that makeup the array. |
shape_ |
const std::vector< ssize_t > & |
The shape of the new ref array (using a std::vector). |
strides_ |
const std::vector< ssize_t > & |
The strides of the new ref array (using a std::vector). |
dtype_ |
[DType](api-ncarray.md#dtype) |
The datatype of the elements of the new array. |
pointer_axis_ |
[Metadata::value_type](api-ncarray-FixedMetadata.md#value_type-2) |
Which if any axis is a pointer axis. |
read_only_ |
bool |
Whether the underlying data is read-only. |
ArrayImpl
Section titled “ArrayImpl”inline
inline ArrayImpl(const std::vector< ssize_t > & shape_, DType dtype_)Defined in src/lib/ncarray/array_impl.hh:520
Construct a new array given a shape and datatype. This will generally be used for Owner type arrays.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
shape_ |
const std::vector< ssize_t > & |
The shape of the new array (using a std::vector). |
dtype_ |
[DType](api-ncarray.md#dtype) |
The datatype of the elements of the new array. |
ArrayImpl
Section titled “ArrayImpl”inline
inline ArrayImpl(const Metadata & shape_, DType dtype_)Defined in src/lib/ncarray/array_impl.hh:565
Construct a new array given a shape and datatype. This will generally be used for Owner type arrays.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
shape_ |
const [Metadata](api-ncarray.md#metadata) & |
The shape of the new array (using the metadata struct). |
dtype_ |
[DType](api-ncarray.md#dtype) |
The datatype of the elements of the new array. |
ArrayImpl
Section titled “ArrayImpl”inline
inline ArrayImpl(ssize_t ndim, const ssize_t * shape_, DType dtype_)Defined in src/lib/ncarray/array_impl.hh:612
Construct a new array given a shape and datatype. This will generally be used for Owner type arrays.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ndim |
ssize_t |
The number of dimensions (to properly increment the pointer). |
shape_ |
const ssize_t * |
The shape of the new array (using a raw pointer). |
dtype_ |
[DType](api-ncarray.md#dtype) |
The datatype of the elements of the new array. |
ArrayImpl
Section titled “ArrayImpl”inline
template<Expression Expr> inline ArrayImpl(const Expr & expr)Defined in src/lib/ncarray/array_impl.hh:656
Expression-materializing constructor.
An array constructed via an expression object will have shape, and metadata determined by the expression. The expression will be evaluated into the array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
expr |
const Expr & |
The expression to be evaluated. |
nbytes
Section titled “nbytes”const inline
inline NCA_HD ssize_t nbytes() constDefined in src/lib/ncarray/array_impl.hh:667
The total number of bytes contained in the array (shape * itemsize).
Returns
Section titled “Returns”The number of bytes.
operator()
Section titled “operator()”const inline requires (sizeof...(Args) >= 0 && (IndexArg<Args> && ...))
template<typename... Args> inline NCA_HDViewType operator()(Args &&... idx_args) const requires (sizeof...(Args) >= 0 && (IndexArg<Args> && ...))Defined in src/lib/ncarray/array_impl.hh:719
Variadic, multi-element operator() for indexing to an array view.
Index arguments must be either:
Returns
Section titled “Returns”The subview array determined by the provided indices.
operator[]
Section titled “operator[]”inline
inline NCA_HDArrayElementProxy operator[](ssize_t idx)Defined in src/lib/ncarray/array_impl.hh:735
operator[]
Section titled “operator[]”const inline
inline NCA_HD const ArrayElementProxy operator[](ssize_t idx) constDefined in src/lib/ncarray/array_impl.hh:758
lin_to_md
Section titled “lin_to_md”inline
template<typename Coords> inline NCA_HD void lin_to_md(ssize_t idx, Coords & coords)Defined in src/lib/ncarray/array_impl.hh:791
Convert a linearized ravel index into a multi-dimensional coords struct.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
idx |
ssize_t |
The linearized input index. |
coords |
Coords & |
The pre-created coords struct to be populated. |
md_to_lin
Section titled “md_to_lin”inline
template<typename Coords> inline NCA_HD ssize_t md_to_lin(Coords & coords)Defined in src/lib/ncarray/array_impl.hh:822
Convert a multi-dimensional coords struct to a linearized index.
Returns
Section titled “Returns”idx The linearized index.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
coords |
Coords & |
The pre-created coords struct with multi-dimensional indices. |
operator[]
Section titled “operator[]”inline
template<typename Coords> inline NCA_HDArrayElementProxy operator[](const Coords & coords)Defined in src/lib/ncarray/array_impl.hh:847
A single Coords struct operator[] overload to index to proxy reference.
The StaticCoords object should be the correct dimensionality to match the array’s dimensionality. This is NOT checked in this function for performance reasons!
Returns
Section titled “Returns”The proxy reference pointed to by the provided coords.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
coords |
const Coords & |
The coords to use to index to proxy reference. |
operator[]
Section titled “operator[]”const inline
template<typename Coords> inline NCA_HD const ArrayElementProxy operator[](const Coords & coords) constDefined in src/lib/ncarray/array_impl.hh:871
A single Coords struct operator[] overload to index to proxy reference.
The StaticCoords object should be the correct dimensionality to match the array’s dimensionality. This is NOT checked in this function for performance reasons!
Returns
Section titled “Returns”The const proxy reference pointed to by the provided coords.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
coords |
const Coords & |
The coords to use to index to proxy reference. |
operator[]
Section titled “operator[]”inline
inline NCA_HDArrayElementProxy operator[](hd_std::initializer_list< hd_std::uint64_t > coords)Defined in src/lib/ncarray/array_impl.hh:893
The initializer list overloader are for indexing down to a proxy reference.
For view semantics, you can make use of the variadic operator[] (C++23) or for NVCC, C++20, code, the variadic operator().
Returns
Section titled “Returns”The proxy reference pointed to by the provided coords.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
coords |
hd_std::initializer_list< hd_std::uint64_t > |
The coords to use to index to proxy reference. |
operator[]
Section titled “operator[]”const inline
inline NCA_HD const ArrayElementProxy operator[](hd_std::initializer_list< hd_std::uint64_t > coords) constDefined in src/lib/ncarray/array_impl.hh:916
The initializer list overloader are for indexing down to a proxy reference.
For view semantics, you can make use of the variadic operator[] (C++23) or for NVCC, C++20, code, the variadic operator().
Returns
Section titled “Returns”The proxy reference pointed to by the provided coords.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
coords |
hd_std::initializer_list< hd_std::uint64_t > |
The coords to use to index to proxy reference. |
view_from_indices
Section titled “view_from_indices”const inline
inline NCA_HDViewType view_from_indices(const IndexItem * indices, ssize_t num_indices) constDefined in src/lib/ncarray/array_impl.hh:941
Provided a set of indices, construct a new ViewType of array.
Returns
Section titled “Returns”The new view of the data.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
indices |
const [IndexItem](api-ncarray-IndexItem.md#indexitem) * |
The index specification. Each item contains a type (like Slice, or integer) and the axis it belongs to. |
num_indices |
ssize_t |
The number of indices that were provided for traversing the pointer. |
out_from_axes_ptr
Section titled “out_from_axes_ptr”const inline
template<class VT> inline NCA_HD VT out_from_axes_ptr(void * data_ptr, const AxisDescr * axes, ssize_t ndim = -1) constDefined in src/lib/ncarray/array_impl.hh:965
Traverse a data pointer using per axis specifications for shapes, strides, and offsets/suboffsets etc.
This function in general is not likely to be used directly. It correctly traverses the data pointer, accumulating offsets as needed, to produce a final view that matches the input axes specifications.
Using the view_from_indices function is more user friendly.
Returns
Section titled “Returns”The new view of the data.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data_ptr |
void * |
The data to traverse. |
axes |
const [AxisDescr](api-ncarray-AxisDescr.md#axisdescr) * |
The specification for each axis in the new view. |
const inline
inline NCA_HDViewType view() constDefined in src/lib/ncarray/array_impl.hh:1050
Construct a view of any array.
Some functions, and in particular device code, require views only, to avoid allocations when dealing with OwnerType arrays. This function will provide a view over the data from any array, so it can be used easily with all APIs.
E.g.:
gpu_kernel<<<blocks, TPB>>>(my_array.view());Returns
Section titled “Returns”The view of the array.
copy_into
Section titled “copy_into”const
void copy_into(void * dest_buffer) constDefined in src/lib/ncarray/array_impl.hh:1059
Copy the array’s data into the provided buffer.
This will copy data using the array’s datatype.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dest_buffer |
void * |
The destination for the copied data. |
copy_into_astype
Section titled “copy_into_astype”const
template<typename OutT> void copy_into_astype(OutT * dest_buffer) constDefined in src/lib/ncarray/array_impl.hh:1071
Copy the array’s data into the provided buffer while casting.
This will perform the appropriate casts from the array’s datatype to the requested datatype.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dest_buffer |
OutT * |
The destination for the copied data. |
to_contiguous
Section titled “to_contiguous”const
OwnerType to_contiguous() constDefined in src/lib/ncarray/array_impl.hh:1083
Convert an array to a new contiguous array.
Todo: Consider the logic in this function to avoid a copy if the array is contiguous.
Returns
Section titled “Returns”A new contiguous array with the same data.
is_contiguous
Section titled “is_contiguous”const inline
inline NCA_HD bool is_contiguous() constDefined in src/lib/ncarray/array_impl.hh:1090
Check whether the array’s current data is a contiguous block.
Returns
Section titled “Returns”is_contiguous Whether the data is contiguous.
astype
Section titled “astype”const
OwnerType astype(DType & dtype_out) constDefined in src/lib/ncarray/array_impl.hh:1119
Convert an array to an array of a new DType.
Returns
Section titled “Returns”A new contiguous array with the same data.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dtype_out |
[DType](api-ncarray.md#dtype) & |
The DType to convert the array to. |
void fill(Scalar val)Defined in src/lib/ncarray/array_impl.hh:1129
Fill all elements of an array with the provided value. The array must not be read-only.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
val |
[Scalar](api-ncarray.md#scalar) |
The value to assign to the array elements. |
assign
Section titled “assign”void assign(const ArrayLike auto & arr)Defined in src/lib/ncarray/array_impl.hh:1142
Fill all elements of an array with the elements of the input array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
arr |
const ArrayLike auto & |
The array to use for assignment. |
squeeze
Section titled “squeeze”const inline
inline ViewType squeeze() constDefined in src/lib/ncarray/array_impl.hh:1149
Return a new array view with axes of size 1 “squeezed” (removed).
Returns
Section titled “Returns”The squeezed output array view.
reshape
Section titled “reshape”const inline
inline NCA_HDViewType reshape(const ssize_t * new_shape, ssize_t ndim) constDefined in src/lib/ncarray/array_impl.hh:1185
This function for reshaping assumes contiguity. It is user responsibility to ensure that this is true!
Returns
Section titled “Returns”The reshaped view.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
new_shape |
const ssize_t * |
The new shape that is requested. |
ndim |
ssize_t |
The number of dimensions in the new shape. |
copy_as_shape
Section titled “copy_as_shape”const inline
inline OwnerType copy_as_shape(const ssize_t * new_shape, ssize_t ndim) constDefined in src/lib/ncarray/array_impl.hh:1224
For non-contiguous arrays, there is no mathematical formula to reshape in the general case. This function provides a copy and reshape utility to return a new array of the specified shape.
Because this function allocates an OwnerType, it can only be called from the host.
Returns
Section titled “Returns”A new contiguous owning array of the specified shape.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
new_shape |
const ssize_t * |
The new shape that is requested. |
ndim |
ssize_t |
The number of dimensions in the new shape. |
const
OwnerType sum(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1250
Perform a sum along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the per-axis sums.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to sum along. |
const
OwnerType max(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1261
Calculate the maximum along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the per-axis maxima.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the maximum along. |
argmax
Section titled “argmax”const
OwnerType argmax(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1271
Determine the index of the maximum along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the indices of the per-axis maxima.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the index of the maximum along. |
const
OwnerType min(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1282
Calculate the minimum along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the per-axis maxima.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the minimum along. |
argmin
Section titled “argmin”const
OwnerType argmin(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1292
Determine the index of the minima along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the indices of the per-axis minima.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the index of the minimum along. |
const
OwnerType mean(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1303
Calculate the mean along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the indices of the per-axis means.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the mean along. |
const
OwnerType var(const std::vector< ssize_t > & axes, ssize_t ddof = 0) constDefined in src/lib/ncarray/array_impl.hh:1314
Calculate the variance along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the indices of the per-axis variance.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the variance along. |
ddof |
ssize_t |
The delta degrees of freedom. Divisor in the calculation is N-ddof. |
const
OwnerType std(const std::vector< ssize_t > & axes, ssize_t ddof = 0) constDefined in src/lib/ncarray/array_impl.hh:1325
Calculate the standard deviation along the set of provided axes.
Returns
Section titled “Returns”An owning type array with the indices of the per-axis standard deviation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to find the standard deviation along. |
ddof |
ssize_t |
The delta degrees of freedom. Divisor in the calculation is N-ddof. |
const
OwnerType all(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1336
Return true along the provided axes if all values are “truthy.”
Returns
Section titled “Returns”An owning type array with a truthy value if all values were truthy.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes to determine truthiness along. |
const
OwnerType any(const std::vector< ssize_t > & axes) constDefined in src/lib/ncarray/array_impl.hh:1346
Return true along the provided axes if any value is “truthy.”
Returns
Section titled “Returns”An owning type array with a truthy value if any value was truthy.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
axes |
const std::vector< ssize_t > & |
The axes along which to determine if any value is “truthy.” |
const
Scalar sum() constDefined in src/lib/ncarray/array_impl.hh:1358
Perform a sum of all array elements.
Returns
Section titled “Returns”The full sum of the array.
const
Scalar max() constDefined in src/lib/ncarray/array_impl.hh:1368
Find the maximum of all array elements.
Returns
Section titled “Returns”The maximum of the array.
argmax
Section titled “argmax”const
Scalar argmax() constDefined in src/lib/ncarray/array_impl.hh:1379
Find the index of the maximum of all array elements.
Returns
Section titled “Returns”The linearized ravel index for the maximum of the array.
const
Scalar min() constDefined in src/lib/ncarray/array_impl.hh:1389
Find the minimum of all array elements.
Returns
Section titled “Returns”The minimum of the array.
argmin
Section titled “argmin”const
Scalar argmin() constDefined in src/lib/ncarray/array_impl.hh:1400
Find the index of the minimum of all array elements.
Returns
Section titled “Returns”The linearized ravel index for the minimum of the array.
const
Scalar mean() constDefined in src/lib/ncarray/array_impl.hh:1410
Find the mean of all array elements.
Returns
Section titled “Returns”The mean of the array.
const
Scalar var(ssize_t ddof = 0) constDefined in src/lib/ncarray/array_impl.hh:1421
Find the variance of all array elements.
Returns
Section titled “Returns”The variance of the array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ddof |
ssize_t |
The delta degrees of freedom. Divisor in the calculation is N-ddof. |
const
Scalar std(ssize_t ddof = 0) constDefined in src/lib/ncarray/array_impl.hh:1431
Find the standard deviation of all array elements.
Returns
Section titled “Returns”The standard deviation of the array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ddof |
ssize_t |
The delta degrees of freedom. Divisor in the calculation is N-ddof. |
const
Scalar all() constDefined in src/lib/ncarray/array_impl.hh:1441
Return truthy if all elements of the array are truthy.
Returns
Section titled “Returns”Truthy if all elements are truthy, otherwise falsey.
const
Scalar any() constDefined in src/lib/ncarray/array_impl.hh:1450
Return truthy if any element of the array is truthy.
Returns
Section titled “Returns”Truthy if any element of the array is truthy, otherwise falsey.
get_scalar
Section titled “get_scalar”const inline
inline Scalar get_scalar(void * ptr) constDefined in src/lib/ncarray/array_impl.hh:1461
Return the underlying pointer to an array element as a Scalar variant.
Returns
Section titled “Returns”A scalar for the provided array element.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ptr |
void * |
The pointer to an element of the array. |
operator=
Section titled “operator=”template<Expression Expr> ArrayImpl & operator=(const Expr & expr)Defined in src/lib/ncarray/array_impl.hh:1478
Evaluate an expression object into the array.
const inline
inline ExprResult iota() constDefined in src/lib/ncarray/array_impl.hh:1492
Generate an array using the APL-style index generator.
Use the ravel index to populate the values of the array based on the shape of the instance it is called on.
Returns
Section titled “Returns”An expression to be evaluated which will create the ravel index array.
operator-
Section titled “operator-”const inline
inline ExprResult operator-() constDefined in src/lib/ncarray/array_impl.hh:1522
Return an expression for the negation of the array.
Returns
Section titled “Returns”An expression for the negation of the array.
operator++
Section titled “operator++”inline
inline ArrayImpl & operator++()Defined in src/lib/ncarray/array_impl.hh:1526
Inplace increment each element of the array.
operator–
Section titled “operator–”inline
inline ArrayImpl & operator--()Defined in src/lib/ncarray/array_impl.hh:1530
Inplace decrement each element of the array.
operator!
Section titled “operator!”const inline
inline ExprResult operator!() constDefined in src/lib/ncarray/array_impl.hh:1536
Return an expression for the logical not of the array.
Returns
Section titled “Returns”An expression for the logical not of the array.
operator+
Section titled “operator+”const inline
inline ExprResult operator+(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1548
Return an expression for the sum of the array and the provided expression.
Returns
Section titled “Returns”An expression for the sum of the array and the provided expression.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to sum with the array. |
operator-
Section titled “operator-”const
ExprResult operator-(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1558
Return an expression for the difference of an expression from the array.
Returns
Section titled “Returns”An expression for the difference of the provided expression from the array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to subtract from the array. |
operator*
Section titled “operator*”const inline
inline ExprResult operator*(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1568
Return an expression for the product of the array and the provided expression.
Returns
Section titled “Returns”An expression for the product of the array and the provided expression.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to multiply with the array. |
operator/
Section titled “operator/”const inline
inline ExprResult operator/(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1578
Return an expression for the quotient of array over the provided expression.
Returns
Section titled “Returns”An expression for the quotient of array and expression.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression that will be the denominator. |
operator%
Section titled “operator%”const inline
inline ExprResult operator%(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1588
Return an expression for the remainder (modulo) of array over the provided expression.
Returns
Section titled “Returns”An expression for the remainder (modulo) of array and expression.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression that will be the denominator. |
operator+=
Section titled “operator+=”inline
inline ArrayImpl & operator+=(const ExprResult & right)Defined in src/lib/ncarray/array_impl.hh:1599
Add an expression into an array inplace.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to sum with the array. |
operator-=
Section titled “operator-=”inline
inline ArrayImpl & operator-=(const ExprResult & right)Defined in src/lib/ncarray/array_impl.hh:1608
Subtract an expression from an array inplace.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to subtract from the array. |
operator*=
Section titled “operator*=”inline
inline ArrayImpl & operator*=(const ExprResult & right)Defined in src/lib/ncarray/array_impl.hh:1617
Calculate the product of an expression into an array inplace.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to multiply with the array. |
operator/=
Section titled “operator/=”inline
inline ArrayImpl & operator/=(const ExprResult & right)Defined in src/lib/ncarray/array_impl.hh:1626
Divide an expression into an array inplace.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to divide the array by. |
operator==
Section titled “operator==”const inline
inline ExprResult operator==(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1638
Return an expression for the elementwise equality test between the expression and array.
Returns
Section titled “Returns”An expression for the elementwise equality comparison.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to compare with the array. |
operator!=
Section titled “operator!=”const inline
inline ExprResult operator!=(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1648
Return an expression for the elementwise inequality test between the expression and array.
Returns
Section titled “Returns”An expression for the elementwise inequality comparison.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to compare with the array. |
operator<
Section titled “operator<”const inline
inline ExprResult operator<(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1658
Return an expression for the elementwise less than test between the expression and array.
Returns
Section titled “Returns”An expression for the elementwise less than comparison.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to compare with the array. |
operator<=
Section titled “operator<=”const inline
inline ExprResult operator<=(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1668
Return an expression for the elementwise less than or equal test between the expression and array.
Returns
Section titled “Returns”An expression for the elementwise less than or equal comparison.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to compare with the array. |
operator>
Section titled “operator>”const inline
inline ExprResult operator>(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1678
Return an expression for the elementwise greater than test between the expression and array.
Returns
Section titled “Returns”An expression for the elementwise greater than comparison.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to compare with the array. |
operator>=
Section titled “operator>=”const inline
inline ExprResult operator>=(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1688
Return an expression for the elementwise greater than or equal test between the expression and array.
Returns
Section titled “Returns”An expression for the elementwise greater than or equal comparison.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to compare with the array. |
operator&&
Section titled “operator&&”const inline
inline ExprResult operator&&(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1700
Return an expression for the logical AND of the expression and array.
Returns
Section titled “Returns”An expression for the logical AND.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to calculate the logical AND of with the array. |
operator||
Section titled “operator||”const inline
inline ExprResult operator||(const ExprResult & right) constDefined in src/lib/ncarray/array_impl.hh:1710
Return an expression for the logical OR of the expression and array.
Returns
Section titled “Returns”An expression for the logical OR.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to calculate the logical OR of with the array. |
operator&=
Section titled “operator&=”inline
inline ArrayImpl & operator&=(const ExprResult & right)Defined in src/lib/ncarray/array_impl.hh:1722
Calculate the logical AND of an expression and array in place.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to calculate the logical AND of with the array. |
operator|=
Section titled “operator|=”inline
inline ArrayImpl & operator|=(const ExprResult & right)Defined in src/lib/ncarray/array_impl.hh:1732
Calculate the logical OR of an expression and array in place.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
right |
const [ExprResult](#exprresult) & |
The expression to calculate the logical OR of with the array. |
Iterator begin()Defined in src/lib/ncarray/array_impl.hh:1802
Construct a non-const Iterator pointing to the first subview of the array.
Returns
Section titled “Returns”A non-const iterator pointing to the first subview of the array.
Iterator end()Defined in src/lib/ncarray/array_impl.hh:1808
Construct a non-const Iterator pointing to the past the last subview of the array.
Returns
Section titled “Returns”A non-const iterator pointing past the last subview of the array.
const
ConstIterator begin() constDefined in src/lib/ncarray/array_impl.hh:1815
Construct a const Iterator pointing to the first subview of the array.
Returns
Section titled “Returns”A const iterator pointing to the first subview of the array.
const
ConstIterator end() constDefined in src/lib/ncarray/array_impl.hh:1821
Construct a const Iterator pointing to the past the last subview of the array.
Returns
Section titled “Returns”A const iterator pointing past the last subview of the array.
const inline
inline std::string repr() constDefined in src/lib/ncarray/array_impl.hh:1841
Return a string representation of the data elements of the array.
This routine returns a string of data elements of the array, formatted in a manner very similar to how NumPy prints its NDArrays. If there are too many elements, the first 3 and last 3 are shown with the truncated elements replaced by an elipsis on all axes this has occurred.
Returns
Section titled “Returns”The string representation.
Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
OwnerType |
iota static inline |
Generate an array of the specified type using the APL-style index generator. |
static inline
static inline OwnerType iota(const std::vector< ssize_t > & shape, DType dtype = DType::int64)Defined in src/lib/ncarray/array_impl.hh:1508
Generate an array of the specified type using the APL-style index generator.
Use the ravel index to populate the values of the array based on the shape of the instance it is called on.
Returns
Section titled “Returns”An array with elements populated by the index generator.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
shape |
const std::vector< ssize_t > & |
The shape of the array to construct. |
dtype |
[DType](api-ncarray.md#dtype) |
The datatype for the final array. |
Protected Methods
Section titled “Protected Methods”| Return | Name | Description |
|---|---|---|
std::string |
class_name const inline |
Return a class name primarily for the repr routine. |
void |
repr_recursive const inline |
Dispatcher for the recursive helper for repr() that handles arbitrary dimensions. |
void |
repr_recursive_dispatched const inline |
Recursive helper for repr() that handles arbitrary dimensions. |
class_name
Section titled “class_name”const inline
inline std::string class_name() constDefined in src/lib/ncarray/array_impl.hh:1883
Return a class name primarily for the repr routine.
This provides a unique name for the class that combines the layout and storage specifications for easy identification when printing to console.
Returns
Section titled “Returns”The class name.
repr_recursive
Section titled “repr_recursive”const inline
inline void repr_recursive(std::ostringstream & oss, void * current_data, ssize_t axis, ssize_t indent, ssize_t edge_items) constDefined in src/lib/ncarray/array_impl.hh:1898
Dispatcher for the recursive helper for repr() that handles arbitrary dimensions.
This function only dispatches the true recurser based on the datatype.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
oss |
std::ostringstream & |
The stream to write the array representation to. |
current_data |
void * |
A pointer to the current data element of the array. |
axis |
ssize_t |
The current array axis being traversed. |
indent |
ssize_t |
The current indentation level to add to the string representation. |
edge_items |
ssize_t |
The current number of items to be shown when truncating for length. |
repr_recursive_dispatched
Section titled “repr_recursive_dispatched”const inline
template<class T> inline void repr_recursive_dispatched(std::ostringstream & oss, void * current_data, ssize_t axis, ssize_t indent, ssize_t edge_items) constDefined in src/lib/ncarray/array_impl.hh:1921
Recursive helper for repr() that handles arbitrary dimensions.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
oss |
std::ostringstream & |
The stream to write the array representation to. |
current_data |
void * |
A pointer to the current data element of the array. |
axis |
ssize_t |
The current array axis being traversed. |
indent |
ssize_t |
The current indentation level to add to the string representation. |
edge_items |
ssize_t |
The current number of items to be shown when truncating for length. |
Public Types
Section titled “Public Types”| Name | Description |
|---|---|
StoragePolicy |
|
LayoutPolicy |
|
MemType |
|
VPolicy |
|
OPolicy |
|
ViewType |
|
OwnerType |
|
ExprResult |
|
Iterator |
|
ConstIterator |
StoragePolicy
Section titled “StoragePolicy”using StoragePolicy = StorageDefined in src/lib/ncarray/array_impl.hh:151
LayoutPolicy
Section titled “LayoutPolicy”using LayoutPolicy = LayoutDefined in src/lib/ncarray/array_impl.hh:152
MemType
Section titled “MemType”using MemType = typename Storage::MemTypeDefined in src/lib/ncarray/array_impl.hh:157
VPolicy
Section titled “VPolicy”using VPolicy = typename StoragePolicyTraits< MemType >::ViewDefined in src/lib/ncarray/array_impl.hh:158
OPolicy
Section titled “OPolicy”using OPolicy = typename StoragePolicyTraits< MemType >::OwnerDefined in src/lib/ncarray/array_impl.hh:159
ViewType
Section titled “ViewType”using ViewType = ArrayImpl< Layout, VPolicy >Defined in src/lib/ncarray/array_impl.hh:161
OwnerType
Section titled “OwnerType”using OwnerType = ArrayImpl< Layout, OPolicy >Defined in src/lib/ncarray/array_impl.hh:162
ExprResult
Section titled “ExprResult”using ExprResult = ExprMVNode< MemType >Defined in src/lib/ncarray/array_impl.hh:1480
Iterator
Section titled “Iterator”using Iterator = IteratorImpl< ViewType >Defined in src/lib/ncarray/array_impl.hh:1794
ConstIterator
Section titled “ConstIterator”using ConstIterator = IteratorImpl< const ViewType >Defined in src/lib/ncarray/array_impl.hh:1795