Array Class Listing#
-
template<typename ShapeType_, typename StorageType_>
struct TypeInfo<array::ArrayContainer<ShapeType_, StorageType_>> - #include <arrayContainer.hpp>
Public Types
-
using Scalar = typename TypeInfo<StorageType_>::Scalar
-
using Packet = std::false_type
-
using Backend = typename TypeInfo<StorageType_>::Backend
Public Static Attributes
-
static constexpr detail::LibRapidType type = detail::LibRapidType::ArrayContainer
-
static constexpr int64_t packetWidth = 1
-
static constexpr bool supportsArithmetic = TypeInfo<Scalar>::supportsArithmetic
-
static constexpr bool supportsLogical = TypeInfo<Scalar>::supportsLogical
-
static constexpr bool supportsBinary = TypeInfo<Scalar>::supportsBinary
-
static constexpr bool allowVectorisation = TypeInfo<Scalar>::packetWidth > 1
-
static constexpr cudaDataType_t CudaType = TypeInfo<Scalar>::CudaType
-
static constexpr int64_t cudaPacketWidth = 1
-
static constexpr bool canAlign = false
-
static constexpr int64_t canMemcpy = false
-
using Scalar = typename TypeInfo<StorageType_>::Scalar
-
template<typename SizeType, size_t dims, typename StorageScalar>
struct IsArrayContainer<array::ArrayContainer<Shape<SizeType, dims>, StorageScalar>> : public std::true_type - #include <arrayContainer.hpp>
-
template<typename T>
struct IsArrayType<array::ArrayView<T>> - #include <arrayContainer.hpp>
Public Static Attributes
-
static constexpr bool val = true
-
static constexpr bool val = true
-
namespace librapid
-
namespace array#
-
template<typename ShapeType_, typename StorageType_>
class ArrayContainer - #include <arrayContainer.hpp>
Public Types
-
using StorageType = StorageType_
-
using ShapeType = ShapeType_
-
using StrideType = Stride<size_t, 32>
-
using SizeType = typename ShapeType::SizeType
-
using Scalar = typename StorageType::Scalar
-
using Packet = typename typetraits::TypeInfo<Scalar>::Packet
-
using Backend = typename typetraits::TypeInfo<ArrayContainer>::Backend
-
using Iterator = detail::ArrayIterator<ArrayView<ArrayContainer>>
-
using DirectSubscriptType = typename detail::SubscriptType<StorageType>::Direct
-
using DirectRefSubscriptType = typename detail::SubscriptType<StorageType>::Ref
Public Functions
-
ArrayContainer()
Default constructor.
-
template<typename T>
ArrayContainer(const std::initializer_list<T> &data)
-
template<typename T>
explicit ArrayContainer(const std::vector<T> &data)
-
explicit ArrayContainer(const ShapeType &shape)
Constructs an array container from a shape
- Parameters
shape – The shape of the array container
-
ArrayContainer(const ShapeType &shape, const Scalar &value)
Create an array container from a shape and a scalar value. The scalar value represents the value the memory is initialized with.
- Parameters
shape – The shape of the array container
value – The value to initialize the memory with
-
explicit ArrayContainer(const Scalar &value)
Allows for a fixed-size array to be constructed with a fill value
- Parameters
value – The value to fill the array with
-
explicit ArrayContainer(ShapeType &&shape)
Construct an array container from a shape, which is moved, not copied.
- Parameters
shape – The shape of the array container
-
ArrayContainer(const ArrayContainer &other) = default
Construct an array container from another array container.
- Parameters
other – The array container to copy.
-
ArrayContainer(ArrayContainer &&other) noexcept = default
Construct an array container from a temporary array container.
- Parameters
other – The array container to move.
-
template<typename desc, typename Functor_, typename ...Args>
ArrayContainer &assign(const detail::Function<desc, Functor_, Args...> &function)
- template<typename desc, typename Functor_, typename... Args> ArrayContainer (const detail::Function< desc, Functor_, Args... > &function) LIBRAPID_RELEASE_NOEXCEPT
Construct an array container from a function object. This will assign the result of the function to the array container, evaluating it accordingly.
- Template Parameters
desc – The assignment descriptor
Functor_ – The function type
Args – The argument types of the function
- Parameters
function – The function to assign
-
ArrayContainer &operator=(const ArrayContainer &other) = default
Assign an array container to this array container.
- Parameters
other – The array container to copy.
- Returns
A reference to this array container.
-
ArrayContainer &operator=(const Scalar &value)
-
ArrayContainer &operator=(ArrayContainer &&other) noexcept = default
Assign a temporary array container to this array container.
- Parameters
other – The array container to move.
- Returns
A reference to this array container.
-
template<typename desc, typename Functor_, typename ...Args>
ArrayContainer &operator=(const detail::Function<desc, Functor_, Args...> &function) Assign a function object to this array container. This will assign the result of the function to the array container, evaluating it accordingly.
- Template Parameters
Functor_ – The function type
Args – The argument types of the function
- Parameters
function – The function to assign
- Returns
A reference to this array container.
-
template<typename TransposeType>
ArrayContainer &operator=(const Transpose<TransposeType> &transpose)
-
template<typename T>
detail::CommaInitializer<ArrayContainer> operator<<(const T &value) Allow ArrayContainer objects to be initialized with a comma separated list of values. This makes use of the CommaInitializer class
- Template Parameters
T – The type of the values
- Parameters
value – The value to set in the Array object
- Returns
The comma initializer object
-
auto operator[](int64_t index) const
Access a sub-array of this ArrayContainer instance. The sub-array will reference the same memory as this ArrayContainer instance.
See also
- Parameters
index – The index of the sub-array
- Returns
A reference to the sub-array (ArrayView)
-
auto operator[](int64_t index)
-
template<typename ...Indices>
DirectSubscriptType operator()(Indices... indices) const
-
template<typename ...Indices>
DirectRefSubscriptType operator()(Indices... indices)
-
Scalar get() const
-
ShapeType::SizeType ndim() const noexcept
Return the number of dimensions of the ArrayContainer object
- Returns
Number of dimensions of the ArrayContainer
-
const ShapeType &shape() const noexcept
Return the shape of the array container. This is an immutable reference.
- Returns
The shape of the array container.
-
const StorageType &storage() const noexcept
Return the StorageType object of the ArrayContainer
- Returns
The StorageType object of the ArrayContainer
-
StorageType &storage() noexcept
Return the StorageType object of the ArrayContainer
- Returns
The StorageType object of the ArrayContainer
-
Packet packet(size_t index) const
Return a Packet object from the array’s storage at a specific index.
- Parameters
index – The index to get the packet from
- Returns
A Packet object from the array’s storage at a specific index
-
Scalar scalar(size_t index) const
Return a Scalar from the array’s storage at a specific index.
- Parameters
index – The index to get the scalar from
- Returns
A Scalar from the array’s storage at a specific index
-
void writePacket(size_t index, const Packet &value)
Write a Packet object to the array’s storage at a specific index
- Parameters
index – The index to write the packet to
value – The value to write to the array’s storage
-
void write(size_t index, const Scalar &value)
Write a Scalar to the array’s storage at a specific index
- Parameters
index – The index to write the scalar to
value – The value to write to the array’s storage
-
Iterator begin() const noexcept
Return an iterator to the beginning of the array container.
- Returns
Iterator
-
Iterator end() const noexcept
Return an iterator to the end of the array container.
- Returns
Iterator
-
Iterator begin()
Return an iterator to the beginning of the array container.
- Returns
Iterator
-
Iterator end()
Return an iterator to the end of the array container.
- Returns
Iterator
-
std::string str(const std::string &format = "{}") const
Return a string representation of the array container \format The format to use for the string representation
- Returns
A string representation of the array container
-
template<typename desc, typename Functor_, typename ...Args>
auto assign(const detail::Function<desc, Functor_, Args...> &function) -> ArrayContainer&
-
template<typename desc, typename Functor_, typename ...Args>
auto operator=(const detail::Function<desc, Functor_, Args...> &function) -> ArrayContainer&
-
template<typename TransposeType>
auto operator=(const Transpose<TransposeType> &transpose) -> ArrayContainer&
-
template<typename T>
auto operator<<(const T &value) -> detail::CommaInitializer<ArrayContainer>
-
template<typename ...Indices>
auto operator()(Indices... indices) const -> DirectSubscriptType
-
template<typename ...Indices>
auto operator()(Indices... indices) -> DirectRefSubscriptType
-
using StorageType = StorageType_
-
template<typename ShapeType_, typename StorageType_>
-
namespace detail
-
template<typename T>
struct SubscriptType - #include <arrayContainer.hpp>
-
template<typename T, size_t... Dims>
struct SubscriptType<FixedStorage<T, Dims...>> - #include <arrayContainer.hpp>
-
template<typename T>
struct SubscriptType<CudaStorage<T>> - #include <arrayContainer.hpp>
-
template<typename T>
struct IsArrayType - #include <arrayContainer.hpp>
Public Static Attributes
-
static constexpr bool val = false
-
static constexpr bool val = false
-
template<typename T>
struct IsArrayType<ArrayRef<T>> - #include <arrayContainer.hpp>
Public Static Attributes
-
static constexpr bool val = true
-
static constexpr bool val = true
-
template<typename ...T>
struct IsArrayType<FunctionRef<T...>> - #include <arrayContainer.hpp>
Public Static Attributes
-
static constexpr bool val = true
-
static constexpr bool val = true
- template<typename T> ArrayView< T > >
- #include <arrayContainer.hpp>
Public Static Attributes
-
static constexpr bool val = true#
-
static constexpr bool val = true#
-
template<typename First, typename ...Types>
struct ContainsArrayType - #include <arrayContainer.hpp>
Public Static Attributes
-
static constexpr auto evaluator =
[]() {if constexpr (sizeof...(Types) == 0)returnIsArrayType<First>::val;elsereturnIsArrayType<First>::val || ContainsArrayType<Types...>::val;}
-
static constexpr bool val = evaluator()
-
static constexpr auto evaluator =
-
template<typename T>
-
namespace typetraits#
Functions
- LIBRAPID_DEFINE_AS_TYPE (typename SizeType COMMA size_t dims COMMA typename StorageScalar, array::ArrayContainer< Shape< SizeType COMMA dims > COMMA StorageScalar >)
- template<typename ShapeType_, typename StorageType_> ArrayContainer< ShapeType_, StorageType_ > >
- #include <arrayContainer.hpp>
Public Types
-
using Packet = std::false_type#
Public Static Attributes
-
static constexpr detail::LibRapidType type = detail::LibRapidType::ArrayContainer#
-
static constexpr int64_t packetWidth = 1#
-
static constexpr int64_t cudaPacketWidth = 1#
-
static constexpr bool canAlign = false#
-
static constexpr int64_t canMemcpy = false#
-
using Packet = std::false_type#
-
template<typename T>
struct IsArrayContainer : public std::false_type - #include <arrayContainer.hpp>
Evaluates as true if the input type is an ArrayContainer instance
- Template Parameters
T – Input type
- template<typename SizeType, size_t dims, typename StorageScalar> ArrayContainer< Shape< SizeType, dims >, StorageScalar > > : public std::true_type
- #include <arrayContainer.hpp>
-
namespace array#