StaticVector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_DENSE_STATICVECTOR_H_
36 #define _BLAZE_MATH_DENSE_STATICVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
48 #include <blaze/math/Forward.h>
49 #include <blaze/math/Intrinsics.h>
50 #include <blaze/math/shims/Clear.h>
66 #include <blaze/system/Inline.h>
71 #include <blaze/util/Assert.h>
77 #include <blaze/util/DisableIf.h>
78 #include <blaze/util/EnableIf.h>
79 #include <blaze/util/Exception.h>
80 #include <blaze/util/Memory.h>
82 #include <blaze/util/mpl/SizeT.h>
84 #include <blaze/util/Template.h>
85 #include <blaze/util/Types.h>
89 #include <blaze/util/Unused.h>
91 
92 
93 namespace blaze {
94 
95 //=================================================================================================
96 //
97 // CLASS DEFINITION
98 //
99 //=================================================================================================
100 
101 //*************************************************************************************************
167 template< typename Type // Data type of the vector
168  , size_t N // Number of elements
169  , bool TF = defaultTransposeFlag > // Transpose flag
170 class StaticVector : public DenseVector< StaticVector<Type,N,TF>, TF >
171 {
172  private:
173  //**Type definitions****************************************************************************
175  //**********************************************************************************************
176 
177  //**********************************************************************************************
179  static const size_t NN = ( usePadding )?( NextMultiple< SizeT<N>, SizeT<IT::size> >::value ):( N );
180  //**********************************************************************************************
181 
182  public:
183  //**Type definitions****************************************************************************
185  typedef This ResultType;
187  typedef Type ElementType;
188  typedef typename IT::Type IntrinsicType;
189  typedef const Type& ReturnType;
190  typedef const StaticVector& CompositeType;
191 
192  typedef Type& Reference;
193  typedef const Type& ConstReference;
194  typedef Type* Pointer;
195  typedef const Type* ConstPointer;
196 
199  //**********************************************************************************************
200 
201  //**Rebind struct definition********************************************************************
204  template< typename ET > // Data type of the other vector
205  struct Rebind {
207  };
208  //**********************************************************************************************
209 
210  //**Compilation flags***************************************************************************
212 
216  enum { vectorizable = IsVectorizable<Type>::value };
217 
219 
222  enum { smpAssignable = 0 };
223  //**********************************************************************************************
224 
225  //**Constructors********************************************************************************
228  explicit inline StaticVector();
229  explicit inline StaticVector( const Type& init );
230  template< typename Other > explicit inline StaticVector( size_t n, const Other* array );
231 
232  template< typename Other >
233  explicit inline StaticVector( const Other (&array)[N] );
234 
235  inline StaticVector( const StaticVector& v );
236  template< typename Other > inline StaticVector( const StaticVector<Other,N,TF>& v );
237  template< typename VT > inline StaticVector( const Vector<VT,TF>& v );
238 
239  inline StaticVector( const Type& v1, const Type& v2 );
240  inline StaticVector( const Type& v1, const Type& v2, const Type& v3 );
241  inline StaticVector( const Type& v1, const Type& v2, const Type& v3, const Type& v4 );
242  inline StaticVector( const Type& v1, const Type& v2, const Type& v3,
243  const Type& v4, const Type& v5 );
244  inline StaticVector( const Type& v1, const Type& v2, const Type& v3,
245  const Type& v4, const Type& v5, const Type& v6 );
247  //**********************************************************************************************
248 
249  //**Destructor**********************************************************************************
250  // No explicitly declared destructor.
251  //**********************************************************************************************
252 
253  //**Data access functions***********************************************************************
256  inline Reference operator[]( size_t index );
257  inline ConstReference operator[]( size_t index ) const;
258  inline Reference at( size_t index );
259  inline ConstReference at( size_t index ) const;
260  inline Pointer data ();
261  inline ConstPointer data () const;
262  inline Iterator begin ();
263  inline ConstIterator begin () const;
264  inline ConstIterator cbegin() const;
265  inline Iterator end ();
266  inline ConstIterator end () const;
267  inline ConstIterator cend () const;
269  //**********************************************************************************************
270 
271  //**Assignment operators************************************************************************
274  template< typename Other >
275  inline StaticVector& operator=( const Other (&array)[N] );
276 
277  inline StaticVector& operator= ( const Type& rhs );
278  inline StaticVector& operator= ( const StaticVector& rhs );
279  template< typename Other > inline StaticVector& operator= ( const StaticVector<Other,N,TF>& rhs );
280  template< typename VT > inline StaticVector& operator= ( const Vector<VT,TF>& rhs );
281  template< typename VT > inline StaticVector& operator+=( const Vector<VT,TF>& rhs );
282  template< typename VT > inline StaticVector& operator-=( const Vector<VT,TF>& rhs );
283  template< typename VT > inline StaticVector& operator*=( const Vector<VT,TF>& rhs );
284 
285  template< typename Other >
286  inline typename EnableIf< IsNumeric<Other>, StaticVector >::Type&
287  operator*=( Other rhs );
288 
289  template< typename Other >
290  inline typename EnableIf< IsNumeric<Other>, StaticVector >::Type&
291  operator/=( Other rhs );
293  //**********************************************************************************************
294 
295  //**Utility functions***************************************************************************
298  inline size_t size() const;
299  inline size_t capacity() const;
300  inline size_t nonZeros() const;
301  inline void reset();
302  template< typename Other > inline StaticVector& scale( const Other& scalar );
303  inline void swap( StaticVector& v ) /* throw() */;
305  //**********************************************************************************************
306 
307  //**Memory functions****************************************************************************
310  static inline void* operator new ( std::size_t size );
311  static inline void* operator new[]( std::size_t size );
312  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
313  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
314 
315  static inline void operator delete ( void* ptr );
316  static inline void operator delete[]( void* ptr );
317  static inline void operator delete ( void* ptr, const std::nothrow_t& );
318  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
320  //**********************************************************************************************
321 
322  private:
323  //**********************************************************************************************
325  template< typename VT >
327  struct VectorizedAssign {
328  enum { value = useOptimizedKernels &&
329  vectorizable && VT::vectorizable &&
330  IsSame<Type,typename VT::ElementType>::value };
331  };
333  //**********************************************************************************************
334 
335  //**********************************************************************************************
337  template< typename VT >
339  struct VectorizedAddAssign {
340  enum { value = useOptimizedKernels &&
341  vectorizable && VT::vectorizable &&
342  IsSame<Type,typename VT::ElementType>::value &&
343  IntrinsicTrait<Type>::addition };
344  };
346  //**********************************************************************************************
347 
348  //**********************************************************************************************
350  template< typename VT >
352  struct VectorizedSubAssign {
353  enum { value = useOptimizedKernels &&
354  vectorizable && VT::vectorizable &&
355  IsSame<Type,typename VT::ElementType>::value &&
356  IntrinsicTrait<Type>::subtraction };
357  };
359  //**********************************************************************************************
360 
361  //**********************************************************************************************
363  template< typename VT >
365  struct VectorizedMultAssign {
366  enum { value = useOptimizedKernels &&
367  vectorizable && VT::vectorizable &&
368  IsSame<Type,typename VT::ElementType>::value &&
369  IntrinsicTrait<Type>::multiplication };
370  };
372  //**********************************************************************************************
373 
374  public:
375  //**Expression template evaluation functions****************************************************
378  template< typename Other > inline bool canAlias ( const Other* alias ) const;
379  template< typename Other > inline bool isAliased( const Other* alias ) const;
380 
381  inline bool isAligned() const;
382 
383  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
384  BLAZE_ALWAYS_INLINE IntrinsicType loada( size_t index ) const;
385  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
386 
387  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
388  BLAZE_ALWAYS_INLINE void storea( size_t index, const IntrinsicType& value );
389  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
390  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
391 
392  template< typename VT >
393  inline typename DisableIf< VectorizedAssign<VT> >::Type
394  assign( const DenseVector<VT,TF>& rhs );
395 
396  template< typename VT >
397  inline typename EnableIf< VectorizedAssign<VT> >::Type
398  assign( const DenseVector<VT,TF>& rhs );
399 
400  template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
401 
402  template< typename VT >
403  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
404  addAssign( const DenseVector<VT,TF>& rhs );
405 
406  template< typename VT >
407  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
408  addAssign( const DenseVector<VT,TF>& rhs );
409 
410  template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
411 
412  template< typename VT >
413  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
414  subAssign( const DenseVector<VT,TF>& rhs );
415 
416  template< typename VT >
417  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
418  subAssign( const DenseVector<VT,TF>& rhs );
419 
420  template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
421 
422  template< typename VT >
423  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
424  multAssign( const DenseVector<VT,TF>& rhs );
425 
426  template< typename VT >
427  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
428  multAssign( const DenseVector<VT,TF>& rhs );
429 
430  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
432  //**********************************************************************************************
433 
434  private:
435  //**Member variables****************************************************************************
439 
445  //**********************************************************************************************
446 
447  //**Compile time checks*************************************************************************
453  BLAZE_STATIC_ASSERT( !usePadding || ( NN % IT::size == 0UL ) );
454  BLAZE_STATIC_ASSERT( NN >= N );
456  //**********************************************************************************************
457 };
458 //*************************************************************************************************
459 
460 
461 
462 
463 //=================================================================================================
464 //
465 // CONSTRUCTORS
466 //
467 //=================================================================================================
468 
469 //*************************************************************************************************
474 template< typename Type // Data type of the vector
475  , size_t N // Number of elements
476  , bool TF > // Transpose flag
478  : v_() // The statically allocated vector elements
479 {
481 
482  if( IsNumeric<Type>::value ) {
483  for( size_t i=0UL; i<NN; ++i )
484  v_[i] = Type();
485  }
486 }
487 //*************************************************************************************************
488 
489 
490 //*************************************************************************************************
495 template< typename Type // Data type of the vector
496  , size_t N // Number of elements
497  , bool TF > // Transpose flag
498 inline StaticVector<Type,N,TF>::StaticVector( const Type& init )
499  : v_() // The statically allocated vector elements
500 {
502 
503  for( size_t i=0UL; i<N; ++i )
504  v_[i] = init;
505 
506  for( size_t i=N; i<NN; ++i )
507  v_[i] = Type();
508 }
509 //*************************************************************************************************
510 
511 
512 //*************************************************************************************************
534 template< typename Type // Data type of the vector
535  , size_t N // Number of elements
536  , bool TF > // Transpose flag
537 template< typename Other > // Data type of the initialization array
538 inline StaticVector<Type,N,TF>::StaticVector( size_t n, const Other* array )
539  : v_() // The statically allocated vector elements
540 {
542 
543  if( n > N ) {
544  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
545  }
546 
547  for( size_t i=0UL; i<n; ++i )
548  v_[i] = array[i];
549 
550  if( IsNumeric<Type>::value ) {
551  for( size_t i=n; i<NN; ++i )
552  v_[i] = Type();
553  }
554 }
555 //*************************************************************************************************
556 
557 
558 //*************************************************************************************************
574 template< typename Type // Data type of the vector
575  , size_t N // Number of elements
576  , bool TF > // Transpose flag
577 template< typename Other > // Data type of the initialization array
578 inline StaticVector<Type,N,TF>::StaticVector( const Other (&array)[N] )
579  : v_() // The statically allocated vector elements
580 {
582 
583  for( size_t i=0UL; i<N; ++i )
584  v_[i] = array[i];
585 
586  for( size_t i=N; i<NN; ++i )
587  v_[i] = Type();
588 }
589 //*************************************************************************************************
590 
591 
592 //*************************************************************************************************
599 template< typename Type // Data type of the vector
600  , size_t N // Number of elements
601  , bool TF > // Transpose flag
603  : v_() // The statically allocated vector elements
604 {
606 
607  for( size_t i=0UL; i<NN; ++i )
608  v_[i] = v.v_[i];
609 }
610 //*************************************************************************************************
611 
612 
613 //*************************************************************************************************
618 template< typename Type // Data type of the vector
619  , size_t N // Number of elements
620  , bool TF > // Transpose flag
621 template< typename Other > // Data type of the foreign vector
623  : v_() // The statically allocated vector elements
624 {
626 
627  for( size_t i=0UL; i<N; ++i )
628  v_[i] = v[i];
629 
630  for( size_t i=N; i<NN; ++i )
631  v_[i] = Type();
632 }
633 //*************************************************************************************************
634 
635 
636 //*************************************************************************************************
646 template< typename Type // Data type of the vector
647  , size_t N // Number of elements
648  , bool TF > // Transpose flag
649 template< typename VT > // Type of the foreign vector
651  : v_() // The statically allocated vector elements
652 {
653  using blaze::assign;
654 
656 
657  if( (~v).size() != N ) {
658  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
659  }
660 
661  for( size_t i=( IsSparseVector<VT>::value ? 0UL : N ); i<NN; ++i ) {
662  v_[i] = Type();
663  }
664 
665  assign( *this, ~v );
666 }
667 //*************************************************************************************************
668 
669 
670 //*************************************************************************************************
682 template< typename Type // Data type of the vector
683  , size_t N // Number of elements
684  , bool TF > // Transpose flag
685 inline StaticVector<Type,N,TF>::StaticVector( const Type& v1, const Type& v2 )
686  : v_() // The statically allocated vector elements
687 {
688  BLAZE_STATIC_ASSERT( N == 2UL );
690 
691  v_[0UL] = v1;
692  v_[1UL] = v2;
693 
694  for( size_t i=N; i<NN; ++i )
695  v_[i] = Type();
696 }
697 //*************************************************************************************************
698 
699 
700 //*************************************************************************************************
713 template< typename Type // Data type of the vector
714  , size_t N // Number of elements
715  , bool TF > // Transpose flag
716 inline StaticVector<Type,N,TF>::StaticVector( const Type& v1, const Type& v2, const Type& v3 )
717  : v_() // The statically allocated vector elements
718 {
719  BLAZE_STATIC_ASSERT( N == 3UL );
721 
722  v_[0UL] = v1;
723  v_[1UL] = v2;
724  v_[2UL] = v3;
725 
726  for( size_t i=N; i<NN; ++i )
727  v_[i] = Type();
728 }
729 //*************************************************************************************************
730 
731 
732 //*************************************************************************************************
746 template< typename Type // Data type of the vector
747  , size_t N // Number of elements
748  , bool TF > // Transpose flag
749 inline StaticVector<Type,N,TF>::StaticVector( const Type& v1, const Type& v2,
750  const Type& v3, const Type& v4 )
751  : v_() // The statically allocated vector elements
752 {
753  BLAZE_STATIC_ASSERT( N == 4UL );
755 
756  v_[0UL] = v1;
757  v_[1UL] = v2;
758  v_[2UL] = v3;
759  v_[3UL] = v4;
760 
761  for( size_t i=N; i<NN; ++i )
762  v_[i] = Type();
763 }
764 //*************************************************************************************************
765 
766 
767 //*************************************************************************************************
782 template< typename Type // Data type of the vector
783  , size_t N // Number of elements
784  , bool TF > // Transpose flag
785 inline StaticVector<Type,N,TF>::StaticVector( const Type& v1, const Type& v2, const Type& v3,
786  const Type& v4, const Type& v5 )
787  : v_() // The statically allocated vector elements
788 {
789  BLAZE_STATIC_ASSERT( N == 5UL );
791 
792  v_[0UL] = v1;
793  v_[1UL] = v2;
794  v_[2UL] = v3;
795  v_[3UL] = v4;
796  v_[4UL] = v5;
797 
798  for( size_t i=N; i<NN; ++i )
799  v_[i] = Type();
800 }
801 //*************************************************************************************************
802 
803 
804 //*************************************************************************************************
820 template< typename Type // Data type of the vector
821  , size_t N // Number of elements
822  , bool TF > // Transpose flag
823 inline StaticVector<Type,N,TF>::StaticVector( const Type& v1, const Type& v2, const Type& v3,
824  const Type& v4, const Type& v5, const Type& v6 )
825  : v_() // The statically allocated vector elements
826 {
827  BLAZE_STATIC_ASSERT( N == 6UL );
829 
830  v_[0UL] = v1;
831  v_[1UL] = v2;
832  v_[2UL] = v3;
833  v_[3UL] = v4;
834  v_[4UL] = v5;
835  v_[5UL] = v6;
836 
837  for( size_t i=N; i<NN; ++i )
838  v_[i] = Type();
839 }
840 //*************************************************************************************************
841 
842 
843 
844 
845 //=================================================================================================
846 //
847 // DATA ACCESS FUNCTIONS
848 //
849 //=================================================================================================
850 
851 //*************************************************************************************************
860 template< typename Type // Data type of the vector
861  , size_t N // Number of elements
862  , bool TF > // Transpose flag
865 {
866  BLAZE_USER_ASSERT( index < N, "Invalid vector access index" );
867  return v_[index];
868 }
869 //*************************************************************************************************
870 
871 
872 //*************************************************************************************************
881 template< typename Type // Data type of the vector
882  , size_t N // Number of elements
883  , bool TF > // Transpose flag
886 {
887  BLAZE_USER_ASSERT( index < N, "Invalid vector access index" );
888  return v_[index];
889 }
890 //*************************************************************************************************
891 
892 
893 //*************************************************************************************************
903 template< typename Type // Data type of the vector
904  , size_t N // Number of elements
905  , bool TF > // Transpose flag
908 {
909  if( index >= N ) {
910  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
911  }
912  return (*this)[index];
913 }
914 //*************************************************************************************************
915 
916 
917 //*************************************************************************************************
927 template< typename Type // Data type of the vector
928  , size_t N // Number of elements
929  , bool TF > // Transpose flag
931  StaticVector<Type,N,TF>::at( size_t index ) const
932 {
933  if( index >= N ) {
934  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
935  }
936  return (*this)[index];
937 }
938 //*************************************************************************************************
939 
940 
941 //*************************************************************************************************
948 template< typename Type // Data type of the vector
949  , size_t N // Number of elements
950  , bool TF > // Transpose flag
952 {
953  return v_;
954 }
955 //*************************************************************************************************
956 
957 
958 //*************************************************************************************************
965 template< typename Type // Data type of the vector
966  , size_t N // Number of elements
967  , bool TF > // Transpose flag
969 {
970  return v_;
971 }
972 //*************************************************************************************************
973 
974 
975 //*************************************************************************************************
980 template< typename Type // Data type of the vector
981  , size_t N // Number of elements
982  , bool TF > // Transpose flag
984 {
985  return Iterator( v_ );
986 }
987 //*************************************************************************************************
988 
989 
990 //*************************************************************************************************
995 template< typename Type // Data type of the vector
996  , size_t N // Number of elements
997  , bool TF > // Transpose flag
999 {
1000  return ConstIterator( v_ );
1001 }
1002 //*************************************************************************************************
1003 
1004 
1005 //*************************************************************************************************
1010 template< typename Type // Data type of the vector
1011  , size_t N // Number of elements
1012  , bool TF > // Transpose flag
1014 {
1015  return ConstIterator( v_ );
1016 }
1017 //*************************************************************************************************
1018 
1019 
1020 //*************************************************************************************************
1025 template< typename Type // Data type of the vector
1026  , size_t N // Number of elements
1027  , bool TF > // Transpose flag
1029 {
1030  return Iterator( v_ + N );
1031 }
1032 //*************************************************************************************************
1033 
1034 
1035 //*************************************************************************************************
1040 template< typename Type // Data type of the vector
1041  , size_t N // Number of elements
1042  , bool TF > // Transpose flag
1044 {
1045  return ConstIterator( v_ + N );
1046 }
1047 //*************************************************************************************************
1048 
1049 
1050 //*************************************************************************************************
1055 template< typename Type // Data type of the vector
1056  , size_t N // Number of elements
1057  , bool TF > // Transpose flag
1059 {
1060  return ConstIterator( v_ + N );
1061 }
1062 //*************************************************************************************************
1063 
1064 
1065 
1066 
1067 //=================================================================================================
1068 //
1069 // ASSIGNMENT OPERATORS
1070 //
1071 //=================================================================================================
1072 
1073 //*************************************************************************************************
1090 template< typename Type // Data type of the vector
1091  , size_t N // Number of elements
1092  , bool TF > // Transpose flag
1093 template< typename Other > // Data type of the initialization array
1095 {
1096  for( size_t i=0UL; i<N; ++i )
1097  v_[i] = array[i];
1098  return *this;
1099 }
1100 //*************************************************************************************************
1101 
1102 
1103 //*************************************************************************************************
1109 template< typename Type // Data type of the vector
1110  , size_t N // Number of elements
1111  , bool TF > // Transpose flag
1113 {
1114  for( size_t i=0UL; i<N; ++i )
1115  v_[i] = rhs;
1116  return *this;
1117 }
1118 //*************************************************************************************************
1119 
1120 
1121 //*************************************************************************************************
1129 template< typename Type // Data type of the vector
1130  , size_t N // Number of elements
1131  , bool TF > // Transpose flag
1133 {
1134  using blaze::assign;
1135 
1136  assign( *this, ~rhs );
1137  return *this;
1138 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1148 template< typename Type // Data type of the vector
1149  , size_t N // Number of elements
1150  , bool TF > // Transpose flag
1151 template< typename Other > // Data type of the foreign vector
1153 {
1154  using blaze::assign;
1155 
1156  assign( *this, ~rhs );
1157  return *this;
1158 }
1159 //*************************************************************************************************
1160 
1161 
1162 //*************************************************************************************************
1172 template< typename Type // Data type of the vector
1173  , size_t N // Number of elements
1174  , bool TF > // Transpose flag
1175 template< typename VT > // Type of the right-hand side vector
1177 {
1178  using blaze::assign;
1179 
1180  if( (~rhs).size() != N ) {
1181  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static vector" );
1182  }
1183 
1184  if( (~rhs).canAlias( this ) ) {
1185  StaticVector tmp( ~rhs );
1186  swap( tmp );
1187  }
1188  else {
1190  reset();
1191  assign( *this, ~rhs );
1192  }
1193 
1194  return *this;
1195 }
1196 //*************************************************************************************************
1197 
1198 
1199 //*************************************************************************************************
1209 template< typename Type // Data type of the vector
1210  , size_t N // Number of elements
1211  , bool TF > // Transpose flag
1212 template< typename VT > // Type of the right-hand side vector
1214 {
1215  using blaze::addAssign;
1216 
1217  if( (~rhs).size() != N ) {
1218  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1219  }
1220 
1221  if( (~rhs).canAlias( this ) ) {
1222  StaticVector tmp( ~rhs );
1223  addAssign( *this, tmp );
1224  }
1225  else {
1226  addAssign( *this, ~rhs );
1227  }
1228 
1229  return *this;
1230 }
1231 //*************************************************************************************************
1232 
1233 
1234 //*************************************************************************************************
1244 template< typename Type // Data type of the vector
1245  , size_t N // Number of elements
1246  , bool TF > // Transpose flag
1247 template< typename VT > // Type of the right-hand side vector
1249 {
1250  using blaze::subAssign;
1251 
1252  if( (~rhs).size() != N ) {
1253  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1254  }
1255 
1256  if( (~rhs).canAlias( this ) ) {
1257  StaticVector tmp( ~rhs );
1258  subAssign( *this, tmp );
1259  }
1260  else {
1261  subAssign( *this, ~rhs );
1262  }
1263 
1264  return *this;
1265 }
1266 //*************************************************************************************************
1267 
1268 
1269 //*************************************************************************************************
1280 template< typename Type // Data type of the vector
1281  , size_t N // Number of elements
1282  , bool TF > // Transpose flag
1283 template< typename VT > // Type of the right-hand side vector
1285 {
1286  using blaze::multAssign;
1287 
1288  if( (~rhs).size() != N ) {
1289  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1290  }
1291 
1292  if( IsSparseVector<VT>::value || (~rhs).canAlias( this ) ) {
1293  const StaticVector tmp( *this * (~rhs) );
1294  this->operator=( tmp );
1295  }
1296  else {
1297  multAssign( *this, ~rhs );
1298  }
1299 
1300  return *this;
1301 }
1302 //*************************************************************************************************
1303 
1304 
1305 //*************************************************************************************************
1312 template< typename Type // Data type of the vector
1313  , size_t N // Number of elements
1314  , bool TF > // Transpose flag
1315 template< typename Other > // Data type of the right-hand side scalar
1316 inline typename EnableIf< IsNumeric<Other>, StaticVector<Type,N,TF> >::Type&
1318 {
1319  using blaze::assign;
1320 
1321  assign( *this, (*this) * rhs );
1322  return *this;
1323 }
1324 //*************************************************************************************************
1325 
1326 
1327 //*************************************************************************************************
1336 template< typename Type // Data type of the vector
1337  , size_t N // Number of elements
1338  , bool TF > // Transpose flag
1339 template< typename Other > // Data type of the right-hand side scalar
1340 inline typename EnableIf< IsNumeric<Other>, StaticVector<Type,N,TF> >::Type&
1342 {
1343  using blaze::assign;
1344 
1345  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1346 
1347  assign( *this, (*this) / rhs );
1348  return *this;
1349 }
1350 //*************************************************************************************************
1351 
1352 
1353 
1354 
1355 //=================================================================================================
1356 //
1357 // UTILITY FUNCTIONS
1358 //
1359 //=================================================================================================
1360 
1361 //*************************************************************************************************
1366 template< typename Type // Data type of the vector
1367  , size_t N // Number of elements
1368  , bool TF > // Transpose flag
1369 inline size_t StaticVector<Type,N,TF>::size() const
1370 {
1371  return N;
1372 }
1373 //*************************************************************************************************
1374 
1375 
1376 //*************************************************************************************************
1381 template< typename Type // Data type of the vector
1382  , size_t N // Number of elements
1383  , bool TF > // Transpose flag
1385 {
1386  return NN;
1387 }
1388 //*************************************************************************************************
1389 
1390 
1391 //*************************************************************************************************
1399 template< typename Type // Data type of the vector
1400  , size_t N // Number of elements
1401  , bool TF > // Transpose flag
1403 {
1404  size_t nonzeros( 0 );
1405 
1406  for( size_t i=0UL; i<N; ++i ) {
1407  if( !isDefault( v_[i] ) )
1408  ++nonzeros;
1409  }
1410 
1411  return nonzeros;
1412 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1421 template< typename Type // Data type of the vector
1422  , size_t N // Number of elements
1423  , bool TF > // Transpose flag
1425 {
1426  using blaze::clear;
1427  for( size_t i=0UL; i<N; ++i )
1428  clear( v_[i] );
1429 }
1430 //*************************************************************************************************
1431 
1432 
1433 //*************************************************************************************************
1439 template< typename Type // Data type of the vector
1440  , size_t N // Number of elements
1441  , bool TF > // Transpose flag
1442 template< typename Other > // Data type of the scalar value
1444 {
1445  for( size_t i=0; i<N; ++i )
1446  v_[i] *= scalar;
1447  return *this;
1448 }
1449 //*************************************************************************************************
1450 
1451 
1452 //*************************************************************************************************
1459 template< typename Type // Data type of the vector
1460  , size_t N // Number of elements
1461  , bool TF > // Transpose flag
1462 inline void StaticVector<Type,N,TF>::swap( StaticVector& v ) /* throw() */
1463 {
1464  using std::swap;
1465 
1466  for( size_t i=0UL; i<N; ++i )
1467  swap( v_[i], v.v_[i] );
1468 }
1469 //*************************************************************************************************
1470 
1471 
1472 
1473 
1474 //=================================================================================================
1475 //
1476 // MEMORY FUNCTIONS
1477 //
1478 //=================================================================================================
1479 
1480 //*************************************************************************************************
1490 template< typename Type // Data type of the vector
1491  , size_t N // Number of elements
1492  , bool TF > // Transpose flag
1493 inline void* StaticVector<Type,N,TF>::operator new( std::size_t size )
1494 {
1495  UNUSED_PARAMETER( size );
1496 
1497  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticVector ), "Invalid number of bytes detected" );
1498 
1499  return allocate<StaticVector>( 1UL );
1500 }
1501 //*************************************************************************************************
1502 
1503 
1504 //*************************************************************************************************
1514 template< typename Type // Data type of the vector
1515  , size_t N // Number of elements
1516  , bool TF > // Transpose flag
1517 inline void* StaticVector<Type,N,TF>::operator new[]( std::size_t size )
1518 {
1519  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticVector ) , "Invalid number of bytes detected" );
1520  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticVector ) == 0UL, "Invalid number of bytes detected" );
1521 
1522  return allocate<StaticVector>( size/sizeof(StaticVector) );
1523 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1537 template< typename Type // Data type of the vector
1538  , size_t N // Number of elements
1539  , bool TF > // Transpose flag
1540 inline void* StaticVector<Type,N,TF>::operator new( std::size_t size, const std::nothrow_t& )
1541 {
1542  UNUSED_PARAMETER( size );
1543 
1544  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticVector ), "Invalid number of bytes detected" );
1545 
1546  return allocate<StaticVector>( 1UL );
1547 }
1548 //*************************************************************************************************
1549 
1550 
1551 //*************************************************************************************************
1561 template< typename Type // Data type of the vector
1562  , size_t N // Number of elements
1563  , bool TF > // Transpose flag
1564 inline void* StaticVector<Type,N,TF>::operator new[]( std::size_t size, const std::nothrow_t& )
1565 {
1566  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticVector ) , "Invalid number of bytes detected" );
1567  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticVector ) == 0UL, "Invalid number of bytes detected" );
1568 
1569  return allocate<StaticVector>( size/sizeof(StaticVector) );
1570 }
1571 //*************************************************************************************************
1572 
1573 
1574 //*************************************************************************************************
1580 template< typename Type // Data type of the vector
1581  , size_t N // Number of elements
1582  , bool TF > // Transpose flag
1583 inline void StaticVector<Type,N,TF>::operator delete( void* ptr )
1584 {
1585  deallocate( static_cast<StaticVector*>( ptr ) );
1586 }
1587 //*************************************************************************************************
1588 
1589 
1590 //*************************************************************************************************
1596 template< typename Type // Data type of the vector
1597  , size_t N // Number of elements
1598  , bool TF > // Transpose flag
1599 inline void StaticVector<Type,N,TF>::operator delete[]( void* ptr )
1600 {
1601  deallocate( static_cast<StaticVector*>( ptr ) );
1602 }
1603 //*************************************************************************************************
1604 
1605 
1606 //*************************************************************************************************
1612 template< typename Type // Data type of the vector
1613  , size_t N // Number of elements
1614  , bool TF > // Transpose flag
1615 inline void StaticVector<Type,N,TF>::operator delete( void* ptr, const std::nothrow_t& )
1616 {
1617  deallocate( static_cast<StaticVector*>( ptr ) );
1618 }
1619 //*************************************************************************************************
1620 
1621 
1622 //*************************************************************************************************
1628 template< typename Type // Data type of the vector
1629  , size_t N // Number of elements
1630  , bool TF > // Transpose flag
1631 inline void StaticVector<Type,N,TF>::operator delete[]( void* ptr, const std::nothrow_t& )
1632 {
1633  deallocate( static_cast<StaticVector*>( ptr ) );
1634 }
1635 //*************************************************************************************************
1636 
1637 
1638 
1639 
1640 //=================================================================================================
1641 //
1642 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1643 //
1644 //=================================================================================================
1645 
1646 //*************************************************************************************************
1656 template< typename Type // Data type of the vector
1657  , size_t N // Number of elements
1658  , bool TF > // Transpose flag
1659 template< typename Other > // Data type of the foreign expression
1660 inline bool StaticVector<Type,N,TF>::canAlias( const Other* alias ) const
1661 {
1662  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1663 }
1664 //*************************************************************************************************
1665 
1666 
1667 //*************************************************************************************************
1677 template< typename Type // Data type of the vector
1678  , size_t N // Number of elements
1679  , bool TF > // Transpose flag
1680 template< typename Other > // Data type of the foreign expression
1681 inline bool StaticVector<Type,N,TF>::isAliased( const Other* alias ) const
1682 {
1683  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1684 }
1685 //*************************************************************************************************
1686 
1687 
1688 //*************************************************************************************************
1697 template< typename Type // Data type of the vector
1698  , size_t N // Number of elements
1699  , bool TF > // Transpose flag
1701 {
1702  return true;
1703 }
1704 //*************************************************************************************************
1705 
1706 
1707 //*************************************************************************************************
1720 template< typename Type // Data type of the vector
1721  , size_t N // Number of elements
1722  , bool TF > // Transpose flag
1724  StaticVector<Type,N,TF>::load( size_t index ) const
1725 {
1726  return loada( index );
1727 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1744 template< typename Type // Data type of the vector
1745  , size_t N // Number of elements
1746  , bool TF > // Transpose flag
1748  StaticVector<Type,N,TF>::loada( size_t index ) const
1749 {
1750  using blaze::loada;
1751 
1753 
1754  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1755  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1756  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1757  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1758 
1759  return loada( &v_[index] );
1760 }
1761 //*************************************************************************************************
1762 
1763 
1764 //*************************************************************************************************
1777 template< typename Type // Data type of the vector
1778  , size_t N // Number of elements
1779  , bool TF > // Transpose flag
1781  StaticVector<Type,N,TF>::loadu( size_t index ) const
1782 {
1783  using blaze::loadu;
1784 
1786 
1787  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1788  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1789 
1790  return loadu( &v_[index] );
1791 }
1792 //*************************************************************************************************
1793 
1794 
1795 //*************************************************************************************************
1809 template< typename Type // Data type of the vector
1810  , size_t N // Number of elements
1811  , bool TF > // Transpose flag
1813  StaticVector<Type,N,TF>::store( size_t index, const IntrinsicType& value )
1814 {
1815  storea( index, value );
1816 }
1817 //*************************************************************************************************
1818 
1819 
1820 //*************************************************************************************************
1834 template< typename Type // Data type of the vector
1835  , size_t N // Number of elements
1836  , bool TF > // Transpose flag
1838  StaticVector<Type,N,TF>::storea( size_t index, const IntrinsicType& value )
1839 {
1840  using blaze::storea;
1841 
1843 
1844  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1845  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN , "Invalid vector access index" );
1846  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1847  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1848 
1849  storea( &v_[index], value );
1850 }
1851 //*************************************************************************************************
1852 
1853 
1854 //*************************************************************************************************
1868 template< typename Type // Data type of the vector
1869  , size_t N // Number of elements
1870  , bool TF > // Transpose flag
1872  StaticVector<Type,N,TF>::storeu( size_t index, const IntrinsicType& value )
1873 {
1874  using blaze::storeu;
1875 
1877 
1878  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1879  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1880 
1881  storeu( &v_[index], value );
1882 }
1883 //*************************************************************************************************
1884 
1885 
1886 //*************************************************************************************************
1900 template< typename Type // Data type of the vector
1901  , size_t N // Number of elements
1902  , bool TF > // Transpose flag
1904  StaticVector<Type,N,TF>::stream( size_t index, const IntrinsicType& value )
1905 {
1906  using blaze::stream;
1907 
1909 
1910  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1911  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1912  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1913  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1914 
1915  stream( &v_[index], value );
1916 }
1917 //*************************************************************************************************
1918 
1919 
1920 //*************************************************************************************************
1931 template< typename Type // Data type of the vector
1932  , size_t N // Number of elements
1933  , bool TF > // Transpose flag
1934 template< typename VT > // Type of the right-hand side dense vector
1935 inline typename DisableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1937 {
1938  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
1939 
1940  for( size_t i=0UL; i<N; ++i )
1941  v_[i] = (~rhs)[i];
1942 }
1943 //*************************************************************************************************
1944 
1945 
1946 //*************************************************************************************************
1957 template< typename Type // Data type of the vector
1958  , size_t N // Number of elements
1959  , bool TF > // Transpose flag
1960 template< typename VT > // Type of the right-hand side dense vector
1961 inline typename EnableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1963 {
1965 
1966  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
1967 
1968  const bool remainder( !usePadding || !IsPadded<VT>::value );
1969 
1970  const size_t ipos( ( remainder )?( N & size_t(-IT::size) ):( N ) );
1971  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (IT::size) ) ) == ipos, "Invalid end calculation" );
1972 
1973  size_t i( 0UL );
1974 
1975  for( ; i<ipos; i+=IT::size ) {
1976  store( i, (~rhs).load(i) );
1977  }
1978  for( ; remainder && i<N; ++i ) {
1979  v_[i] = (~rhs)[i];
1980  }
1981 }
1982 //*************************************************************************************************
1983 
1984 
1985 //*************************************************************************************************
1996 template< typename Type // Data type of the vector
1997  , size_t N // Number of elements
1998  , bool TF > // Transpose flag
1999 template< typename VT > // Type of the right-hand side sparse vector
2001 {
2002  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2003 
2004  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2005  v_[element->index()] = element->value();
2006 }
2007 //*************************************************************************************************
2008 
2009 
2010 //*************************************************************************************************
2021 template< typename Type // Data type of the vector
2022  , size_t N // Number of elements
2023  , bool TF > // Transpose flag
2024 template< typename VT > // Type of the right-hand side dense vector
2025 inline typename DisableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
2027 {
2028  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2029 
2030  for( size_t i=0UL; i<N; ++i )
2031  v_[i] += (~rhs)[i];
2032 }
2033 //*************************************************************************************************
2034 
2035 
2036 //*************************************************************************************************
2047 template< typename Type // Data type of the vector
2048  , size_t N // Number of elements
2049  , bool TF > // Transpose flag
2050 template< typename VT > // Type of the right-hand side dense vector
2051 inline typename EnableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
2053 {
2055 
2056  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2057 
2058  const bool remainder( !usePadding || !IsPadded<VT>::value );
2059 
2060  const size_t ipos( ( remainder )?( N & size_t(-IT::size) ):( N ) );
2061  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (IT::size) ) ) == ipos, "Invalid end calculation" );
2062 
2063  size_t i( 0UL );
2064 
2065  for( ; i<ipos; i+=IT::size ) {
2066  store( i, load(i) + (~rhs).load(i) );
2067  }
2068  for( ; remainder && i<N; ++i ) {
2069  v_[i] += (~rhs)[i];
2070  }
2071 }
2072 //*************************************************************************************************
2073 
2074 
2075 //*************************************************************************************************
2086 template< typename Type // Data type of the vector
2087  , size_t N // Number of elements
2088  , bool TF > // Transpose flag
2089 template< typename VT > // Type of the right-hand side sparse vector
2091 {
2092  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2093 
2094  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2095  v_[element->index()] += element->value();
2096 }
2097 //*************************************************************************************************
2098 
2099 
2100 //*************************************************************************************************
2111 template< typename Type // Data type of the vector
2112  , size_t N // Number of elements
2113  , bool TF > // Transpose flag
2114 template< typename VT > // Type of the right-hand side dense vector
2115 inline typename DisableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2117 {
2118  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2119 
2120  for( size_t i=0UL; i<N; ++i )
2121  v_[i] -= (~rhs)[i];
2122 }
2123 //*************************************************************************************************
2124 
2125 
2126 //*************************************************************************************************
2137 template< typename Type // Data type of the vector
2138  , size_t N // Number of elements
2139  , bool TF > // Transpose flag
2140 template< typename VT > // Type of the right-hand side dense vector
2141 inline typename EnableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2143 {
2145 
2146  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2147 
2148  const bool remainder( !usePadding || !IsPadded<VT>::value );
2149 
2150  const size_t ipos( ( remainder )?( N & size_t(-IT::size) ):( N ) );
2151  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (IT::size) ) ) == ipos, "Invalid end calculation" );
2152 
2153  size_t i( 0UL );
2154 
2155  for( ; i<ipos; i+=IT::size ) {
2156  store( i, load(i) - (~rhs).load(i) );
2157  }
2158  for( ; remainder && i<N; ++i ) {
2159  v_[i] -= (~rhs)[i];
2160  }
2161 }
2162 //*************************************************************************************************
2163 
2164 
2165 //*************************************************************************************************
2176 template< typename Type // Data type of the vector
2177  , size_t N // Number of elements
2178  , bool TF > // Transpose flag
2179 template< typename VT > // Type of the right-hand side sparse vector
2181 {
2182  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2183 
2184  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2185  v_[element->index()] -= element->value();
2186 }
2187 //*************************************************************************************************
2188 
2189 
2190 //*************************************************************************************************
2201 template< typename Type // Data type of the vector
2202  , size_t N // Number of elements
2203  , bool TF > // Transpose flag
2204 template< typename VT > // Type of the right-hand side dense vector
2205 inline typename DisableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2207 {
2208  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2209 
2210  for( size_t i=0UL; i<N; ++i )
2211  v_[i] *= (~rhs)[i];
2212 }
2213 //*************************************************************************************************
2214 
2215 
2216 //*************************************************************************************************
2227 template< typename Type // Data type of the vector
2228  , size_t N // Number of elements
2229  , bool TF > // Transpose flag
2230 template< typename VT > // Type of the right-hand side dense vector
2231 inline typename EnableIf< typename StaticVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2233 {
2235 
2236  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2237 
2238  const bool remainder( !usePadding || !IsPadded<VT>::value );
2239 
2240  const size_t ipos( ( remainder )?( N & size_t(-IT::size) ):( N ) );
2241  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (IT::size) ) ) == ipos, "Invalid end calculation" );
2242 
2243  size_t i( 0UL );
2244 
2245  for( ; i<ipos; i+=IT::size ) {
2246  store( i, load(i) * (~rhs).load(i) );
2247  }
2248  for( ; remainder && i<N; ++i ) {
2249  v_[i] *= (~rhs)[i];
2250  }
2251 }
2252 //*************************************************************************************************
2253 
2254 
2255 //*************************************************************************************************
2266 template< typename Type // Data type of the vector
2267  , size_t N // Number of elements
2268  , bool TF > // Transpose flag
2269 template< typename VT > // Type of the right-hand side sparse vector
2271 {
2272  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2273 
2274  const StaticVector tmp( serial( *this ) );
2275 
2276  reset();
2277 
2278  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2279  v_[element->index()] = tmp[element->index()] * element->value();
2280 }
2281 //*************************************************************************************************
2282 
2283 
2284 
2285 
2286 
2287 
2288 
2289 
2290 //=================================================================================================
2291 //
2292 // UNDEFINED CLASS TEMPLATE SPECIALIZATION
2293 //
2294 //=================================================================================================
2295 
2296 //*************************************************************************************************
2304 template< typename Type // Data type of the vector
2305  , bool TF > // Transpose flag
2306 class StaticVector<Type,0UL,TF>;
2308 //*************************************************************************************************
2309 
2310 
2311 
2312 
2313 
2314 
2315 
2316 
2317 //=================================================================================================
2318 //
2319 // STATICVECTOR OPERATORS
2320 //
2321 //=================================================================================================
2322 
2323 //*************************************************************************************************
2326 template< typename Type, size_t N, bool TF >
2327 inline void reset( StaticVector<Type,N,TF>& v );
2328 
2329 template< typename Type, size_t N, bool TF >
2330 inline void clear( StaticVector<Type,N,TF>& v );
2331 
2332 template< typename Type, size_t N, bool TF >
2333 inline bool isDefault( const StaticVector<Type,N,TF>& v );
2334 
2335 template< typename Type, size_t N, bool TF >
2336 inline bool isIntact( const StaticVector<Type,N,TF>& v );
2337 
2338 template< typename Type, bool TF >
2340 
2341 template< typename Type, bool TF >
2343 
2344 template< typename Type, size_t N, bool TF >
2345 inline void swap( StaticVector<Type,N,TF>& a, StaticVector<Type,N,TF>& b ) /* throw() */;
2346 
2347 template< typename Type, size_t N, bool TF >
2348 inline void move( StaticVector<Type,N,TF>& dst, StaticVector<Type,N,TF>& src ) /* throw() */;
2350 //*************************************************************************************************
2351 
2352 
2353 //*************************************************************************************************
2360 template< typename Type // Data type of the vector
2361  , size_t N // Number of elements
2362  , bool TF > // Transpose flag
2364 {
2365  v.reset();
2366 }
2367 //*************************************************************************************************
2368 
2369 
2370 //*************************************************************************************************
2379 template< typename Type // Data type of the vector
2380  , size_t N // Number of elements
2381  , bool TF > // Transpose flag
2383 {
2384  v.reset();
2385 }
2386 //*************************************************************************************************
2387 
2388 
2389 //*************************************************************************************************
2407 template< typename Type // Data type of the vector
2408  , size_t N // Number of elements
2409  , bool TF > // Transpose flag
2410 inline bool isDefault( const StaticVector<Type,N,TF>& v )
2411 {
2412  for( size_t i=0UL; i<N; ++i )
2413  if( !isDefault( v[i] ) ) return false;
2414  return true;
2415 }
2416 //*************************************************************************************************
2417 
2418 
2419 //*************************************************************************************************
2437 template< typename Type // Data type of the vector
2438  , size_t N // Number of elements
2439  , bool TF > // Transpose flag
2440 inline bool isIntact( const StaticVector<Type,N,TF>& v )
2441 {
2442  UNUSED_PARAMETER( v );
2443 
2444  return true;
2445 }
2446 //*************************************************************************************************
2447 
2448 
2449 //*************************************************************************************************
2460 template< typename Type // Data type of the vector
2461  , bool TF > // Transpose flag
2463 {
2464  return StaticVector<Type,2UL,TF>( -v[1UL], v[0UL] );
2465 }
2466 //*************************************************************************************************
2467 
2468 
2469 //*************************************************************************************************
2477 template< typename Type // Data type of the vector
2478  , bool TF > // Transpose flag
2480 {
2481  if( v[0] != Type() || v[1] != Type() )
2482  return StaticVector<Type,3UL,TF>( v[1UL], -v[0UL], Type() );
2483  else
2484  return StaticVector<Type,3UL,TF>( Type(), v[2UL], -v[1UL] );
2485 }
2486 //*************************************************************************************************
2487 
2488 
2489 //*************************************************************************************************
2498 template< typename Type // Data type of the vector
2499  , size_t N // Number of elements
2500  , bool TF > // Transpose flag
2501 inline void swap( StaticVector<Type,N,TF>& a, StaticVector<Type,N,TF>& b ) /* throw() */
2502 {
2503  a.swap( b );
2504 }
2505 //*************************************************************************************************
2506 
2507 
2508 //*************************************************************************************************
2517 template< typename Type // Data type of the vector
2518  , size_t N // Number of elements
2519  , bool TF > // Transpose flag
2520 inline void move( StaticVector<Type,N,TF>& dst, StaticVector<Type,N,TF>& src ) /* throw() */
2521 {
2522  dst = src;
2523 }
2524 //*************************************************************************************************
2525 
2526 
2527 
2528 
2529 //=================================================================================================
2530 //
2531 // SIZE SPECIALIZATIONS
2532 //
2533 //=================================================================================================
2534 
2535 //*************************************************************************************************
2537 template< typename T, size_t N, bool TF >
2538 struct Size< StaticVector<T,N,TF> >
2539 {
2540  static const size_t value = N;
2541 };
2543 //*************************************************************************************************
2544 
2545 
2546 
2547 
2548 //=================================================================================================
2549 //
2550 // HASCONSTDATAACCESS SPECIALIZATIONS
2551 //
2552 //=================================================================================================
2553 
2554 //*************************************************************************************************
2556 template< typename T, size_t N, bool TF >
2557 struct HasConstDataAccess< StaticVector<T,N,TF> > : public IsTrue<true>
2558 {};
2560 //*************************************************************************************************
2561 
2562 
2563 
2564 
2565 //=================================================================================================
2566 //
2567 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2568 //
2569 //=================================================================================================
2570 
2571 //*************************************************************************************************
2573 template< typename T, size_t N, bool TF >
2574 struct HasMutableDataAccess< StaticVector<T,N,TF> > : public IsTrue<true>
2575 {};
2577 //*************************************************************************************************
2578 
2579 
2580 
2581 
2582 //=================================================================================================
2583 //
2584 // ISALIGNED SPECIALIZATIONS
2585 //
2586 //=================================================================================================
2587 
2588 //*************************************************************************************************
2590 template< typename T, size_t N, bool TF >
2591 struct IsAligned< StaticVector<T,N,TF> > : public IsTrue<true>
2592 {};
2594 //*************************************************************************************************
2595 
2596 
2597 
2598 
2599 //=================================================================================================
2600 //
2601 // ISPADDED SPECIALIZATIONS
2602 //
2603 //=================================================================================================
2604 
2605 //*************************************************************************************************
2607 template< typename T, size_t N, bool TF >
2608 struct IsPadded< StaticVector<T,N,TF> > : public IsTrue<usePadding>
2609 {};
2611 //*************************************************************************************************
2612 
2613 
2614 
2615 
2616 //=================================================================================================
2617 //
2618 // ADDTRAIT SPECIALIZATIONS
2619 //
2620 //=================================================================================================
2621 
2622 //*************************************************************************************************
2624 template< typename T1, size_t N, bool TF, typename T2 >
2625 struct AddTrait< StaticVector<T1,N,TF>, StaticVector<T2,N,TF> >
2626 {
2627  typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2628 };
2630 //*************************************************************************************************
2631 
2632 
2633 
2634 
2635 //=================================================================================================
2636 //
2637 // SUBTRAIT SPECIALIZATIONS
2638 //
2639 //=================================================================================================
2640 
2641 //*************************************************************************************************
2643 template< typename T1, size_t N, bool TF, typename T2 >
2644 struct SubTrait< StaticVector<T1,N,TF>, StaticVector<T2,N,TF> >
2645 {
2646  typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2647 };
2649 //*************************************************************************************************
2650 
2651 
2652 
2653 
2654 //=================================================================================================
2655 //
2656 // MULTTRAIT SPECIALIZATIONS
2657 //
2658 //=================================================================================================
2659 
2660 //*************************************************************************************************
2662 template< typename T1, size_t N, bool TF, typename T2 >
2663 struct MultTrait< StaticVector<T1,N,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2664 {
2665  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2666 };
2667 
2668 template< typename T1, typename T2, size_t N, bool TF >
2669 struct MultTrait< T1, StaticVector<T2,N,TF>, typename EnableIf< IsNumeric<T1> >::Type >
2670 {
2671  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2672 };
2673 
2674 template< typename T1, size_t N, bool TF, typename T2 >
2675 struct MultTrait< StaticVector<T1,N,TF>, StaticVector<T2,N,TF> >
2676 {
2677  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2678 };
2679 
2680 template< typename T1, size_t M, typename T2, size_t N >
2681 struct MultTrait< StaticVector<T1,M,false>, StaticVector<T2,N,true> >
2682 {
2683  typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, false > Type;
2684 };
2685 
2686 template< typename T1, size_t N, typename T2 >
2687 struct MultTrait< StaticVector<T1,N,true>, StaticVector<T2,N,false> >
2688 {
2689  typedef typename MultTrait<T1,T2>::Type Type;
2690 };
2692 //*************************************************************************************************
2693 
2694 
2695 
2696 
2697 //=================================================================================================
2698 //
2699 // CROSSTRAIT SPECIALIZATIONS
2700 //
2701 //=================================================================================================
2702 
2703 //*************************************************************************************************
2705 template< typename T1, typename T2 >
2706 struct CrossTrait< StaticVector<T1,3UL,false>, StaticVector<T2,3UL,false> >
2707 {
2708  private:
2709  typedef typename MultTrait<T1,T2>::Type T;
2710 
2711  public:
2712  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2713 };
2715 //*************************************************************************************************
2716 
2717 
2718 
2719 
2720 //=================================================================================================
2721 //
2722 // DIVTRAIT SPECIALIZATIONS
2723 //
2724 //=================================================================================================
2725 
2726 //*************************************************************************************************
2728 template< typename T1, size_t N, bool TF, typename T2 >
2729 struct DivTrait< StaticVector<T1,N,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2730 {
2731  typedef StaticVector< typename DivTrait<T1,T2>::Type, N, TF > Type;
2732 };
2734 //*************************************************************************************************
2735 
2736 
2737 
2738 
2739 //=================================================================================================
2740 //
2741 // MATHTRAIT SPECIALIZATIONS
2742 //
2743 //=================================================================================================
2744 
2745 //*************************************************************************************************
2747 template< typename T1, size_t N, bool TF, typename T2 >
2748 struct MathTrait< StaticVector<T1,N,TF>, StaticVector<T2,N,TF> >
2749 {
2750  typedef StaticVector< typename MathTrait<T1,T2>::HighType, N, TF > HighType;
2751  typedef StaticVector< typename MathTrait<T1,T2>::LowType , N, TF > LowType;
2752 };
2754 //*************************************************************************************************
2755 
2756 
2757 
2758 
2759 //=================================================================================================
2760 //
2761 // SUBVECTORTRAIT SPECIALIZATIONS
2762 //
2763 //=================================================================================================
2764 
2765 //*************************************************************************************************
2767 template< typename T1, size_t N, bool TF >
2768 struct SubvectorTrait< StaticVector<T1,N,TF> >
2769 {
2770  typedef HybridVector<T1,N,TF> Type;
2771 };
2773 //*************************************************************************************************
2774 
2775 } // namespace blaze
2776 
2777 #endif
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:118
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:116
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
BLAZE_ALWAYS_INLINE void storea(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the vector.
Definition: StaticVector.h:1838
const bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.This value specifies the default tran...
Definition: TransposeFlag.h:56
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
Header file for the NextMultiple class template.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
Type * Pointer
Pointer to a non-constant vector value.
Definition: StaticVector.h:194
Iterator end()
Returns an iterator just past the last element of the static vector.
Definition: StaticVector.h:1028
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:250
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Store of an intrinsic element of the vector.
Definition: StaticVector.h:1813
Header file for the IsSame and IsStrictlySame type traits.
IT::Type IntrinsicType
Intrinsic type of the vector elements.
Definition: StaticVector.h:188
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
BLAZE_ALWAYS_INLINE IntrinsicType loada(size_t index) const
Aligned load of an intrinsic element of the vector.
Definition: StaticVector.h:1748
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:116
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the SizeT class template.
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: StaticVector.h:1402
Header file for memory allocation and deallocation functionality.
void move(CustomMatrix< Type, AF, PF, SO > &dst, CustomMatrix< Type, AF, PF, SO > &src)
Moving the contents of one custom matrix to another.
Definition: CustomMatrix.h:6085
System settings for performance optimizations.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
bool isAligned() const
Returns whether the vector is properly aligned in memory.
Definition: StaticVector.h:1700
Header file for the DisableIf class template.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:74
size_t capacity() const
Returns the maximum capacity of the vector.
Definition: StaticVector.h:1384
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: StaticVector.h:1660
void swap(StaticVector &v)
Swapping the contents of two static vectors.
Definition: StaticVector.h:1462
Header file for the multiplication trait.
const StaticVector & CompositeType
Data type for composite expression templates.
Definition: StaticVector.h:190
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Compile time assertion.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const simd_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:75
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:116
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:75
Reference at(size_t index)
Checked access to the vector elements.
Definition: StaticVector.h:907
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:227
Header file for the DenseIterator class template.
const Type * ConstPointer
Pointer to a constant vector value.
Definition: StaticVector.h:195
Header file for the subvector trait.
Constraint on the data type.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
Compile time check for sparse vector types.This type trait tests whether or not the given template pa...
Definition: IsSparseVector.h:103
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticVector.h:189
Header file for the IsAligned type trait.
void reset()
Reset to the default initial values.
Definition: StaticVector.h:1424
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:79
static const size_t NN
Alignment adjustment.
Definition: StaticVector.h:179
ConstIterator cbegin() const
Returns an iterator to the first element of the static vector.
Definition: StaticVector.h:1013
Reference operator[](size_t index)
Subscript operator for the direct access to the vector elements.
Definition: StaticVector.h:864
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:187
This ResultType
Result type for expression template evaluations.
Definition: StaticVector.h:185
const StaticVector< Type, 2UL, TF > perp(const StaticVector< Type, 2UL, TF > &v)
Unary perp dot product operator for the calculation of a perpendicular vector ( ).
Definition: StaticVector.h:2462
DenseIterator< const Type, aligned > ConstIterator
Iterator over constant elements.
Definition: StaticVector.h:198
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Load of an intrinsic element of the vector.
Definition: StaticVector.h:1724
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Header file for the IsPadded type trait.
Header file for the serial shim.
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the vector.
Definition: StaticVector.h:1904
Header file for the IsVectorizable type trait.
Header file for the IsNumeric type trait.
AlignedArray< Type, NN > v_
The statically allocated vector elements.
Definition: StaticVector.h:438
Header file for the HasConstDataAccess type trait.
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the vector.
Definition: StaticVector.h:1872
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type loada(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loada.h:77
Header file for the IsSparseVector type trait.
Compile time integral constant wrapper for size_t.The SizeT class template represents an integral wra...
Definition: SizeT.h:72
Type ElementType
Type of the vector elements.
Definition: StaticVector.h:187
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
StaticVector()
The default constructor for StaticVector.
Definition: StaticVector.h:477
Header file for run time assertion macros.
Header file for the addition trait.
DenseIterator< Type, aligned > Iterator
Iterator over non-constant elements.
Definition: StaticVector.h:197
Header file for the cross product trait.
Header file for the division trait.
Constraint on the data type.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Iterator begin()
Returns an iterator to the first element of the static vector.
Definition: StaticVector.h:983
const bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
Header file for the AlignedArray implementation.
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the vector.
Definition: StaticVector.h:1781
const bool usePadding
Configuration of the padding of dense vectors and matrices.This configuration switch enables/disables...
Definition: Optimizations.h:52
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the isDefault shim.
StaticVector< Type, N, TF > This
Type of this StaticVector instance.
Definition: StaticVector.h:184
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: StaticVector.h:1681
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
IntrinsicTrait< Type > IT
Intrinsic trait for the vector element type.
Definition: StaticVector.h:174
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:59
Header file for all intrinsic functionality.
Header file for the mathematical trait.
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
StaticVector< ET, N, TF > Other
The type of the other StaticVector.
Definition: StaticVector.h:206
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
Header file for the default transpose flag for all vectors of the Blaze library.
StaticVector< Type, N,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: StaticVector.h:186
Header file for the alignment check function.
size_t size() const
Returns the current size/dimension of the vector.
Definition: StaticVector.h:1369
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
Header file for the IsTrue value trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type stream(T *address, const simd_int16_t &value)
Aligned, non-temporal store of a vector of 2-byte integral values.
Definition: Stream.h:74
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
ConstIterator cend() const
Returns an iterator just past the last element of the static vector.
Definition: StaticVector.h:1058
Header file for exception macros.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
Pointer data()
Low-level data access to the vector elements.
Definition: StaticVector.h:951
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Rebind mechanism to obtain a StaticVector with different data/element type.
Definition: StaticVector.h:205
const Type & ConstReference
Reference to a constant vector value.
Definition: StaticVector.h:193
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storea(T *address, const simd_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Storea.h:78
Type & Reference
Reference to a non-constant vector value.
Definition: StaticVector.h:192
Compile time integral round up operation.The NextMultiple class template rounds up the given template...
Definition: NextMultiple.h:81