DynamicVector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_
36 #define _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
48 #include <blaze/math/Forward.h>
49 #include <blaze/math/Functions.h>
50 #include <blaze/math/Intrinsics.h>
51 #include <blaze/math/shims/Clear.h>
68 #include <blaze/system/CacheSize.h>
69 #include <blaze/system/Inline.h>
71 #include <blaze/system/Restrict.h>
75 #include <blaze/util/Assert.h>
81 #include <blaze/util/DisableIf.h>
82 #include <blaze/util/EnableIf.h>
83 #include <blaze/util/Exception.h>
84 #include <blaze/util/Memory.h>
85 #include <blaze/util/Null.h>
86 #include <blaze/util/Template.h>
87 #include <blaze/util/Types.h>
92 
93 
94 namespace blaze {
95 
96 //=================================================================================================
97 //
98 // CLASS DEFINITION
99 //
100 //=================================================================================================
101 
102 //*************************************************************************************************
166 template< typename Type // Data type of the vector
167  , bool TF = defaultTransposeFlag > // Transpose flag
168 class DynamicVector : public DenseVector< DynamicVector<Type,TF>, TF >
169 {
170  private:
171  //**Type definitions****************************************************************************
173  //**********************************************************************************************
174 
175  public:
176  //**Type definitions****************************************************************************
178  typedef This ResultType;
180  typedef Type ElementType;
181  typedef typename IT::Type IntrinsicType;
182  typedef const Type& ReturnType;
183  typedef const DynamicVector& CompositeType;
184 
185  typedef Type& Reference;
186  typedef const Type& ConstReference;
187  typedef Type* Pointer;
188  typedef const Type* ConstPointer;
189 
192  //**********************************************************************************************
193 
194  //**Rebind struct definition********************************************************************
197  template< typename ET > // Data type of the other vector
198  struct Rebind {
200  };
201  //**********************************************************************************************
202 
203  //**Compilation flags***************************************************************************
205 
209  enum { vectorizable = IsVectorizable<Type>::value };
210 
212 
215  enum { smpAssignable = !IsSMPAssignable<Type>::value };
216  //**********************************************************************************************
217 
218  //**Constructors********************************************************************************
221  explicit inline DynamicVector();
222  explicit inline DynamicVector( size_t n );
223  explicit inline DynamicVector( size_t n, const Type& init );
224  template< typename Other > explicit inline DynamicVector( size_t n, const Other* array );
225 
226  template< typename Other, size_t N >
227  explicit inline DynamicVector( const Other (&array)[N] );
228 
229  inline DynamicVector( const DynamicVector& v );
230  template< typename VT > inline DynamicVector( const Vector<VT,TF>& v );
232  //**********************************************************************************************
233 
234  //**Destructor**********************************************************************************
237  inline ~DynamicVector();
239  //**********************************************************************************************
240 
241  //**Data access functions***********************************************************************
244  inline Reference operator[]( size_t index );
245  inline ConstReference operator[]( size_t index ) const;
246  inline Reference at( size_t index );
247  inline ConstReference at( size_t index ) const;
248  inline Pointer data ();
249  inline ConstPointer data () const;
250  inline Iterator begin ();
251  inline ConstIterator begin () const;
252  inline ConstIterator cbegin() const;
253  inline Iterator end ();
254  inline ConstIterator end () const;
255  inline ConstIterator cend () const;
257  //**********************************************************************************************
258 
259  //**Assignment operators************************************************************************
262  template< typename Other, size_t N >
263  inline DynamicVector& operator=( const Other (&array)[N] );
264 
265  inline DynamicVector& operator= ( const Type& rhs );
266  inline DynamicVector& operator= ( const DynamicVector& rhs );
267  template< typename VT > inline DynamicVector& operator= ( const Vector<VT,TF>& rhs );
268  template< typename VT > inline DynamicVector& operator+=( const Vector<VT,TF>& rhs );
269  template< typename VT > inline DynamicVector& operator-=( const Vector<VT,TF>& rhs );
270  template< typename VT > inline DynamicVector& operator*=( const Vector<VT,TF>& rhs );
271 
272  template< typename Other >
273  inline typename EnableIf< IsNumeric<Other>, DynamicVector >::Type&
274  operator*=( Other rhs );
275 
276  template< typename Other >
277  inline typename EnableIf< IsNumeric<Other>, DynamicVector >::Type&
278  operator/=( Other rhs );
280  //**********************************************************************************************
281 
282  //**Utility functions***************************************************************************
285  inline size_t size() const;
286  inline size_t capacity() const;
287  inline size_t nonZeros() const;
288  inline void reset();
289  inline void clear();
290  inline void resize( size_t n, bool preserve=true );
291  inline void extend( size_t n, bool preserve=true );
292  inline void reserve( size_t n );
293  template< typename Other > inline DynamicVector& scale( const Other& scalar );
294  inline void swap( DynamicVector& v ) /* throw() */;
296  //**********************************************************************************************
297 
298  private:
299  //**********************************************************************************************
301  template< typename VT >
303  struct VectorizedAssign {
304  enum { value = useOptimizedKernels &&
305  vectorizable && VT::vectorizable &&
306  IsSame<Type,typename VT::ElementType>::value };
307  };
309  //**********************************************************************************************
310 
311  //**********************************************************************************************
313  template< typename VT >
315  struct VectorizedAddAssign {
316  enum { value = useOptimizedKernels &&
317  vectorizable && VT::vectorizable &&
318  IsSame<Type,typename VT::ElementType>::value &&
319  IntrinsicTrait<Type>::addition };
320  };
322  //**********************************************************************************************
323 
324  //**********************************************************************************************
326  template< typename VT >
328  struct VectorizedSubAssign {
329  enum { value = useOptimizedKernels &&
330  vectorizable && VT::vectorizable &&
331  IsSame<Type,typename VT::ElementType>::value &&
332  IntrinsicTrait<Type>::subtraction };
333  };
335  //**********************************************************************************************
336 
337  //**********************************************************************************************
339  template< typename VT >
341  struct VectorizedMultAssign {
342  enum { value = useOptimizedKernels &&
343  vectorizable && VT::vectorizable &&
344  IsSame<Type,typename VT::ElementType>::value &&
345  IntrinsicTrait<Type>::multiplication };
346  };
348  //**********************************************************************************************
349 
350  public:
351  //**Expression template evaluation functions****************************************************
354  template< typename Other > inline bool canAlias ( const Other* alias ) const;
355  template< typename Other > inline bool isAliased( const Other* alias ) const;
356 
357  inline bool isAligned () const;
358  inline bool canSMPAssign() const;
359 
360  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
361  BLAZE_ALWAYS_INLINE IntrinsicType loada( size_t index ) const;
362  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
363 
364  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
365  BLAZE_ALWAYS_INLINE void storea( size_t index, const IntrinsicType& value );
366  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
367  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
368 
369  template< typename VT >
370  inline typename DisableIf< VectorizedAssign<VT> >::Type
371  assign( const DenseVector<VT,TF>& rhs );
372 
373  template< typename VT >
374  inline typename EnableIf< VectorizedAssign<VT> >::Type
375  assign( const DenseVector<VT,TF>& rhs );
376 
377  template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
378 
379  template< typename VT >
380  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
381  addAssign( const DenseVector<VT,TF>& rhs );
382 
383  template< typename VT >
384  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
385  addAssign( const DenseVector<VT,TF>& rhs );
386 
387  template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
388 
389  template< typename VT >
390  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
391  subAssign( const DenseVector<VT,TF>& rhs );
392 
393  template< typename VT >
394  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
395  subAssign( const DenseVector<VT,TF>& rhs );
396 
397  template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
398 
399  template< typename VT >
400  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
401  multAssign( const DenseVector<VT,TF>& rhs );
402 
403  template< typename VT >
404  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
405  multAssign( const DenseVector<VT,TF>& rhs );
406 
407  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
409  //**********************************************************************************************
410 
411  private:
412  //**Utility functions***************************************************************************
415  inline size_t adjustCapacity( size_t minCapacity ) const;
417  //**********************************************************************************************
418 
419  //**Member variables****************************************************************************
422  size_t size_;
423  size_t capacity_;
425 
431  //**********************************************************************************************
432 
433  //**Compile time checks*************************************************************************
440  //**********************************************************************************************
441 };
442 //*************************************************************************************************
443 
444 
445 
446 
447 //=================================================================================================
448 //
449 // CONSTRUCTORS
450 //
451 //=================================================================================================
452 
453 //*************************************************************************************************
456 template< typename Type // Data type of the vector
457  , bool TF > // Transpose flag
459  : size_ ( 0UL ) // The current size/dimension of the vector
460  , capacity_( 0UL ) // The maximum capacity of the vector
461  , v_ ( NULL ) // The vector elements
462 {}
463 //*************************************************************************************************
464 
465 
466 //*************************************************************************************************
474 template< typename Type // Data type of the vector
475  , bool TF > // Transpose flag
477  : size_ ( n ) // The current size/dimension of the vector
478  , capacity_( adjustCapacity( n ) ) // The maximum capacity of the vector
479  , v_ ( allocate<Type>( capacity_ ) ) // The vector elements
480 {
482  for( size_t i=size_; i<capacity_; ++i )
483  v_[i] = Type();
484  }
485 }
486 //*************************************************************************************************
487 
488 
489 //*************************************************************************************************
497 template< typename Type // Data type of the vector
498  , bool TF > // Transpose flag
499 inline DynamicVector<Type,TF>::DynamicVector( size_t n, const Type& init )
500  : size_ ( n ) // The current size/dimension of the vector
501  , capacity_( adjustCapacity( n ) ) // The maximum capacity of the vector
502  , v_ ( allocate<Type>( capacity_ ) ) // The vector elements
503 {
504  for( size_t i=0UL; i<size_; ++i )
505  v_[i] = init;
506 
508  for( size_t i=size_; i<capacity_; ++i )
509  v_[i] = Type();
510  }
511 }
512 //*************************************************************************************************
513 
514 
515 //*************************************************************************************************
535 template< typename Type // Data type of the vector
536  , bool TF > // Transpose flag
537 template< typename Other > // Data type of the initialization array
538 inline DynamicVector<Type,TF>::DynamicVector( size_t n, const Other* array )
539  : size_ ( n ) // The current size/dimension of the vector
540  , capacity_( adjustCapacity( n ) ) // The maximum capacity of the vector
541  , v_ ( allocate<Type>( capacity_ ) ) // The vector elements
542 {
543  for( size_t i=0UL; i<n; ++i )
544  v_[i] = array[i];
545 
547  for( size_t i=n; i<capacity_; ++i )
548  v_[i] = Type();
549  }
550 }
551 //*************************************************************************************************
552 
553 
554 //*************************************************************************************************
571 template< typename Type // Data type of the vector
572  , bool TF > // Transpose flag
573 template< typename Other // Data type of the initialization array
574  , size_t N > // Dimension of the initialization array
575 inline DynamicVector<Type,TF>::DynamicVector( const Other (&array)[N] )
576  : size_ ( N ) // The current size/dimension of the vector
577  , capacity_( adjustCapacity( N ) ) // The maximum capacity of the vector
578  , v_ ( allocate<Type>( capacity_ ) ) // The vector elements
579 {
580  for( size_t i=0UL; i<N; ++i )
581  v_[i] = array[i];
582 
584  for( size_t i=N; i<capacity_; ++i )
585  v_[i] = Type();
586  }
587 }
588 //*************************************************************************************************
589 
590 
591 //*************************************************************************************************
599 template< typename Type // Data type of the vector
600  , bool TF > // Transpose flag
602  : size_ ( v.size_ ) // The current size/dimension of the vector
603  , capacity_( adjustCapacity( v.size_ ) ) // The maximum capacity of the vector
604  , v_ ( allocate<Type>( capacity_ ) ) // The vector elements
605 {
606  BLAZE_INTERNAL_ASSERT( capacity_ <= v.capacity_, "Invalid capacity estimation" );
607 
608  for( size_t i=0UL; i<capacity_; ++i )
609  v_[i] = v.v_[i];
610 }
611 //*************************************************************************************************
612 
613 
614 //*************************************************************************************************
619 template< typename Type // Data type of the vector
620  , bool TF > // Transpose flag
621 template< typename VT > // Type of the foreign vector
623  : size_ ( (~v).size() ) // The current size/dimension of the vector
624  , capacity_( adjustCapacity( size_ ) ) // The maximum capacity of the vector
625  , v_ ( allocate<Type>( capacity_ ) ) // The vector elements
626 {
627  for( size_t i=( IsSparseVector<VT>::value ? 0UL : size_ );
628  i<( IsVectorizable<Type>::value ? capacity_ : size_ ); ++i ) {
629  v_[i] = Type();
630  }
631 
632  smpAssign( *this, ~v );
633 }
634 //*************************************************************************************************
635 
636 
637 
638 
639 //=================================================================================================
640 //
641 // DESTRUCTOR
642 //
643 //=================================================================================================
644 
645 //*************************************************************************************************
648 template< typename Type // Data type of the vector
649  , bool TF > // Transpose flag
651 {
652  deallocate( v_ );
653 }
654 //*************************************************************************************************
655 
656 
657 
658 
659 //=================================================================================================
660 //
661 // DATA ACCESS FUNCTIONS
662 //
663 //=================================================================================================
664 
665 //*************************************************************************************************
674 template< typename Type // Data type of the vector
675  , bool TF > // Transpose flag
676 inline typename DynamicVector<Type,TF>::Reference
678 {
679  BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
680  return v_[index];
681 }
682 //*************************************************************************************************
683 
684 
685 //*************************************************************************************************
694 template< typename Type // Data type of the vector
695  , bool TF > // Transpose flag
698 {
699  BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
700  return v_[index];
701 }
702 //*************************************************************************************************
703 
704 
705 //*************************************************************************************************
715 template< typename Type // Data type of the vector
716  , bool TF > // Transpose flag
717 inline typename DynamicVector<Type,TF>::Reference
719 {
720  if( index >= size_ ) {
721  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
722  }
723  return (*this)[index];
724 }
725 //*************************************************************************************************
726 
727 
728 //*************************************************************************************************
738 template< typename Type // Data type of the vector
739  , bool TF > // Transpose flag
741  DynamicVector<Type,TF>::at( size_t index ) const
742 {
743  if( index >= size_ ) {
744  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
745  }
746  return (*this)[index];
747 }
748 //*************************************************************************************************
749 
750 
751 //*************************************************************************************************
758 template< typename Type // Data type of the vector
759  , bool TF > // Transpose flag
761 {
762  return v_;
763 }
764 //*************************************************************************************************
765 
766 
767 //*************************************************************************************************
774 template< typename Type // Data type of the vector
775  , bool TF > // Transpose flag
777 {
778  return v_;
779 }
780 //*************************************************************************************************
781 
782 
783 //*************************************************************************************************
788 template< typename Type // Data type of the vector
789  , bool TF > // Transpose flag
791 {
792  return Iterator( v_ );
793 }
794 //*************************************************************************************************
795 
796 
797 //*************************************************************************************************
802 template< typename Type // Data type of the vector
803  , bool TF > // Transpose flag
805 {
806  return ConstIterator( v_ );
807 }
808 //*************************************************************************************************
809 
810 
811 //*************************************************************************************************
816 template< typename Type // Data type of the vector
817  , bool TF > // Transpose flag
819 {
820  return ConstIterator( v_ );
821 }
822 //*************************************************************************************************
823 
824 
825 //*************************************************************************************************
830 template< typename Type // Data type of the vector
831  , bool TF > // Transpose flag
833 {
834  return Iterator( v_ + size_ );
835 }
836 //*************************************************************************************************
837 
838 
839 //*************************************************************************************************
844 template< typename Type // Data type of the vector
845  , bool TF > // Transpose flag
847 {
848  return ConstIterator( v_ + size_ );
849 }
850 //*************************************************************************************************
851 
852 
853 //*************************************************************************************************
858 template< typename Type // Data type of the vector
859  , bool TF > // Transpose flag
861 {
862  return ConstIterator( v_ + size_ );
863 }
864 //*************************************************************************************************
865 
866 
867 
868 
869 //=================================================================================================
870 //
871 // ASSIGNMENT OPERATORS
872 //
873 //=================================================================================================
874 
875 //*************************************************************************************************
893 template< typename Type // Data type of the vector
894  , bool TF > // Transpose flag
895 template< typename Other // Data type of the initialization array
896  , size_t N > // Dimension of the initialization array
898 {
899  resize( N, false );
900 
901  for( size_t i=0UL; i<N; ++i )
902  v_[i] = array[i];
903 
904  return *this;
905 }
906 //*************************************************************************************************
907 
908 
909 //*************************************************************************************************
915 template< typename Type // Data type of the vector
916  , bool TF > // Transpose flag
918 {
919  for( size_t i=0UL; i<size_; ++i )
920  v_[i] = rhs;
921  return *this;
922 }
923 //*************************************************************************************************
924 
925 
926 //*************************************************************************************************
935 template< typename Type // Data type of the vector
936  , bool TF > // Transpose flag
938 {
939  if( &rhs == this ) return *this;
940 
941  resize( rhs.size_, false );
942  smpAssign( *this, ~rhs );
943 
944  return *this;
945 }
946 //*************************************************************************************************
947 
948 
949 //*************************************************************************************************
957 template< typename Type // Data type of the vector
958  , bool TF > // Transpose flag
959 template< typename VT > // Type of the right-hand side vector
961 {
962  if( (~rhs).canAlias( this ) ) {
963  DynamicVector tmp( ~rhs );
964  swap( tmp );
965  }
966  else {
967  resize( (~rhs).size(), false );
969  reset();
970  smpAssign( *this, ~rhs );
971  }
972 
973  return *this;
974 }
975 //*************************************************************************************************
976 
977 
978 //*************************************************************************************************
988 template< typename Type // Data type of the vector
989  , bool TF > // Transpose flag
990 template< typename VT > // Type of the right-hand side vector
992 {
993  if( (~rhs).size() != size_ ) {
994  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
995  }
996 
997  if( (~rhs).canAlias( this ) ) {
998  typename VT::ResultType tmp( ~rhs );
999  smpAddAssign( *this, tmp );
1000  }
1001  else {
1002  smpAddAssign( *this, ~rhs );
1003  }
1004 
1005  return *this;
1006 }
1007 //*************************************************************************************************
1008 
1009 
1010 //*************************************************************************************************
1021 template< typename Type // Data type of the vector
1022  , bool TF > // Transpose flag
1023 template< typename VT > // Type of the right-hand side vector
1025 {
1026  if( (~rhs).size() != size_ ) {
1027  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1028  }
1029 
1030  if( (~rhs).canAlias( this ) ) {
1031  typename VT::ResultType tmp( ~rhs );
1032  smpSubAssign( *this, tmp );
1033  }
1034  else {
1035  smpSubAssign( *this, ~rhs );
1036  }
1037 
1038  return *this;
1039 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1054 template< typename Type // Data type of the vector
1055  , bool TF > // Transpose flag
1056 template< typename VT > // Type of the right-hand side vector
1058 {
1059  if( (~rhs).size() != size_ ) {
1060  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1061  }
1062 
1063  if( IsSparseVector<VT>::value || (~rhs).canAlias( this ) ) {
1064  DynamicVector<Type,TF> tmp( *this * (~rhs) );
1065  swap( tmp );
1066  }
1067  else {
1068  smpMultAssign( *this, ~rhs );
1069  }
1070 
1071  return *this;
1072 }
1073 //*************************************************************************************************
1074 
1075 
1076 //*************************************************************************************************
1083 template< typename Type // Data type of the vector
1084  , bool TF > // Transpose flag
1085 template< typename Other > // Data type of the right-hand side scalar
1086 inline typename EnableIf< IsNumeric<Other>, DynamicVector<Type,TF> >::Type&
1088 {
1089  smpAssign( *this, (*this) * rhs );
1090  return *this;
1091 }
1092 //*************************************************************************************************
1093 
1094 
1095 //*************************************************************************************************
1104 template< typename Type // Data type of the vector
1105  , bool TF > // Transpose flag
1106 template< typename Other > // Data type of the right-hand side scalar
1107 inline typename EnableIf< IsNumeric<Other>, DynamicVector<Type,TF> >::Type&
1109 {
1110  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1111 
1112  smpAssign( *this, (*this) / rhs );
1113  return *this;
1114 }
1115 //*************************************************************************************************
1116 
1117 
1118 
1119 
1120 //=================================================================================================
1121 //
1122 // UTILITY FUNCTIONS
1123 //
1124 //=================================================================================================
1125 
1126 //*************************************************************************************************
1131 template< typename Type // Data type of the vector
1132  , bool TF > // Transpose flag
1133 inline size_t DynamicVector<Type,TF>::size() const
1134 {
1135  return size_;
1136 }
1137 //*************************************************************************************************
1138 
1139 
1140 //*************************************************************************************************
1145 template< typename Type // Data type of the vector
1146  , bool TF > // Transpose flag
1148 {
1149  return capacity_;
1150 }
1151 //*************************************************************************************************
1152 
1153 
1154 //*************************************************************************************************
1162 template< typename Type // Data type of the vector
1163  , bool TF > // Transpose flag
1165 {
1166  size_t nonzeros( 0 );
1167 
1168  for( size_t i=0UL; i<size_; ++i ) {
1169  if( !isDefault( v_[i] ) )
1170  ++nonzeros;
1171  }
1172 
1173  return nonzeros;
1174 }
1175 //*************************************************************************************************
1176 
1177 
1178 //*************************************************************************************************
1183 template< typename Type // Data type of the vector
1184  , bool TF > // Transpose flag
1186 {
1187  using blaze::clear;
1188  for( size_t i=0UL; i<size_; ++i )
1189  clear( v_[i] );
1190 }
1191 //*************************************************************************************************
1192 
1193 
1194 //*************************************************************************************************
1201 template< typename Type // Data type of the vector
1202  , bool TF > // Transpose flag
1204 {
1205  resize( 0UL, false );
1206 }
1207 //*************************************************************************************************
1208 
1209 
1210 //*************************************************************************************************
1239 template< typename Type // Data type of the vector
1240  , bool TF > // Transpose flag
1241 inline void DynamicVector<Type,TF>::resize( size_t n, bool preserve )
1242 {
1243  if( n > capacity_ )
1244  {
1245  // Allocating a new array
1246  const size_t newCapacity( adjustCapacity( n ) );
1247  Type* BLAZE_RESTRICT tmp = allocate<Type>( newCapacity );
1248 
1249  // Initializing the new array
1250  if( preserve ) {
1251  std::copy( v_, v_+size_, tmp );
1252  }
1253 
1255  for( size_t i=size_; i<newCapacity; ++i )
1256  tmp[i] = Type();
1257  }
1258 
1259  // Replacing the old array
1260  std::swap( v_, tmp );
1261  deallocate( tmp );
1262  capacity_ = newCapacity;
1263  }
1264  else if( IsVectorizable<Type>::value && n < size_ )
1265  {
1266  for( size_t i=n; i<size_; ++i )
1267  v_[i] = Type();
1268  }
1269 
1270  size_ = n;
1271 }
1272 //*************************************************************************************************
1273 
1274 
1275 //*************************************************************************************************
1287 template< typename Type // Data type of the vector
1288  , bool TF > // Transpose flag
1289 inline void DynamicVector<Type,TF>::extend( size_t n, bool preserve )
1290 {
1291  resize( size_+n, preserve );
1292 }
1293 //*************************************************************************************************
1294 
1295 
1296 //*************************************************************************************************
1305 template< typename Type // Data type of the vector
1306  , bool TF > // Transpose flag
1307 inline void DynamicVector<Type,TF>::reserve( size_t n )
1308 {
1309  if( n > capacity_ )
1310  {
1311  // Allocating a new array
1312  const size_t newCapacity( adjustCapacity( n ) );
1313  Type* BLAZE_RESTRICT tmp = allocate<Type>( newCapacity );
1314 
1315  // Initializing the new array
1316  std::copy( v_, v_+size_, tmp );
1317 
1319  for( size_t i=size_; i<newCapacity; ++i )
1320  tmp[i] = Type();
1321  }
1322 
1323  // Replacing the old array
1324  std::swap( tmp, v_ );
1325  deallocate( tmp );
1326  capacity_ = newCapacity;
1327  }
1328 }
1329 //*************************************************************************************************
1330 
1331 
1332 //*************************************************************************************************
1338 template< typename Type // Data type of the vector
1339  , bool TF > // Transpose flag
1340 template< typename Other > // Data type of the scalar value
1342 {
1343  for( size_t i=0UL; i<size_; ++i )
1344  v_[i] *= scalar;
1345  return *this;
1346 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1357 template< typename Type // Data type of the vector
1358  , bool TF > // Transpose flag
1359 inline void DynamicVector<Type,TF>::swap( DynamicVector& v ) /* throw() */
1360 {
1361  std::swap( size_, v.size_ );
1363  std::swap( v_, v.v_ );
1364 }
1365 //*************************************************************************************************
1366 
1367 
1368 //*************************************************************************************************
1374 template< typename Type // Data type of the vector
1375  , bool TF > // Transpose flag
1376 inline size_t DynamicVector<Type,TF>::adjustCapacity( size_t minCapacity ) const
1377 {
1379  return nextMultiple<size_t>( minCapacity, IT::size );
1380  else return minCapacity;
1381 }
1382 //*************************************************************************************************
1383 
1384 
1385 
1386 
1387 //=================================================================================================
1388 //
1389 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1390 //
1391 //=================================================================================================
1392 
1393 //*************************************************************************************************
1403 template< typename Type // Data type of the vector
1404  , bool TF > // Transpose flag
1405 template< typename Other > // Data type of the foreign expression
1406 inline bool DynamicVector<Type,TF>::canAlias( const Other* alias ) const
1407 {
1408  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1409 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1423 template< typename Type // Data type of the vector
1424  , bool TF > // Transpose flag
1425 template< typename Other > // Data type of the foreign expression
1426 inline bool DynamicVector<Type,TF>::isAliased( const Other* alias ) const
1427 {
1428  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1429 }
1430 //*************************************************************************************************
1431 
1432 
1433 //*************************************************************************************************
1442 template< typename Type // Data type of the vector
1443  , bool TF > // Transpose flag
1445 {
1446  return true;
1447 }
1448 //*************************************************************************************************
1449 
1450 
1451 //*************************************************************************************************
1461 template< typename Type // Data type of the vector
1462  , bool TF > // Transpose flag
1464 {
1465  return ( size() > SMP_DVECASSIGN_THRESHOLD );
1466 }
1467 //*************************************************************************************************
1468 
1469 
1470 //*************************************************************************************************
1483 template< typename Type // Data type of the vector
1484  , bool TF > // Transpose flag
1486  DynamicVector<Type,TF>::load( size_t index ) const
1487 {
1488  return loada( index );
1489 }
1490 //*************************************************************************************************
1491 
1492 
1493 //*************************************************************************************************
1506 template< typename Type // Data type of the vector
1507  , bool TF > // Transpose flag
1509  DynamicVector<Type,TF>::loada( size_t index ) const
1510 {
1511  using blaze::loada;
1512 
1514 
1515  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1516  BLAZE_INTERNAL_ASSERT( index + IT::size <= capacity_, "Invalid vector access index" );
1517  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1518  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+index ), "Invalid alignment detected" );
1519 
1520  return loada( v_+index );
1521 }
1522 //*************************************************************************************************
1523 
1524 
1525 //*************************************************************************************************
1538 template< typename Type // Data type of the vector
1539  , bool TF > // Transpose flag
1541  DynamicVector<Type,TF>::loadu( size_t index ) const
1542 {
1543  using blaze::loadu;
1544 
1546 
1547  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1548  BLAZE_INTERNAL_ASSERT( index + IT::size <= capacity_, "Invalid vector access index" );
1549 
1550  return loadu( v_+index );
1551 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1569 template< typename Type // Data type of the vector
1570  , bool TF > // Transpose flag
1571 BLAZE_ALWAYS_INLINE void DynamicVector<Type,TF>::store( size_t index, const IntrinsicType& value )
1572 {
1573  storea( index, value );
1574 }
1575 //*************************************************************************************************
1576 
1577 
1578 //*************************************************************************************************
1592 template< typename Type // Data type of the vector
1593  , bool TF > // Transpose flag
1594 BLAZE_ALWAYS_INLINE void DynamicVector<Type,TF>::storea( size_t index, const IntrinsicType& value )
1595 {
1596  using blaze::storea;
1597 
1599 
1600  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1601  BLAZE_INTERNAL_ASSERT( index + IT::size <= capacity_, "Invalid vector access index" );
1602  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1603  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+index ), "Invalid alignment detected" );
1604 
1605  storea( v_+index, value );
1606 }
1607 //*************************************************************************************************
1608 
1609 
1610 //*************************************************************************************************
1624 template< typename Type // Data type of the vector
1625  , bool TF > // Transpose flag
1626 BLAZE_ALWAYS_INLINE void DynamicVector<Type,TF>::storeu( size_t index, const IntrinsicType& value )
1627 {
1628  using blaze::storeu;
1629 
1631 
1632  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1633  BLAZE_INTERNAL_ASSERT( index + IT::size <= capacity_, "Invalid vector access index" );
1634 
1635  storeu( v_+index, value );
1636 }
1637 //*************************************************************************************************
1638 
1639 
1640 //*************************************************************************************************
1654 template< typename Type // Data type of the vector
1655  , bool TF > // Transpose flag
1656 BLAZE_ALWAYS_INLINE void DynamicVector<Type,TF>::stream( size_t index, const IntrinsicType& value )
1657 {
1658  using blaze::stream;
1659 
1661 
1662  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1663  BLAZE_INTERNAL_ASSERT( index + IT::size <= capacity_, "Invalid vector access index" );
1664  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1665  BLAZE_INTERNAL_ASSERT( checkAlignment( v_+index ), "Invalid alignment detected" );
1666 
1667  stream( v_+index, value );
1668 }
1669 //*************************************************************************************************
1670 
1671 
1672 //*************************************************************************************************
1683 template< typename Type // Data type of the vector
1684  , bool TF > // Transpose flag
1685 template< typename VT > // Type of the right-hand side dense vector
1686 inline typename DisableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1688 {
1689  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1690 
1691  const size_t ipos( size_ & size_t(-2) );
1692  BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % 2UL ) ) == ipos, "Invalid end calculation" );
1693 
1694  for( size_t i=0UL; i<ipos; i+=2UL ) {
1695  v_[i ] = (~rhs)[i ];
1696  v_[i+1UL] = (~rhs)[i+1UL];
1697  }
1698  if( ipos < (~rhs).size() )
1699  v_[ipos] = (~rhs)[ipos];
1700 }
1701 //*************************************************************************************************
1702 
1703 
1704 //*************************************************************************************************
1715 template< typename Type // Data type of the vector
1716  , bool TF > // Transpose flag
1717 template< typename VT > // Type of the right-hand side dense vector
1718 inline typename EnableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1720 {
1722 
1723  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1724 
1725  const bool remainder( !usePadding || !IsPadded<VT>::value );
1726 
1727  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
1728  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
1729 
1730  if( useStreaming && size_ > ( cacheSize/( sizeof(Type) * 3UL ) ) && !(~rhs).isAliased( this ) )
1731  {
1732  size_t i=0UL;
1733 
1734  for( ; i<ipos; i+=IT::size ) {
1735  stream( i, (~rhs).load(i) );
1736  }
1737  for( ; remainder && i<size_; ++i ) {
1738  v_[i] = (~rhs)[i];
1739  }
1740  }
1741  else
1742  {
1743  size_t i( 0UL );
1744  typename VT::ConstIterator it( (~rhs).begin() );
1745 
1746  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
1747  store( i , it.load() ); it += IT::size;
1748  store( i+IT::size , it.load() ); it += IT::size;
1749  store( i+IT::size*2UL, it.load() ); it += IT::size;
1750  store( i+IT::size*3UL, it.load() ); it += IT::size;
1751  }
1752  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
1753  store( i, it.load() );
1754  }
1755  for( ; remainder && i<size_; ++i, ++it ) {
1756  v_[i] = *it;
1757  }
1758  }
1759 }
1760 //*************************************************************************************************
1761 
1762 
1763 //*************************************************************************************************
1774 template< typename Type // Data type of the vector
1775  , bool TF > // Transpose flag
1776 template< typename VT > // Type of the right-hand side sparse vector
1778 {
1779  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1780 
1781  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1782  v_[element->index()] = element->value();
1783 }
1784 //*************************************************************************************************
1785 
1786 
1787 //*************************************************************************************************
1798 template< typename Type // Data type of the vector
1799  , bool TF > // Transpose flag
1800 template< typename VT > // Type of the right-hand side dense vector
1801 inline typename DisableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1803 {
1804  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1805 
1806  const size_t ipos( size_ & size_t(-2) );
1807  BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % 2UL ) ) == ipos, "Invalid end calculation" );
1808 
1809  for( size_t i=0UL; i<ipos; i+=2UL ) {
1810  v_[i ] += (~rhs)[i ];
1811  v_[i+1UL] += (~rhs)[i+1UL];
1812  }
1813  if( ipos < (~rhs).size() )
1814  v_[ipos] += (~rhs)[ipos];
1815 }
1816 //*************************************************************************************************
1817 
1818 
1819 //*************************************************************************************************
1830 template< typename Type // Data type of the vector
1831  , bool TF > // Transpose flag
1832 template< typename VT > // Type of the right-hand side dense vector
1833 inline typename EnableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1835 {
1837 
1838  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1839 
1840  const bool remainder( !usePadding || !IsPadded<VT>::value );
1841 
1842  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
1843  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
1844 
1845  size_t i( 0UL );
1846  typename VT::ConstIterator it( (~rhs).begin() );
1847 
1848  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
1849  store( i , load(i ) + it.load() ); it += IT::size;
1850  store( i+IT::size , load(i+IT::size ) + it.load() ); it += IT::size;
1851  store( i+IT::size*2UL, load(i+IT::size*2UL) + it.load() ); it += IT::size;
1852  store( i+IT::size*3UL, load(i+IT::size*3UL) + it.load() ); it += IT::size;
1853  }
1854  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
1855  store( i, load(i) + it.load() );
1856  }
1857  for( ; remainder && i<size_; ++i, ++it ) {
1858  v_[i] += *it;
1859  }
1860 }
1861 //*************************************************************************************************
1862 
1863 
1864 //*************************************************************************************************
1875 template< typename Type // Data type of the vector
1876  , bool TF > // Transpose flag
1877 template< typename VT > // Type of the right-hand side sparse vector
1879 {
1880  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1881 
1882  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1883  v_[element->index()] += element->value();
1884 }
1885 //*************************************************************************************************
1886 
1887 
1888 //*************************************************************************************************
1899 template< typename Type // Data type of the vector
1900  , bool TF > // Transpose flag
1901 template< typename VT > // Type of the right-hand side dense vector
1902 inline typename DisableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1904 {
1905  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1906 
1907  const size_t ipos( size_ & size_t(-2) );
1908  BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % 2UL ) ) == ipos, "Invalid end calculation" );
1909 
1910  for( size_t i=0UL; i<ipos; i+=2UL ) {
1911  v_[i ] -= (~rhs)[i ];
1912  v_[i+1UL] -= (~rhs)[i+1UL];
1913  }
1914  if( ipos < (~rhs).size() )
1915  v_[ipos] -= (~rhs)[ipos];
1916 }
1917 //*************************************************************************************************
1918 
1919 
1920 //*************************************************************************************************
1931 template< typename Type // Data type of the vector
1932  , bool TF > // Transpose flag
1933 template< typename VT > // Type of the right-hand side dense vector
1934 inline typename EnableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
1936 {
1938 
1939  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1940 
1941  const bool remainder( !usePadding || !IsPadded<VT>::value );
1942 
1943  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
1944  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
1945 
1946  size_t i( 0UL );
1947  typename VT::ConstIterator it( (~rhs).begin() );
1948 
1949  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
1950  store( i , load(i ) - it.load() ); it += IT::size;
1951  store( i+IT::size , load(i+IT::size ) - it.load() ); it += IT::size;
1952  store( i+IT::size*2UL, load(i+IT::size*2UL) - it.load() ); it += IT::size;
1953  store( i+IT::size*3UL, load(i+IT::size*3UL) - it.load() ); it += IT::size;
1954  }
1955  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
1956  store( i, load(i) - it.load() );
1957  }
1958  for( ; remainder && i<size_; ++i, ++it ) {
1959  v_[i] -= *it;
1960  }
1961 }
1962 //*************************************************************************************************
1963 
1964 
1965 //*************************************************************************************************
1976 template< typename Type // Data type of the vector
1977  , bool TF > // Transpose flag
1978 template< typename VT > // Type of the right-hand side sparse vector
1980 {
1981  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
1982 
1983  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1984  v_[element->index()] -= element->value();
1985 }
1986 //*************************************************************************************************
1987 
1988 
1989 //*************************************************************************************************
2000 template< typename Type // Data type of the vector
2001  , bool TF > // Transpose flag
2002 template< typename VT > // Type of the right-hand side dense vector
2003 inline typename DisableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2005 {
2006  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
2007 
2008  const size_t ipos( size_ & size_t(-2) );
2009  BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % 2UL ) ) == ipos, "Invalid end calculation" );
2010 
2011  for( size_t i=0UL; i<ipos; i+=2UL ) {
2012  v_[i ] *= (~rhs)[i ];
2013  v_[i+1UL] *= (~rhs)[i+1UL];
2014  }
2015  if( ipos < (~rhs).size() )
2016  v_[ipos] *= (~rhs)[ipos];
2017 }
2018 //*************************************************************************************************
2019 
2020 
2021 //*************************************************************************************************
2032 template< typename Type // Data type of the vector
2033  , bool TF > // Transpose flag
2034 template< typename VT > // Type of the right-hand side dense vector
2035 inline typename EnableIf< typename DynamicVector<Type,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2037 {
2039 
2040  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
2041 
2042  const bool remainder( !usePadding || !IsPadded<VT>::value );
2043 
2044  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
2045  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
2046 
2047  size_t i( 0UL );
2048  typename VT::ConstIterator it( (~rhs).begin() );
2049 
2050  for( ; (i+IT::size*3UL) < ipos; i+=IT::size*4UL ) {
2051  store( i , load(i ) * it.load() ); it += IT::size;
2052  store( i+IT::size , load(i+IT::size ) * it.load() ); it += IT::size;
2053  store( i+IT::size*2UL, load(i+IT::size*2UL) * it.load() ); it += IT::size;
2054  store( i+IT::size*3UL, load(i+IT::size*3UL) * it.load() ); it += IT::size;
2055  }
2056  for( ; i<ipos; i+=IT::size, it+=IT::size ) {
2057  store( i, load(i) * it.load() );
2058  }
2059  for( ; remainder && i<size_; ++i, ++it ) {
2060  v_[i] *= *it;
2061  }
2062 }
2063 //*************************************************************************************************
2064 
2065 
2066 //*************************************************************************************************
2077 template< typename Type // Data type of the vector
2078  , bool TF > // Transpose flag
2079 template< typename VT > // Type of the right-hand side sparse vector
2081 {
2082  BLAZE_INTERNAL_ASSERT( size_ == (~rhs).size(), "Invalid vector sizes" );
2083 
2084  const DynamicVector tmp( serial( *this ) );
2085 
2086  reset();
2087 
2088  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2089  v_[element->index()] = tmp[element->index()] * element->value();
2090 }
2091 //*************************************************************************************************
2092 
2093 
2094 
2095 
2096 //=================================================================================================
2097 //
2098 // DYNAMICVECTOR OPERATORS
2099 //
2100 //=================================================================================================
2101 
2102 //*************************************************************************************************
2105 template< typename Type, bool TF >
2106 inline void reset( DynamicVector<Type,TF>& v );
2107 
2108 template< typename Type, bool TF >
2109 inline void clear( DynamicVector<Type,TF>& v );
2110 
2111 template< typename Type, bool TF >
2112 inline bool isDefault( const DynamicVector<Type,TF>& v );
2113 
2114 template< typename Type, bool TF >
2115 inline bool isIntact( const DynamicVector<Type,TF>& v );
2116 
2117 template< typename Type, bool TF >
2118 inline void swap( DynamicVector<Type,TF>& a, DynamicVector<Type,TF>& b ) /* throw() */;
2119 
2120 template< typename Type, bool TF >
2121 inline void move( DynamicVector<Type,TF>& dst, DynamicVector<Type,TF>& src ) /* throw() */;
2123 //*************************************************************************************************
2124 
2125 
2126 //*************************************************************************************************
2133 template< typename Type // Data type of the vector
2134  , bool TF > // Transpose flag
2136 {
2137  v.reset();
2138 }
2139 //*************************************************************************************************
2140 
2141 
2142 //*************************************************************************************************
2149 template< typename Type // Data type of the vector
2150  , bool TF > // Transpose flag
2152 {
2153  v.clear();
2154 }
2155 //*************************************************************************************************
2156 
2157 
2158 //*************************************************************************************************
2175 template< typename Type // Data type of the vector
2176  , bool TF > // Transpose flag
2177 inline bool isDefault( const DynamicVector<Type,TF>& v )
2178 {
2179  return ( v.size() == 0UL );
2180 }
2181 //*************************************************************************************************
2182 
2183 
2184 //*************************************************************************************************
2202 template< typename Type // Data type of the vector
2203  , bool TF > // Transpose flag
2204 inline bool isIntact( const DynamicVector<Type,TF>& v )
2205 {
2206  return ( v.size() <= v.capacity() );
2207 }
2208 //*************************************************************************************************
2209 
2210 
2211 //*************************************************************************************************
2220 template< typename Type // Data type of the vector
2221  , bool TF > // Transpose flag
2222 inline void swap( DynamicVector<Type,TF>& a, DynamicVector<Type,TF>& b ) /* throw() */
2223 {
2224  a.swap( b );
2225 }
2226 //*************************************************************************************************
2227 
2228 
2229 //*************************************************************************************************
2238 template< typename Type // Data type of the vector
2239  , bool TF > // Transpose flag
2240 inline void move( DynamicVector<Type,TF>& dst, DynamicVector<Type,TF>& src ) /* throw() */
2241 {
2242  dst.swap( src );
2243 }
2244 //*************************************************************************************************
2245 
2246 
2247 
2248 
2249 //=================================================================================================
2250 //
2251 // HASCONSTDATAACCESS SPECIALIZATIONS
2252 //
2253 //=================================================================================================
2254 
2255 //*************************************************************************************************
2257 template< typename T, bool TF >
2258 struct HasConstDataAccess< DynamicVector<T,TF> > : public IsTrue<true>
2259 {};
2261 //*************************************************************************************************
2262 
2263 
2264 
2265 
2266 //=================================================================================================
2267 //
2268 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2269 //
2270 //=================================================================================================
2271 
2272 //*************************************************************************************************
2274 template< typename T, bool TF >
2275 struct HasMutableDataAccess< DynamicVector<T,TF> > : public IsTrue<true>
2276 {};
2278 //*************************************************************************************************
2279 
2280 
2281 
2282 
2283 //=================================================================================================
2284 //
2285 // ISALIGNED SPECIALIZATIONS
2286 //
2287 //=================================================================================================
2288 
2289 //*************************************************************************************************
2291 template< typename T, bool TF >
2292 struct IsAligned< DynamicVector<T,TF> > : public IsTrue<true>
2293 {};
2295 //*************************************************************************************************
2296 
2297 
2298 
2299 
2300 //=================================================================================================
2301 //
2302 // ISPADDED SPECIALIZATIONS
2303 //
2304 //=================================================================================================
2305 
2306 //*************************************************************************************************
2308 template< typename T, bool TF >
2309 struct IsPadded< DynamicVector<T,TF> > : public IsTrue<usePadding>
2310 {};
2312 //*************************************************************************************************
2313 
2314 
2315 
2316 
2317 //=================================================================================================
2318 //
2319 // ISRESIZABLE SPECIALIZATIONS
2320 //
2321 //=================================================================================================
2322 
2323 //*************************************************************************************************
2325 template< typename T, bool TF >
2326 struct IsResizable< DynamicVector<T,TF> > : public IsTrue<true>
2327 {};
2329 //*************************************************************************************************
2330 
2331 
2332 
2333 
2334 //=================================================================================================
2335 //
2336 // ADDTRAIT SPECIALIZATIONS
2337 //
2338 //=================================================================================================
2339 
2340 //*************************************************************************************************
2342 template< typename T1, bool TF, typename T2, size_t N >
2343 struct AddTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2344 {
2345  typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2346 };
2347 
2348 template< typename T1, size_t N, bool TF, typename T2 >
2349 struct AddTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2350 {
2351  typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2352 };
2353 
2354 template< typename T1, bool TF, typename T2, size_t N >
2355 struct AddTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2356 {
2357  typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2358 };
2359 
2360 template< typename T1, size_t N, bool TF, typename T2 >
2361 struct AddTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2362 {
2363  typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2364 };
2365 
2366 template< typename T1, bool TF, typename T2 >
2367 struct AddTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2368 {
2369  typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
2370 };
2372 //*************************************************************************************************
2373 
2374 
2375 
2376 
2377 //=================================================================================================
2378 //
2379 // SUBTRAIT SPECIALIZATIONS
2380 //
2381 //=================================================================================================
2382 
2383 //*************************************************************************************************
2385 template< typename T1, bool TF, typename T2, size_t N >
2386 struct SubTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2387 {
2388  typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2389 };
2390 
2391 template< typename T1, size_t N, bool TF, typename T2 >
2392 struct SubTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2393 {
2394  typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2395 };
2396 
2397 template< typename T1, bool TF, typename T2, size_t N >
2398 struct SubTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2399 {
2400  typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2401 };
2402 
2403 template< typename T1, size_t N, bool TF, typename T2 >
2404 struct SubTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2405 {
2406  typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2407 };
2408 
2409 template< typename T1, bool TF, typename T2 >
2410 struct SubTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2411 {
2412  typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
2413 };
2415 //*************************************************************************************************
2416 
2417 
2418 
2419 
2420 //=================================================================================================
2421 //
2422 // MULTTRAIT SPECIALIZATIONS
2423 //
2424 //=================================================================================================
2425 
2426 //*************************************************************************************************
2428 template< typename T1, bool TF, typename T2 >
2429 struct MultTrait< DynamicVector<T1,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2430 {
2431  typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
2432 };
2433 
2434 template< typename T1, typename T2, bool TF >
2435 struct MultTrait< T1, DynamicVector<T2,TF>, typename EnableIf< IsNumeric<T1> >::Type >
2436 {
2437  typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
2438 };
2439 
2440 template< typename T1, bool TF, typename T2, size_t N >
2441 struct MultTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2442 {
2443  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2444 };
2445 
2446 template< typename T1, typename T2, size_t N >
2447 struct MultTrait< DynamicVector<T1,false>, StaticVector<T2,N,true> >
2448 {
2449  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2450 };
2451 
2452 template< typename T1, typename T2, size_t N >
2453 struct MultTrait< DynamicVector<T1,true>, StaticVector<T2,N,false> >
2454 {
2455  typedef typename MultTrait<T1,T2>::Type Type;
2456 };
2457 
2458 template< typename T1, size_t N, bool TF, typename T2 >
2459 struct MultTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2460 {
2461  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2462 };
2463 
2464 template< typename T1, size_t N, typename T2 >
2465 struct MultTrait< StaticVector<T1,N,false>, DynamicVector<T2,true> >
2466 {
2467  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2468 };
2469 
2470 template< typename T1, size_t N, typename T2 >
2471 struct MultTrait< StaticVector<T1,N,true>, DynamicVector<T2,false> >
2472 {
2473  typedef typename MultTrait<T1,T2>::Type Type;
2474 };
2475 
2476 template< typename T1, bool TF, typename T2, size_t N >
2477 struct MultTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2478 {
2479  typedef HybridVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2480 };
2481 
2482 template< typename T1, typename T2, size_t N >
2483 struct MultTrait< DynamicVector<T1,false>, HybridVector<T2,N,true> >
2484 {
2485  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2486 };
2487 
2488 template< typename T1, typename T2, size_t N >
2489 struct MultTrait< DynamicVector<T1,true>, HybridVector<T2,N,false> >
2490 {
2491  typedef typename MultTrait<T1,T2>::Type Type;
2492 };
2493 
2494 template< typename T1, size_t N, bool TF, typename T2 >
2495 struct MultTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2496 {
2497  typedef HybridVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2498 };
2499 
2500 template< typename T1, size_t N, typename T2 >
2501 struct MultTrait< HybridVector<T1,N,false>, DynamicVector<T2,true> >
2502 {
2503  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2504 };
2505 
2506 template< typename T1, size_t N, typename T2 >
2507 struct MultTrait< HybridVector<T1,N,true>, DynamicVector<T2,false> >
2508 {
2509  typedef typename MultTrait<T1,T2>::Type Type;
2510 };
2511 
2512 template< typename T1, bool TF, typename T2 >
2513 struct MultTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2514 {
2515  typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
2516 };
2517 
2518 template< typename T1, typename T2 >
2519 struct MultTrait< DynamicVector<T1,false>, DynamicVector<T2,true> >
2520 {
2521  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2522 };
2523 
2524 template< typename T1, typename T2 >
2525 struct MultTrait< DynamicVector<T1,true>, DynamicVector<T2,false> >
2526 {
2527  typedef typename MultTrait<T1,T2>::Type Type;
2528 };
2530 //*************************************************************************************************
2531 
2532 
2533 
2534 
2535 //=================================================================================================
2536 //
2537 // CROSSTRAIT SPECIALIZATIONS
2538 //
2539 //=================================================================================================
2540 
2541 //*************************************************************************************************
2543 template< typename T1, typename T2 >
2544 struct CrossTrait< DynamicVector<T1,false>, StaticVector<T2,3UL,false> >
2545 {
2546  private:
2547  typedef typename MultTrait<T1,T2>::Type T;
2548 
2549  public:
2550  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2551 };
2552 
2553 template< typename T1, typename T2 >
2554 struct CrossTrait< StaticVector<T1,3UL,false>, DynamicVector<T2,false> >
2555 {
2556  private:
2557  typedef typename MultTrait<T1,T2>::Type T;
2558 
2559  public:
2560  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2561 };
2562 
2563 template< typename T1, typename T2, size_t N >
2564 struct CrossTrait< DynamicVector<T1,false>, HybridVector<T2,N,false> >
2565 {
2566  private:
2567  typedef typename MultTrait<T1,T2>::Type T;
2568 
2569  public:
2570  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2571 };
2572 
2573 template< typename T1, size_t N, typename T2 >
2574 struct CrossTrait< HybridVector<T1,N,false>, DynamicVector<T2,false> >
2575 {
2576  private:
2577  typedef typename MultTrait<T1,T2>::Type T;
2578 
2579  public:
2580  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2581 };
2582 
2583 template< typename T1, typename T2 >
2584 struct CrossTrait< DynamicVector<T1,false>, DynamicVector<T2,false> >
2585 {
2586  private:
2587  typedef typename MultTrait<T1,T2>::Type T;
2588 
2589  public:
2590  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2591 };
2593 //*************************************************************************************************
2594 
2595 
2596 
2597 
2598 //=================================================================================================
2599 //
2600 // DIVTRAIT SPECIALIZATIONS
2601 //
2602 //=================================================================================================
2603 
2604 //*************************************************************************************************
2606 template< typename T1, bool TF, typename T2 >
2607 struct DivTrait< DynamicVector<T1,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2608 {
2609  typedef DynamicVector< typename DivTrait<T1,T2>::Type, TF > Type;
2610 };
2612 //*************************************************************************************************
2613 
2614 
2615 
2616 
2617 //=================================================================================================
2618 //
2619 // MATHTRAIT SPECIALIZATIONS
2620 //
2621 //=================================================================================================
2622 
2623 //*************************************************************************************************
2625 template< typename T1, bool TF, typename T2 >
2626 struct MathTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2627 {
2628  typedef DynamicVector< typename MathTrait<T1,T2>::HighType, TF > HighType;
2629  typedef DynamicVector< typename MathTrait<T1,T2>::LowType , TF > LowType;
2630 };
2632 //*************************************************************************************************
2633 
2634 
2635 
2636 
2637 //=================================================================================================
2638 //
2639 // SUBVECTORTRAIT SPECIALIZATIONS
2640 //
2641 //=================================================================================================
2642 
2643 //*************************************************************************************************
2645 template< typename T1, bool TF >
2646 struct SubvectorTrait< DynamicVector<T1,TF> >
2647 {
2648  typedef DynamicVector<T1,TF> Type;
2649 };
2651 //*************************************************************************************************
2652 
2653 } // namespace blaze
2654 
2655 #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
DenseIterator< Type, aligned > Iterator
Iterator over non-constant elements.
Definition: DynamicVector.h:190
const bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.This value specifies the default tran...
Definition: TransposeFlag.h:56
Type *BLAZE_RESTRICT v_
The dynamically allocated vector elements.
Definition: DynamicVector.h:424
Header file for mathematical functions.
#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 subtraction trait.
Pointer data()
Low-level data access to the vector elements.
Definition: DynamicVector.h:760
Header file for basic type definitions.
Header file for the SparseVector base class.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: DynamicVector.h:1164
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the dense vector.
Definition: DynamicVector.h:1626
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
void swap(DynamicVector &v)
Swapping the contents of two vectors.
Definition: DynamicVector.h:1359
Iterator begin()
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:790
void clear()
Clearing the vector.
Definition: DynamicVector.h:1203
IT::Type IntrinsicType
Intrinsic type of the vector elements.
Definition: DynamicVector.h:181
Header file for the IsSame and IsStrictlySame type traits.
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const Type * ConstPointer
Pointer to a constant vector value.
Definition: DynamicVector.h:188
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
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:168
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.
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense vector.
Definition: DynamicVector.h:1656
EnableIf< IsBuiltin< T >, T * >::Type allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:152
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2751
~DynamicVector()
The destructor for DynamicVector.
Definition: DynamicVector.h:650
ConstIterator cbegin() const
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:818
DynamicVector< ET, TF > Other
The type of the other DynamicVector.
Definition: DynamicVector.h:199
DenseIterator< const Type, aligned > ConstIterator
Iterator over constant elements.
Definition: DynamicVector.h:191
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
This ResultType
Result type for expression template evaluations.
Definition: DynamicVector.h:178
void resize(size_t n, bool preserve=true)
Changing the size of the vector.
Definition: DynamicVector.h:1241
Header file for the multiplication trait.
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.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
bool isAligned() const
Returns whether the vector is properly aligned in memory.
Definition: DynamicVector.h:1444
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
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicVector.h:182
#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
Header file for the IsSMPAssignable type trait.
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:75
BLAZE_ALWAYS_INLINE void storea(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the vector.
Definition: DynamicVector.h:1594
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the vector.
Definition: DynamicVector.h:1541
#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.
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
void reset()
Reset to the default initial values.
Definition: DynamicVector.h:1185
size_t size() const
Returns the current size/dimension of the vector.
Definition: DynamicVector.h:1133
Header file for the IsAligned type trait.
size_t size_
The current size/dimension of the vector.
Definition: DynamicVector.h:422
#define BLAZE_RESTRICT
Platform dependent setup of the restrict keyword.
Definition: Restrict.h:81
Type & Reference
Reference to a non-constant vector value.
Definition: DynamicVector.h:185
#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
const Type & ConstReference
Reference to a constant vector value.
Definition: DynamicVector.h:186
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
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:120
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:532
size_t adjustCapacity(size_t minCapacity) const
Adjusting the new capacity of the vector according to its data type Type.
Definition: DynamicVector.h:1376
DynamicVector()
The default constructor for DynamicVector.
Definition: DynamicVector.h:458
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.
Header file for the IsVectorizable type trait.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
size_t capacity_
The maximum capacity of the vector.
Definition: DynamicVector.h:423
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
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: DynamicVector.h:1426
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Load of an intrinsic element of the vector.
Definition: DynamicVector.h:1486
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseVector type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
ConstIterator cend() const
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:860
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
IntrinsicTrait< Type > IT
Intrinsic trait for the vector element type.
Definition: DynamicVector.h:172
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
const DynamicVector & CompositeType
Data type for composite expression templates.
Definition: DynamicVector.h:183
const bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: DynamicVector.h:1289
const bool usePadding
Configuration of the padding of dense vectors and matrices.This configuration switch enables/disables...
Definition: Optimizations.h:52
Header file for the cache size of the target architecture.
#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
Rebind mechanism to obtain a DynamicVector with different data/element type.
Definition: DynamicVector.h:198
Header file for the isDefault shim.
System settings for the restrict keyword.
Type ElementType
Type of the vector elements.
Definition: DynamicVector.h:180
Type * Pointer
Pointer to a non-constant vector value.
Definition: DynamicVector.h:187
size_t capacity() const
Returns the maximum capacity of the vector.
Definition: DynamicVector.h:1147
BLAZE_ALWAYS_INLINE IntrinsicType loada(size_t index) const
Aligned load of an intrinsic element of the vector.
Definition: DynamicVector.h:1509
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
void reserve(size_t n)
Setting the minimum capacity of the vector.
Definition: DynamicVector.h:1307
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
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
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: DynamicVector.h:1406
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.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
Header file for the alignment check function.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
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 canSMPAssign() const
Returns whether the vector can be used in SMP assignments.
Definition: DynamicVector.h:1463
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
Header file for exception macros.
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Store of an intrinsic element of the vector.
Definition: DynamicVector.h:1571
Iterator end()
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:832
Reference at(size_t index)
Checked access to the vector elements.
Definition: DynamicVector.h:718
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
Header file for the IsResizable type trait.
System settings for the inline keywords.
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
Reference operator[](size_t index)
Subscript operator for the direct access to the vector elements.
Definition: DynamicVector.h:677
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
DynamicVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: DynamicVector.h:179
Header file for a safe C++ NULL pointer implementation.
DynamicVector< Type, TF > This
Type of this DynamicVector instance.
Definition: DynamicVector.h:177