Vc  1.4.2
SIMD Vector Classes for C++
array< T, Size > Struct Template Reference

Detailed Description

template<class T, size_t Size>
struct Vc::array< T, Size >

This is std::array with additional subscript operators supporting gather and scatter operations.

The std::array documentation applies.

Gathers from structured data (AoS: arrays of struct) are possible via a special subscript operator. Example:

std::iota(data.begin(), data.end(), 0.f); // fill with values 0, 1, 2, ...
float_v gathered = data[indexes]; // gathered == [0, 1, 2, ...]

This also works for gathers into arrays of structures:

struct Point { float x, y, z; };
// fill points ...
float_v xs = data[indexes][&Point::x]; // [points[0].x, points[1].x, points[2].x, ...]
float_v ys = data[indexes][&Point::y]; // [points[0].y, points[1].y, points[2].y, ...]
float_v zs = data[indexes][&Point::z]; // [points[0].z, points[1].z, points[2].z, ...]

Arrays may also be nested:

:
// fill points ...
float_v xs = data[indexes][0]; // [points[0][0], points[1][0], points[2][0], ...]
float_v ys = data[indexes][1]; // [points[0][1], points[1][1], points[2][1], ...]
float_v zs = data[indexes][2]; // [points[0][2], points[1][2], points[2][2], ...]

Definition at line 86 of file array.

Public Member Functions

Data-Parallel Subscripting for Gather & Scatter
template<typename I >
auto operator[] (I &&arg_) -> decltype(subscript_operator(*this, std::forward< I >(arg_)))
 
template<typename I >
auto operator[] (I &&arg_) const -> decltype(subscript_operator(*this, std::forward< I >(arg_)))
 

The documentation for this struct was generated from the following file:
Vc::array
Definition: array:86
Vc::Vector::IndexesFromZero
static Vector IndexesFromZero()
Returns a vector with the entries initialized to 0, 1, 2, 3, 4, 5, ...
Vc::float_v
Vector< float > float_v
vector of single precision
Definition: vector.h:54