ROOT  6.06/09
Reference Guide
Public Types | Public Member Functions | Private Member Functions | List of all members
ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory > Class Template Reference

template<typename V, typename Parent, int Dimension, typename RowMemory>
class ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >

Common interface to all Memory classes, independent of allocation on the stack or heap.

Parameters
VThe vector type you want to operate on. (e.g. float_v or uint_v)
ParentThis type is the complete type of the class that derives from MemoryBase.
DimensionThe number of dimensions the implementation provides.
RowMemoryClass to be used to work on a single row.

Definition at line 265 of file memorybase.h.

Public Types

typedef V::EntryType EntryType
 The type of the scalar entries in the array. More...
 

Public Member Functions

Vc_ALWAYS_INLINE Vc_PURE size_t entriesCount () const
 
Vc_ALWAYS_INLINE Vc_PURE size_t vectorsCount () const
 
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlagvector (size_t i)
 
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlagvector (size_t i) const
 Const overload of the above function. More...
 
template<typename A >
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, A > vectorAt (size_t i, A)
 
template<typename A >
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, A > vectorAt (size_t i, A) const
 
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlagvectorAt (size_t i)
 
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlagvectorAt (size_t i) const
 
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, UnalignedFlagvector (size_t i, int shift)
 
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, UnalignedFlagvector (size_t i, int shift) const
 Const overload of the above function. More...
 
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlagfirstVector ()
 
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlagfirstVector () const
 Const overload of the above function. More...
 
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlaglastVector ()
 
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst< V, AlignedFlaglastVector () const
 Const overload of the above function. More...
 
Vc_ALWAYS_INLINE Vc_PUREgather (const unsigned char *indexes) const
 
Vc_ALWAYS_INLINE Vc_PUREgather (const unsigned short *indexes) const
 
Vc_ALWAYS_INLINE Vc_PUREgather (const unsigned int *indexes) const
 
Vc_ALWAYS_INLINE Vc_PUREgather (const unsigned long *indexes) const
 
Vc_ALWAYS_INLINE void setZero ()
 
template<typename P2 , typename RM >
Parent & operator+= (const MemoryBase< V, P2, Dimension, RM > &rhs)
 
template<typename P2 , typename RM >
Parent & operator-= (const MemoryBase< V, P2, Dimension, RM > &rhs)
 
template<typename P2 , typename RM >
Parent & operator*= (const MemoryBase< V, P2, Dimension, RM > &rhs)
 
template<typename P2 , typename RM >
Parent & operator/= (const MemoryBase< V, P2, Dimension, RM > &rhs)
 
Parent & operator+= (EntryType rhs)
 
Parent & operator-= (EntryType rhs)
 
Parent & operator*= (EntryType rhs)
 
Parent & operator/= (EntryType rhs)
 
template<typename P2 , typename RM >
bool operator== (const MemoryBase< V, P2, Dimension, RM > &rhs) const
 
template<typename P2 , typename RM >
bool operator!= (const MemoryBase< V, P2, Dimension, RM > &rhs) const
 
template<typename P2 , typename RM >
bool operator< (const MemoryBase< V, P2, Dimension, RM > &rhs) const
 
template<typename P2 , typename RM >
bool operator<= (const MemoryBase< V, P2, Dimension, RM > &rhs) const
 
template<typename P2 , typename RM >
bool operator> (const MemoryBase< V, P2, Dimension, RM > &rhs) const
 
template<typename P2 , typename RM >
bool operator>= (const MemoryBase< V, P2, Dimension, RM > &rhs) const
 

Private Member Functions

Parent * p ()
 
const Parent * p () const
 

#include <Vc/Memory>

+ Inheritance diagram for ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >:
+ Collaboration diagram for ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >:

Member Typedef Documentation

template<typename V, typename Parent, int Dimension, typename RowMemory>
typedef V::EntryType ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::EntryType

The type of the scalar entries in the array.

Definition at line 274 of file memorybase.h.

Member Function Documentation

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE size_t ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::entriesCount ( ) const
inline
Returns
the number of scalar entries in the array. This function is optimized away if a constant size array is used.

Definition at line 280 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::firstVector ( )
inline
Returns
the first vector in the allocated memory.

This function is simply a shorthand for vector(0).

Definition at line 414 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::firstVector ( ) const
inline

Const overload of the above function.

Definition at line 418 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE V ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::gather ( const unsigned char *  indexes) const
inline

Definition at line 435 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE V ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::gather ( const unsigned short *  indexes) const
inline

Definition at line 436 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE V ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::gather ( const unsigned int *  indexes) const
inline

Definition at line 437 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE V ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::gather ( const unsigned long *  indexes) const
inline

Definition at line 438 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::lastVector ( )
inline
Returns
the last vector in the allocated memory.

This function is simply a shorthand for vector(vectorsCount() - 1).

Definition at line 427 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::lastVector ( ) const
inline

Const overload of the above function.

Definition at line 431 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
bool ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator!= ( const MemoryBase< V, P2, Dimension, RM > &  rhs) const
inline

Definition at line 518 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator*= ( const MemoryBase< V, P2, Dimension, RM > &  rhs)
inline

Definition at line 464 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator*= ( EntryType  rhs)
inline

Definition at line 493 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator+= ( const MemoryBase< V, P2, Dimension, RM > &  rhs)
inline

Definition at line 448 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator+= ( EntryType  rhs)
inline

Definition at line 479 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator-= ( const MemoryBase< V, P2, Dimension, RM > &  rhs)
inline

Definition at line 456 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator-= ( EntryType  rhs)
inline

Definition at line 486 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator/= ( const MemoryBase< V, P2, Dimension, RM > &  rhs)
inline

Definition at line 472 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Parent& ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator/= ( EntryType  rhs)
inline

Definition at line 500 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
bool ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator< ( const MemoryBase< V, P2, Dimension, RM > &  rhs) const
inline

Definition at line 528 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
bool ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator<= ( const MemoryBase< V, P2, Dimension, RM > &  rhs) const
inline

Definition at line 538 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
bool ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator== ( const MemoryBase< V, P2, Dimension, RM > &  rhs) const
inline

Definition at line 508 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
bool ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator> ( const MemoryBase< V, P2, Dimension, RM > &  rhs) const
inline

Definition at line 548 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename P2 , typename RM >
bool ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::operator>= ( const MemoryBase< V, P2, Dimension, RM > &  rhs) const
inline

Definition at line 558 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Parent* ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::p ( )
inlineprivate

Definition at line 268 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
const Parent* ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::p ( ) const
inlineprivate

Definition at line 269 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE void ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::setZero ( )
inline

Definition at line 440 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vector ( size_t  i)
inline
Parameters
iSelects the offset, where the vector should be read.
Returns
a smart object to wrap the i-th vector in the memory.

The return value can be used as any other vector object. I.e. you can substitute something like

float_v a = ..., b = ...;
a += b;

with

mem.vector(i) += b;

This function ensures that only aligned loads and stores are used. Thus it only allows to access memory at fixed strides. If access to known offsets from the aligned vectors is needed the vector(size_t, int) function can be used.

Definition at line 310 of file memorybase.h.

Referenced by ROOT::Vc::Internal::copyVectors(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator!=(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator*=(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator+=(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator-=(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator/=(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator==(), ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator>(), and ROOT::Vc::MemoryBase< V, Memory< V, 0u, 0u >, 1, void >::operator>=().

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vector ( size_t  i) const
inline

Const overload of the above function.

Parameters
iSelects the offset, where the vector should be read.
Returns
a smart object to wrap the i-th vector in the memory.

Definition at line 319 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper<V, UnalignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vector ( size_t  i,
int  shift 
)
inline
Returns
a smart object to wrap the i-th vector + shift in the memory.

This function ensures that only unaligned loads and stores are used. It allows to access memory at any location aligned to the entry type.

Parameters
iSelects the memory location of the i-th vector. Thus if V::Size == 4 and i is set to 3 the base address for the load/store will be the 12th entry (same as &mem[12]).
shiftShifts the base address determined by parameter i by shift many entries. Thus vector(3, 1) for V::Size == 4 will load/store the 13th - 16th entries (same as &mem[13]).
Note
Any shift value is allowed as long as you make sure it stays within bounds of the allocated memory. Shift values that are a multiple of V::Size will not result in aligned loads. You have to use the above vector(size_t) function for aligned loads instead.
Thus a simple way to access vectors randomly is to set i to 0 and use shift as the parameter to select the memory address:
// don't use:
mem.vector(i / V::Size, i % V::Size) += 1;
// instead use:
mem.vector(0, i) += 1;

Definition at line 401 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst<V, UnalignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vector ( size_t  i,
int  shift 
) const
inline

Const overload of the above function.

Definition at line 405 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename A >
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper<V, A> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vectorAt ( size_t  i,
 
)
inline
Returns
a smart object to wrap the vector starting from the i-th scalar entry in the memory.

Example:

Memory<float_v, N> mem;
mem.setZero();
for (int i = 0; i < mem.entriesCount(); i += float_v::Size) {
mem.vectorAt(i) += b;
}
Parameters
iSpecifies the scalar entry from where the vector will be loaded/stored. I.e. the values scalar(i), scalar(i + 1), ..., scalar(i + V::Size - 1) will be read/overwritten.
alignYou must take care to determine whether an unaligned load/store is required. Per default an aligned load/store is used. If i is not a multiple of V::Size you must pass Vc::Unaligned here.

Definition at line 358 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
template<typename A >
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst<V, A> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vectorAt ( size_t  i,
 
) const
inline

Definition at line 362 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vectorAt ( size_t  i)
inline

Definition at line 366 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE const VectorPointerHelperConst<V, AlignedFlag> ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vectorAt ( size_t  i) const
inline

Definition at line 369 of file memorybase.h.

template<typename V, typename Parent, int Dimension, typename RowMemory>
Vc_ALWAYS_INLINE Vc_PURE size_t ROOT::Vc::MemoryBase< V, Parent, Dimension, RowMemory >::vectorsCount ( ) const
inline

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