Array Class Listing#
Defines
-
SINIT(SUB_TYPE)
-
SVEC(SUB_TYPE)
-
ARRAY_FROM_DATA_DEF(TYPE_INIT, TYPE_VEC)
Functions
- ARRAY_TYPE_FMT_IML (typename ShapeType_ COMMA typename StorageType_, librapid::array::ArrayContainer< ShapeType_ COMMA StorageType_ >) LIBRAPID_SIMPLE_IO_NORANGE(typename ShapeType_ COMMA typename StorageType_
-
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
-
using ShapeType = ShapeType_
-
using StorageType = StorageType_
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 ShapeType, typename StorageScalar>
struct IsArrayContainer<array::ArrayContainer<ShapeType, StorageScalar>> : public std::true_type - #include <arrayContainer.hpp>
-
template<typename T, typename S>
struct IsArrayType<array::GeneralArrayView<T, S>> - #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 SizeType = typename ShapeType::SizeType
-
using Scalar = typename StorageType::Scalar
-
using Packet = typename typetraits::TypeInfo<Scalar>::Packet
-
using Backend = typename typetraits::TypeInfo<ArrayContainer>::Backend
-
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 Shape &shape)
Constructs an array container from a shape
- Parameters
shape – The shape of the array container
-
explicit ArrayContainer(const MatrixShape &shape)
-
explicit ArrayContainer(const VectorShape &shape)
-
ArrayContainer(const Shape &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
-
ArrayContainer(const MatrixShape &shape, const Scalar &value)
-
ArrayContainer(const VectorShape &shape, const Scalar &value)
-
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
Reference an existing array container.
This constructor does not copy the data, but instead references the data of the input array container. This means that the input array container must outlive the constructed array container. Please use
ArrayContainer::copy()
if you want to copy the data.- Parameters
other – The array container to reference
-
ArrayContainer(ArrayContainer &&other) noexcept = default
Construct an array container from a temporary array container.
- Parameters
other – The array container to move.
-
template<typename TransposeType>
ArrayContainer(const Transpose<TransposeType> &trans)
-
template<typename ShapeTypeA, typename StorageTypeA, typename ShapeTypeB, typename StorageTypeB, typename Alpha, typename Beta>
ArrayContainer(const linalg::ArrayMultiply<ShapeTypeA, StorageTypeA, ShapeTypeB, StorageTypeB, Alpha, Beta> &multiply)
-
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
Reference an existing array container.
This assignment operator does not copy the data, but instead references the data of the input array container. This means that the input array container must outlive the constructed array container. Please use
ArrayContainer::copy()
if you want to copy the data.- Parameters
other – The array container to reference
-
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 ShapeTypeA, typename StorageTypeA, typename ShapeTypeB, typename StorageTypeB, typename Alpha, typename Beta>
ArrayContainer &operator=(const linalg::ArrayMultiply<ShapeTypeA, StorageTypeA, ShapeTypeB, StorageTypeB, Alpha, Beta> &multiply)
-
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
-
ArrayContainer copy() const
-
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
ArrayView
- 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
-
auto size() const noexcept -> size_t
-
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
-
template<typename T>
ArrayContainer &operator+=(const T &other)
-
template<typename T>
ArrayContainer &operator-=(const T &other)
-
template<typename T>
ArrayContainer &operator*=(const T &other)
-
template<typename T>
ArrayContainer &operator/=(const T &other)
-
template<typename T>
ArrayContainer &operator%=(const T &other)
-
template<typename T>
ArrayContainer &operator&=(const T &other)
-
template<typename T>
ArrayContainer &operator|=(const T &other)
-
template<typename T>
ArrayContainer &operator^=(const T &other)
-
template<typename T>
ArrayContainer &operator<<=(const T &other)
-
template<typename T>
ArrayContainer &operator>>=(const T &other)
-
auto begin() const noexcept
Return an iterator to the beginning of the array container.
- Returns
Iterator
-
auto end() const noexcept
Return an iterator to the end of the array container.
- Returns
Iterator
-
auto begin()
Return an iterator to the beginning of the array container.
- Returns
Iterator
-
auto end()
Return an iterator to the end of the array container.
- Returns
Iterator
-
template<typename T, typename Char, typename Ctx>
void str(const fmt::formatter<T, Char> &format, char bracket, char separator, Ctx &ctx) const
-
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 ShapeTypeA, typename StorageTypeA, typename ShapeTypeB, typename StorageTypeB, typename Alpha, typename Beta>
auto operator=(const linalg::ArrayMultiply<ShapeTypeA, StorageTypeA, ShapeTypeB, StorageTypeB, Alpha, Beta> &arrayMultiply) -> 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
-
template<typename T>
auto operator+=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator-=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator*=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator/=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator%=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator&=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator|=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator^=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator<<=(const T &value) -> ArrayContainer&
-
template<typename T>
auto operator>>=(const T &value) -> ArrayContainer&
Public Static Functions
-
static auto fromData(const std::initializer_list<Scalar> &data) -> ArrayContainer
-
static auto fromData(const std::vector<Scalar> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<Scalar>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<Scalar>> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<std::initializer_list<Scalar>>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<std::vector<Scalar>>> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<Scalar>>>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<std::vector<std::vector<Scalar>>>> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<Scalar>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<std::vector<std::vector<std::vector<Scalar>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<Scalar>>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<Scalar>>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<Scalar>>>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<Scalar>>>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<std::initializer_list<Scalar>>>>>>>> &data) -> ArrayContainer
-
static auto fromData(const std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<Scalar>>>>>>>> &data) -> ArrayContainer
-
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, typename V>
struct IsArrayType<ArrayRef<T, V>> - #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, typename S> GeneralArrayView< T, S > >
- #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 Functions
-
static inline constexpr auto evaluator()
Public Static Attributes
-
static constexpr bool val = evaluator()
-
static inline constexpr auto evaluator()
-
template<typename T>
-
namespace typetraits#
Functions
- LIBRAPID_DEFINE_AS_TYPE (typename StorageScalar, array::ArrayContainer< Shape COMMA StorageScalar >)
- LIBRAPID_DEFINE_AS_TYPE (typename StorageScalar, array::ArrayContainer< MatrixShape COMMA StorageScalar >)
- template<typename ShapeType_, typename StorageType_> ArrayContainer< ShapeType_, StorageType_ > >
- #include <arrayContainer.hpp>
Public Types
-
using Packet = std::false_type#
-
using ShapeType = ShapeType_#
-
using StorageType = StorageType_#
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 ShapeType, typename StorageScalar> ArrayContainer< ShapeType, StorageScalar > > : public std::true_type
- #include <arrayContainer.hpp>
-
namespace array#