Vc 1.4.5
SIMD Vector Classes for C++
 
Loading...
Searching...
No Matches
array< T, N > Struct Template Reference

Detailed Description

template<typename T, std::size_t N>
struct Vc::array< T, N >

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, ...]
The main vector class for expressing data parallelism.
Definition vector.h:126
static Vector IndexesFromZero()
Returns a vector with the entries initialized to 0, 1, 2, 3, 4, 5, ...
This is std::array with additional subscript operators supporting gather and scatter operations.
Definition types.h:188

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 188 of file types.h.

#include <array>


The documentation for this struct was generated from the following files: