40 #include <blitz/array/slice.h>
42 #ifdef BZ_HAVE_BOOST_SERIALIZATION
43 #include <boost/serialization/serialization.hpp>
45 #ifdef BZ_HAVE_BOOST_MPI
46 #include <boost/mpi/datatype.hpp>
49 #ifdef BZ_HAVE_CSTRING
59 template<
typename P_numtype,
int N_length>
60 class FastTV2Iterator;
61 template<
typename P_numtype,
int N_length>
62 class FastTV2CopyIterator;
71 template<
typename P_numtype,
int N_length>
72 class TinyVector :
public ETBase<TinyVector<P_numtype, N_length> >
97 template <
typename T_numtype2>
103 template <
typename T_expr>
112 template <
typename T_expr>
119 memcpy(data_,x,N_length*
sizeof(T_numtype));
146 T_numtype x3, T_numtype x4)
156 T_numtype x3, T_numtype x4, T_numtype x5)
167 T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6)
179 T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6,
193 T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6,
194 T_numtype x7, T_numtype x8)
208 T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6,
209 T_numtype x7, T_numtype x8, T_numtype x9)
224 T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6,
225 T_numtype x7, T_numtype x8, T_numtype x9, T_numtype x10)
244 { BZPRECONDITION(rank==0);
return 0; }
250 const_iterator
begin()
const {
return data_; }
255 iterator
end() {
return data_ + N_length; }
256 const_iterator
end()
const {
return data_ + N_length; }
274 { BZPRECONDITION(rank==0);
return 0; }
279 { BZPRECONDITION(rank==0);
return N_length; }
284 { BZPRECONDITION(rank==0);
return N_length; }
302 { BZPRECONDITION(rank==0);
return 1; }
305 { BZPRECONDITION(rank==0);
return length()-1; }
310 template<
typename P_expr,
typename P_updater>
321 {
return const_cast<T_vector&
>(*this); }
325 BZPRECHECK(i < N_length,
326 "TinyVector<" << BZ_DEBUG_TEMPLATE_AS_STRING_LITERAL(T_numtype)
327 <<
"," << N_length <<
"> index out of bounds: " << i);
377 BZPRECONDITION(outerLoopRank==0);
378 BZPRECONDITION(innerLoopRank==0);
394 template<
typename T_expr>
397 template<
typename T> T_vector&
operator+=(
const T&);
398 template<
typename T> T_vector&
operator-=(
const T&);
399 template<
typename T> T_vector&
operator*=(
const T&);
400 template<
typename T> T_vector&
operator/=(
const T&);
401 template<
typename T> T_vector&
operator%=(
const T&);
402 template<
typename T> T_vector&
operator^=(
const T&);
403 template<
typename T> T_vector&
operator&=(
const T&);
404 template<
typename T> T_vector&
operator|=(
const T&);
405 template<
typename T> T_vector&
operator>>=(
const T&);
406 template<
typename T> T_vector&
operator<<=(
const T&);
424 template<
typename T_expr,
typename T_update>
427 #ifdef BZ_HAVE_BOOST_SERIALIZATION
428 friend class boost::serialization::access;
430 template<
class T_arch>
431 void serialize(T_arch& ar,
const unsigned int version) {
449 #ifdef BZ_HAVE_BOOST_SERIALIZATION
452 template<
typename T>
struct is_mpi_datatype;
453 template <
typename T,
int N>
454 struct is_mpi_datatype<
blitz::TinyVector<T, N> >
455 :
public is_mpi_datatype<T> { };
460 #endif // BZ_TINYVEC_H
TinyVector()
Definition: tinyvec2.h:92
static int dimensions()
Definition: tinyvec2.h:252
TinyVector(const ETBase< T_expr > &expr)
This constructor creates a TinyVector from another ETBase object.
Definition: tinyvec2.h:104
Definition: et-forward.h:21
const T_numtype & fastRead(diffType i) const
Definition: tinyvec2.h:367
static int lbound(int rank)
Definition: tinyvec2.h:273
_bz_global blitz::IndexPlaceholder< 0 > i
Definition: indexexpr.h:256
T_numtype operator*() const
Definition: tinyvec2.h:313
Helper class that defines the width of the simd instructions for a given type.
Definition: simdtypes.h:31
Definition: listinit.h:71
static int lbound()
Definition: tinyvec2.h:275
T_vector & operator^=(const T &)
T_vector & operator/=(const T &)
static int base()
Definition: tinyvec2.h:240
bool isVectorAligned(diffType offset) const
Since data_ is simd aligned by construction, we just have to check the offest.
Definition: tinyvec2.h:372
static bool lengthCheck(unsigned i)
Definition: tinyvec2.h:323
ListInitializationSwitch< T_vector, T_numtype * > operator=(T_numtype x)
Definition: tinyvec2.h:387
iterator end()
Definition: tinyvec2.h:255
const T_numtype * const_iterator
Definition: tinyvec2.h:84
Definition: et-forward.h:10
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6, T_numtype x7, T_numtype x8, T_numtype x9)
Definition: tinyvec2.h:207
static int ordering()
Definition: tinyvec2.h:289
const T_numtype & operator()(unsigned i) const
Definition: tinyvec2.h:331
T_numtype &restrict operator()(unsigned i)
Definition: tinyvec2.h:337
const_iterator begin() const
Definition: tinyvec2.h:250
T_vector & operator<<=(const T &)
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6, T_numtype x7)
Definition: tinyvec2.h:178
T_vector & initialize(T_numtype)
void _bz_assign(P_expr, P_updater)
T_numtype * iterator
Definition: tinyvec2.h:83
~TinyVector()
Definition: tinyvec2.h:93
T_iterator beginFast() const
Definition: tinyvec2.h:247
Definition: et-forward.h:20
iterator begin()
Definition: tinyvec2.h:249
Definition: array-impl.h:82
FastTV2Iterator< T_numtype, N_length > T_iterator
Definition: tinyvec2.h:82
const T_numtype *restrict data() const
Definition: tinyvec2.h:261
T_vector & operator%=(const T &)
TinyVector(const T_numtype x[])
Definition: tinyvec2.h:118
Definition: array-impl.h:66
Definition: et-forward.h:48
ptrdiff_t diffType
Definition: blitz.h:111
T_vector & noConst() const
Definition: tinyvec2.h:320
bool canCollapse(int outerLoopRank, int innerLoopRank) const
Definition: tinyvec2.h:375
static int base(int rank)
Definition: tinyvec2.h:243
T_numtype &restrict operator[](unsigned i)
Definition: tinyvec2.h:359
static int length()
Definition: tinyvec2.h:280
void _tv_evaluate(const T_expr &expr, T_update)
size_t sizeType
Definition: blitz.h:110
const TinyVector< int, rank_ > shape() const
Definition: tinyvec2.h:270
static int rank()
Definition: tinyvec2.h:292
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4, T_numtype x5)
Definition: tinyvec2.h:155
T_vector & operator-=(const T &)
static diffType stride(int rank)
Definition: tinyvec2.h:301
static diffType stride()
Definition: tinyvec2.h:298
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6, T_numtype x7, T_numtype x8)
Definition: tinyvec2.h:192
static int ubound(int rank)
Definition: tinyvec2.h:304
T_numtype *restrict dataFirst()
Definition: tinyvec2.h:264
TinyVector(const _bz_ArrayExpr< T_expr > &expr)
This constructor creates a TinyVector specifically from an expression.
Definition: tinyvec2.h:113
TinyVector< T_numtype, N_length > T_vector
Definition: tinyvec2.h:81
T_numtype *restrict getInitializationIterator()
Definition: tinyvec2.h:408
TinyVector(T_numtype x0, T_numtype x1)
Definition: tinyvec2.h:123
T_vector & operator+=(const T &)
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6, T_numtype x7, T_numtype x8, T_numtype x9, T_numtype x10)
Definition: tinyvec2.h:223
#define BZ_SIMD_WIDTH
Definition: bzconfig.h:387
const_iterator end() const
Definition: tinyvec2.h:256
const T_numtype & operator[](unsigned i) const
Definition: tinyvec2.h:353
P_numtype T_numtype
Definition: tinyvec2.h:80
T_vector & operator*=(const T &)
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2)
Definition: tinyvec2.h:129
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3)
Definition: tinyvec2.h:136
static sizeType numElements()
Definition: tinyvec2.h:295
static int extent(int rank)
Definition: tinyvec2.h:283
#define restrict
Definition: compiler.h:95
T_vector & operator&=(const T &)
const T_numtype *restrict dataFirst() const
Definition: tinyvec2.h:267
The TinyVector class is a one-dimensional, fixed length vector that implements the blitz expression t...
Definition: et-forward.h:14
static int ordering(int storageRankIndex)
Definition: tinyvec2.h:286
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4)
Definition: tinyvec2.h:145
T_vector & operator>>=(const T &)
#define BZ_ALIGN_VARIABLE(vartype, varname, alignment)
Definition: bzconfig.h:22
static int length(int rank)
Definition: tinyvec2.h:278
T_numtype *restrict data()
Definition: tinyvec2.h:258
TinyVector(T_numtype x0, T_numtype x1, T_numtype x2, T_numtype x3, T_numtype x4, T_numtype x5, T_numtype x6)
Definition: tinyvec2.h:166
FastTV2CopyIterator< P_numtype, N_length > T_range_result
Definition: tinyvec2.h:85
static int ubound()
Definition: tinyvec2.h:307
static const int rank_
Definition: tinyvec2.h:90
T_numtype operator()(TinyVector< int, 1 > i) const
Definition: tinyvec2.h:343
T_vector & operator|=(const T &)