Template Struct wide_vector¶
Defined in File wide_vector.hpp
Inheritance Relationships¶
Base Type¶
private wt::detail::simd_data_t< f_t, Width, N >
Struct Documentation¶
-
template<std::size_t Width, std::size_t N, Quantity Q>
struct wide_vector : private wt::detail::simd_data_t<f_t, Width, N>¶ Wide (4 or 8 element) floating point vectors, each vector of
N
elements (up to 4). Used SIMD type and instruction set depends onwt::f_t
, designed to support 32-bit and 64-bit precision. The resulting data type is ofWidth
xN
element count. Supports quantities.- Template Parameters:
Width – width (count of simd elements) of the vector, must be 4 or 8
N – number of vector elements (N==1 is treated as a scalar), must be 1<=N<=4
Q – quantity of the vector (
simd::unitless
indicates unitless,simd::bool_mask
indicates boolean masks)
Public Types
-
using S = std::conditional_t<is_unitless, Fp, Q>¶
Type of a single element of the wide vector — scalar of quantity
Q
.
Public Functions
-
wide_vector() noexcept = default¶
-
inline wide_vector(const wide_vector &o) noexcept = default¶
-
inline explicit wide_vector(const simd_native_t &v) noexcept¶
Construct a scalar wide vector from a native SIMD wide scalar. Typically should not be used.
-
inline explicit wide_vector(const simd_native_t &x, const simd_native_t &y) noexcept¶
Construct a wide vector from native SIMD wide scalars. Typically should not be used.
-
inline explicit wide_vector(const simd_native_t &x, const simd_native_t &y, const simd_native_t &z) noexcept¶
Construct a wide vector from native SIMD wide scalars. Typically should not be used.
-
inline explicit wide_vector(const simd_native_t &x, const simd_native_t &y, const simd_native_t &z, const simd_native_t &w) noexcept¶
Construct a wide vector from native SIMD wide scalars. Typically should not be used.
-
inline auto &simd_native(std::size_t n) noexcept¶
Access the underlying SIMD element for vector index
n
. Typically, should not be used.
-
inline const auto &simd_native(std::size_t n) const noexcept¶
Access the underlying SIMD element for vector index
n
. Typically, should not be used.
-
template<typename T2>
inline explicit wide_vector(const T2 &scalar) noexcept¶ Construct a scalar wide vector from a single scalar
scalar
, copyingscalar
into all wide elements.
-
template<typename T2>
inline explicit wide_vector(const T2 &vec) noexcept Construct a wide vector from a single vector
vec
, copyingvec
into all wide elements.
-
inline explicit wide_vector(const wide_vector<Width, N, simd::unitless> &v) noexcept¶
Explicit construction of a bool mask from a unitless wide vector.
-
inline explicit wide_vector(wide_vector<4, N, Q> lower, wide_vector<4, N, Q> upper) noexcept¶
Construct an 8-wide vector from 2 4-wide vectors.
-
inline explicit wide_vector(wide_vector<4, N, Q> lower, wide_vector<4, N, Q> upper) noexcept
Construct an 8-wide vector from 2 4-wide vectors.
-
inline explicit wide_vector(wide_vector<Width, 1, Q> x, wide_vector<Width, 1, Q> y) noexcept¶
Construct a wide vector from scalar wide vectors.
-
inline explicit wide_vector(wide_vector<Width, 1, Q> x, wide_vector<Width, 1, Q> y, wide_vector<Width, 1, Q> z) noexcept¶
Construct a wide vector from scalar wide vectors.
-
inline explicit wide_vector(wide_vector<Width, 1, Q> x, wide_vector<Width, 1, Q> y, wide_vector<Width, 1, Q> z, wide_vector<Width, 1, Q> w) noexcept¶
Construct a wide vector from scalar wide vectors.
-
inline explicit wide_vector(const T &w0, const T &w1, const T &w2, const T &w3) noexcept¶
Construct a scalar wide vector by explicitly setting each wide element.
-
inline explicit wide_vector(const T &w0, const T &w1, const T &w2, const T &w3, const T &w4, const T &w5, const T &w6, const T &w7) noexcept¶
Construct a scalar wide vector by explicitly setting each wide element.
-
inline explicit wide_vector(const T &w0, const T &w1, const T &w2, const T &w3) noexcept
Construct a wide vector by explicitly setting each wide element.
-
inline explicit wide_vector(const T &w0, const T &w1, const T &w2, const T &w3, const T &w4, const T &w5, const T &w6, const T &w7) noexcept
Construct a wide vector by explicitly setting each wide element.
-
inline explicit wide_vector(const S *data, simd::unaligned_data_t) noexcept¶
Loads wide data from arbitrarily-aligned address.
-
inline explicit wide_vector(const S *x, const S *y, simd::unaligned_data_t) noexcept¶
Loads wide data from arbitrarily-aligned address.
-
inline explicit wide_vector(const S *x, const S *y, const S *z, simd::unaligned_data_t) noexcept¶
Loads wide data from arbitrarily-aligned address.
-
inline explicit wide_vector(const S *x, const S *y, const S *z, const S *w, simd::unaligned_data_t) noexcept¶
Loads wide data from arbitrarily-aligned address.
-
inline explicit wide_vector(const S *data, simd::aligned_data_t) noexcept¶
Loads wide data from address, assumes address is aligned to
sizeof(Fp)*Width
boundary.
-
inline explicit wide_vector(const S *x, const S *y, simd::aligned_data_t) noexcept¶
Loads wide data from address, assumes address is aligned to
sizeof(Fp)*Width
boundary.
-
inline explicit wide_vector(const S *x, const S *y, const S *z, simd::aligned_data_t) noexcept¶
Loads wide data from address, assumes address is aligned to
sizeof(Fp)*Width
boundary.
-
inline explicit wide_vector(const S *x, const S *y, const S *z, const S *w, simd::aligned_data_t) noexcept¶
Loads wide data from address, assumes address is aligned to
sizeof(Fp)*Width
boundary.
-
inline explicit wide_vector(const wide_vector<4, N, Q> &o) noexcept¶
-
inline explicit wide_vector(const wide_vector<4, N, Q> &o) noexcept
-
inline wide_vector &operator=(const wide_vector &o) noexcept = default¶
-
inline auto operator[](std::size_t n) const noexcept¶
Extracts a horizontal slice as a scalar wide vector from element at position
n
(between 0 andN-1
) in the vector.
-
inline auto x() const noexcept¶
Extracts the
n==0
scalar wide vector, equivalent tooperator[0]
.
-
inline auto y() const noexcept¶
Extracts the
n==1
scalar wide vector, equivalent tooperator[1]
.
-
inline auto z() const noexcept¶
Extracts the
n==2
scalar wide vector, equivalent tooperator[2]
.
-
inline auto w() const noexcept¶
Extracts the
n==3
scalar wide vector, equivalent tooperator[3]
.
-
inline auto extract_lower_half() const noexcept¶
Casts an 8-wide vector into a 4-wide vector by extracting the 4 lower wide elements.
-
inline auto extract_upper_half() const noexcept¶
Casts an 8-wide vector into a 4-wide vector by extracting the 4 upper wide elements.
-
template<std::size_t idx>
inline auto reads() const noexcept¶ Returns a vertical slice of the wide vector at position
w
between 0 andWidth-1
.- Template Parameters:
idx – the compile-time known wide index
-
template<std::size_t idx>
inline auto reads() const noexcept Returns a vertical slice of the wide vector at position
w
between 0 andWidth-1
.- Template Parameters:
idx – the compile-time known wide index
-
template<std::size_t idx>
inline auto reads() const noexcept Returns a vertical slice of the wide vector at position
w
between 0 andWidth-1
.- Template Parameters:
idx – the compile-time known wide index
-
inline auto read(std::size_t w) const noexcept¶
Returns a vertical slice of the wide vector at position
w
between 0 andWidth-1
. Dynamic index, slower thanreads
.
-
inline auto read(std::size_t w) const noexcept
Returns a vertical slice of the wide vector at position
w
between 0 andWidth-1
. Dynamic index, slower thanreads
.
-
inline auto read(std::size_t w) const noexcept
Returns a vertical slice of the wide vector at position
w
between 0 andWidth-1
. Dynamic index, slower thanreads
.
-
inline wide_vector &operator+=(const wide_vector &o) noexcept¶
-
inline wide_vector &operator-=(const wide_vector &o) noexcept¶
-
inline wide_vector &operator*=(const wide_vector &o) noexcept¶
-
inline wide_vector &operator/=(const wide_vector &o) noexcept¶
-
inline wide_vector &operator*=(const Fp &t) noexcept¶
-
inline wide_vector &operator/=(const Fp &t) noexcept¶
-
inline wide_vector &operator&=(const wide_vector &o) noexcept¶
Logical AND.
-
inline wide_vector &operator|=(const wide_vector &o) noexcept¶
Logical OR.
-
inline wide_vector<Width, N, simd::bool_mask> operator==(const wide_vector &o) const noexcept¶
Logical (bool masks) equality comparison.
-
inline wide_vector<Width, N, simd::bool_mask> operator!=(const wide_vector &o) const noexcept¶
Logical (bool masks) inequality comparison.
-
inline wide_vector<Width, N, simd::bool_mask> operator==(const wide_vector &o) const noexcept
Floating point equality comparison.
-
inline wide_vector<Width, N, simd::bool_mask> operator!=(const wide_vector &o) const noexcept
Floating point inequality comparison.
-
inline wide_vector<Width, N, simd::bool_mask> operator<(const wide_vector &o) const noexcept¶
-
inline wide_vector<Width, N, simd::bool_mask> operator>(const wide_vector &o) const noexcept¶
-
inline wide_vector<Width, N, simd::bool_mask> operator<=(const wide_vector &o) const noexcept¶
-
inline wide_vector<Width, N, simd::bool_mask> operator>=(const wide_vector &o) const noexcept¶
-
inline auto to_bitmask() const noexcept¶
Converts a unitless wide vector to a vector of
std::bitset
. This is useful for reading the results of comparisons operators.
-
inline auto to_bitmask() const noexcept
Converts a unitless wide vector to a vector of
std::bitset
. This is useful for reading the results of comparison operators.
Public Static Functions
-
template<typename T2>
static inline wide_vector from_scalar(T2 scalar) noexcept¶ Constructs from a single scalar, i.e. sets all
Width*N
elements toscalar
.
-
template<typename S2>
static inline wide_vector from_vector(S2 scalar) noexcept¶ Constructs from a single vector, i.e. sets all
Width*N
elements toscalar
.
-
static inline wide_vector zero() noexcept¶
-
static inline wide_vector zero() noexcept
-
static inline wide_vector one() noexcept¶
-
static inline wide_vector inf() noexcept¶
-
static inline wide_vector inf() noexcept
-
static inline wide_vector mask_true() noexcept¶
Creates a unitless wide vector with all its elements initialized to a mask interpreted as TRUE.
-
static inline wide_vector mask_false() noexcept¶
Creates a unitless wide vector with all its elements initialized to 0, also interpreted as FALSE.