Represents a data container used to move data to an accelerator.
The element type of the data.
The rank of the array.
Copies the contents of the array to another array.
Returns a pointer to the raw data of the array.
Returns the accelerator_view object that represents the location where the array is allocated. This property can be accessed only on the CPU.
Returns the access_type of the array. This method can be accessed only on the CPU.
Returns the extent object of the array.
Returns a one-dimensional array that contains all the elements in the array object.
Returns a subsection of the array object that is at the specified origin and, optionally, that has the specified extent.
Returns an array_view object that is constructed from the array object.
Uses copy(*this, vector) to implicitly convert the array to a std::vector object.
Returns the element value that is specified by the parameters.
Returns the element that is at the specified index.
Copies the contents of the specified array object into this one.
Gets the accelerator_view object that represents the location where the array is allocated. This property can be accessed only on the CPU.
Gets the access_type that represents how the CPU can access the storage of the array.
Gets the extent that defines the shape of the array.
The type array<T,N> represents a dense and regular (not jagged) N-dimensional array that is located in a specific location, such as an accelerator or the CPU. The data type of the elements in the array is T, which must be of a type that is compatible with the target accelerator. Although the rank, N, (of the array is determined statically and is part of the type, the extent of the array is determined by the runtime and is expressed by using class extent<N>.
An array can have any number of dimensions, although some functionality is specialized for array objects with rank one, two, and three. If you omit the dimension argument, the default is 1.
Array data is laid out contiguously in memory. Elements that differ by one in the least significant dimension are adjacent in memory.
Arrays are logically considered to be value types, because when an array is copied to another array, a deep copy is performed. Two arrays never point to the same data.
The array<T,N> type is used in several scenarios:
As a data container that can be used in computations on an accelerator.
As a data container to hold memory on the host CPU (that can be used to copy to and from other arrays).
As a staging object to act as a fast intermediary in host-to-device copies.