LibRapid Modules#
Test Page
-
template<typename ShapeType_, typename StorageType_>
class ArrayContainer 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 V, typename B1, typename E1, typename B2, typename E2>
auto librapid::map(const V &val, const B1 &start1, const E1 &stop1, const B2 &start2, const E2 &stop2) Map a value from one range to another
- Template Parameters
V – Data type of the value to map
B1 – Data type of the lower bound of the input range
E1 – Data type of the upper bound of the input range
B2 – Data type of the lower bound of the output range
E2 – Data type of the upper bound of the output range
- Parameters
val – Value to map
start1 – Lower bound of the input range
stop1 – Upper bound of the input range
start2 – Lower bound of the output range
stop2 – Upper bound of the output range
- Returns
Mapped value