Blaze  3.6
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>
35 #include <utility>
36 #include <blaze/math/Aliases.h>
41 #include <blaze/math/Exception.h>
44 #include <blaze/math/Forward.h>
45 #include <blaze/math/Infinity.h>
47 #include <blaze/math/shims/Clear.h>
51 #include <blaze/math/SIMD.h>
89 #include <blaze/system/Inline.h>
96 #include <blaze/util/Assert.h>
102 #include <blaze/util/DisableIf.h>
103 #include <blaze/util/EnableIf.h>
105 #include <blaze/util/MaybeUnused.h>
106 #include <blaze/util/Memory.h>
107 #include <blaze/util/StaticAssert.h>
108 #include <blaze/util/Types.h>
113 
114 
115 namespace blaze {
116 
117 //=================================================================================================
118 //
119 // CLASS DEFINITION
120 //
121 //=================================================================================================
122 
123 //*************************************************************************************************
193 template< typename Type // Data type of the vector
194  , size_t N // Number of elements
195  , bool TF = defaultTransposeFlag > // Transpose flag
196 class HybridVector
197  : public DenseVector< HybridVector<Type,N,TF>, TF >
198 {
199  private:
200  //**********************************************************************************************
202  static constexpr size_t SIMDSIZE = SIMDTrait<Type>::size;
203 
205  static constexpr size_t NN = ( usePadding ? nextMultiple( N, SIMDSIZE ) : N );
206 
208  static constexpr bool align = ( NN >= SIMDSIZE );
209  //**********************************************************************************************
210 
211  public:
212  //**Type definitions****************************************************************************
215  using ResultType = This;
217  using ElementType = Type;
219  using ReturnType = const Type&;
220  using CompositeType = const HybridVector&;
221 
222  using Reference = Type&;
223  using ConstReference = const Type&;
224  using Pointer = Type*;
225  using ConstPointer = const Type*;
226 
229  //**********************************************************************************************
230 
231  //**Rebind struct definition********************************************************************
234  template< typename NewType > // Data type of the other vector
235  struct Rebind {
237  };
238  //**********************************************************************************************
239 
240  //**Resize struct definition********************************************************************
243  template< size_t NewN > // Number of elements of the other vector
244  struct Resize {
246  };
247  //**********************************************************************************************
248 
249  //**Compilation flags***************************************************************************
251 
255  static constexpr bool simdEnabled = IsVectorizable_v<Type>;
256 
258 
261  static constexpr bool smpAssignable = false;
262  //**********************************************************************************************
263 
264  //**Constructors********************************************************************************
267  explicit inline HybridVector();
268  explicit inline HybridVector( size_t n );
269  explicit inline HybridVector( size_t n, const Type& init );
270  inline HybridVector( initializer_list<Type> list );
271 
272  template< typename Other >
273  explicit inline HybridVector( size_t n, const Other* array );
274 
275  template< typename Other, size_t Dim >
276  explicit inline HybridVector( const Other (&array)[Dim] );
277 
278  inline HybridVector( const HybridVector& v );
279  template< typename VT > inline HybridVector( const Vector<VT,TF>& v );
281  //**********************************************************************************************
282 
283  //**Destructor**********************************************************************************
286  ~HybridVector() = default;
288  //**********************************************************************************************
289 
290  //**Data access functions***********************************************************************
293  inline Reference operator[]( size_t index ) noexcept;
294  inline ConstReference operator[]( size_t index ) const noexcept;
295  inline Reference at( size_t index );
296  inline ConstReference at( size_t index ) const;
297  inline Pointer data () noexcept;
298  inline ConstPointer data () const noexcept;
299  inline Iterator begin () noexcept;
300  inline ConstIterator begin () const noexcept;
301  inline ConstIterator cbegin() const noexcept;
302  inline Iterator end () noexcept;
303  inline ConstIterator end () const noexcept;
304  inline ConstIterator cend () const noexcept;
306  //**********************************************************************************************
307 
308  //**Assignment operators************************************************************************
311  inline HybridVector& operator=( const Type& rhs );
312  inline HybridVector& operator=( initializer_list<Type> list );
313 
314  template< typename Other, size_t Dim >
315  inline HybridVector& operator=( const Other (&array)[Dim] );
316 
317  inline HybridVector& operator= ( const HybridVector& rhs );
318  template< typename VT > inline HybridVector& operator= ( const Vector<VT,TF>& rhs );
319  template< typename VT > inline HybridVector& operator+=( const Vector<VT,TF>& rhs );
320  template< typename VT > inline HybridVector& operator-=( const Vector<VT,TF>& rhs );
321  template< typename VT > inline HybridVector& operator*=( const Vector<VT,TF>& rhs );
322  template< typename VT > inline HybridVector& operator/=( const DenseVector<VT,TF>& rhs );
323  template< typename VT > inline HybridVector& operator%=( const Vector<VT,TF>& rhs );
325  //**********************************************************************************************
326 
327  //**Utility functions***************************************************************************
330  inline size_t size() const noexcept;
331  static inline constexpr size_t spacing() noexcept;
332  static inline constexpr size_t capacity() noexcept;
333  inline size_t nonZeros() const;
334  inline void reset();
335  inline void clear();
336  inline void resize( size_t n, bool preserve=true );
337  inline void extend( size_t n, bool preserve=true );
338  inline void swap( HybridVector& v ) noexcept;
340  //**********************************************************************************************
341 
342  //**Numeric functions***************************************************************************
345  template< typename Other > inline HybridVector& scale( const Other& scalar );
347  //**********************************************************************************************
348 
349  //**Memory functions****************************************************************************
352  static inline void* operator new ( std::size_t size );
353  static inline void* operator new[]( std::size_t size );
354  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
355  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
356 
357  static inline void operator delete ( void* ptr );
358  static inline void operator delete[]( void* ptr );
359  static inline void operator delete ( void* ptr, const std::nothrow_t& );
360  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
362  //**********************************************************************************************
363 
364  private:
365  //**********************************************************************************************
367  template< typename VT >
369  static constexpr bool VectorizedAssign_v =
370  ( useOptimizedKernels &&
371  simdEnabled && VT::simdEnabled &&
372  IsSIMDCombinable_v< Type, ElementType_t<VT> > );
374  //**********************************************************************************************
375 
376  //**********************************************************************************************
378  template< typename VT >
380  static constexpr bool VectorizedAddAssign_v =
381  ( useOptimizedKernels &&
382  simdEnabled && VT::simdEnabled &&
383  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
384  HasSIMDAdd_v< Type, ElementType_t<VT> > );
386  //**********************************************************************************************
387 
388  //**********************************************************************************************
390  template< typename VT >
392  static constexpr bool VectorizedSubAssign_v =
393  ( useOptimizedKernels &&
394  simdEnabled && VT::simdEnabled &&
395  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
396  HasSIMDSub_v< Type, ElementType_t<VT> > );
398  //**********************************************************************************************
399 
400  //**********************************************************************************************
402  template< typename VT >
404  static constexpr bool VectorizedMultAssign_v =
405  ( useOptimizedKernels &&
406  simdEnabled && VT::simdEnabled &&
407  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
408  HasSIMDMult_v< Type, ElementType_t<VT> > );
410  //**********************************************************************************************
411 
412  //**********************************************************************************************
414  template< typename VT >
416  static constexpr bool VectorizedDivAssign_v =
417  ( useOptimizedKernels &&
418  simdEnabled && VT::simdEnabled &&
419  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
420  HasSIMDDiv_v< Type, ElementType_t<VT> > );
422  //**********************************************************************************************
423 
424  public:
425  //**Debugging functions*************************************************************************
428  inline bool isIntact() const noexcept;
430  //**********************************************************************************************
431 
432  //**Expression template evaluation functions****************************************************
435  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
436  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
437 
438  static inline constexpr bool isAligned() noexcept;
439 
440  BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
441  BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
442  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
443 
444  BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
445  BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
446  BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
447  BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
448 
449  template< typename VT >
450  inline auto assign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT> >;
451 
452  template< typename VT >
453  inline auto assign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT> >;
454 
455  template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
456 
457  template< typename VT >
458  inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT> >;
459 
460  template< typename VT >
461  inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT> >;
462 
463  template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
464 
465  template< typename VT >
466  inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT> >;
467 
468  template< typename VT >
469  inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT> >;
470 
471  template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
472 
473  template< typename VT >
474  inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT> >;
475 
476  template< typename VT >
477  inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT> >;
478 
479  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
480 
481  template< typename VT >
482  inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT> >;
483 
484  template< typename VT >
485  inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT> >;
487  //**********************************************************************************************
488 
489  private:
490  //**********************************************************************************************
492  static constexpr size_t Alignment =
493  ( NN >= SIMDSIZE ? AlignmentOf_v<Type> : std::alignment_of<Type>::value );
494 
497  //**********************************************************************************************
498 
499  //**Member variables****************************************************************************
503 
508  size_t size_;
509 
510  //**********************************************************************************************
511 
512  //**Compile time checks*************************************************************************
518  BLAZE_STATIC_ASSERT( !usePadding || NN % SIMDSIZE == 0UL );
519  BLAZE_STATIC_ASSERT( NN >= N );
521  //**********************************************************************************************
522 };
523 //*************************************************************************************************
524 
525 
526 
527 
528 //=================================================================================================
529 //
530 // CONSTRUCTORS
531 //
532 //=================================================================================================
533 
534 //*************************************************************************************************
539 template< typename Type // Data type of the vector
540  , size_t N // Number of elements
541  , bool TF > // Transpose flag
542 inline HybridVector<Type,N,TF>::HybridVector()
543  : v_ () // The statically allocated vector elements
544  , size_( 0UL ) // The current size/dimension of the vector
545 {
546  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
547 
548  if( IsNumeric_v<Type> ) {
549  for( size_t i=0UL; i<NN; ++i )
550  v_[i] = Type();
551  }
552 
553  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
554 }
555 //*************************************************************************************************
556 
557 
558 //*************************************************************************************************
568 template< typename Type // Data type of the vector
569  , size_t N // Number of elements
570  , bool TF > // Transpose flag
572  : v_ () // The statically allocated vector elements
573  , size_( n ) // The current size/dimension of the vector
574 {
575  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
576 
577  if( n > N ) {
578  BLAZE_THROW_INVALID_ARGUMENT( "Invalid size for hybrid vector" );
579  }
580 
581  if( IsNumeric_v<Type> ) {
582  for( size_t i=0UL; i<NN; ++i )
583  v_[i] = Type();
584  }
585 
586  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
587 }
588 //*************************************************************************************************
589 
590 
591 //*************************************************************************************************
602 template< typename Type // Data type of the vector
603  , size_t N // Number of elements
604  , bool TF > // Transpose flag
605 inline HybridVector<Type,N,TF>::HybridVector( size_t n, const Type& init )
606  : v_ () // The statically allocated vector elements
607  , size_( n ) // The current size/dimension of the vector
608 {
609  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
610 
611  if( n > N ) {
612  BLAZE_THROW_INVALID_ARGUMENT( "Invalid size for hybrid vector" );
613  }
614 
615  for( size_t i=0UL; i<n; ++i )
616  v_[i] = init;
617 
618  if( IsNumeric_v<Type> ) {
619  for( size_t i=n; i<NN; ++i )
620  v_[i] = Type();
621  }
622 
623  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
624 }
625 //*************************************************************************************************
626 
627 
628 //*************************************************************************************************
646 template< typename Type // Data type of the vector
647  , size_t N // Number of elements
648  , bool TF > // Transpose flag
650  : v_ () // The statically allocated vector elements
651  , size_( list.size() ) // The current size/dimension of the vector
652 {
653  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
654 
655  if( size_ > N ) {
656  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of hybrid vector" );
657  }
658 
659  std::fill( std::copy( list.begin(), list.end(), v_.data() ), v_.data()+NN, Type() );
660 
661  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
662 }
663 //*************************************************************************************************
664 
665 
666 //*************************************************************************************************
689 template< typename Type // Data type of the vector
690  , size_t N // Number of elements
691  , bool TF > // Transpose flag
692 template< typename Other > // Data type of the initialization array
693 inline HybridVector<Type,N,TF>::HybridVector( size_t n, const Other* array )
694  : v_ () // The statically allocated vector elements
695  , size_( n ) // The current size/dimension of the vector
696 {
697  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
698 
699  if( n > N ) {
700  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of hybrid vector" );
701  }
702 
703  for( size_t i=0UL; i<n; ++i )
704  v_[i] = array[i];
705 
706  if( IsNumeric_v<Type> ) {
707  for( size_t i=n; i<NN; ++i )
708  v_[i] = Type();
709  }
710 
711  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
712 }
713 //*************************************************************************************************
714 
715 
716 //*************************************************************************************************
734 template< typename Type // Data type of the vector
735  , size_t N // Number of elements
736  , bool TF > // Transpose flag
737 template< typename Other // Data type of the initialization array
738  , size_t Dim > // Number of elements of the initialization array
739 inline HybridVector<Type,N,TF>::HybridVector( const Other (&array)[Dim] )
740  : v_ () // The statically allocated vector elements
741  , size_( Dim ) // The current size/dimension of the vector
742 {
743  BLAZE_STATIC_ASSERT( Dim <= N );
744  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
745 
746  for( size_t i=0UL; i<Dim; ++i )
747  v_[i] = array[i];
748 
749  if( IsNumeric_v<Type> ) {
750  for( size_t i=Dim; i<NN; ++i )
751  v_[i] = Type();
752  }
753 
754  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
755 }
756 //*************************************************************************************************
757 
758 
759 //*************************************************************************************************
766 template< typename Type // Data type of the vector
767  , size_t N // Number of elements
768  , bool TF > // Transpose flag
770  : v_ () // The statically allocated vector elements
771  , size_( v.size_ ) // The current size/dimension of the vector
772 {
773  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
774 
775  for( size_t i=0UL; i<size_; ++i )
776  v_[i] = v.v_[i];
777 
778  if( IsNumeric_v<Type> ) {
779  for( size_t i=size_; i<NN; ++i )
780  v_[i] = Type();
781  }
782 
783  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
784 }
785 //*************************************************************************************************
786 
787 
788 //*************************************************************************************************
798 template< typename Type // Data type of the vector
799  , size_t N // Number of elements
800  , bool TF > // Transpose flag
801 template< typename VT > // Type of the foreign vector
803  : v_ () // The statically allocated vector elements
804  , size_( (~v).size() ) // The current size/dimension of the vector
805 {
806  using blaze::assign;
807 
808  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
809 
810  if( (~v).size() > N ) {
811  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of hybrid vector" );
812  }
813 
814  for( size_t i=( IsSparseVector_v<VT> ? 0UL : size_ );
815  i<( IsNumeric_v<Type> ? NN : size_ ); ++i ) {
816  v_[i] = Type();
817  }
818 
819  assign( *this, ~v );
820 
821  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
822 }
823 //*************************************************************************************************
824 
825 
826 
827 
828 //=================================================================================================
829 //
830 // DATA ACCESS FUNCTIONS
831 //
832 //=================================================================================================
833 
834 //*************************************************************************************************
843 template< typename Type // Data type of the vector
844  , size_t N // Number of elements
845  , bool TF > // Transpose flag
847  HybridVector<Type,N,TF>::operator[]( size_t index ) noexcept
848 {
849  BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
850  return v_[index];
851 }
852 //*************************************************************************************************
853 
854 
855 //*************************************************************************************************
864 template< typename Type // Data type of the vector
865  , size_t N // Number of elements
866  , bool TF > // Transpose flag
868  HybridVector<Type,N,TF>::operator[]( size_t index ) const noexcept
869 {
870  BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
871  return v_[index];
872 }
873 //*************************************************************************************************
874 
875 
876 //*************************************************************************************************
886 template< typename Type // Data type of the vector
887  , size_t N // Number of elements
888  , bool TF > // Transpose flag
891 {
892  if( index >= size_ ) {
893  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
894  }
895  return (*this)[index];
896 }
897 //*************************************************************************************************
898 
899 
900 //*************************************************************************************************
910 template< typename Type // Data type of the vector
911  , size_t N // Number of elements
912  , bool TF > // Transpose flag
914  HybridVector<Type,N,TF>::at( size_t index ) const
915 {
916  if( index >= size_ ) {
917  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
918  }
919  return (*this)[index];
920 }
921 //*************************************************************************************************
922 
923 
924 //*************************************************************************************************
931 template< typename Type // Data type of the vector
932  , size_t N // Number of elements
933  , bool TF > // Transpose flag
935 {
936  return v_;
937 }
938 //*************************************************************************************************
939 
940 
941 //*************************************************************************************************
948 template< typename Type // Data type of the vector
949  , size_t N // Number of elements
950  , bool TF > // Transpose flag
952 {
953  return v_;
954 }
955 //*************************************************************************************************
956 
957 
958 //*************************************************************************************************
963 template< typename Type // Data type of the vector
964  , size_t N // Number of elements
965  , bool TF > // Transpose flag
967 {
968  return Iterator( v_ );
969 }
970 //*************************************************************************************************
971 
972 
973 //*************************************************************************************************
978 template< typename Type // Data type of the vector
979  , size_t N // Number of elements
980  , bool TF > // Transpose flag
982 {
983  return ConstIterator( v_ );
984 }
985 //*************************************************************************************************
986 
987 
988 //*************************************************************************************************
993 template< typename Type // Data type of the vector
994  , size_t N // Number of elements
995  , bool TF > // Transpose flag
997 {
998  return ConstIterator( v_ );
999 }
1000 //*************************************************************************************************
1001 
1002 
1003 //*************************************************************************************************
1008 template< typename Type // Data type of the vector
1009  , size_t N // Number of elements
1010  , bool TF > // Transpose flag
1012 {
1013  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
1014  return Iterator( v_ + size_ );
1015 }
1016 //*************************************************************************************************
1017 
1018 
1019 //*************************************************************************************************
1024 template< typename Type // Data type of the vector
1025  , size_t N // Number of elements
1026  , bool TF > // Transpose flag
1028 {
1029  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
1030  return ConstIterator( v_ + size_ );
1031 }
1032 //*************************************************************************************************
1033 
1034 
1035 //*************************************************************************************************
1040 template< typename Type // Data type of the vector
1041  , size_t N // Number of elements
1042  , bool TF > // Transpose flag
1044 {
1045  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
1046  return ConstIterator( v_ + size_ );
1047 }
1048 //*************************************************************************************************
1049 
1050 
1051 
1052 
1053 //=================================================================================================
1054 //
1055 // ASSIGNMENT OPERATORS
1056 //
1057 //=================================================================================================
1058 
1059 //*************************************************************************************************
1065 template< typename Type // Data type of the vector
1066  , size_t N // Number of elements
1067  , bool TF > // Transpose flag
1069 {
1070  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
1071 
1072  for( size_t i=0UL; i<size_; ++i )
1073  v_[i] = rhs;
1074  return *this;
1075 }
1076 //*************************************************************************************************
1077 
1078 
1079 //*************************************************************************************************
1098 template< typename Type // Data type of the vector
1099  , size_t N // Number of elements
1100  , bool TF > // Transpose flag
1102 {
1103  if( list.size() > N ) {
1104  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to hybrid vector" );
1105  }
1106 
1107  resize( list.size(), false );
1108  std::copy( list.begin(), list.end(), v_.data() );
1109 
1110  return *this;
1111 }
1112 //*************************************************************************************************
1113 
1114 
1115 //*************************************************************************************************
1134 template< typename Type // Data type of the vector
1135  , size_t N // Number of elements
1136  , bool TF > // Transpose flag
1137 template< typename Other // Data type of the initialization array
1138  , size_t Dim > // Number of elements of the initialization array
1140 {
1141  BLAZE_STATIC_ASSERT( Dim <= N );
1142 
1143  resize( Dim, false );
1144 
1145  for( size_t i=0UL; i<Dim; ++i )
1146  v_[i] = array[i];
1147 
1148  return *this;
1149 }
1150 //*************************************************************************************************
1151 
1152 
1153 //*************************************************************************************************
1161 template< typename Type // Data type of the vector
1162  , size_t N // Number of elements
1163  , bool TF > // Transpose flag
1165 {
1166  using blaze::assign;
1167 
1168  BLAZE_INTERNAL_ASSERT( size_ <= N, "Invalid size detected" );
1169 
1170  resize( rhs.size() );
1171  assign( *this, ~rhs );
1172 
1173  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1174 
1175  return *this;
1176 }
1177 //*************************************************************************************************
1178 
1179 
1180 //*************************************************************************************************
1190 template< typename Type // Data type of the vector
1191  , size_t N // Number of elements
1192  , bool TF > // Transpose flag
1193 template< typename VT > // Type of the right-hand side vector
1195 {
1196  using blaze::assign;
1197 
1198  if( (~rhs).size() > N ) {
1199  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to hybrid vector" );
1200  }
1201 
1202  if( (~rhs).canAlias( this ) ) {
1203  HybridVector tmp( ~rhs );
1204  swap( tmp );
1205  }
1206  else {
1207  resize( (~rhs).size(), false );
1208  if( IsSparseVector_v<VT> )
1209  reset();
1210  assign( *this, ~rhs );
1211  }
1212 
1213  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1214 
1215  return *this;
1216 }
1217 //*************************************************************************************************
1218 
1219 
1220 //*************************************************************************************************
1230 template< typename Type // Data type of the vector
1231  , size_t N // Number of elements
1232  , bool TF > // Transpose flag
1233 template< typename VT > // Type of the right-hand side vector
1235 {
1236  using blaze::addAssign;
1237 
1238  if( (~rhs).size() != size_ ) {
1239  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1240  }
1241 
1242  if( (~rhs).canAlias( this ) ) {
1243  const ResultType_t<VT> tmp( ~rhs );
1244  addAssign( *this, tmp );
1245  }
1246  else {
1247  addAssign( *this, ~rhs );
1248  }
1249 
1250  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1251 
1252  return *this;
1253 }
1254 //*************************************************************************************************
1255 
1256 
1257 //*************************************************************************************************
1267 template< typename Type // Data type of the vector
1268  , size_t N // Number of elements
1269  , bool TF > // Transpose flag
1270 template< typename VT > // Type of the right-hand side vector
1272 {
1273  using blaze::subAssign;
1274 
1275  if( (~rhs).size() != size_ ) {
1276  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1277  }
1278 
1279  if( (~rhs).canAlias( this ) ) {
1280  const ResultType_t<VT> tmp( ~rhs );
1281  subAssign( *this, tmp );
1282  }
1283  else {
1284  subAssign( *this, ~rhs );
1285  }
1286 
1287  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1288 
1289  return *this;
1290 }
1291 //*************************************************************************************************
1292 
1293 
1294 //*************************************************************************************************
1305 template< typename Type // Data type of the vector
1306  , size_t N // Number of elements
1307  , bool TF > // Transpose flag
1308 template< typename VT > // Type of the right-hand side vector
1310 {
1311  using blaze::assign;
1312  using blaze::multAssign;
1313 
1314  if( (~rhs).size() != size_ ) {
1315  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1316  }
1317 
1318  if( IsSparseVector_v<VT> || (~rhs).canAlias( this ) ) {
1319  const HybridVector tmp( *this * (~rhs) );
1320  assign( *this, tmp );
1321  }
1322  else {
1323  multAssign( *this, ~rhs );
1324  }
1325 
1326  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1327 
1328  return *this;
1329 }
1330 //*************************************************************************************************
1331 
1332 
1333 //*************************************************************************************************
1343 template< typename Type // Data type of the vector
1344  , size_t N // Number of elements
1345  , bool TF > // Transpose flag
1346 template< typename VT > // Type of the right-hand side vector
1348 {
1349  using blaze::assign;
1350  using blaze::divAssign;
1351 
1352  if( (~rhs).size() != size_ ) {
1353  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1354  }
1355 
1356  if( (~rhs).canAlias( this ) ) {
1357  const HybridVector tmp( *this / (~rhs) );
1358  assign( *this, tmp );
1359  }
1360  else {
1361  divAssign( *this, ~rhs );
1362  }
1363 
1364  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1365 
1366  return *this;
1367 }
1368 //*************************************************************************************************
1369 
1370 
1371 //*************************************************************************************************
1382 template< typename Type // Data type of the vector
1383  , size_t N // Number of elements
1384  , bool TF > // Transpose flag
1385 template< typename VT > // Type of the right-hand side vector
1387 {
1388  using blaze::assign;
1389 
1392 
1393  using CrossType = CrossTrait_t< This, ResultType_t<VT> >;
1394 
1398 
1399  if( size_ != 3UL || (~rhs).size() != 3UL ) {
1400  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1401  }
1402 
1403  const CrossType tmp( *this % (~rhs) );
1404  assign( *this, tmp );
1405 
1406  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1407 
1408  return *this;
1409 }
1410 //*************************************************************************************************
1411 
1412 
1413 
1414 
1415 //=================================================================================================
1416 //
1417 // UTILITY FUNCTIONS
1418 //
1419 //=================================================================================================
1420 
1421 //*************************************************************************************************
1426 template< typename Type // Data type of the vector
1427  , size_t N // Number of elements
1428  , bool TF > // Transpose flag
1429 inline size_t HybridVector<Type,N,TF>::size() const noexcept
1430 {
1431  return size_;
1432 }
1433 //*************************************************************************************************
1434 
1435 
1436 //*************************************************************************************************
1444 template< typename Type // Data type of the vector
1445  , size_t N // Number of elements
1446  , bool TF > // Transpose flag
1447 inline constexpr size_t HybridVector<Type,N,TF>::spacing() noexcept
1448 {
1449  return NN;
1450 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1459 template< typename Type // Data type of the vector
1460  , size_t N // Number of elements
1461  , bool TF > // Transpose flag
1462 inline constexpr size_t HybridVector<Type,N,TF>::capacity() noexcept
1463 {
1464  return NN;
1465 }
1466 //*************************************************************************************************
1467 
1468 
1469 //*************************************************************************************************
1477 template< typename Type // Data type of the vector
1478  , size_t N // Number of elements
1479  , bool TF > // Transpose flag
1481 {
1482  size_t nonzeros( 0 );
1483 
1484  for( size_t i=0UL; i<size_; ++i ) {
1485  if( !isDefault( v_[i] ) )
1486  ++nonzeros;
1487  }
1488 
1489  return nonzeros;
1490 }
1491 //*************************************************************************************************
1492 
1493 
1494 //*************************************************************************************************
1499 template< typename Type // Data type of the vector
1500  , size_t N // Number of elements
1501  , bool TF > // Transpose flag
1503 {
1504  using blaze::clear;
1505  for( size_t i=0UL; i<size_; ++i )
1506  clear( v_[i] );
1507 }
1508 //*************************************************************************************************
1509 
1510 
1511 //*************************************************************************************************
1518 template< typename Type // Data type of the vector
1519  , size_t N // Number of elements
1520  , bool TF > // Transpose flag
1522 {
1523  resize( 0UL );
1524 }
1525 //*************************************************************************************************
1526 
1527 
1528 //*************************************************************************************************
1559 template< typename Type // Data type of the vector
1560  , size_t N // Number of elements
1561  , bool TF > // Transpose flag
1562 inline void HybridVector<Type,N,TF>::resize( size_t n, bool preserve )
1563 {
1564  MAYBE_UNUSED( preserve );
1565 
1566  if( n > N ) {
1567  BLAZE_THROW_INVALID_ARGUMENT( "Invalid size for hybrid vector" );
1568  }
1569 
1570  if( IsNumeric_v<Type> && n < size_ ) {
1571  for( size_t i=n; i<size_; ++i )
1572  v_[i] = Type();
1573  }
1574 
1575  size_ = n;
1576 }
1577 //*************************************************************************************************
1578 
1579 
1580 //*************************************************************************************************
1594 template< typename Type // Data type of the vector
1595  , size_t N // Number of elements
1596  , bool TF > // Transpose flag
1597 inline void HybridVector<Type,N,TF>::extend( size_t n, bool preserve )
1598 {
1599  MAYBE_UNUSED( preserve );
1600  resize( size_+n );
1601 }
1602 //*************************************************************************************************
1603 
1604 
1605 //*************************************************************************************************
1611 template< typename Type // Data type of the vector
1612  , size_t N // Number of elements
1613  , bool TF > // Transpose flag
1615 {
1616  using std::swap;
1617 
1618  const size_t maxsize( max( size_, v.size_ ) );
1619  for( size_t i=0UL; i<maxsize; ++i )
1620  swap( v_[i], v.v_[i] );
1621  swap( size_, v.size_ );
1622 }
1623 //*************************************************************************************************
1624 
1625 
1626 
1627 
1628 //=================================================================================================
1629 //
1630 // NUMERIC FUNCTIONS
1631 //
1632 //=================================================================================================
1633 
1634 //*************************************************************************************************
1651 template< typename Type // Data type of the vector
1652  , size_t N // Number of elements
1653  , bool TF > // Transpose flag
1654 template< typename Other > // Data type of the scalar value
1656 {
1657  for( size_t i=0; i<size_; ++i )
1658  v_[i] *= scalar;
1659  return *this;
1660 }
1661 //*************************************************************************************************
1662 
1663 
1664 
1665 
1666 //=================================================================================================
1667 //
1668 // MEMORY FUNCTIONS
1669 //
1670 //=================================================================================================
1671 
1672 //*************************************************************************************************
1682 template< typename Type // Data type of the vector
1683  , size_t N // Number of elements
1684  , bool TF > // Transpose flag
1685 inline void* HybridVector<Type,N,TF>::operator new( std::size_t size )
1686 {
1687  MAYBE_UNUSED( size );
1688 
1689  BLAZE_INTERNAL_ASSERT( size == sizeof( HybridVector ), "Invalid number of bytes detected" );
1690 
1691  return allocate<HybridVector>( 1UL );
1692 }
1693 //*************************************************************************************************
1694 
1695 
1696 //*************************************************************************************************
1706 template< typename Type // Data type of the vector
1707  , size_t N // Number of elements
1708  , bool TF > // Transpose flag
1709 inline void* HybridVector<Type,N,TF>::operator new[]( std::size_t size )
1710 {
1711  BLAZE_INTERNAL_ASSERT( size >= sizeof( HybridVector ) , "Invalid number of bytes detected" );
1712  BLAZE_INTERNAL_ASSERT( size % sizeof( HybridVector ) == 0UL, "Invalid number of bytes detected" );
1713 
1714  return allocate<HybridVector>( size/sizeof(HybridVector) );
1715 }
1716 //*************************************************************************************************
1717 
1718 
1719 //*************************************************************************************************
1729 template< typename Type // Data type of the vector
1730  , size_t N // Number of elements
1731  , bool TF > // Transpose flag
1732 inline void* HybridVector<Type,N,TF>::operator new( std::size_t size, const std::nothrow_t& )
1733 {
1734  MAYBE_UNUSED( size );
1735 
1736  BLAZE_INTERNAL_ASSERT( size == sizeof( HybridVector ), "Invalid number of bytes detected" );
1737 
1738  return allocate<HybridVector>( 1UL );
1739 }
1740 //*************************************************************************************************
1741 
1742 
1743 //*************************************************************************************************
1753 template< typename Type // Data type of the vector
1754  , size_t N // Number of elements
1755  , bool TF > // Transpose flag
1756 inline void* HybridVector<Type,N,TF>::operator new[]( std::size_t size, const std::nothrow_t& )
1757 {
1758  BLAZE_INTERNAL_ASSERT( size >= sizeof( HybridVector ) , "Invalid number of bytes detected" );
1759  BLAZE_INTERNAL_ASSERT( size % sizeof( HybridVector ) == 0UL, "Invalid number of bytes detected" );
1760 
1761  return allocate<HybridVector>( size/sizeof(HybridVector) );
1762 }
1763 //*************************************************************************************************
1764 
1765 
1766 //*************************************************************************************************
1772 template< typename Type // Data type of the vector
1773  , size_t N // Number of elements
1774  , bool TF > // Transpose flag
1775 inline void HybridVector<Type,N,TF>::operator delete( void* ptr )
1776 {
1777  deallocate( static_cast<HybridVector*>( ptr ) );
1778 }
1779 //*************************************************************************************************
1780 
1781 
1782 //*************************************************************************************************
1788 template< typename Type // Data type of the vector
1789  , size_t N // Number of elements
1790  , bool TF > // Transpose flag
1791 inline void HybridVector<Type,N,TF>::operator delete[]( void* ptr )
1792 {
1793  deallocate( static_cast<HybridVector*>( ptr ) );
1794 }
1795 //*************************************************************************************************
1796 
1797 
1798 //*************************************************************************************************
1804 template< typename Type // Data type of the vector
1805  , size_t N // Number of elements
1806  , bool TF > // Transpose flag
1807 inline void HybridVector<Type,N,TF>::operator delete( void* ptr, const std::nothrow_t& )
1808 {
1809  deallocate( static_cast<HybridVector*>( ptr ) );
1810 }
1811 //*************************************************************************************************
1812 
1813 
1814 //*************************************************************************************************
1820 template< typename Type // Data type of the vector
1821  , size_t N // Number of elements
1822  , bool TF > // Transpose flag
1823 inline void HybridVector<Type,N,TF>::operator delete[]( void* ptr, const std::nothrow_t& )
1824 {
1825  deallocate( static_cast<HybridVector*>( ptr ) );
1826 }
1827 //*************************************************************************************************
1828 
1829 
1830 
1831 
1832 //=================================================================================================
1833 //
1834 // DEBUGGING FUNCTIONS
1835 //
1836 //=================================================================================================
1837 
1838 //*************************************************************************************************
1847 template< typename Type // Data type of the vector
1848  , size_t N // Number of elements
1849  , bool TF > // Transpose flag
1850 inline bool HybridVector<Type,N,TF>::isIntact() const noexcept
1851 {
1852  if( size_ > N )
1853  return false;
1854 
1855  if( IsVectorizable_v<Type> ) {
1856  for( size_t i=size_; i<NN; ++i ) {
1857  if( v_[i] != Type() )
1858  return false;
1859  }
1860  }
1861 
1862  return true;
1863 }
1864 //*************************************************************************************************
1865 
1866 
1867 
1868 
1869 //=================================================================================================
1870 //
1871 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1872 //
1873 //=================================================================================================
1874 
1875 //*************************************************************************************************
1885 template< typename Type // Data type of the vector
1886  , size_t N // Number of elements
1887  , bool TF > // Transpose flag
1888 template< typename Other > // Data type of the foreign expression
1889 inline bool HybridVector<Type,N,TF>::canAlias( const Other* alias ) const noexcept
1890 {
1891  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1892 }
1893 //*************************************************************************************************
1894 
1895 
1896 //*************************************************************************************************
1906 template< typename Type // Data type of the vector
1907  , size_t N // Number of elements
1908  , bool TF > // Transpose flag
1909 template< typename Other > // Data type of the foreign expression
1910 inline bool HybridVector<Type,N,TF>::isAliased( const Other* alias ) const noexcept
1911 {
1912  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1913 }
1914 //*************************************************************************************************
1915 
1916 
1917 //*************************************************************************************************
1926 template< typename Type // Data type of the vector
1927  , size_t N // Number of elements
1928  , bool TF > // Transpose flag
1929 inline constexpr bool HybridVector<Type,N,TF>::isAligned() noexcept
1930 {
1931  return align;
1932 }
1933 //*************************************************************************************************
1934 
1935 
1936 //*************************************************************************************************
1948 template< typename Type // Data type of the vector
1949  , size_t N // Number of elements
1950  , bool TF > // Transpose flag
1952  HybridVector<Type,N,TF>::load( size_t index ) const noexcept
1953 {
1954  return loada( index );
1955 }
1956 //*************************************************************************************************
1957 
1958 
1959 //*************************************************************************************************
1972 template< typename Type // Data type of the vector
1973  , size_t N // Number of elements
1974  , bool TF > // Transpose flag
1976  HybridVector<Type,N,TF>::loada( size_t index ) const noexcept
1977 {
1978  using blaze::loada;
1979 
1981 
1982  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
1983  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
1984  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
1985  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1986 
1987  return loada( &v_[index] );
1988 }
1989 //*************************************************************************************************
1990 
1991 
1992 //*************************************************************************************************
2005 template< typename Type // Data type of the vector
2006  , size_t N // Number of elements
2007  , bool TF > // Transpose flag
2009  HybridVector<Type,N,TF>::loadu( size_t index ) const noexcept
2010 {
2011  using blaze::loadu;
2012 
2014 
2015  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2016  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2017 
2018  return loadu( &v_[index] );
2019 }
2020 //*************************************************************************************************
2021 
2022 
2023 //*************************************************************************************************
2036 template< typename Type // Data type of the vector
2037  , size_t N // Number of elements
2038  , bool TF > // Transpose flag
2040  HybridVector<Type,N,TF>::store( size_t index, const SIMDType& value ) noexcept
2041 {
2042  storea( index, value );
2043 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2060 template< typename Type // Data type of the vector
2061  , size_t N // Number of elements
2062  , bool TF > // Transpose flag
2064  HybridVector<Type,N,TF>::storea( size_t index, const SIMDType& value ) noexcept
2065 {
2066  using blaze::storea;
2067 
2069 
2070  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2071  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2072  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2073  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
2074 
2075  storea( &v_[index], value );
2076 }
2077 //*************************************************************************************************
2078 
2079 
2080 //*************************************************************************************************
2093 template< typename Type // Data type of the vector
2094  , size_t N // Number of elements
2095  , bool TF > // Transpose flag
2097  HybridVector<Type,N,TF>::storeu( size_t index, const SIMDType& value ) noexcept
2098 {
2099  using blaze::storeu;
2100 
2102 
2103  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2104  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2105 
2106  storeu( &v_[index], value );
2107 }
2108 //*************************************************************************************************
2109 
2110 
2111 //*************************************************************************************************
2125 template< typename Type // Data type of the vector
2126  , size_t N // Number of elements
2127  , bool TF > // Transpose flag
2129  HybridVector<Type,N,TF>::stream( size_t index, const SIMDType& value ) noexcept
2130 {
2131  using blaze::stream;
2132 
2134 
2135  BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2136  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2137  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2138  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
2139 
2140  stream( &v_[index], value );
2141 }
2142 //*************************************************************************************************
2143 
2144 
2145 //*************************************************************************************************
2156 template< typename Type // Data type of the vector
2157  , size_t N // Number of elements
2158  , bool TF > // Transpose flag
2159 template< typename VT > // Type of the right-hand side dense vector
2162 {
2163  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2164 
2165  for( size_t i=0UL; i<size_; ++i )
2166  v_[i] = (~rhs)[i];
2167 }
2168 //*************************************************************************************************
2169 
2170 
2171 //*************************************************************************************************
2182 template< typename Type // Data type of the vector
2183  , size_t N // Number of elements
2184  , bool TF > // Transpose flag
2185 template< typename VT > // Type of the right-hand side dense vector
2186 inline auto HybridVector<Type,N,TF>::assign( const DenseVector<VT,TF>& rhs )
2188 {
2190 
2191  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2192 
2193  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2194 
2195  const size_t ipos( ( remainder )?( size_ & size_t(-SIMDSIZE) ):( size_ ) );
2196  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2197 
2198  size_t i( 0UL );
2199 
2200  for( ; i<ipos; i+=SIMDSIZE ) {
2201  store( i, (~rhs).load(i) );
2202  }
2203  for( ; remainder && i<size_; ++i ) {
2204  v_[i] = (~rhs)[i];
2205  }
2206 }
2207 //*************************************************************************************************
2208 
2209 
2210 //*************************************************************************************************
2221 template< typename Type // Data type of the vector
2222  , size_t N // Number of elements
2223  , bool TF > // Transpose flag
2224 template< typename VT > // Type of the right-hand side sparse vector
2226 {
2227  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2228 
2229  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2230  v_[element->index()] = element->value();
2231 }
2232 //*************************************************************************************************
2233 
2234 
2235 //*************************************************************************************************
2246 template< typename Type // Data type of the vector
2247  , size_t N // Number of elements
2248  , bool TF > // Transpose flag
2249 template< typename VT > // Type of the right-hand side dense vector
2252 {
2253  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2254 
2255  for( size_t i=0UL; i<size_; ++i )
2256  v_[i] += (~rhs)[i];
2257 }
2258 //*************************************************************************************************
2259 
2260 
2261 //*************************************************************************************************
2272 template< typename Type // Data type of the vector
2273  , size_t N // Number of elements
2274  , bool TF > // Transpose flag
2275 template< typename VT > // Type of the right-hand side dense vector
2278 {
2280 
2281  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2282 
2283  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2284 
2285  const size_t ipos( ( remainder )?( size_ & size_t(-SIMDSIZE) ):( size_ ) );
2286  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2287 
2288  size_t i( 0UL );
2289 
2290  for( ; i<ipos; i+=SIMDSIZE ) {
2291  store( i, load(i) + (~rhs).load(i) );
2292  }
2293  for( ; remainder && i<size_; ++i ) {
2294  v_[i] += (~rhs)[i];
2295  }
2296 }
2297 //*************************************************************************************************
2298 
2299 
2300 //*************************************************************************************************
2311 template< typename Type // Data type of the vector
2312  , size_t N // Number of elements
2313  , bool TF > // Transpose flag
2314 template< typename VT > // Type of the right-hand side sparse vector
2316 {
2317  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2318 
2319  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2320  v_[element->index()] += element->value();
2321 }
2322 //*************************************************************************************************
2323 
2324 
2325 //*************************************************************************************************
2336 template< typename Type // Data type of the vector
2337  , size_t N // Number of elements
2338  , bool TF > // Transpose flag
2339 template< typename VT > // Type of the right-hand side dense vector
2342 {
2343  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2344 
2345  for( size_t i=0UL; i<size_; ++i )
2346  v_[i] -= (~rhs)[i];
2347 }
2348 //*************************************************************************************************
2349 
2350 
2351 //*************************************************************************************************
2362 template< typename Type // Data type of the vector
2363  , size_t N // Number of elements
2364  , bool TF > // Transpose flag
2365 template< typename VT > // Type of the right-hand side dense vector
2368 {
2370 
2371  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2372 
2373  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2374 
2375  const size_t ipos( ( remainder )?( size_ & size_t(-SIMDSIZE) ):( size_ ) );
2376  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2377 
2378  size_t i( 0UL );
2379 
2380  for( ; i<ipos; i+=SIMDSIZE ) {
2381  store( i, load(i) - (~rhs).load(i) );
2382  }
2383  for( ; remainder && i<size_; ++i ) {
2384  v_[i] -= (~rhs)[i];
2385  }
2386 }
2387 //*************************************************************************************************
2388 
2389 
2390 //*************************************************************************************************
2401 template< typename Type // Data type of the vector
2402  , size_t N // Number of elements
2403  , bool TF > // Transpose flag
2404 template< typename VT > // Type of the right-hand side sparse vector
2406 {
2407  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2408 
2409  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2410  v_[element->index()] -= element->value();
2411 }
2412 //*************************************************************************************************
2413 
2414 
2415 //*************************************************************************************************
2426 template< typename Type // Data type of the vector
2427  , size_t N // Number of elements
2428  , bool TF > // Transpose flag
2429 template< typename VT > // Type of the right-hand side dense vector
2432 {
2433  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2434 
2435  for( size_t i=0UL; i<size_; ++i )
2436  v_[i] *= (~rhs)[i];
2437 }
2438 //*************************************************************************************************
2439 
2440 
2441 //*************************************************************************************************
2452 template< typename Type // Data type of the vector
2453  , size_t N // Number of elements
2454  , bool TF > // Transpose flag
2455 template< typename VT > // Type of the right-hand side dense vector
2458 {
2460 
2461  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2462 
2463  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2464 
2465  const size_t ipos( ( remainder )?( size_ & size_t(-SIMDSIZE) ):( size_ ) );
2466  BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2467 
2468  size_t i( 0UL );
2469 
2470  for( ; i<ipos; i+=SIMDSIZE ) {
2471  store( i, load(i) * (~rhs).load(i) );
2472  }
2473  for( ; remainder && i<size_; ++i ) {
2474  v_[i] *= (~rhs)[i];
2475  }
2476 }
2477 //*************************************************************************************************
2478 
2479 
2480 //*************************************************************************************************
2491 template< typename Type // Data type of the vector
2492  , size_t N // Number of elements
2493  , bool TF > // Transpose flag
2494 template< typename VT > // Type of the right-hand side sparse vector
2496 {
2497  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2498 
2499  const HybridVector tmp( serial( *this ) );
2500 
2501  reset();
2502 
2503  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2504  v_[element->index()] = tmp[element->index()] * element->value();
2505 }
2506 //*************************************************************************************************
2507 
2508 
2509 //*************************************************************************************************
2520 template< typename Type // Data type of the vector
2521  , size_t N // Number of elements
2522  , bool TF > // Transpose flag
2523 template< typename VT > // Type of the right-hand side dense vector
2526 {
2527  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2528 
2529  for( size_t i=0UL; i<size_; ++i )
2530  v_[i] /= (~rhs)[i];
2531 }
2532 //*************************************************************************************************
2533 
2534 
2535 //*************************************************************************************************
2546 template< typename Type // Data type of the vector
2547  , size_t N // Number of elements
2548  , bool TF > // Transpose flag
2549 template< typename VT > // Type of the right-hand side dense vector
2552 {
2554 
2555  BLAZE_INTERNAL_ASSERT( (~rhs).size() == size_, "Invalid vector sizes" );
2556 
2557  const size_t ipos( size_ & size_t(-SIMDSIZE) );
2558  BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2559 
2560  size_t i( 0UL );
2561 
2562  for( ; i<ipos; i+=SIMDSIZE ) {
2563  store( i, load(i) / (~rhs).load(i) );
2564  }
2565  for( ; i<size_; ++i ) {
2566  v_[i] /= (~rhs)[i];
2567  }
2568 }
2569 //*************************************************************************************************
2570 
2571 
2572 
2573 
2574 
2575 
2576 
2577 
2578 //=================================================================================================
2579 //
2580 // HYBRIDVECTOR OPERATORS
2581 //
2582 //=================================================================================================
2583 
2584 //*************************************************************************************************
2587 template< typename Type, size_t N, bool TF >
2588 void reset( HybridVector<Type,N,TF>& v );
2589 
2590 template< typename Type, size_t N, bool TF >
2591 void clear( HybridVector<Type,N,TF>& v );
2592 
2593 template< bool RF, typename Type, size_t N, bool TF >
2594 bool isDefault( const HybridVector<Type,N,TF>& v );
2595 
2596 template< typename Type, size_t N, bool TF >
2597 bool isIntact( const HybridVector<Type,N,TF>& v );
2598 
2599 template< typename Type, size_t N, bool TF >
2600 void swap( HybridVector<Type,N,TF>& a, HybridVector<Type,N,TF>& b ) noexcept;
2602 //*************************************************************************************************
2603 
2604 
2605 //*************************************************************************************************
2612 template< typename Type // Data type of the vector
2613  , size_t N // Number of elements
2614  , bool TF > // Transpose flag
2616 {
2617  v.reset();
2618 }
2619 //*************************************************************************************************
2620 
2621 
2622 //*************************************************************************************************
2629 template< typename Type // Data type of the vector
2630  , size_t N // Number of elements
2631  , bool TF > // Transpose flag
2633 {
2634  v.clear();
2635 }
2636 //*************************************************************************************************
2637 
2638 
2639 //*************************************************************************************************
2663 template< bool RF // Relaxation flag
2664  , typename Type // Data type of the vector
2665  , size_t N // Number of elements
2666  , bool TF > // Transpose flag
2667 inline bool isDefault( const HybridVector<Type,N,TF>& v )
2668 {
2669  return ( v.size() == 0UL );
2670 }
2671 //*************************************************************************************************
2672 
2673 
2674 //*************************************************************************************************
2692 template< typename Type // Data type of the vector
2693  , size_t N // Number of elements
2694  , bool TF > // Transpose flag
2695 inline bool isIntact( const HybridVector<Type,N,TF>& v )
2696 {
2697  return v.isIntact();
2698 }
2699 //*************************************************************************************************
2700 
2701 
2702 //*************************************************************************************************
2710 template< typename Type // Data type of the vector
2711  , size_t N // Number of elements
2712  , bool TF > // Transpose flag
2714 {
2715  a.swap( b );
2716 }
2717 //*************************************************************************************************
2718 
2719 
2720 
2721 
2722 //=================================================================================================
2723 //
2724 // MAXSIZE SPECIALIZATIONS
2725 //
2726 //=================================================================================================
2727 
2728 //*************************************************************************************************
2730 template< typename T, size_t N, bool TF >
2731 struct MaxSize< HybridVector<T,N,TF>, 0UL >
2732  : public Ptrdiff_t<N>
2733 {};
2735 //*************************************************************************************************
2736 
2737 
2738 
2739 
2740 //=================================================================================================
2741 //
2742 // HASCONSTDATAACCESS SPECIALIZATIONS
2743 //
2744 //=================================================================================================
2745 
2746 //*************************************************************************************************
2748 template< typename T, size_t N, bool TF >
2749 struct HasConstDataAccess< HybridVector<T,N,TF> >
2750  : public TrueType
2751 {};
2753 //*************************************************************************************************
2754 
2755 
2756 
2757 
2758 //=================================================================================================
2759 //
2760 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2761 //
2762 //=================================================================================================
2763 
2764 //*************************************************************************************************
2766 template< typename T, size_t N, bool TF >
2767 struct HasMutableDataAccess< HybridVector<T,N,TF> >
2768  : public TrueType
2769 {};
2771 //*************************************************************************************************
2772 
2773 
2774 
2775 
2776 //=================================================================================================
2777 //
2778 // ISALIGNED SPECIALIZATIONS
2779 //
2780 //=================================================================================================
2781 
2782 //*************************************************************************************************
2784 template< typename T, size_t N, bool TF >
2785 struct IsAligned< HybridVector<T,N,TF> >
2786  : public BoolConstant< HybridVector<T,N,TF>::isAligned() >
2787 {};
2789 //*************************************************************************************************
2790 
2791 
2792 
2793 
2794 //=================================================================================================
2795 //
2796 // ISCONTIGUOUS SPECIALIZATIONS
2797 //
2798 //=================================================================================================
2799 
2800 //*************************************************************************************************
2802 template< typename T, size_t N, bool TF >
2803 struct IsContiguous< HybridVector<T,N,TF> >
2804  : public TrueType
2805 {};
2807 //*************************************************************************************************
2808 
2809 
2810 
2811 
2812 //=================================================================================================
2813 //
2814 // ISPADDED SPECIALIZATIONS
2815 //
2816 //=================================================================================================
2817 
2818 //*************************************************************************************************
2820 template< typename T, size_t N, bool TF >
2821 struct IsPadded< HybridVector<T,N,TF> >
2822  : public BoolConstant<usePadding>
2823 {};
2825 //*************************************************************************************************
2826 
2827 
2828 
2829 
2830 //=================================================================================================
2831 //
2832 // ISRESIZABLE SPECIALIZATIONS
2833 //
2834 //=================================================================================================
2835 
2836 //*************************************************************************************************
2838 template< typename T, size_t N, bool TF >
2839 struct IsResizable< HybridVector<T,N,TF> >
2840  : public TrueType
2841 {};
2843 //*************************************************************************************************
2844 
2845 
2846 
2847 
2848 //=================================================================================================
2849 //
2850 // ADDTRAIT SPECIALIZATIONS
2851 //
2852 //=================================================================================================
2853 
2854 //*************************************************************************************************
2856 template< typename T1, typename T2 >
2857 struct AddTraitEval2< T1, T2
2858  , EnableIf_t< IsVector_v<T1> &&
2859  IsVector_v<T2> &&
2860  ( Size_v<T1,0UL> == DefaultSize_v ) &&
2861  ( Size_v<T2,0UL> == DefaultSize_v ) &&
2862  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ||
2863  MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
2864 {
2865  using ET1 = ElementType_t<T1>;
2866  using ET2 = ElementType_t<T2>;
2867 
2868  static constexpr size_t N = min( size_t( MaxSize_v<T1,0UL> ), size_t( MaxSize_v<T2,0UL> ) );
2869 
2870  using Type = HybridVector< AddTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2871 };
2873 //*************************************************************************************************
2874 
2875 
2876 
2877 
2878 //=================================================================================================
2879 //
2880 // SUBTRAIT SPECIALIZATIONS
2881 //
2882 //=================================================================================================
2883 
2884 //*************************************************************************************************
2886 template< typename T1, typename T2 >
2887 struct SubTraitEval2< T1, T2
2888  , EnableIf_t< IsVector_v<T1> &&
2889  IsVector_v<T2> &&
2890  ( Size_v<T1,0UL> == DefaultSize_v ) &&
2891  ( Size_v<T2,0UL> == DefaultSize_v ) &&
2892  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ||
2893  MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
2894 {
2895  using ET1 = ElementType_t<T1>;
2896  using ET2 = ElementType_t<T2>;
2897 
2898  static constexpr size_t N = min( size_t( MaxSize_v<T1,0UL> ), size_t( MaxSize_v<T2,0UL> ) );
2899 
2900  using Type = HybridVector< SubTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2901 };
2903 //*************************************************************************************************
2904 
2905 
2906 
2907 
2908 //=================================================================================================
2909 //
2910 // MULTTRAIT SPECIALIZATIONS
2911 //
2912 //=================================================================================================
2913 
2914 //*************************************************************************************************
2916 template< typename T1, typename T2 >
2917 struct MultTraitEval2< T1, T2
2918  , EnableIf_t< IsVector_v<T1> &&
2919  IsNumeric_v<T2> &&
2920  ( Size_v<T1,0UL> == DefaultSize_v ) &&
2921  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ) > >
2922 {
2923  using ET1 = ElementType_t<T1>;
2924 
2925  static constexpr size_t N = MaxSize_v<T1,0UL>;
2926 
2927  using Type = HybridVector< MultTrait_t<ET1,T2>, N, TransposeFlag_v<T1> >;
2928 };
2929 
2930 template< typename T1, typename T2 >
2931 struct MultTraitEval2< T1, T2
2932  , EnableIf_t< IsNumeric_v<T1> &&
2933  IsVector_v<T2> &&
2934  ( Size_v<T2,0UL> == DefaultSize_v ) &&
2935  ( MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
2936 {
2937  using ET2 = ElementType_t<T2>;
2938 
2939  static constexpr size_t N = MaxSize_v<T2,0UL>;
2940 
2941  using Type = HybridVector< MultTrait_t<T1,ET2>, N, TransposeFlag_v<T2> >;
2942 };
2943 
2944 template< typename T1, typename T2 >
2945 struct MultTraitEval2< T1, T2
2946  , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
2947  ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
2948  IsDenseVector_v<T1> &&
2949  IsDenseVector_v<T2> &&
2950  ( Size_v<T1,0UL> == DefaultSize_v ) &&
2951  ( Size_v<T2,0UL> == DefaultSize_v ) &&
2952  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ||
2953  MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
2954 {
2955  using ET1 = ElementType_t<T1>;
2956  using ET2 = ElementType_t<T2>;
2957 
2958  static constexpr size_t N = min( size_t( MaxSize_v<T1,0UL> ), size_t( MaxSize_v<T2,0UL> ) );
2959 
2960  using Type = HybridVector< MultTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2961 };
2962 
2963 template< typename T1, typename T2 >
2964 struct MultTraitEval2< T1, T2
2965  , EnableIf_t< IsMatrix_v<T1> &&
2966  IsColumnVector_v<T2> &&
2967  ( Size_v<T1,0UL> == DefaultSize_v &&
2968  ( !IsSquare_v<T1> || Size_v<T2,0UL> == DefaultSize_v ) ) &&
2969  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ||
2970  ( IsSquare_v<T1> && MaxSize_v<T2,0UL> != DefaultMaxSize_v ) ) > >
2971 {
2972  using ET1 = ElementType_t<T1>;
2973  using ET2 = ElementType_t<T2>;
2974 
2975  static constexpr size_t N = ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ? MaxSize_v<T1,0UL> : MaxSize_v<T2,0UL> );
2976 
2977  using Type = HybridVector< MultTrait_t<ET1,ET2>, N, false >;
2978 };
2979 
2980 template< typename T1, typename T2 >
2981 struct MultTraitEval2< T1, T2
2982  , EnableIf_t< IsRowVector_v<T1> &&
2983  IsMatrix_v<T2> &&
2984  ( Size_v<T2,1UL> == DefaultSize_v &&
2985  ( !IsSquare_v<T2> || Size_v<T1,0UL> == DefaultSize_v ) ) &&
2986  ( MaxSize_v<T2,1UL> != DefaultMaxSize_v ||
2987  ( IsSquare_v<T2> && MaxSize_v<T1,0UL> != DefaultMaxSize_v ) ) > >
2988 {
2989  using ET1 = ElementType_t<T1>;
2990  using ET2 = ElementType_t<T2>;
2991 
2992  static constexpr size_t N = ( MaxSize_v<T2,1UL> != DefaultMaxSize_v ? MaxSize_v<T2,1UL> : MaxSize_v<T1,0UL> );
2993 
2994  using Type = HybridVector< MultTrait_t<ET1,ET2>, N, true >;
2995 };
2997 //*************************************************************************************************
2998 
2999 
3000 
3001 
3002 //=================================================================================================
3003 //
3004 // KRONTRAIT SPECIALIZATIONS
3005 //
3006 //=================================================================================================
3007 
3008 //*************************************************************************************************
3010 template< typename T1, typename T2 >
3011 struct KronTraitEval2< T1, T2
3012  , EnableIf_t< IsDenseVector_v<T1> &&
3013  IsDenseVector_v<T2> &&
3014  ( ( Size_v<T1,0UL> == DefaultSize_v ) ||
3015  ( Size_v<T2,0UL> == DefaultSize_v ) ) &&
3016  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ) &&
3017  ( MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
3018 {
3019  using ET1 = ElementType_t<T1>;
3020  using ET2 = ElementType_t<T2>;
3021 
3022  static constexpr size_t N = MaxSize_v<T1,0UL> * MaxSize_v<T2,0UL>;
3023 
3024  using Type = HybridVector< MultTrait_t<ET1,ET2>, N, TransposeFlag_v<T2> >;
3025 };
3027 //*************************************************************************************************
3028 
3029 
3030 
3031 
3032 //=================================================================================================
3033 //
3034 // DIVTRAIT SPECIALIZATIONS
3035 //
3036 //=================================================================================================
3037 
3038 //*************************************************************************************************
3040 template< typename T1, typename T2 >
3041 struct DivTraitEval2< T1, T2
3042  , EnableIf_t< IsVector_v<T1> &&
3043  IsNumeric_v<T2> &&
3044  ( Size_v<T1,0UL> == DefaultSize_v ) &&
3045  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ) > >
3046 {
3047  using ET1 = ElementType_t<T1>;
3048 
3049  static constexpr size_t N = MaxSize_v<T1,0UL>;
3050 
3051  using Type = HybridVector< DivTrait_t<ET1,T2>, N, TransposeFlag_v<T1> >;
3052 };
3053 
3054 template< typename T1, typename T2 >
3055 struct DivTraitEval2< T1, T2
3056  , EnableIf_t< IsDenseVector_v<T1> &&
3057  IsDenseVector_v<T2> &&
3058  ( Size_v<T1,0UL> == DefaultSize_v ) &&
3059  ( Size_v<T2,0UL> == DefaultSize_v ) &&
3060  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ||
3061  MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
3062 {
3063  using ET1 = ElementType_t<T1>;
3064  using ET2 = ElementType_t<T2>;
3065 
3066  static constexpr size_t N = min( size_t( MaxSize_v<T1,0UL> ), size_t( MaxSize_v<T2,0UL> ) );
3067 
3068  using Type = HybridVector< DivTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
3069 };
3071 //*************************************************************************************************
3072 
3073 
3074 
3075 
3076 //=================================================================================================
3077 //
3078 // MAPTRAIT SPECIALIZATIONS
3079 //
3080 //=================================================================================================
3081 
3082 //*************************************************************************************************
3084 template< typename T, typename OP >
3085 struct UnaryMapTraitEval2< T, OP
3086  , EnableIf_t< IsVector_v<T> &&
3087  Size_v<T,0UL> == DefaultSize_v &&
3088  MaxSize_v<T,0UL> != DefaultMaxSize_v > >
3089 {
3090  using ET = ElementType_t<T>;
3091 
3092  using Type = HybridVector< MapTrait_t<ET,OP>, MaxSize_v<T,0UL>, TransposeFlag_v<T> >;
3093 };
3095 //*************************************************************************************************
3096 
3097 
3098 //*************************************************************************************************
3100 template< typename T1, typename T2, typename OP >
3101 struct BinaryMapTraitEval2< T1, T2, OP
3102  , EnableIf_t< IsVector_v<T1> &&
3103  IsVector_v<T2> &&
3104  Size_v<T1,0UL> == DefaultSize_v &&
3105  Size_v<T2,0UL> == DefaultSize_v &&
3106  ( MaxSize_v<T1,0UL> != DefaultMaxSize_v ||
3107  MaxSize_v<T2,0UL> != DefaultMaxSize_v ) > >
3108 {
3109  using ET1 = ElementType_t<T1>;
3110  using ET2 = ElementType_t<T2>;
3111 
3112  static constexpr size_t N = min( size_t( MaxSize_v<T1,0UL> ), size_t( MaxSize_v<T2,0UL> ) );
3113 
3114  using Type = HybridVector< MapTrait_t<ET1,ET2,OP>, N, TransposeFlag_v<T1> >;
3115 };
3117 //*************************************************************************************************
3118 
3119 
3120 
3121 
3122 //=================================================================================================
3123 //
3124 // REDUCETRAIT SPECIALIZATIONS
3125 //
3126 //=================================================================================================
3127 
3128 //*************************************************************************************************
3130 template< typename T, typename OP, size_t RF >
3131 struct PartialReduceTraitEval2< T, OP, RF
3132  , EnableIf_t< IsMatrix_v<T> &&
3133  ( Size_v<T,0UL> == DefaultSize_v ||
3134  Size_v<T,1UL> == DefaultSize_v ) &&
3135  MaxSize_v<T,0UL> != DefaultMaxSize_v &&
3136  MaxSize_v<T,1UL> != DefaultMaxSize_v > >
3137 {
3138  using ET = ElementType_t<T>;
3139  using RT = decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) );
3140 
3141  static constexpr bool TF = ( RF == 0UL );
3142 
3143  static constexpr size_t N = MaxSize_v< T, TF ? 1UL : 0UL >;
3144 
3145  using Type = HybridVector<RT,N,TF>;
3146 };
3148 //*************************************************************************************************
3149 
3150 
3151 
3152 
3153 //=================================================================================================
3154 //
3155 // HIGHTYPE SPECIALIZATIONS
3156 //
3157 //=================================================================================================
3158 
3159 //*************************************************************************************************
3161 template< typename T1, size_t N, bool TF, typename T2 >
3162 struct HighType< HybridVector<T1,N,TF>, HybridVector<T2,N,TF> >
3163 {
3164  using Type = StaticVector< typename HighType<T1,T2>::Type, N, TF >;
3165 };
3167 //*************************************************************************************************
3168 
3169 
3170 
3171 
3172 //=================================================================================================
3173 //
3174 // LOWTYPE SPECIALIZATIONS
3175 //
3176 //=================================================================================================
3177 
3178 //*************************************************************************************************
3180 template< typename T1, size_t N, bool TF, typename T2 >
3181 struct LowType< HybridVector<T1,N,TF>, HybridVector<T2,N,TF> >
3182 {
3183  using Type = StaticVector< typename LowType<T1,T2>::Type, N, TF >;
3184 };
3186 //*************************************************************************************************
3187 
3188 
3189 
3190 
3191 //=================================================================================================
3192 //
3193 // SUBVECTORTRAIT SPECIALIZATIONS
3194 //
3195 //=================================================================================================
3196 
3197 //*************************************************************************************************
3199 template< typename VT >
3200 struct SubvectorTraitEval2< VT, inf, inf
3201  , EnableIf_t< IsDenseVector_v<VT> &&
3202  ( Size_v<VT,0UL> != DefaultSize_v ||
3203  MaxSize_v<VT,0UL> != DefaultMaxSize_v ) > >
3204 {
3205  static constexpr size_t N = max( Size_v<VT,0UL>, MaxSize_v<VT,0UL> );
3206 
3207  using Type = HybridVector< RemoveConst_t< ElementType_t<VT> >, N, TransposeFlag_v<VT> >;
3208 };
3210 //*************************************************************************************************
3211 
3212 
3213 
3214 
3215 //=================================================================================================
3216 //
3217 // ELEMENTSTRAIT SPECIALIZATIONS
3218 //
3219 //=================================================================================================
3220 
3221 //*************************************************************************************************
3223 template< typename VT >
3224 struct ElementsTraitEval2< VT, 0UL
3225  , EnableIf_t< IsDenseVector_v<VT> &&
3226  ( Size_v<VT,0UL> != DefaultSize_v ||
3227  MaxSize_v<VT,0UL> != DefaultMaxSize_v ) > >
3228 {
3229  static constexpr size_t N = max( Size_v<VT,0UL>, MaxSize_v<VT,0UL> );
3230 
3231  using Type = HybridVector< RemoveConst_t< ElementType_t<VT> >, N, TransposeFlag_v<VT> >;
3232 };
3234 //*************************************************************************************************
3235 
3236 
3237 
3238 
3239 //=================================================================================================
3240 //
3241 // ROWTRAIT SPECIALIZATIONS
3242 //
3243 //=================================================================================================
3244 
3245 //*************************************************************************************************
3247 template< typename MT, size_t I >
3248 struct RowTraitEval2< MT, I
3249  , EnableIf_t< IsDenseMatrix_v<MT> &&
3250  Size_v<MT,1UL> == DefaultSize_v &&
3251  MaxSize_v<MT,1UL> != DefaultMaxSize_v > >
3252 {
3253  using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, MaxSize_v<MT,1UL>, true >;
3254 };
3256 //*************************************************************************************************
3257 
3258 
3259 
3260 
3261 //=================================================================================================
3262 //
3263 // COLUMNTRAIT SPECIALIZATIONS
3264 //
3265 //=================================================================================================
3266 
3267 //*************************************************************************************************
3269 template< typename MT, size_t I >
3270 struct ColumnTraitEval2< MT, I
3271  , EnableIf_t< IsDenseMatrix_v<MT> &&
3272  Size_v<MT,0UL> == DefaultSize_v &&
3273  MaxSize_v<MT,0UL> != DefaultMaxSize_v > >
3274 {
3275  using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, MaxSize_v<MT,0UL>, false >;
3276 };
3278 //*************************************************************************************************
3279 
3280 
3281 
3282 
3283 //=================================================================================================
3284 //
3285 // BANDTRAIT SPECIALIZATIONS
3286 //
3287 //=================================================================================================
3288 
3289 //*************************************************************************************************
3291 template< typename MT, ptrdiff_t I >
3292 struct BandTraitEval2< MT, I
3293  , EnableIf_t< IsDenseMatrix_v<MT> &&
3294  ( Size_v<MT,0UL> == DefaultSize_v ||
3295  Size_v<MT,1UL> == DefaultSize_v ) &&
3296  MaxSize_v<MT,0UL> != DefaultMaxSize_v &&
3297  MaxSize_v<MT,1UL> != DefaultMaxSize_v > >
3298 {
3299  static constexpr size_t M = MaxSize_v<MT,0UL>;
3300  static constexpr size_t N = MaxSize_v<MT,1UL>;
3301  static constexpr size_t Min = min( M - ( I >= 0L ? 0UL : -I ), N - ( I >= 0L ? I : 0UL ) );
3302 
3303  using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
3304 };
3305 
3306 template< typename MT >
3307 struct BandTraitEval2< MT, inf
3308  , EnableIf_t< IsDenseMatrix_v<MT> &&
3309  Size_v<MT,0UL> != DefaultSize_v &&
3310  Size_v<MT,1UL> != DefaultSize_v > >
3311 {
3312  static constexpr size_t Min = min( Size_v<MT,0UL>, Size_v<MT,1UL> );
3313 
3314  using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
3315 };
3316 
3317 template< typename MT >
3318 struct BandTraitEval2< MT, inf
3319  , EnableIf_t< IsDenseMatrix_v<MT> &&
3320  ( Size_v<MT,0UL> == DefaultSize_v ||
3321  Size_v<MT,1UL> == DefaultSize_v ) &&
3322  MaxSize_v<MT,0UL> != DefaultMaxSize_v &&
3323  MaxSize_v<MT,1UL> != DefaultMaxSize_v > >
3324 {
3325  static constexpr size_t Min = min( MaxSize_v<MT,0UL>, MaxSize_v<MT,1UL> );
3326 
3327  using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
3328 };
3330 //*************************************************************************************************
3331 
3332 } // namespace blaze
3333 
3334 #endif
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,...
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
static constexpr size_t Alignment
Alignment of the data elements.
Definition: HybridVector.h:492
Header file for the nextMultiple shim.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the AlignmentOf type trait.
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: HybridVector.h:1597
auto multAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
Default implementation of the multiplication assignment of a dense vector.
Definition: HybridVector.h:2430
HybridVector()
The default constructor for HybridVector.
Definition: HybridVector.h:542
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
static constexpr size_t capacity() noexcept
Returns the maximum capacity of the vector.
Definition: HybridVector.h:1462
Header file for the row trait.
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.The Ptrdiff_t alias template represents an integ...
Definition: IntegralConstant.h:237
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.The IsRowVector_v variable template provid...
Definition: IsRowVector.h:142
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
Header file for the serial shim.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Iterator end() noexcept
Returns an iterator just past the last element of the hybrid vector.
Definition: HybridVector.h:1011
Header file for the IsRowVector type trait.
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: HybridVector.h:1429
Header file for the DenseVector base class.
Header file for the MAYBE_UNUSED function template.
Pointer data() noexcept
Low-level data access to the vector elements.
Definition: HybridVector.h:934
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:187
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for all forward declarations of the math module.
Header file for memory allocation and deallocation functionality.
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
Header file for the reduce trait.
Header file for the MaxSize type trait.
Type ElementType
Type of the vector elements.
Definition: HybridVector.h:217
Header file for the elements trait.
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: HybridVector.h:1910
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Header file for the band trait.
static constexpr bool align
Compilation switch for the choice of alignment.
Definition: HybridVector.h:208
Constraint on the data type.
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.The IsDenseMatrix_v variable template pr...
Definition: IsDenseMatrix.h:138
Header file for the IsMatrix type trait.
Efficient implementation of a dynamically sized vector with static memory.The HybridVector class temp...
Definition: Forward.h:59
Header file for the IsSquare type trait.
Type & Reference
Reference to a non-constant vector value.
Definition: HybridVector.h:222
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Rebind mechanism to obtain a HybridVector with different data/element type.
Definition: HybridVector.h:235
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition: HybridVector.h:847
BLAZE_ALWAYS_INLINE void storeu(size_t index, const SIMDType &value) noexcept
Unaligned store of a SIMD element of the vector.
Definition: HybridVector.h:2097
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the LowType type trait.
Header file for the multiplication trait.
constexpr ptrdiff_t DefaultMaxSize_v
Default size of the MaxSize type trait.
Definition: MaxSize.h:72
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Compile time assertion.
void swap(HybridVector< Type, N, TF > &a, HybridVector< Type, N, TF > &b) noexcept
Swapping the contents of two hybrid vectors.
Definition: HybridVector.h:2713
#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:79
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:187
Type * Pointer
Pointer to a non-constant vector value.
Definition: HybridVector.h:224
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
Header file for the DenseIterator class template.
Iterator begin() noexcept
Returns an iterator to the first element of the hybrid vector.
Definition: HybridVector.h:966
Numerical infinity for built-in data types.
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
Aligned load of a SIMD element of the vector.
Definition: HybridVector.h:1976
Header file for the subvector trait.
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
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:76
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: HybridVector.h:261
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Aligned store of a SIMD element of the vector.
Definition: HybridVector.h:2064
Constraint on the data type.
auto divAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
Default implementation of the division assignment of a dense vector.
Definition: HybridVector.h:2524
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
Header file for the Kron product trait.
#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:61
Header file for the TransposeFlag type trait.
Constraint on the data type.
Header file for the exception macros of the math module.
auto assign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
Default implementation of the assignment of a dense vector.
Definition: HybridVector.h:2160
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
Unaligned load of a SIMD element of the vector.
Definition: HybridVector.h:2009
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
Load of a SIMD element of the vector.
Definition: HybridVector.h:1952
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
constexpr bool HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.The HasSIMDDiv_v variable template provides...
Definition: HasSIMDDiv.h:171
Constraint on the data type.
Header file for the IsVector type trait.
Header file for the IsDenseMatrix type trait.
void clear()
Clearing the vector.
Definition: HybridVector.h:1521
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
Header file for the IsPadded type trait.
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_t alias declaration prov...
Definition: CrossTrait.h:164
Header file for the IsVectorizable type trait.
auto addAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
Default implementation of the addition assignment of a dense vector.
Definition: HybridVector.h:2250
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:1562
size_t size_
The current size/dimension of the vector.
Definition: HybridVector.h:508
Header file for the RemoveConst type trait.
ConstIterator cend() const noexcept
Returns an iterator just past the last element of the hybrid vector.
Definition: HybridVector.h:1043
Header file for the IsSIMDCombinable type trait.
AlignedStorage v_
The statically allocated vector elements.
Definition: HybridVector.h:502
Header file for the IsSparseVector type trait.
Header file for the HasSIMDMult type trait.
BLAZE_ALWAYS_INLINE constexpr auto nextMultiple(T1 value, T2 factor) noexcept
Rounds up an integral value to the next multiple of a given factor.
Definition: NextMultiple.h:68
Header file for run time assertion macros.
HybridVector & operator=(const Type &rhs)
Homogenous assignment to all vector elements.
Definition: HybridVector.h:1068
SIMDTrait_t< ElementType > SIMDType
SIMD type of the vector elements.
Definition: HybridVector.h:218
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
bool isIntact() const noexcept
Returns whether the invariants of the hybrid vector are intact.
Definition: HybridVector.h:1850
Constraint on the data type.
Header file for the IsContiguous type trait.
constexpr Pointer data() noexcept
Low-level data access to the array elements.
Definition: AlignedArray.h:367
static constexpr size_t NN
Alignment adjustment.
Definition: HybridVector.h:205
ConstIterator cbegin() const noexcept
Returns an iterator to the first element of the hybrid vector.
Definition: HybridVector.h:996
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:139
Header file for the AlignedArray implementation.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#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,...
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
BLAZE_ALWAYS_INLINE void stream(size_t index, const SIMDType &value) noexcept
Aligned, non-temporal store of a SIMD element of the vector.
Definition: HybridVector.h:2129
Constraint on the data type.
Header file for the HasSIMDSub type trait.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMutableDataAccess type trait.
static constexpr bool simdEnabled
Compilation flag for SIMD optimization.
Definition: HybridVector.h:255
void swap(HybridVector &v) noexcept
Swapping the contents of two hybrid vectors.
Definition: HybridVector.h:1614
auto subAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
Default implementation of the subtraction assignment of a dense vector.
Definition: HybridVector.h:2340
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
const Type & ConstReference
Reference to a constant vector value.
Definition: HybridVector.h:223
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
Header file for the IsDenseVector type trait.
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
const Type * ConstPointer
Pointer to a constant vector value.
Definition: HybridVector.h:225
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
void reset()
Reset to the default initial values.
Definition: HybridVector.h:1502
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type,...
Definition: DenseVector.h:61
Reference at(size_t index)
Checked access to the vector elements.
Definition: HybridVector.h:890
HybridVector< Type, N, TF > This
Type of this HybridVector instance.
Definition: HybridVector.h:213
constexpr size_t AlignmentOf_v
Auxiliary variable template for the AlignmentOf type trait.The AlignmentOf_v variable template provid...
Definition: AlignmentOf.h:238
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD vector.
Definition: HybridVector.h:202
static constexpr size_t spacing() noexcept
Returns the minimum capacity of the vector.
Definition: HybridVector.h:1447
Resize mechanism to obtain a HybridVector with a different fixed number of elements.
Definition: HybridVector.h:244
Header file for the HasSIMDDiv type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:198
EnableIf_t< IsBuiltin_v< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:224
Header file for the default transpose flag for all vectors of the Blaze library.
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:188
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:146
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.The IsDenseVector_v variable template pr...
Definition: IsDenseVector.h:138
Header file for the IntegralConstant class template.
constexpr Infinity inf
Global Infinity instance.The blaze::inf instance can be used wherever a built-in data type is expecte...
Definition: Infinity.h:1080
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
static constexpr bool isAligned() noexcept
Returns whether the vector is properly aligned in memory.
Definition: HybridVector.h:1929
Header file for the IsColumnVector type trait.
#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:112
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Store of a SIMD element of the vector.
Definition: HybridVector.h:2040
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: HybridVector.h:1480
Header file for the HighType type trait.
Header file for the clear shim.
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: HybridVector.h:1889
const Type & ReturnType
Return type for expression template evaluations.
Definition: HybridVector.h:219