HybridVector.h
Go to the documentation of this file.
1 //=================================================================================================
24 //=================================================================================================
25 
26 #ifndef _BLAZE_MATH_DENSE_HYBRIDVECTOR_H_
27 #define _BLAZE_MATH_DENSE_HYBRIDVECTOR_H_
28 
29 
30 //*************************************************************************************************
31 // Includes
32 //*************************************************************************************************
33 
34 #include <algorithm>
39 #include <blaze/math/Forward.h>
40 #include <blaze/math/Functions.h>
41 #include <blaze/math/Intrinsics.h>
42 #include <blaze/math/shims/Clear.h>
58 #include <blaze/system/Inline.h>
63 #include <blaze/util/Assert.h>
69 #include <blaze/util/DisableIf.h>
70 #include <blaze/util/EnableIf.h>
71 #include <blaze/util/Exception.h>
72 #include <blaze/util/Memory.h>
74 #include <blaze/util/mpl/SizeT.h>
76 #include <blaze/util/Template.h>
77 #include <blaze/util/Types.h>
81 #include <blaze/util/Unused.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS DEFINITION
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
163 template< typename Type // Data type of the vector
164  , size_t N // Number of elements
165  , bool TF = defaultTransposeFlag > // Transpose flag
166 class HybridVector : public DenseVector< HybridVector<Type,N,TF>, TF >
167 {
168  private:
169  //**Type definitions****************************************************************************
171  //**********************************************************************************************
172 
173  //**********************************************************************************************
175  static const size_t NN = ( usePadding )?( NextMultiple< SizeT<N>, SizeT<IT::size> >::value ):( N );
176  //**********************************************************************************************
177 
178  public:
179  //**Type definitions****************************************************************************
181  typedef This ResultType;
183  typedef Type ElementType;
184  typedef typename IT::Type IntrinsicType;
185  typedef const Type& ReturnType;
186  typedef const HybridVector& CompositeType;
187 
188  typedef Type& Reference;
189  typedef const Type& ConstReference;
190  typedef Type* Pointer;
191  typedef const Type* ConstPointer;
192 
195  //**********************************************************************************************
196 
197  //**Rebind struct definition********************************************************************
200  template< typename ET > // Data type of the other vector
201  struct Rebind {
203  };
204  //**********************************************************************************************
205 
206  //**Compilation flags***************************************************************************
208 
212  enum { vectorizable = IsVectorizable<Type>::value };
213 
215 
218  enum { smpAssignable = 0 };
219  //**********************************************************************************************
220 
221  //**Constructors********************************************************************************
224  explicit inline HybridVector();
225  explicit inline HybridVector( size_t n );
226  explicit inline HybridVector( size_t n, const Type& init );
227  template< typename Other > explicit inline HybridVector( size_t n, const Other* array );
228 
229  template< typename Other, size_t M >
230  explicit inline HybridVector( const Other (&array)[M] );
231 
232  inline HybridVector( const HybridVector& v );
233  template< typename VT > inline HybridVector( const Vector<VT,TF>& v );
235  //**********************************************************************************************
236 
237  //**Destructor**********************************************************************************
238  // No explicitly declared destructor.
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 M >
263  inline HybridVector& operator=( const Other (&array)[M] );
264 
265  inline HybridVector& operator= ( const Type& rhs );
266  inline HybridVector& operator= ( const HybridVector& rhs );
267  template< typename VT > inline HybridVector& operator= ( const Vector<VT,TF>& rhs );
268  template< typename VT > inline HybridVector& operator+=( const Vector<VT,TF>& rhs );
269  template< typename VT > inline HybridVector& operator-=( const Vector<VT,TF>& rhs );
270  template< typename VT > inline HybridVector& operator*=( const Vector<VT,TF>& rhs );
271 
272  template< typename Other >
273  inline typename EnableIf< IsNumeric<Other>, HybridVector >::Type&
274  operator*=( Other rhs );
275 
276  template< typename Other >
277  inline typename EnableIf< IsNumeric<Other>, HybridVector >::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  template< typename Other > inline HybridVector& scale( const Other& scalar );
293  inline void swap( HybridVector& v ) /* throw() */;
295  //**********************************************************************************************
296 
297  //**Memory functions****************************************************************************
300  static inline void* operator new ( std::size_t size );
301  static inline void* operator new[]( std::size_t size );
302  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
303  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
304 
305  static inline void operator delete ( void* ptr );
306  static inline void operator delete[]( void* ptr );
307  static inline void operator delete ( void* ptr, const std::nothrow_t& );
308  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
310  //**********************************************************************************************
311 
312  private:
313  //**********************************************************************************************
315  template< typename VT >
317  struct VectorizedAssign {
318  enum { value = useOptimizedKernels &&
319  vectorizable && VT::vectorizable &&
320  IsSame<Type,typename VT::ElementType>::value };
321  };
323  //**********************************************************************************************
324 
325  //**********************************************************************************************
327  template< typename VT >
329  struct VectorizedAddAssign {
330  enum { value = useOptimizedKernels &&
331  vectorizable && VT::vectorizable &&
332  IsSame<Type,typename VT::ElementType>::value &&
333  IntrinsicTrait<Type>::addition };
334  };
336  //**********************************************************************************************
337 
338  //**********************************************************************************************
340  template< typename VT >
342  struct VectorizedSubAssign {
343  enum { value = useOptimizedKernels &&
344  vectorizable && VT::vectorizable &&
345  IsSame<Type,typename VT::ElementType>::value &&
346  IntrinsicTrait<Type>::subtraction };
347  };
349  //**********************************************************************************************
350 
351  //**********************************************************************************************
353  template< typename VT >
355  struct VectorizedMultAssign {
356  enum { value = useOptimizedKernels &&
357  vectorizable && VT::vectorizable &&
358  IsSame<Type,typename VT::ElementType>::value &&
359  IntrinsicTrait<Type>::multiplication };
360  };
362  //**********************************************************************************************
363 
364  public:
365  //**Expression template evaluation functions****************************************************
368  template< typename Other > inline bool canAlias ( const Other* alias ) const;
369  template< typename Other > inline bool isAliased( const Other* alias ) const;
370 
371  inline bool isAligned() const;
372 
373  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t index ) const;
374  BLAZE_ALWAYS_INLINE IntrinsicType loada( size_t index ) const;
375  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t index ) const;
376 
377  BLAZE_ALWAYS_INLINE void store ( size_t index, const IntrinsicType& value );
378  BLAZE_ALWAYS_INLINE void storea( size_t index, const IntrinsicType& value );
379  BLAZE_ALWAYS_INLINE void storeu( size_t index, const IntrinsicType& value );
380  BLAZE_ALWAYS_INLINE void stream( size_t index, const IntrinsicType& value );
381 
382  template< typename VT >
383  inline typename DisableIf< VectorizedAssign<VT> >::Type
384  assign( const DenseVector<VT,TF>& rhs );
385 
386  template< typename VT >
387  inline typename EnableIf< VectorizedAssign<VT> >::Type
388  assign( const DenseVector<VT,TF>& rhs );
389 
390  template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
391 
392  template< typename VT >
393  inline typename DisableIf< VectorizedAddAssign<VT> >::Type
394  addAssign( const DenseVector<VT,TF>& rhs );
395 
396  template< typename VT >
397  inline typename EnableIf< VectorizedAddAssign<VT> >::Type
398  addAssign( const DenseVector<VT,TF>& rhs );
399 
400  template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
401 
402  template< typename VT >
403  inline typename DisableIf< VectorizedSubAssign<VT> >::Type
404  subAssign( const DenseVector<VT,TF>& rhs );
405 
406  template< typename VT >
407  inline typename EnableIf< VectorizedSubAssign<VT> >::Type
408  subAssign( const DenseVector<VT,TF>& rhs );
409 
410  template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
411 
412  template< typename VT >
413  inline typename DisableIf< VectorizedMultAssign<VT> >::Type
414  multAssign( const DenseVector<VT,TF>& rhs );
415 
416  template< typename VT >
417  inline typename EnableIf< VectorizedMultAssign<VT> >::Type
418  multAssign( const DenseVector<VT,TF>& rhs );
419 
420  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
422  //**********************************************************************************************
423 
424  private:
425  //**Member variables****************************************************************************
429 
434  size_t size_;
435 
436  //**********************************************************************************************
437 
438  //**Compile time checks*************************************************************************
444  BLAZE_STATIC_ASSERT( !usePadding || NN % IT::size == 0UL );
445  BLAZE_STATIC_ASSERT( NN >= N );
447  //**********************************************************************************************
448 };
449 //*************************************************************************************************
450 
451 
452 
453 
454 //=================================================================================================
455 //
456 // CONSTRUCTORS
457 //
458 //=================================================================================================
459 
460 //*************************************************************************************************
465 template< typename Type // Data type of the vector
466  , size_t N // Number of elements
467  , bool TF > // Transpose flag
469  : v_ () // The statically allocated vector elements
470  , size_( 0UL ) // The current size/dimension of the vector
471 {
473 
474  if( IsNumeric<Type>::value ) {
475  for( size_t i=0UL; i<NN; ++i )
476  v_[i] = Type();
477  }
478 }
479 //*************************************************************************************************
480 
481 
482 //*************************************************************************************************
492 template< typename Type // Data type of the vector
493  , size_t N // Number of elements
494  , bool TF > // Transpose flag
496  : v_ () // The statically allocated vector elements
497  , size_( n ) // The current size/dimension of the vector
498 {
500 
501  if( n > N ) {
502  BLAZE_THROW_INVALID_ARGUMENT( "Invalid size for hybrid vector" );
503  }
504 
505  if( IsNumeric<Type>::value ) {
506  for( size_t i=0UL; i<NN; ++i )
507  v_[i] = Type();
508  }
509 }
510 //*************************************************************************************************
511 
512 
513 //*************************************************************************************************
524 template< typename Type // Data type of the vector
525  , size_t N // Number of elements
526  , bool TF > // Transpose flag
527 inline HybridVector<Type,N,TF>::HybridVector( size_t n, const Type& init )
528  : v_ () // The statically allocated vector elements
529  , size_( n ) // The current size/dimension of the vector
530 {
532 
533  if( n > N ) {
534  BLAZE_THROW_INVALID_ARGUMENT( "Invalid size for hybrid vector" );
535  }
536 
537  for( size_t i=0UL; i<n; ++i )
538  v_[i] = init;
539 
540  if( IsNumeric<Type>::value ) {
541  for( size_t i=n; i<NN; ++i )
542  v_[i] = Type();
543  }
544 }
545 //*************************************************************************************************
546 
547 
548 //*************************************************************************************************
571 template< typename Type // Data type of the vector
572  , size_t N // Number of elements
573  , bool TF > // Transpose flag
574 template< typename Other > // Data type of the initialization array
575 inline HybridVector<Type,N,TF>::HybridVector( size_t n, const Other* array )
576  : v_ () // The statically allocated vector elements
577  , size_( n ) // The current size/dimension of the vector
578 {
580 
581  if( n > N ) {
582  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of hybrid vector" );
583  }
584 
585  for( size_t i=0UL; i<n; ++i )
586  v_[i] = array[i];
587 
588  if( IsNumeric<Type>::value ) {
589  for( size_t i=n; i<NN; ++i )
590  v_[i] = Type();
591  }
592 }
593 //*************************************************************************************************
594 
595 
596 //*************************************************************************************************
614 template< typename Type // Data type of the vector
615  , size_t N // Number of elements
616  , bool TF > // Transpose flag
617 template< typename Other // Data type of the initialization array
618  , size_t M > // Number of elements of the initialization array
619 inline HybridVector<Type,N,TF>::HybridVector( const Other (&array)[M] )
620  : v_ () // The statically allocated vector elements
621  , size_( M ) // The current size/dimension of the vector
622 {
623  BLAZE_STATIC_ASSERT( M <= N );
625 
626  for( size_t i=0UL; i<M; ++i )
627  v_[i] = array[i];
628 
629  if( IsNumeric<Type>::value ) {
630  for( size_t i=M; i<NN; ++i )
631  v_[i] = Type();
632  }
633 }
634 //*************************************************************************************************
635 
636 
637 //*************************************************************************************************
644 template< typename Type // Data type of the vector
645  , size_t N // Number of elements
646  , bool TF > // Transpose flag
648  : v_ () // The statically allocated vector elements
649  , size_( v.size_ ) // The current size/dimension of the vector
650 {
652 
653  for( size_t i=0UL; i<size_; ++i )
654  v_[i] = v.v_[i];
655 
656  if( IsNumeric<Type>::value ) {
657  for( size_t i=size_; i<NN; ++i )
658  v_[i] = Type();
659  }
660 }
661 //*************************************************************************************************
662 
663 
664 //*************************************************************************************************
674 template< typename Type // Data type of the vector
675  , size_t N // Number of elements
676  , bool TF > // Transpose flag
677 template< typename VT > // Type of the foreign vector
679  : v_ () // The statically allocated vector elements
680  , size_( (~v).size() ) // The current size/dimension of the vector
681 {
682  using blaze::assign;
683 
685 
686  if( (~v).size() > N ) {
687  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of hybrid vector" );
688  }
689 
690  for( size_t i=( IsSparseVector<VT>::value ? 0UL : size_ );
691  i<( IsNumeric<Type>::value ? NN : size_ ); ++i ) {
692  v_[i] = Type();
693  }
694 
695  assign( *this, ~v );
696 }
697 //*************************************************************************************************
698 
699 
700 
701 
702 //=================================================================================================
703 //
704 // DATA ACCESS FUNCTIONS
705 //
706 //=================================================================================================
707 
708 //*************************************************************************************************
717 template< typename Type // Data type of the vector
718  , size_t N // Number of elements
719  , bool TF > // Transpose flag
722 {
723  BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
724  return v_[index];
725 }
726 //*************************************************************************************************
727 
728 
729 //*************************************************************************************************
738 template< typename Type // Data type of the vector
739  , size_t N // Number of elements
740  , bool TF > // Transpose flag
743 {
744  BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
745  return v_[index];
746 }
747 //*************************************************************************************************
748 
749 
750 //*************************************************************************************************
760 template< typename Type // Data type of the vector
761  , size_t N // Number of elements
762  , bool TF > // Transpose flag
765 {
766  if( index >= size_ ) {
767  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
768  }
769  return (*this)[index];
770 }
771 //*************************************************************************************************
772 
773 
774 //*************************************************************************************************
784 template< typename Type // Data type of the vector
785  , size_t N // Number of elements
786  , bool TF > // Transpose flag
788  HybridVector<Type,N,TF>::at( size_t index ) const
789 {
790  if( index >= size_ ) {
791  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
792  }
793  return (*this)[index];
794 }
795 //*************************************************************************************************
796 
797 
798 //*************************************************************************************************
805 template< typename Type // Data type of the vector
806  , size_t N // Number of elements
807  , bool TF > // Transpose flag
809 {
810  return v_;
811 }
812 //*************************************************************************************************
813 
814 
815 //*************************************************************************************************
822 template< typename Type // Data type of the vector
823  , size_t N // Number of elements
824  , bool TF > // Transpose flag
826 {
827  return v_;
828 }
829 //*************************************************************************************************
830 
831 
832 //*************************************************************************************************
837 template< typename Type // Data type of the vector
838  , size_t N // Number of elements
839  , bool TF > // Transpose flag
841 {
842  return Iterator( v_ );
843 }
844 //*************************************************************************************************
845 
846 
847 //*************************************************************************************************
852 template< typename Type // Data type of the vector
853  , size_t N // Number of elements
854  , bool TF > // Transpose flag
856 {
857  return ConstIterator( v_ );
858 }
859 //*************************************************************************************************
860 
861 
862 //*************************************************************************************************
867 template< typename Type // Data type of the vector
868  , size_t N // Number of elements
869  , bool TF > // Transpose flag
871 {
872  return ConstIterator( v_ );
873 }
874 //*************************************************************************************************
875 
876 
877 //*************************************************************************************************
882 template< typename Type // Data type of the vector
883  , size_t N // Number of elements
884  , bool TF > // Transpose flag
886 {
887  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
888  return Iterator( v_ + size_ );
889 }
890 //*************************************************************************************************
891 
892 
893 //*************************************************************************************************
898 template< typename Type // Data type of the vector
899  , size_t N // Number of elements
900  , bool TF > // Transpose flag
902 {
903  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
904  return ConstIterator( v_ + size_ );
905 }
906 //*************************************************************************************************
907 
908 
909 //*************************************************************************************************
914 template< typename Type // Data type of the vector
915  , size_t N // Number of elements
916  , bool TF > // Transpose flag
918 {
919  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
920  return ConstIterator( v_ + size_ );
921 }
922 //*************************************************************************************************
923 
924 
925 
926 
927 //=================================================================================================
928 //
929 // ASSIGNMENT OPERATORS
930 //
931 //=================================================================================================
932 
933 //*************************************************************************************************
952 template< typename Type // Data type of the vector
953  , size_t N // Number of elements
954  , bool TF > // Transpose flag
955 template< typename Other // Data type of the initialization array
956  , size_t M > // Number of elements of the initialization array
958 {
959  BLAZE_STATIC_ASSERT( M <= N );
960 
961  resize( M );
962 
963  for( size_t i=0UL; i<M; ++i )
964  v_[i] = array[i];
965 
966  return *this;
967 }
968 //*************************************************************************************************
969 
970 
971 //*************************************************************************************************
977 template< typename Type // Data type of the vector
978  , size_t N // Number of elements
979  , bool TF > // Transpose flag
981 {
982  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
983 
984  for( size_t i=0UL; i<size_; ++i )
985  v_[i] = rhs;
986  return *this;
987 }
988 //*************************************************************************************************
989 
990 
991 //*************************************************************************************************
999 template< typename Type // Data type of the vector
1000  , size_t N // Number of elements
1001  , bool TF > // Transpose flag
1003 {
1004  using blaze::assign;
1005 
1006  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
1007 
1008  resize( rhs.size() );
1009  assign( *this, ~rhs );
1010 
1011  return *this;
1012 }
1013 //*************************************************************************************************
1014 
1015 
1016 //*************************************************************************************************
1026 template< typename Type // Data type of the vector
1027  , size_t N // Number of elements
1028  , bool TF > // Transpose flag
1029 template< typename VT > // Type of the right-hand side vector
1031 {
1032  using blaze::assign;
1033 
1034  if( (~rhs).size() > N ) {
1035  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to hybrid vector" );
1036  }
1037 
1038  if( (~rhs).canAlias( this ) ) {
1039  HybridVector tmp( ~rhs );
1040  swap( tmp );
1041  }
1042  else {
1043  resize( (~rhs).size() );
1045  reset();
1046  assign( *this, ~rhs );
1047  }
1048 
1049  return *this;
1050 }
1051 //*************************************************************************************************
1052 
1053 
1054 //*************************************************************************************************
1064 template< typename Type // Data type of the vector
1065  , size_t N // Number of elements
1066  , bool TF > // Transpose flag
1067 template< typename VT > // Type of the right-hand side vector
1069 {
1070  using blaze::addAssign;
1071 
1072  if( (~rhs).size() != size_ ) {
1073  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1074  }
1075 
1076  if( (~rhs).canAlias( this ) ) {
1077  typename VT::ResultType tmp( ~rhs );
1078  addAssign( *this, tmp );
1079  }
1080  else {
1081  addAssign( *this, ~rhs );
1082  }
1083 
1084  return *this;
1085 }
1086 //*************************************************************************************************
1087 
1088 
1089 //*************************************************************************************************
1099 template< typename Type // Data type of the vector
1100  , size_t N // Number of elements
1101  , bool TF > // Transpose flag
1102 template< typename VT > // Type of the right-hand side vector
1104 {
1105  using blaze::subAssign;
1106 
1107  if( (~rhs).size() != size_ ) {
1108  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1109  }
1110 
1111  if( (~rhs).canAlias( this ) ) {
1112  typename VT::ResultType tmp( ~rhs );
1113  subAssign( *this, tmp );
1114  }
1115  else {
1116  subAssign( *this, ~rhs );
1117  }
1118 
1119  return *this;
1120 }
1121 //*************************************************************************************************
1122 
1123 
1124 //*************************************************************************************************
1135 template< typename Type // Data type of the vector
1136  , size_t N // Number of elements
1137  , bool TF > // Transpose flag
1138 template< typename VT > // Type of the right-hand side vector
1140 {
1141  using blaze::multAssign;
1142 
1143  if( (~rhs).size() != size_ ) {
1144  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1145  }
1146 
1147  if( IsSparseVector<VT>::value || (~rhs).canAlias( this ) ) {
1148  const HybridVector tmp( *this * (~rhs) );
1149  this->operator=( tmp );
1150  }
1151  else {
1152  multAssign( *this, ~rhs );
1153  }
1154 
1155  return *this;
1156 }
1157 //*************************************************************************************************
1158 
1159 
1160 //*************************************************************************************************
1167 template< typename Type // Data type of the vector
1168  , size_t N // Number of elements
1169  , bool TF > // Transpose flag
1170 template< typename Other > // Data type of the right-hand side scalar
1171 inline typename EnableIf< IsNumeric<Other>, HybridVector<Type,N,TF> >::Type&
1173 {
1174  using blaze::assign;
1175 
1176  assign( *this, (*this) * rhs );
1177  return *this;
1178 }
1179 //*************************************************************************************************
1180 
1181 
1182 //*************************************************************************************************
1191 template< typename Type // Data type of the vector
1192  , size_t N // Number of elements
1193  , bool TF > // Transpose flag
1194 template< typename Other > // Data type of the right-hand side scalar
1195 inline typename EnableIf< IsNumeric<Other>, HybridVector<Type,N,TF> >::Type&
1197 {
1198  using blaze::assign;
1199 
1200  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1201 
1202  assign( *this, (*this) / rhs );
1203  return *this;
1204 }
1205 //*************************************************************************************************
1206 
1207 
1208 
1209 
1210 //=================================================================================================
1211 //
1212 // UTILITY FUNCTIONS
1213 //
1214 //=================================================================================================
1215 
1216 //*************************************************************************************************
1221 template< typename Type // Data type of the vector
1222  , size_t N // Number of elements
1223  , bool TF > // Transpose flag
1224 inline size_t HybridVector<Type,N,TF>::size() const
1225 {
1226  return size_;
1227 }
1228 //*************************************************************************************************
1229 
1230 
1231 //*************************************************************************************************
1236 template< typename Type // Data type of the vector
1237  , size_t N // Number of elements
1238  , bool TF > // Transpose flag
1240 {
1241  return NN;
1242 }
1243 //*************************************************************************************************
1244 
1245 
1246 //*************************************************************************************************
1254 template< typename Type // Data type of the vector
1255  , size_t N // Number of elements
1256  , bool TF > // Transpose flag
1258 {
1259  size_t nonzeros( 0 );
1260 
1261  for( size_t i=0UL; i<size_; ++i ) {
1262  if( !isDefault( v_[i] ) )
1263  ++nonzeros;
1264  }
1265 
1266  return nonzeros;
1267 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1276 template< typename Type // Data type of the vector
1277  , size_t N // Number of elements
1278  , bool TF > // Transpose flag
1280 {
1281  using blaze::clear;
1282  for( size_t i=0UL; i<size_; ++i )
1283  clear( v_[i] );
1284 }
1285 //*************************************************************************************************
1286 
1287 
1288 //*************************************************************************************************
1295 template< typename Type // Data type of the vector
1296  , size_t N // Number of elements
1297  , bool TF > // Transpose flag
1299 {
1300  resize( 0UL );
1301 }
1302 //*************************************************************************************************
1303 
1304 
1305 //*************************************************************************************************
1336 template< typename Type // Data type of the vector
1337  , size_t N // Number of elements
1338  , bool TF > // Transpose flag
1339 inline void HybridVector<Type,N,TF>::resize( size_t n, bool preserve )
1340 {
1341  UNUSED_PARAMETER( preserve );
1342 
1343  if( n > N ) {
1344  BLAZE_THROW_INVALID_ARGUMENT( "Invalid size for hybrid vector" );
1345  }
1346 
1347  if( IsVectorizable<Type>::value && n < size_ ) {
1348  for( size_t i=n; i<size_; ++i )
1349  v_[i] = Type();
1350  }
1351 
1352  size_ = n;
1353 }
1354 //*************************************************************************************************
1355 
1356 
1357 //*************************************************************************************************
1371 template< typename Type // Data type of the vector
1372  , size_t N // Number of elements
1373  , bool TF > // Transpose flag
1374 inline void HybridVector<Type,N,TF>::extend( size_t n, bool preserve )
1375 {
1376  UNUSED_PARAMETER( preserve );
1377  resize( size_+n );
1378 }
1379 //*************************************************************************************************
1380 
1381 
1382 //*************************************************************************************************
1388 template< typename Type // Data type of the vector
1389  , size_t N // Number of elements
1390  , bool TF > // Transpose flag
1391 template< typename Other > // Data type of the scalar value
1393 {
1394  for( size_t i=0; i<size_; ++i )
1395  v_[i] *= scalar;
1396  return *this;
1397 }
1398 //*************************************************************************************************
1399 
1400 
1401 //*************************************************************************************************
1408 template< typename Type // Data type of the vector
1409  , size_t N // Number of elements
1410  , bool TF > // Transpose flag
1411 inline void HybridVector<Type,N,TF>::swap( HybridVector& v ) /* throw() */
1412 {
1413  using std::swap;
1414 
1415  const size_t maxsize( max( size_, v.size_ ) );
1416  for( size_t i=0UL; i<maxsize; ++i )
1417  swap( v_[i], v.v_[i] );
1418  swap( size_, v.size_ );
1419 }
1420 //*************************************************************************************************
1421 
1422 
1423 
1424 
1425 //=================================================================================================
1426 //
1427 // MEMORY FUNCTIONS
1428 //
1429 //=================================================================================================
1430 
1431 //*************************************************************************************************
1441 template< typename Type // Data type of the vector
1442  , size_t N // Number of elements
1443  , bool TF > // Transpose flag
1444 inline void* HybridVector<Type,N,TF>::operator new( std::size_t size )
1445 {
1447 
1448  BLAZE_INTERNAL_ASSERT( size == sizeof( HybridVector ), "Invalid number of bytes detected" );
1449 
1450  return allocate<HybridVector>( 1UL );
1451 }
1452 //*************************************************************************************************
1453 
1454 
1455 //*************************************************************************************************
1465 template< typename Type // Data type of the vector
1466  , size_t N // Number of elements
1467  , bool TF > // Transpose flag
1468 inline void* HybridVector<Type,N,TF>::operator new[]( std::size_t size )
1469 {
1470  BLAZE_INTERNAL_ASSERT( size >= sizeof( HybridVector ) , "Invalid number of bytes detected" );
1471  BLAZE_INTERNAL_ASSERT( size % sizeof( HybridVector ) == 0UL, "Invalid number of bytes detected" );
1472 
1473  return allocate<HybridVector>( size/sizeof(HybridVector) );
1474 }
1475 //*************************************************************************************************
1476 
1477 
1478 //*************************************************************************************************
1488 template< typename Type // Data type of the vector
1489  , size_t N // Number of elements
1490  , bool TF > // Transpose flag
1491 inline void* HybridVector<Type,N,TF>::operator new( std::size_t size, const std::nothrow_t& )
1492 {
1493  UNUSED_PARAMETER( size );
1494 
1495  BLAZE_INTERNAL_ASSERT( size == sizeof( HybridVector ), "Invalid number of bytes detected" );
1496 
1497  return allocate<HybridVector>( 1UL );
1498 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1512 template< typename Type // Data type of the vector
1513  , size_t N // Number of elements
1514  , bool TF > // Transpose flag
1515 inline void* HybridVector<Type,N,TF>::operator new[]( std::size_t size, const std::nothrow_t& )
1516 {
1517  BLAZE_INTERNAL_ASSERT( size >= sizeof( HybridVector ) , "Invalid number of bytes detected" );
1518  BLAZE_INTERNAL_ASSERT( size % sizeof( HybridVector ) == 0UL, "Invalid number of bytes detected" );
1519 
1520  return allocate<HybridVector>( size/sizeof(HybridVector) );
1521 }
1522 //*************************************************************************************************
1523 
1524 
1525 //*************************************************************************************************
1531 template< typename Type // Data type of the vector
1532  , size_t N // Number of elements
1533  , bool TF > // Transpose flag
1534 inline void HybridVector<Type,N,TF>::operator delete( void* ptr )
1535 {
1536  deallocate( static_cast<HybridVector*>( ptr ) );
1537 }
1538 //*************************************************************************************************
1539 
1540 
1541 //*************************************************************************************************
1547 template< typename Type // Data type of the vector
1548  , size_t N // Number of elements
1549  , bool TF > // Transpose flag
1550 inline void HybridVector<Type,N,TF>::operator delete[]( void* ptr )
1551 {
1552  deallocate( static_cast<HybridVector*>( ptr ) );
1553 }
1554 //*************************************************************************************************
1555 
1556 
1557 //*************************************************************************************************
1563 template< typename Type // Data type of the vector
1564  , size_t N // Number of elements
1565  , bool TF > // Transpose flag
1566 inline void HybridVector<Type,N,TF>::operator delete( void* ptr, const std::nothrow_t& )
1567 {
1568  deallocate( static_cast<HybridVector*>( ptr ) );
1569 }
1570 //*************************************************************************************************
1571 
1572 
1573 //*************************************************************************************************
1579 template< typename Type // Data type of the vector
1580  , size_t N // Number of elements
1581  , bool TF > // Transpose flag
1582 inline void HybridVector<Type,N,TF>::operator delete[]( void* ptr, const std::nothrow_t& )
1583 {
1584  deallocate( static_cast<HybridVector*>( ptr ) );
1585 }
1586 //*************************************************************************************************
1587 
1588 
1589 
1590 
1591 //=================================================================================================
1592 //
1593 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1594 //
1595 //=================================================================================================
1596 
1597 //*************************************************************************************************
1607 template< typename Type // Data type of the vector
1608  , size_t N // Number of elements
1609  , bool TF > // Transpose flag
1610 template< typename Other > // Data type of the foreign expression
1611 inline bool HybridVector<Type,N,TF>::canAlias( const Other* alias ) const
1612 {
1613  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1614 }
1615 //*************************************************************************************************
1616 
1617 
1618 //*************************************************************************************************
1628 template< typename Type // Data type of the vector
1629  , size_t N // Number of elements
1630  , bool TF > // Transpose flag
1631 template< typename Other > // Data type of the foreign expression
1632 inline bool HybridVector<Type,N,TF>::isAliased( const Other* alias ) const
1633 {
1634  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1635 }
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1648 template< typename Type // Data type of the vector
1649  , size_t N // Number of elements
1650  , bool TF > // Transpose flag
1652 {
1653  return true;
1654 }
1655 //*************************************************************************************************
1656 
1657 
1658 //*************************************************************************************************
1671 template< typename Type // Data type of the vector
1672  , size_t N // Number of elements
1673  , bool TF > // Transpose flag
1675  HybridVector<Type,N,TF>::load( size_t index ) const
1676 {
1677  return loada( index );
1678 }
1679 //*************************************************************************************************
1680 
1681 
1682 //*************************************************************************************************
1695 template< typename Type // Data type of the vector
1696  , size_t N // Number of elements
1697  , bool TF > // Transpose flag
1699  HybridVector<Type,N,TF>::loada( size_t index ) const
1700 {
1701  using blaze::loada;
1702 
1704 
1705  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1706  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1707  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1708  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1709 
1710  return loada( &v_[index] );
1711 }
1712 //*************************************************************************************************
1713 
1714 
1715 //*************************************************************************************************
1728 template< typename Type // Data type of the vector
1729  , size_t N // Number of elements
1730  , bool TF > // Transpose flag
1732  HybridVector<Type,N,TF>::loadu( size_t index ) const
1733 {
1734  using blaze::loadu;
1735 
1737 
1738  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1739  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1740 
1741  return loadu( &v_[index] );
1742 }
1743 //*************************************************************************************************
1744 
1745 
1746 //*************************************************************************************************
1760 template< typename Type // Data type of the vector
1761  , size_t N // Number of elements
1762  , bool TF > // Transpose flag
1763 BLAZE_ALWAYS_INLINE void HybridVector<Type,N,TF>::store( size_t index, const IntrinsicType& value )
1764 {
1765  storea( index, value );
1766 }
1767 //*************************************************************************************************
1768 
1769 
1770 //*************************************************************************************************
1784 template< typename Type // Data type of the vector
1785  , size_t N // Number of elements
1786  , bool TF > // Transpose flag
1787 BLAZE_ALWAYS_INLINE void HybridVector<Type,N,TF>::storea( size_t index, const IntrinsicType& value )
1788 {
1789  using blaze::storea;
1790 
1792 
1793  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1794  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1795  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1796  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1797 
1798  storea( &v_[index], value );
1799 }
1800 //*************************************************************************************************
1801 
1802 
1803 //*************************************************************************************************
1817 template< typename Type // Data type of the vector
1818  , size_t N // Number of elements
1819  , bool TF > // Transpose flag
1820 BLAZE_ALWAYS_INLINE void HybridVector<Type,N,TF>::storeu( size_t index, const IntrinsicType& value )
1821 {
1822  using blaze::storeu;
1823 
1825 
1826  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1827  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1828 
1829  storeu( &v_[index], value );
1830 }
1831 //*************************************************************************************************
1832 
1833 
1834 //*************************************************************************************************
1848 template< typename Type // Data type of the vector
1849  , size_t N // Number of elements
1850  , bool TF > // Transpose flag
1851 BLAZE_ALWAYS_INLINE void HybridVector<Type,N,TF>::stream( size_t index, const IntrinsicType& value )
1852 {
1853  using blaze::stream;
1854 
1856 
1857  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1858  BLAZE_INTERNAL_ASSERT( index + IT::size <= NN, "Invalid vector access index" );
1859  BLAZE_INTERNAL_ASSERT( index % IT::size == 0UL, "Invalid vector access index" );
1860  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1861 
1862  stream( &v_[index], value );
1863 }
1864 //*************************************************************************************************
1865 
1866 
1867 //*************************************************************************************************
1878 template< typename Type // Data type of the vector
1879  , size_t N // Number of elements
1880  , bool TF > // Transpose flag
1881 template< typename VT > // Type of the right-hand side dense vector
1882 inline typename DisableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1884 {
1885  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
1886 
1887  for( size_t i=0UL; i<size_; ++i )
1888  v_[i] = (~rhs)[i];
1889 }
1890 //*************************************************************************************************
1891 
1892 
1893 //*************************************************************************************************
1904 template< typename Type // Data type of the vector
1905  , size_t N // Number of elements
1906  , bool TF > // Transpose flag
1907 template< typename VT > // Type of the right-hand side dense vector
1908 inline typename EnableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
1910 {
1912 
1913  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
1914 
1915  const bool remainder( !usePadding || !IsPadded<VT>::value );
1916 
1917  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
1918  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
1919 
1920  size_t i( 0UL );
1921 
1922  for( ; i<ipos; i+=IT::size ) {
1923  store( i, (~rhs).load(i) );
1924  }
1925  for( ; remainder && i<size_; ++i ) {
1926  v_[i] = (~rhs)[i];
1927  }
1928 }
1929 //*************************************************************************************************
1930 
1931 
1932 //*************************************************************************************************
1943 template< typename Type // Data type of the vector
1944  , size_t N // Number of elements
1945  , bool TF > // Transpose flag
1946 template< typename VT > // Type of the right-hand side sparse vector
1948 {
1949  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
1950 
1951  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1952  v_[element->index()] = element->value();
1953 }
1954 //*************************************************************************************************
1955 
1956 
1957 //*************************************************************************************************
1968 template< typename Type // Data type of the vector
1969  , size_t N // Number of elements
1970  , bool TF > // Transpose flag
1971 template< typename VT > // Type of the right-hand side dense vector
1972 inline typename DisableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
1974 {
1975  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
1976 
1977  for( size_t i=0UL; i<size_; ++i )
1978  v_[i] += (~rhs)[i];
1979 }
1980 //*************************************************************************************************
1981 
1982 
1983 //*************************************************************************************************
1994 template< typename Type // Data type of the vector
1995  , size_t N // Number of elements
1996  , bool TF > // Transpose flag
1997 template< typename VT > // Type of the right-hand side dense vector
1998 inline typename EnableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
2000 {
2002 
2003  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2004 
2005  const bool remainder( !usePadding || !IsPadded<VT>::value );
2006 
2007  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
2008  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
2009 
2010  size_t i( 0UL );
2011 
2012  for( ; i<ipos; i+=IT::size ) {
2013  store( i, load(i) + (~rhs).load(i) );
2014  }
2015  for( ; remainder && i<size_; ++i ) {
2016  v_[i] += (~rhs)[i];
2017  }
2018 }
2019 //*************************************************************************************************
2020 
2021 
2022 //*************************************************************************************************
2033 template< typename Type // Data type of the vector
2034  , size_t N // Number of elements
2035  , bool TF > // Transpose flag
2036 template< typename VT > // Type of the right-hand side sparse vector
2038 {
2039  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2040 
2041  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2042  v_[element->index()] += element->value();
2043 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2058 template< typename Type // Data type of the vector
2059  , size_t N // Number of elements
2060  , bool TF > // Transpose flag
2061 template< typename VT > // Type of the right-hand side dense vector
2062 inline typename DisableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2064 {
2065  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2066 
2067  for( size_t i=0UL; i<size_; ++i )
2068  v_[i] -= (~rhs)[i];
2069 }
2070 //*************************************************************************************************
2071 
2072 
2073 //*************************************************************************************************
2084 template< typename Type // Data type of the vector
2085  , size_t N // Number of elements
2086  , bool TF > // Transpose flag
2087 template< typename VT > // Type of the right-hand side dense vector
2088 inline typename EnableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
2090 {
2092 
2093  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2094 
2095  const bool remainder( !usePadding || !IsPadded<VT>::value );
2096 
2097  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
2098  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
2099 
2100  size_t i( 0UL );
2101 
2102  for( ; i<ipos; i+=IT::size ) {
2103  store( i, load(i) - (~rhs).load(i) );
2104  }
2105  for( ; remainder && i<size_; ++i ) {
2106  v_[i] -= (~rhs)[i];
2107  }
2108 }
2109 //*************************************************************************************************
2110 
2111 
2112 //*************************************************************************************************
2123 template< typename Type // Data type of the vector
2124  , size_t N // Number of elements
2125  , bool TF > // Transpose flag
2126 template< typename VT > // Type of the right-hand side sparse vector
2128 {
2129  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2130 
2131  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2132  v_[element->index()] -= element->value();
2133 }
2134 //*************************************************************************************************
2135 
2136 
2137 //*************************************************************************************************
2148 template< typename Type // Data type of the vector
2149  , size_t N // Number of elements
2150  , bool TF > // Transpose flag
2151 template< typename VT > // Type of the right-hand side dense vector
2152 inline typename DisableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2154 {
2155  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2156 
2157  for( size_t i=0UL; i<size_; ++i )
2158  v_[i] *= (~rhs)[i];
2159 }
2160 //*************************************************************************************************
2161 
2162 
2163 //*************************************************************************************************
2174 template< typename Type // Data type of the vector
2175  , size_t N // Number of elements
2176  , bool TF > // Transpose flag
2177 template< typename VT > // Type of the right-hand side dense vector
2178 inline typename EnableIf< typename HybridVector<Type,N,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
2180 {
2182 
2183  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2184 
2185  const bool remainder( !usePadding || !IsPadded<VT>::value );
2186 
2187  const size_t ipos( ( remainder )?( size_ & size_t(-IT::size) ):( size_ ) );
2188  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (IT::size) ) ) == ipos, "Invalid end calculation" );
2189 
2190  size_t i( 0UL );
2191 
2192  for( ; i<ipos; i+=IT::size ) {
2193  store( i, load(i) * (~rhs).load(i) );
2194  }
2195  for( ; remainder && i<size_; ++i ) {
2196  v_[i] *= (~rhs)[i];
2197  }
2198 }
2199 //*************************************************************************************************
2200 
2201 
2202 //*************************************************************************************************
2213 template< typename Type // Data type of the vector
2214  , size_t N // Number of elements
2215  , bool TF > // Transpose flag
2216 template< typename VT > // Type of the right-hand side sparse vector
2218 {
2219  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2220 
2221  const HybridVector tmp( serial( *this ) );
2222 
2223  reset();
2224 
2225  for( typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2226  v_[element->index()] = tmp[element->index()] * element->value();
2227 }
2228 //*************************************************************************************************
2229 
2230 
2231 
2232 
2233 
2234 
2235 
2236 
2237 //=================================================================================================
2238 //
2239 // UNDEFINED CLASS TEMPLATE SPECIALIZATION
2240 //
2241 //=================================================================================================
2242 
2243 //*************************************************************************************************
2251 template< typename Type // Data type of the vector
2252  , bool TF > // Transpose flag
2253 class HybridVector<Type,0UL,TF>;
2255 //*************************************************************************************************
2256 
2257 
2258 
2259 
2260 
2261 
2262 
2263 
2264 //=================================================================================================
2265 //
2266 // HYBRIDVECTOR OPERATORS
2267 //
2268 //=================================================================================================
2269 
2270 //*************************************************************************************************
2273 template< typename Type, size_t N, bool TF >
2274 inline void reset( HybridVector<Type,N,TF>& v );
2275 
2276 template< typename Type, size_t N, bool TF >
2277 inline void clear( HybridVector<Type,N,TF>& v );
2278 
2279 template< typename Type, size_t N, bool TF >
2280 inline bool isDefault( const HybridVector<Type,N,TF>& v );
2281 
2282 template< typename Type, size_t N, bool TF >
2283 inline bool isIntact( const HybridVector<Type,N,TF>& v );
2284 
2285 template< typename Type, size_t N, bool TF >
2286 inline void swap( HybridVector<Type,N,TF>& a, HybridVector<Type,N,TF>& b ) /* throw() */;
2287 
2288 template< typename Type, size_t N, bool TF >
2289 inline void move( HybridVector<Type,N,TF>& dst, HybridVector<Type,N,TF>& src ) /* throw() */;
2291 //*************************************************************************************************
2292 
2293 
2294 //*************************************************************************************************
2301 template< typename Type // Data type of the vector
2302  , size_t N // Number of elements
2303  , bool TF > // Transpose flag
2305 {
2306  v.reset();
2307 }
2308 //*************************************************************************************************
2309 
2310 
2311 //*************************************************************************************************
2318 template< typename Type // Data type of the vector
2319  , size_t N // Number of elements
2320  , bool TF > // Transpose flag
2322 {
2323  v.clear();
2324 }
2325 //*************************************************************************************************
2326 
2327 
2328 //*************************************************************************************************
2345 template< typename Type // Data type of the vector
2346  , size_t N // Number of elements
2347  , bool TF > // Transpose flag
2348 inline bool isDefault( const HybridVector<Type,N,TF>& v )
2349 {
2350  return ( v.size() == 0UL );
2351 }
2352 //*************************************************************************************************
2353 
2354 
2355 //*************************************************************************************************
2373 template< typename Type // Data type of the vector
2374  , size_t N // Number of elements
2375  , bool TF > // Transpose flag
2376 inline bool isIntact( const HybridVector<Type,N,TF>& v )
2377 {
2378  return ( v.size() <= N );
2379 }
2380 //*************************************************************************************************
2381 
2382 
2383 //*************************************************************************************************
2392 template< typename Type // Data type of the vector
2393  , size_t N // Number of elements
2394  , bool TF > // Transpose flag
2395 inline void swap( HybridVector<Type,N,TF>& a, HybridVector<Type,N,TF>& b ) /* throw() */
2396 {
2397  a.swap( b );
2398 }
2399 //*************************************************************************************************
2400 
2401 
2402 //*************************************************************************************************
2411 template< typename Type // Data type of the vector
2412  , size_t N // Number of elements
2413  , bool TF > // Transpose flag
2414 inline void move( HybridVector<Type,N,TF>& dst, HybridVector<Type,N,TF>& src ) /* throw() */
2415 {
2416  dst = src;
2417 }
2418 //*************************************************************************************************
2419 
2420 
2421 
2422 
2423 //=================================================================================================
2424 //
2425 // HASCONSTDATAACCESS SPECIALIZATIONS
2426 //
2427 //=================================================================================================
2428 
2429 //*************************************************************************************************
2431 template< typename T, size_t N, bool TF >
2432 struct HasConstDataAccess< HybridVector<T,N,TF> > : public IsTrue<true>
2433 {};
2435 //*************************************************************************************************
2436 
2437 
2438 
2439 
2440 //=================================================================================================
2441 //
2442 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2443 //
2444 //=================================================================================================
2445 
2446 //*************************************************************************************************
2448 template< typename T, size_t N, bool TF >
2449 struct HasMutableDataAccess< HybridVector<T,N,TF> > : public IsTrue<true>
2450 {};
2452 //*************************************************************************************************
2453 
2454 
2455 
2456 
2457 //=================================================================================================
2458 //
2459 // ISALIGNED SPECIALIZATIONS
2460 //
2461 //=================================================================================================
2462 
2463 //*************************************************************************************************
2465 template< typename T, size_t N, bool TF >
2466 struct IsAligned< HybridVector<T,N,TF> > : public IsTrue<true>
2467 {};
2469 //*************************************************************************************************
2470 
2471 
2472 
2473 
2474 //=================================================================================================
2475 //
2476 // ISPADDED SPECIALIZATIONS
2477 //
2478 //=================================================================================================
2479 
2480 //*************************************************************************************************
2482 template< typename T, size_t N, bool TF >
2483 struct IsPadded< HybridVector<T,N,TF> > : public IsTrue<usePadding>
2484 {};
2486 //*************************************************************************************************
2487 
2488 
2489 
2490 
2491 //=================================================================================================
2492 //
2493 // ISRESIZABLE SPECIALIZATIONS
2494 //
2495 //=================================================================================================
2496 
2497 //*************************************************************************************************
2499 template< typename T, size_t N, bool TF >
2500 struct IsResizable< HybridVector<T,N,TF> > : public IsTrue<true>
2501 {};
2503 //*************************************************************************************************
2504 
2505 
2506 
2507 
2508 //=================================================================================================
2509 //
2510 // ADDTRAIT SPECIALIZATIONS
2511 //
2512 //=================================================================================================
2513 
2514 //*************************************************************************************************
2516 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2517 struct AddTrait< HybridVector<T1,M,TF>, StaticVector<T2,N,TF> >
2518 {
2519  typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
2520 };
2521 
2522 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2523 struct AddTrait< StaticVector<T1,M,TF>, HybridVector<T2,N,TF> >
2524 {
2525  typedef StaticVector< typename AddTrait<T1,T2>::Type, M, TF > Type;
2526 };
2527 
2528 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2529 struct AddTrait< HybridVector<T1,M,TF>, HybridVector<T2,N,TF> >
2530 {
2531  typedef HybridVector< typename AddTrait<T1,T2>::Type, ( M < N )?( M ):( N ), TF > Type;
2532 };
2534 //*************************************************************************************************
2535 
2536 
2537 
2538 
2539 //=================================================================================================
2540 //
2541 // SUBTRAIT SPECIALIZATIONS
2542 //
2543 //=================================================================================================
2544 
2545 //*************************************************************************************************
2547 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2548 struct SubTrait< HybridVector<T1,M,TF>, StaticVector<T2,N,TF> >
2549 {
2550  typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
2551 };
2552 
2553 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2554 struct SubTrait< StaticVector<T1,M,TF>, HybridVector<T2,N,TF> >
2555 {
2556  typedef StaticVector< typename SubTrait<T1,T2>::Type, M, TF > Type;
2557 };
2558 
2559 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2560 struct SubTrait< HybridVector<T1,M,TF>, HybridVector<T2,N,TF> >
2561 {
2562  typedef HybridVector< typename SubTrait<T1,T2>::Type, ( M < N )?( M ):( N ), TF > Type;
2563 };
2565 //*************************************************************************************************
2566 
2567 
2568 
2569 
2570 //=================================================================================================
2571 //
2572 // MULTTRAIT SPECIALIZATIONS
2573 //
2574 //=================================================================================================
2575 
2576 //*************************************************************************************************
2578 template< typename T1, size_t N, bool TF, typename T2 >
2579 struct MultTrait< HybridVector<T1,N,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2580 {
2581  typedef HybridVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2582 };
2583 
2584 template< typename T1, typename T2, size_t N, bool TF >
2585 struct MultTrait< T1, HybridVector<T2,N,TF>, typename EnableIf< IsNumeric<T1> >::Type >
2586 {
2587  typedef HybridVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2588 };
2589 
2590 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2591 struct MultTrait< HybridVector<T1,M,TF>, StaticVector<T2,N,TF> >
2592 {
2593  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
2594 };
2595 
2596 template< typename T1, size_t M, typename T2, size_t N >
2597 struct MultTrait< HybridVector<T1,M,false>, StaticVector<T2,N,true> >
2598 {
2599  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2600 };
2601 
2602 template< typename T1, size_t M, typename T2, size_t N >
2603 struct MultTrait< HybridVector<T1,M,true>, StaticVector<T2,N,false> >
2604 {
2605  typedef typename MultTrait<T1,T2>::Type Type;
2606 };
2607 
2608 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2609 struct MultTrait< StaticVector<T1,M,TF>, HybridVector<T2,N,TF> >
2610 {
2611  typedef StaticVector< typename MultTrait<T1,T2>::Type, M, TF > Type;
2612 };
2613 
2614 template< typename T1, size_t M, typename T2, size_t N >
2615 struct MultTrait< StaticVector<T1,M,false>, HybridVector<T2,N,true> >
2616 {
2617  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2618 };
2619 
2620 template< typename T1, size_t M, typename T2, size_t N >
2621 struct MultTrait< StaticVector<T1,M,true>, HybridVector<T2,N,false> >
2622 {
2623  typedef typename MultTrait<T1,T2>::Type Type;
2624 };
2625 
2626 template< typename T1, size_t M, bool TF, typename T2, size_t N >
2627 struct MultTrait< HybridVector<T1,M,TF>, HybridVector<T2,N,TF> >
2628 {
2629  typedef HybridVector< typename MultTrait<T1,T2>::Type, ( M < N )?( M ):( N ), TF > Type;
2630 };
2631 
2632 template< typename T1, size_t M, typename T2, size_t N >
2633 struct MultTrait< HybridVector<T1,M,false>, HybridVector<T2,N,true> >
2634 {
2635  typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, false > Type;
2636 };
2637 
2638 template< typename T1, size_t M, typename T2, size_t N >
2639 struct MultTrait< HybridVector<T1,M,true>, HybridVector<T2,N,false> >
2640 {
2641  typedef typename MultTrait<T1,T2>::Type Type;
2642 };
2644 //*************************************************************************************************
2645 
2646 
2647 
2648 
2649 //=================================================================================================
2650 //
2651 // CROSSTRAIT SPECIALIZATIONS
2652 //
2653 //=================================================================================================
2654 
2655 //*************************************************************************************************
2657 template< typename T1, size_t N, typename T2 >
2658 struct CrossTrait< HybridVector<T1,N,false>, StaticVector<T2,3UL,false> >
2659 {
2660  private:
2661  typedef typename MultTrait<T1,T2>::Type T;
2662 
2663  public:
2664  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2665 };
2666 
2667 template< typename T1, typename T2, size_t N >
2668 struct CrossTrait< StaticVector<T1,3UL,false>, HybridVector<T2,N,false> >
2669 {
2670  private:
2671  typedef typename MultTrait<T1,T2>::Type T;
2672 
2673  public:
2674  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2675 };
2676 
2677 template< typename T1, size_t M, typename T2, size_t N >
2678 struct CrossTrait< HybridVector<T1,M,false>, HybridVector<T2,N,false> >
2679 {
2680  private:
2681  typedef typename MultTrait<T1,T2>::Type T;
2682 
2683  public:
2684  typedef StaticVector< typename SubTrait<T,T>::Type, 3UL, false > Type;
2685 };
2687 //*************************************************************************************************
2688 
2689 
2690 
2691 
2692 //=================================================================================================
2693 //
2694 // DIVTRAIT SPECIALIZATIONS
2695 //
2696 //=================================================================================================
2697 
2698 //*************************************************************************************************
2700 template< typename T1, size_t N, bool TF, typename T2 >
2701 struct DivTrait< HybridVector<T1,N,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
2702 {
2703  typedef HybridVector< typename DivTrait<T1,T2>::Type, N, TF > Type;
2704 };
2706 //*************************************************************************************************
2707 
2708 
2709 
2710 
2711 //=================================================================================================
2712 //
2713 // MATHTRAIT SPECIALIZATIONS
2714 //
2715 //=================================================================================================
2716 
2717 //*************************************************************************************************
2719 template< typename T1, size_t N, bool TF, typename T2 >
2720 struct MathTrait< HybridVector<T1,N,TF>, HybridVector<T2,N,TF> >
2721 {
2722  typedef StaticVector< typename MathTrait<T1,T2>::HighType, N, TF > HighType;
2723  typedef StaticVector< typename MathTrait<T1,T2>::LowType , N, TF > LowType;
2724 };
2726 //*************************************************************************************************
2727 
2728 
2729 
2730 
2731 //=================================================================================================
2732 //
2733 // SUBVECTORTRAIT SPECIALIZATIONS
2734 //
2735 //=================================================================================================
2736 
2737 //*************************************************************************************************
2739 template< typename T1, size_t N, bool TF >
2740 struct SubvectorTrait< HybridVector<T1,N,TF> >
2741 {
2742  typedef HybridVector<T1,N,TF> Type;
2743 };
2745 //*************************************************************************************************
2746 
2747 } // namespace blaze
2748 
2749 #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
IntrinsicTrait< Type > IT
Intrinsic trait for the vector element type.
Definition: HybridVector.h:170
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
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 mathematical functions.
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
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: HybridVector.h:1374
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
HybridVector()
The default constructor for HybridVector.
Definition: HybridVector.h:468
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the vector.
Definition: HybridVector.h:1851
AlignedArray< Type, NN > v_
The statically allocated vector elements.
Definition: HybridVector.h:428
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 capacity() const
Returns the maximum capacity of the vector.
Definition: HybridVector.h:1239
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 IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the vector.
Definition: HybridVector.h:1732
Header file for the IsSame and IsStrictlySame type traits.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
bool isAligned() const
Returns whether the vector is properly aligned in memory.
Definition: HybridVector.h:1651
Type ElementType
Type of the vector elements.
Definition: HybridVector.h:183
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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: HybridVector.h:1257
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.
Iterator begin()
Returns an iterator to the first element of the hybrid vector.
Definition: HybridVector.h:840
Efficient implementation of a dynamically sized vector with static memory.The HybridVector class temp...
Definition: Forward.h:59
HybridVector< Type, N,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: HybridVector.h:182
Rebind mechanism to obtain a HybridVector with different data/element type.
Definition: HybridVector.h:201
ConstIterator cbegin() const
Returns an iterator to the first element of the hybrid vector.
Definition: HybridVector.h:870
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
HybridVector< ET, N, TF > Other
The type of the other HybridVector.
Definition: HybridVector.h:202
Header file for the multiplication trait.
ConstIterator cend() const
Returns an iterator just past the last element of the hybrid vector.
Definition: HybridVector.h:917
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
size_t size() const
Returns the current size/dimension of the vector.
Definition: HybridVector.h:1224
DenseIterator< Type, aligned > Iterator
Iterator over non-constant elements.
Definition: HybridVector.h:193
#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.
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Store of an intrinsic element of the vector.
Definition: HybridVector.h:1763
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
Header file for the IsAligned type trait.
BLAZE_ALWAYS_INLINE void storea(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the vector.
Definition: HybridVector.h:1787
#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
Reference operator[](size_t index)
Subscript operator for the direct access to the vector elements.
Definition: HybridVector.h:721
BLAZE_ALWAYS_INLINE IntrinsicType loada(size_t index) const
Aligned load of an intrinsic element of the vector.
Definition: HybridVector.h:1699
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
static const size_t NN
Alignment adjustment.
Definition: HybridVector.h:175
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
const Type * ConstPointer
Pointer to a constant vector value.
Definition: HybridVector.h:191
DenseIterator< const Type, aligned > ConstIterator
Iterator over constant elements.
Definition: HybridVector.h:194
void clear()
Clearing the vector.
Definition: HybridVector.h:1298
const Type & ReturnType
Return type for expression template evaluations.
Definition: HybridVector.h:185
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.
void resize(size_t n, bool preserve=true)
Changing the size of the vector.
Definition: HybridVector.h:1339
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
size_t size_
The current size/dimension of the vector.
Definition: HybridVector.h:434
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the vector.
Definition: HybridVector.h:1820
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
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
const HybridVector & CompositeType
Data type for composite expression templates.
Definition: HybridVector.h:186
Header file for run time assertion macros.
Type * Pointer
Pointer to a non-constant vector value.
Definition: HybridVector.h:190
Header file for the addition trait.
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
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.
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.
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
Pointer data()
Low-level data access to the vector elements.
Definition: HybridVector.h:808
void swap(HybridVector &v)
Swapping the contents of two hybrid vectors.
Definition: HybridVector.h:1411
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
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: HybridVector.h:1632
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
Type & Reference
Reference to a non-constant vector value.
Definition: HybridVector.h:188
void reset()
Reset to the default initial values.
Definition: HybridVector.h:1279
Reference at(size_t index)
Checked access to the vector elements.
Definition: HybridVector.h:764
HybridVector< Type, N, TF > This
Type of this HybridVector instance.
Definition: HybridVector.h:180
Iterator end()
Returns an iterator just past the last element of the hybrid vector.
Definition: HybridVector.h:885
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
const Type & ConstReference
Reference to a constant vector value.
Definition: HybridVector.h:189
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: HybridVector.h:1611
Header file for the default transpose flag for all vectors of the Blaze library.
IT::Type IntrinsicType
Intrinsic type of the vector elements.
Definition: HybridVector.h:184
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 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 IntrinsicType load(size_t index) const
Load of an intrinsic element of the vector.
Definition: HybridVector.h:1675
#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
Header file for the IsResizable type trait.
System settings for the inline keywords.
#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
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
This ResultType
Result type for expression template evaluations.
Definition: HybridVector.h:181
Compile time integral round up operation.The NextMultiple class template rounds up the given template...
Definition: NextMultiple.h:81