Vc  1.1.0
SIMD Vector Classes for C++
SimdArray< T, N, VectorType, size_t > Class Template Reference

Detailed Description

template<typename T, std::size_t N, typename VectorType, std::size_t>
class Vc::SimdArray< T, N, VectorType, size_t >

Data-parallel type with (somewhat) arbitrary number of components.

Definition at line 475 of file simdarray.h.

#include <simdarray.h>

Public Member Functions

SimdArray operator+ () const
 Returns a copy of itself.
 
MaskType isNegative () const
 
SimdArray exponent () const
 Returns the exponents of the floating-point values in the vector. More...
 
Gather constructors and member functions

Constructs or loads a vector from the objects at mem[indexes[0]], mem[indexes[1]], mem[indexes[2]], ...

All gather functions optionally take a mask as last argument. In that case only the entries that are selected in the mask are accessed in memory and copied to the vector. This enables invalid indexes in the indexes vector if those are masked off in mask.

Gathers from structured data (AoS: arrays of struct) are possible via a special subscript operator of the container (array). You can use Vc::array and Vc::vector as drop-in replacements for std::array and std::vector. These container classes contain the necessary subscript operator overload. Example:

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

Alternatively, you can use Vc::Common::AdaptSubscriptOperator to extend a given container class with the necessary subscript operator. Example:

template <typename T, typename Allocator = std::allocator<T>>
using my_vector = Vc::Common::AdaptSubscriptOperator<std::vector<T, Allocator>>;
Parameters
memA pointer to memory which contains objects of type MT at the offsets given by indexes.
indexesA container/vector of offsets into mem. The type of indexes (IT) may either be a pointer to integers (C-array) or a vector of integers (preferrably IndexType).
maskIf a mask is given, only the active entries will be copied from memory.
Note
If you use a masked gather constructor the masked-off entries of the vector are zero-initilized.
template<typename MT , typename IT , typename = enable_if<Traits::has_subscript_operator<IT>::value>>
 SimdArray (const MT *mem, IT &&indexes)
 Gather constructor.
 
template<typename MT , typename IT , typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>
 SimdArray (const MT *mem, IT &&indexes, MaskArgument mask)
 Masked gather constructor.
 
template<typename MT , typename IT , typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>
void gather (const MT *mem, IT &&indexes)
 Gather function.
 
template<typename MT , typename IT , typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>
void gather (const MT *mem, IT &&indexes, MaskArgument mask)
 Masked gather function.
 
template<typename S1 , typename IT >
 SimdArray (const S1 *array, const EntryType S1::*member1, const IT indexes)
 
template<typename S1 , typename IT >
 SimdArray (const S1 *array, const EntryType S1::*member1, const IT indexes, MaskArgument mask)
 
template<typename S1 , typename S2 , typename IT >
 SimdArray (const S1 *array, const S2 S1::*member1, const EntryType S2::*member2, const IT indexes)
 
template<typename S1 , typename S2 , typename IT >
 SimdArray (const S1 *array, const S2 S1::*member1, const EntryType S2::*member2, const IT indexes, MaskArgument mask)
 
template<typename S1 , typename IT1 , typename IT2 >
 SimdArray (const S1 *array, const EntryType *const S1::*ptrMember1, const IT1 outerIndexes, const IT2 innerIndexes)
 
template<typename S1 , typename IT1 , typename IT2 >
 SimdArray (const S1 *array, const EntryType *const S1::*ptrMember1, const IT1 outerIndexes, const IT2 innerIndexes, MaskArgument mask)
 
template<typename S1 , typename IT >
void gather (const S1 *array, const EntryType S1::*member1, const IT indexes)
 
template<typename S1 , typename IT >
void gather (const S1 *array, const EntryType S1::*member1, const IT indexes, MaskArgument mask)
 
template<typename S1 , typename S2 , typename IT >
void gather (const S1 *array, const S2 S1::*member1, const EntryType S2::*member2, const IT indexes)
 
template<typename S1 , typename S2 , typename IT >
void gather (const S1 *array, const S2 S1::*member1, const EntryType S2::*member2, const IT indexes, MaskArgument mask)
 
template<typename S1 , typename IT1 , typename IT2 >
void gather (const S1 *array, const EntryType *const S1::*ptrMember1, const IT1 outerIndexes, const IT2 innerIndexes)
 
template<typename S1 , typename IT1 , typename IT2 >
void gather (const S1 *array, const EntryType *const S1::*ptrMember1, const IT1 outerIndexes, const IT2 innerIndexes, MaskArgument mask)
 

Static Public Member Functions

static SimdArray Zero ()
 Returns a vector with the entries initialized to zero. More...
 
static SimdArray One ()
 Returns a vector with the entries initialized to one. More...
 
static SimdArray IndexesFromZero ()
 Returns a vector with the entries initialized to 0, 1, 2, 3, 4, 5, ... More...
 
static SimdArray Random ()
 Returns a vector with pseudo-random entries. More...
 

Constructor & Destructor Documentation

SimdArray ( const S1 *  array,
const EntryType S1::*  member1,
const IT  indexes 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 222 of file simdarray.h.

SimdArray ( const S1 *  array,
const EntryType S1::*  member1,
const IT  indexes,
MaskArgument  mask 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 232 of file simdarray.h.

SimdArray ( const S1 *  array,
const S2 S1::*  member1,
const EntryType S2::*  member2,
const IT  indexes 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 243 of file simdarray.h.

SimdArray ( const S1 *  array,
const S2 S1::*  member1,
const EntryType S2::*  member2,
const IT  indexes,
MaskArgument  mask 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 254 of file simdarray.h.

SimdArray ( const S1 *  array,
const EntryType *const S1::*  ptrMember1,
const IT1  outerIndexes,
const IT2  innerIndexes 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 266 of file simdarray.h.

SimdArray ( const S1 *  array,
const EntryType *const S1::*  ptrMember1,
const IT1  outerIndexes,
const IT2  innerIndexes,
MaskArgument  mask 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 277 of file simdarray.h.

Member Function Documentation

void gather ( const S1 *  array,
const EntryType S1::*  member1,
const IT  indexes 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 289 of file simdarray.h.

void gather ( const S1 *  array,
const EntryType S1::*  member1,
const IT  indexes,
MaskArgument  mask 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 300 of file simdarray.h.

void gather ( const S1 *  array,
const S2 S1::*  member1,
const EntryType S2::*  member2,
const IT  indexes 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 313 of file simdarray.h.

void gather ( const S1 *  array,
const S2 S1::*  member1,
const EntryType S2::*  member2,
const IT  indexes,
MaskArgument  mask 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 324 of file simdarray.h.

void gather ( const S1 *  array,
const EntryType *const S1::*  ptrMember1,
const IT1  outerIndexes,
const IT2  innerIndexes 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 337 of file simdarray.h.

void gather ( const S1 *  array,
const EntryType *const S1::*  ptrMember1,
const IT1  outerIndexes,
const IT2  innerIndexes,
MaskArgument  mask 
)
inline
Deprecated:
Use Vc::array or Vc::vector subscripting instead.

Definition at line 349 of file simdarray.h.

static SimdArray Zero ( )
inlinestatic

Returns a vector with the entries initialized to zero.

Definition at line 690 of file simdarray.h.

static SimdArray One ( )
inlinestatic

Returns a vector with the entries initialized to one.

Definition at line 696 of file simdarray.h.

static SimdArray IndexesFromZero ( )
inlinestatic

Returns a vector with the entries initialized to 0, 1, 2, 3, 4, 5, ...

Definition at line 702 of file simdarray.h.

static SimdArray Random ( )
inlinestatic

Returns a vector with pseudo-random entries.

Currently the state of the random number generator cannot be modified and starts off with the same state. Thus you will get the same sequence of numbers for the same sequence of calls.

Returns
a new random vector. Floating-point values will be in the 0-1 range. Integers will use the full range the integer representation allows.
Note
This function may use a very small amount of state and thus will be a weak random number generator.

Definition at line 708 of file simdarray.h.

MaskType isNegative ( ) const
inline

Deprecated:
use Vc::isnegative instead

Definition at line 797 of file simdarray.h.

SimdArray exponent ( ) const
inline

Returns the exponents of the floating-point values in the vector.

Definition at line 1043 of file simdarray.h.


The documentation for this class was generated from the following file: