Blaze  3.6
StaticVector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_DENSE_STATICVECTOR_H_
36 #define _BLAZE_MATH_DENSE_STATICVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <tuple>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
53 #include <blaze/math/Forward.h>
55 #include <blaze/math/shims/Clear.h>
59 #include <blaze/math/SIMD.h>
97 #include <blaze/system/Inline.h>
102 #include <blaze/util/AlignedArray.h>
104 #include <blaze/util/Assert.h>
110 #include <blaze/util/DisableIf.h>
111 #include <blaze/util/EnableIf.h>
113 #include <blaze/util/MaybeUnused.h>
114 #include <blaze/util/Memory.h>
115 #include <blaze/util/StaticAssert.h>
116 #include <blaze/util/Types.h>
121 
122 
123 namespace blaze {
124 
125 //=================================================================================================
126 //
127 // CLASS DEFINITION
128 //
129 //=================================================================================================
130 
131 //*************************************************************************************************
197 template< typename Type // Data type of the vector
198  , size_t N // Number of elements
199  , bool TF = defaultTransposeFlag > // Transpose flag
200 class StaticVector
201  : public DenseVector< StaticVector<Type,N,TF>, TF >
202 {
203  private:
204  //**********************************************************************************************
206  static constexpr size_t SIMDSIZE = SIMDTrait<Type>::size;
207 
209  static constexpr size_t NN = ( usePadding ? nextMultiple( N, SIMDSIZE ) : N );
210 
212  static constexpr bool align = ( NN >= SIMDSIZE );
213  //**********************************************************************************************
214 
215  public:
216  //**Type definitions****************************************************************************
219  using ResultType = This;
221  using ElementType = Type;
223  using ReturnType = const Type&;
224  using CompositeType = const StaticVector&;
225 
226  using Reference = Type&;
227  using ConstReference = const Type&;
228  using Pointer = Type*;
229  using ConstPointer = const Type*;
230 
233  //**********************************************************************************************
234 
235  //**Rebind struct definition********************************************************************
238  template< typename NewType > // Data type of the other vector
239  struct Rebind {
241  };
242  //**********************************************************************************************
243 
244  //**Resize struct definition********************************************************************
247  template< size_t NewN > // Number of elements of the other vector
248  struct Resize {
250  };
251  //**********************************************************************************************
252 
253  //**Compilation flags***************************************************************************
255 
259  static constexpr bool simdEnabled = IsVectorizable_v<Type>;
260 
262 
265  static constexpr bool smpAssignable = false;
266  //**********************************************************************************************
267 
268  //**Constructors********************************************************************************
271  explicit inline StaticVector();
272  explicit inline StaticVector( const Type& init );
273  inline constexpr StaticVector( initializer_list<Type> list );
274 
275  template< typename Other >
276  explicit inline StaticVector( size_t n, const Other* array );
277 
278  template< typename Other, size_t Dim >
279  explicit inline StaticVector( const Other (&array)[Dim] );
280 
281  inline constexpr StaticVector( const StaticVector& v );
282 
283  template< typename Other >
284  inline StaticVector( const StaticVector<Other,N,TF>& v );
285 
286  template< typename VT >
287  inline StaticVector( const Vector<VT,TF>& v );
289  //**********************************************************************************************
290 
291  //**Destructor**********************************************************************************
294  ~StaticVector() = default;
296  //**********************************************************************************************
297 
298  //**Data access functions***********************************************************************
301  inline constexpr Reference operator[]( size_t index ) noexcept;
302  inline constexpr ConstReference operator[]( size_t index ) const noexcept;
303  inline Reference at( size_t index );
304  inline ConstReference at( size_t index ) const;
305  inline constexpr Pointer data () noexcept;
306  inline constexpr ConstPointer data () const noexcept;
307  inline constexpr Iterator begin () noexcept;
308  inline constexpr ConstIterator begin () const noexcept;
309  inline constexpr ConstIterator cbegin() const noexcept;
310  inline constexpr Iterator end () noexcept;
311  inline constexpr ConstIterator end () const noexcept;
312  inline constexpr ConstIterator cend () const noexcept;
314  //**********************************************************************************************
315 
316  //**Assignment operators************************************************************************
319  inline constexpr StaticVector& operator=( const Type& rhs );
320  inline constexpr StaticVector& operator=( initializer_list<Type> list );
321 
322  template< typename Other, size_t Dim >
323  inline StaticVector& operator=( const Other (&array)[Dim] );
324 
325  inline constexpr StaticVector& operator=( const StaticVector& rhs );
326 
327  template< typename Other >
328  inline StaticVector& operator=( const StaticVector<Other,N,TF>& rhs );
329 
330  template< typename VT > inline StaticVector& operator= ( const Vector<VT,TF>& rhs );
331  template< typename VT > inline StaticVector& operator+=( const Vector<VT,TF>& rhs );
332  template< typename VT > inline StaticVector& operator-=( const Vector<VT,TF>& rhs );
333  template< typename VT > inline StaticVector& operator*=( const Vector<VT,TF>& rhs );
334  template< typename VT > inline StaticVector& operator/=( const DenseVector<VT,TF>& rhs );
335  template< typename VT > inline StaticVector& operator%=( const Vector<VT,TF>& rhs );
337  //**********************************************************************************************
338 
339  //**Utility functions***************************************************************************
342  static inline constexpr size_t size() noexcept;
343  static inline constexpr size_t spacing() noexcept;
344  static inline constexpr size_t capacity() noexcept;
345  inline size_t nonZeros() const;
346  inline constexpr void reset();
347  inline void swap( StaticVector& v ) noexcept;
349  //**********************************************************************************************
350 
351  //**Numeric functions***************************************************************************
354  template< typename Other > inline StaticVector& scale( const Other& scalar );
356  //**********************************************************************************************
357 
358  //**Memory functions****************************************************************************
361  static inline void* operator new ( std::size_t size );
362  static inline void* operator new[]( std::size_t size );
363  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
364  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
365 
366  static inline void operator delete ( void* ptr );
367  static inline void operator delete[]( void* ptr );
368  static inline void operator delete ( void* ptr, const std::nothrow_t& );
369  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
371  //**********************************************************************************************
372 
373  private:
374  //**********************************************************************************************
376  template< typename VT >
378  static constexpr bool VectorizedAssign_v =
379  ( useOptimizedKernels &&
380  simdEnabled && VT::simdEnabled &&
381  IsSIMDCombinable_v< Type, ElementType_t<VT> > );
383  //**********************************************************************************************
384 
385  //**********************************************************************************************
387  template< typename VT >
389  static constexpr bool VectorizedAddAssign_v =
390  ( useOptimizedKernels &&
391  simdEnabled && VT::simdEnabled &&
392  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
393  HasSIMDAdd_v< Type, ElementType_t<VT> > );
395  //**********************************************************************************************
396 
397  //**********************************************************************************************
399  template< typename VT >
401  static constexpr bool VectorizedSubAssign_v =
402  ( useOptimizedKernels &&
403  simdEnabled && VT::simdEnabled &&
404  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
405  HasSIMDSub_v< Type, ElementType_t<VT> > );
407  //**********************************************************************************************
408 
409  //**********************************************************************************************
411  template< typename VT >
413  static constexpr bool VectorizedMultAssign_v =
414  ( useOptimizedKernels &&
415  simdEnabled && VT::simdEnabled &&
416  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
417  HasSIMDMult_v< Type, ElementType_t<VT> > );
419  //**********************************************************************************************
420 
421  //**********************************************************************************************
423  template< typename VT >
425  static constexpr bool VectorizedDivAssign_v =
426  ( useOptimizedKernels &&
427  simdEnabled && VT::simdEnabled &&
428  IsSIMDCombinable_v< Type, ElementType_t<VT> > &&
429  HasSIMDDiv_v< Type, ElementType_t<VT> > );
431  //**********************************************************************************************
432 
433  public:
434  //**Debugging functions*************************************************************************
437  inline constexpr bool isIntact() const noexcept;
439  //**********************************************************************************************
440 
441  //**Expression template evaluation functions****************************************************
444  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
445  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
446 
447  static inline constexpr bool isAligned() noexcept;
448 
449  BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
450  BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
451  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
452 
453  BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
454  BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
455  BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
456  BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
457 
458  template< typename VT >
459  inline auto assign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT> >;
460 
461  template< typename VT >
462  inline auto assign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT> >;
463 
464  template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
465 
466  template< typename VT >
467  inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT> >;
468 
469  template< typename VT >
470  inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT> >;
471 
472  template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
473 
474  template< typename VT >
475  inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT> >;
476 
477  template< typename VT >
478  inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT> >;
479 
480  template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
481 
482  template< typename VT >
483  inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT> >;
484 
485  template< typename VT >
486  inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT> >;
487 
488  template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
489 
490  template< typename VT >
491  inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT> >;
492 
493  template< typename VT >
494  inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT> >;
496  //**********************************************************************************************
497 
498  private:
499  //**********************************************************************************************
501  static constexpr size_t Alignment =
502  ( align ? AlignmentOf_v<Type> : std::alignment_of<Type>::value );
503 
506  //**********************************************************************************************
507 
508  //**Member variables****************************************************************************
512 
518  //**********************************************************************************************
519 
520  //**Compile time checks*************************************************************************
526  BLAZE_STATIC_ASSERT( !usePadding || ( NN % SIMDSIZE == 0UL ) );
527  BLAZE_STATIC_ASSERT( NN >= N );
529  //**********************************************************************************************
530 };
531 //*************************************************************************************************
532 
533 
534 
535 
536 //=================================================================================================
537 //
538 // CONSTRUCTORS
539 //
540 //=================================================================================================
541 
542 //*************************************************************************************************
555 template< typename Type // Data type of the vector
556  , size_t N // Number of elements
557  , bool TF > // Transpose flag
558 inline StaticVector<Type,N,TF>::StaticVector()
559  : v_() // The statically allocated vector elements
560 {
561  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
562 
563  if( IsNumeric_v<Type> ) {
564  if( useDefaultInitialization ) {
565  for( size_t i=0UL; i<NN; ++i )
566  v_[i] = Type();
567  }
568  else if( usePadding ) {
569  for( size_t i=N; i<NN; ++i )
570  v_[i] = Type();
571  }
572  }
573 
574  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
575 }
576 //*************************************************************************************************
577 
578 
579 //*************************************************************************************************
584 template< typename Type // Data type of the vector
585  , size_t N // Number of elements
586  , bool TF > // Transpose flag
587 inline StaticVector<Type,N,TF>::StaticVector( const Type& init )
588  : v_() // The statically allocated vector elements
589 {
590  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
591 
592  for( size_t i=0UL; i<N; ++i )
593  v_[i] = init;
594 
595  for( size_t i=N; i<NN; ++i )
596  v_[i] = Type();
597 
598  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
599 }
600 //*************************************************************************************************
601 
602 
603 //*************************************************************************************************
620 template< typename Type // Data type of the vector
621  , size_t N // Number of elements
622  , bool TF > // Transpose flag
624  : v_( Type() ) // The statically allocated vector elements
625 {
626  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
627 
628  if( list.size() > N ) {
629  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
630  }
631 
632  size_t i( 0UL );
633 
634  for( const auto& element : list ) {
635  v_[i] = element;
636  ++i;
637  }
638 
639  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
640 }
641 //*************************************************************************************************
642 
643 
644 //*************************************************************************************************
666 template< typename Type // Data type of the vector
667  , size_t N // Number of elements
668  , bool TF > // Transpose flag
669 template< typename Other > // Data type of the initialization array
670 inline StaticVector<Type,N,TF>::StaticVector( size_t n, const Other* array )
671  : v_() // The statically allocated vector elements
672 {
673  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
674 
675  if( n > N ) {
676  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
677  }
678 
679  for( size_t i=0UL; i<n; ++i )
680  v_[i] = array[i];
681 
682  if( IsNumeric_v<Type> ) {
683  for( size_t i=n; i<NN; ++i )
684  v_[i] = Type();
685  }
686 
687  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
688 }
689 //*************************************************************************************************
690 
691 
692 //*************************************************************************************************
708 template< typename Type // Data type of the vector
709  , size_t N // Number of elements
710  , bool TF > // Transpose flag
711 template< typename Other // Data type of the initialization array
712  , size_t Dim > // Dimension of the initialization array
713 inline StaticVector<Type,N,TF>::StaticVector( const Other (&array)[Dim] )
714  : v_() // The statically allocated vector elements
715 {
716  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
717  BLAZE_STATIC_ASSERT( Dim == N );
718 
719  for( size_t i=0UL; i<N; ++i )
720  v_[i] = array[i];
721 
722  for( size_t i=N; i<NN; ++i )
723  v_[i] = Type();
724 
725  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
726 }
727 //*************************************************************************************************
728 
729 
730 //*************************************************************************************************
737 template< typename Type // Data type of the vector
738  , size_t N // Number of elements
739  , bool TF > // Transpose flag
741  : v_( v.v_ ) // The statically allocated vector elements
742 {
743  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
744 
745  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
746 }
747 //*************************************************************************************************
748 
749 
750 //*************************************************************************************************
755 template< typename Type // Data type of the vector
756  , size_t N // Number of elements
757  , bool TF > // Transpose flag
758 template< typename Other > // Data type of the foreign vector
760  : v_() // The statically allocated vector elements
761 {
762  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
763 
764  for( size_t i=0UL; i<N; ++i )
765  v_[i] = v[i];
766 
767  for( size_t i=N; i<NN; ++i )
768  v_[i] = Type();
769 
770  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
771 }
772 //*************************************************************************************************
773 
774 
775 //*************************************************************************************************
785 template< typename Type // Data type of the vector
786  , size_t N // Number of elements
787  , bool TF > // Transpose flag
788 template< typename VT > // Type of the foreign vector
790  : v_() // The statically allocated vector elements
791 {
792  using blaze::assign;
793 
794  BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
795 
796  if( (~v).size() != N ) {
797  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
798  }
799 
800  for( size_t i=( IsSparseVector_v<VT> ? 0UL : N ); i<NN; ++i ) {
801  v_[i] = Type();
802  }
803 
804  assign( *this, ~v );
805 
806  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
807 }
808 //*************************************************************************************************
809 
810 
811 
812 
813 //=================================================================================================
814 //
815 // DATA ACCESS FUNCTIONS
816 //
817 //=================================================================================================
818 
819 //*************************************************************************************************
828 template< typename Type // Data type of the vector
829  , size_t N // Number of elements
830  , bool TF > // Transpose flag
831 inline constexpr typename StaticVector<Type,N,TF>::Reference
832  StaticVector<Type,N,TF>::operator[]( size_t index ) noexcept
833 {
834  BLAZE_USER_ASSERT( index < N, "Invalid vector access index" );
835  return v_[index];
836 }
837 //*************************************************************************************************
838 
839 
840 //*************************************************************************************************
849 template< typename Type // Data type of the vector
850  , size_t N // Number of elements
851  , bool TF > // Transpose flag
852 inline constexpr typename StaticVector<Type,N,TF>::ConstReference
853  StaticVector<Type,N,TF>::operator[]( size_t index ) const noexcept
854 {
855  BLAZE_USER_ASSERT( index < N, "Invalid vector access index" );
856  return v_[index];
857 }
858 //*************************************************************************************************
859 
860 
861 //*************************************************************************************************
871 template< typename Type // Data type of the vector
872  , size_t N // Number of elements
873  , bool TF > // Transpose flag
876 {
877  if( index >= N ) {
878  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
879  }
880  return (*this)[index];
881 }
882 //*************************************************************************************************
883 
884 
885 //*************************************************************************************************
895 template< typename Type // Data type of the vector
896  , size_t N // Number of elements
897  , bool TF > // Transpose flag
899  StaticVector<Type,N,TF>::at( size_t index ) const
900 {
901  if( index >= N ) {
902  BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
903  }
904  return (*this)[index];
905 }
906 //*************************************************************************************************
907 
908 
909 //*************************************************************************************************
916 template< typename Type // Data type of the vector
917  , size_t N // Number of elements
918  , bool TF > // Transpose flag
919 inline constexpr typename StaticVector<Type,N,TF>::Pointer
921 {
922  return v_;
923 }
924 //*************************************************************************************************
925 
926 
927 //*************************************************************************************************
934 template< typename Type // Data type of the vector
935  , size_t N // Number of elements
936  , bool TF > // Transpose flag
937 inline constexpr typename StaticVector<Type,N,TF>::ConstPointer
939 {
940  return v_;
941 }
942 //*************************************************************************************************
943 
944 
945 //*************************************************************************************************
950 template< typename Type // Data type of the vector
951  , size_t N // Number of elements
952  , bool TF > // Transpose flag
953 inline constexpr typename StaticVector<Type,N,TF>::Iterator
955 {
956  return Iterator( v_ );
957 }
958 //*************************************************************************************************
959 
960 
961 //*************************************************************************************************
966 template< typename Type // Data type of the vector
967  , size_t N // Number of elements
968  , bool TF > // Transpose flag
969 inline constexpr typename StaticVector<Type,N,TF>::ConstIterator
971 {
972  return ConstIterator( v_ );
973 }
974 //*************************************************************************************************
975 
976 
977 //*************************************************************************************************
982 template< typename Type // Data type of the vector
983  , size_t N // Number of elements
984  , bool TF > // Transpose flag
985 inline constexpr typename StaticVector<Type,N,TF>::ConstIterator
987 {
988  return ConstIterator( v_ );
989 }
990 //*************************************************************************************************
991 
992 
993 //*************************************************************************************************
998 template< typename Type // Data type of the vector
999  , size_t N // Number of elements
1000  , bool TF > // Transpose flag
1001 inline constexpr typename StaticVector<Type,N,TF>::Iterator
1003 {
1004  return Iterator( v_ + N );
1005 }
1006 //*************************************************************************************************
1007 
1008 
1009 //*************************************************************************************************
1014 template< typename Type // Data type of the vector
1015  , size_t N // Number of elements
1016  , bool TF > // Transpose flag
1017 inline constexpr typename StaticVector<Type,N,TF>::ConstIterator
1019 {
1020  return ConstIterator( v_ + N );
1021 }
1022 //*************************************************************************************************
1023 
1024 
1025 //*************************************************************************************************
1030 template< typename Type // Data type of the vector
1031  , size_t N // Number of elements
1032  , bool TF > // Transpose flag
1033 inline constexpr typename StaticVector<Type,N,TF>::ConstIterator
1035 {
1036  return ConstIterator( v_ + N );
1037 }
1038 //*************************************************************************************************
1039 
1040 
1041 
1042 
1043 //=================================================================================================
1044 //
1045 // ASSIGNMENT OPERATORS
1046 //
1047 //=================================================================================================
1048 
1049 //*************************************************************************************************
1055 template< typename Type // Data type of the vector
1056  , size_t N // Number of elements
1057  , bool TF > // Transpose flag
1058 inline constexpr StaticVector<Type,N,TF>&
1060 {
1061  for( size_t i=0UL; i<N; ++i )
1062  v_[i] = rhs;
1063  return *this;
1064 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1086 template< typename Type // Data type of the vector
1087  , size_t N // Number of elements
1088  , bool TF > // Transpose flag
1089 inline constexpr StaticVector<Type,N,TF>&
1091 {
1092  if( list.size() > N ) {
1093  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static vector" );
1094  }
1095 
1096  size_t i( 0UL );
1097 
1098  for( const auto& element : list ) {
1099  v_[i] = element;
1100  ++i;
1101  }
1102 
1103  for( ; i<N; ++i ) {
1104  v_[i] = Type();
1105  }
1106 
1107  return *this;
1108 }
1109 //*************************************************************************************************
1110 
1111 
1112 //*************************************************************************************************
1129 template< typename Type // Data type of the vector
1130  , size_t N // Number of elements
1131  , bool TF > // Transpose flag
1132 template< typename Other // Data type of the initialization array
1133  , size_t Dim > // Dimension of the initialization array
1135 {
1136  BLAZE_STATIC_ASSERT( Dim == N );
1137 
1138  for( size_t i=0UL; i<N; ++i )
1139  v_[i] = array[i];
1140  return *this;
1141 }
1142 //*************************************************************************************************
1143 
1144 
1145 //*************************************************************************************************
1153 template< typename Type // Data type of the vector
1154  , size_t N // Number of elements
1155  , bool TF > // Transpose flag
1157 {
1158  v_ = rhs.v_;
1159 
1160  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1161 
1162  return *this;
1163 }
1164 //*************************************************************************************************
1165 
1166 
1167 //*************************************************************************************************
1173 template< typename Type // Data type of the vector
1174  , size_t N // Number of elements
1175  , bool TF > // Transpose flag
1176 template< typename Other > // Data type of the foreign vector
1178 {
1179  using blaze::assign;
1180 
1181  assign( *this, ~rhs );
1182 
1183  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1184 
1185  return *this;
1186 }
1187 //*************************************************************************************************
1188 
1189 
1190 //*************************************************************************************************
1200 template< typename Type // Data type of the vector
1201  , size_t N // Number of elements
1202  , bool TF > // Transpose flag
1203 template< typename VT > // Type of the right-hand side vector
1205 {
1206  using blaze::assign;
1207 
1208  if( (~rhs).size() != N ) {
1209  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static vector" );
1210  }
1211 
1212  if( (~rhs).canAlias( this ) ) {
1213  StaticVector tmp( ~rhs );
1214  swap( tmp );
1215  }
1216  else {
1217  if( IsSparseVector_v<VT> )
1218  reset();
1219  assign( *this, ~rhs );
1220  }
1221 
1222  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1223 
1224  return *this;
1225 }
1226 //*************************************************************************************************
1227 
1228 
1229 //*************************************************************************************************
1239 template< typename Type // Data type of the vector
1240  , size_t N // Number of elements
1241  , bool TF > // Transpose flag
1242 template< typename VT > // Type of the right-hand side vector
1244 {
1245  using blaze::addAssign;
1246 
1247  if( (~rhs).size() != N ) {
1248  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1249  }
1250 
1251  if( (~rhs).canAlias( this ) ) {
1252  StaticVector tmp( ~rhs );
1253  addAssign( *this, tmp );
1254  }
1255  else {
1256  addAssign( *this, ~rhs );
1257  }
1258 
1259  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1260 
1261  return *this;
1262 }
1263 //*************************************************************************************************
1264 
1265 
1266 //*************************************************************************************************
1276 template< typename Type // Data type of the vector
1277  , size_t N // Number of elements
1278  , bool TF > // Transpose flag
1279 template< typename VT > // Type of the right-hand side vector
1281 {
1282  using blaze::subAssign;
1283 
1284  if( (~rhs).size() != N ) {
1285  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1286  }
1287 
1288  if( (~rhs).canAlias( this ) ) {
1289  StaticVector tmp( ~rhs );
1290  subAssign( *this, tmp );
1291  }
1292  else {
1293  subAssign( *this, ~rhs );
1294  }
1295 
1296  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1297 
1298  return *this;
1299 }
1300 //*************************************************************************************************
1301 
1302 
1303 //*************************************************************************************************
1314 template< typename Type // Data type of the vector
1315  , size_t N // Number of elements
1316  , bool TF > // Transpose flag
1317 template< typename VT > // Type of the right-hand side vector
1319 {
1320  using blaze::assign;
1321  using blaze::multAssign;
1322 
1323  if( (~rhs).size() != N ) {
1324  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1325  }
1326 
1327  if( IsSparseVector_v<VT> || (~rhs).canAlias( this ) ) {
1328  const StaticVector tmp( *this * (~rhs) );
1329  assign( *this, tmp );
1330  }
1331  else {
1332  multAssign( *this, ~rhs );
1333  }
1334 
1335  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1336 
1337  return *this;
1338 }
1339 //*************************************************************************************************
1340 
1341 
1342 //*************************************************************************************************
1352 template< typename Type // Data type of the vector
1353  , size_t N // Number of elements
1354  , bool TF > // Transpose flag
1355 template< typename VT > // Type of the right-hand side vector
1357 {
1358  using blaze::assign;
1359  using blaze::divAssign;
1360 
1361  if( (~rhs).size() != N ) {
1362  BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1363  }
1364 
1365  if( (~rhs).canAlias( this ) ) {
1366  const StaticVector tmp( *this / (~rhs) );
1367  assign( *this, tmp );
1368  }
1369  else {
1370  divAssign( *this, ~rhs );
1371  }
1372 
1373  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1374 
1375  return *this;
1376 }
1377 //*************************************************************************************************
1378 
1379 
1380 //*************************************************************************************************
1391 template< typename Type // Data type of the vector
1392  , size_t N // Number of elements
1393  , bool TF > // Transpose flag
1394 template< typename VT > // Type of the right-hand side vector
1396 {
1397  using blaze::assign;
1398 
1401 
1402  using CrossType = CrossTrait_t< This, ResultType_t<VT> >;
1403 
1407 
1408  if( N != 3UL || (~rhs).size() != 3UL ) {
1409  BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1410  }
1411 
1412  const CrossType tmp( *this % (~rhs) );
1413  assign( *this, tmp );
1414 
1415  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1416 
1417  return *this;
1418 }
1419 //*************************************************************************************************
1420 
1421 
1422 
1423 
1424 //=================================================================================================
1425 //
1426 // UTILITY FUNCTIONS
1427 //
1428 //=================================================================================================
1429 
1430 //*************************************************************************************************
1435 template< typename Type // Data type of the vector
1436  , size_t N // Number of elements
1437  , bool TF > // Transpose flag
1438 inline constexpr size_t StaticVector<Type,N,TF>::size() noexcept
1439 {
1440  return N;
1441 }
1442 //*************************************************************************************************
1443 
1444 
1445 //*************************************************************************************************
1453 template< typename Type // Data type of the vector
1454  , size_t N // Number of elements
1455  , bool TF > // Transpose flag
1456 inline constexpr size_t StaticVector<Type,N,TF>::spacing() noexcept
1457 {
1458  return NN;
1459 }
1460 //*************************************************************************************************
1461 
1462 
1463 //*************************************************************************************************
1468 template< typename Type // Data type of the vector
1469  , size_t N // Number of elements
1470  , bool TF > // Transpose flag
1471 inline constexpr size_t StaticVector<Type,N,TF>::capacity() noexcept
1472 {
1473  return NN;
1474 }
1475 //*************************************************************************************************
1476 
1477 
1478 //*************************************************************************************************
1486 template< typename Type // Data type of the vector
1487  , size_t N // Number of elements
1488  , bool TF > // Transpose flag
1490 {
1491  size_t nonzeros( 0 );
1492 
1493  for( size_t i=0UL; i<N; ++i ) {
1494  if( !isDefault( v_[i] ) )
1495  ++nonzeros;
1496  }
1497 
1498  return nonzeros;
1499 }
1500 //*************************************************************************************************
1501 
1502 
1503 //*************************************************************************************************
1508 template< typename Type // Data type of the vector
1509  , size_t N // Number of elements
1510  , bool TF > // Transpose flag
1511 inline constexpr void StaticVector<Type,N,TF>::reset()
1512 {
1513  using blaze::clear;
1514  for( size_t i=0UL; i<N; ++i )
1515  clear( v_[i] );
1516 }
1517 //*************************************************************************************************
1518 
1519 
1520 //*************************************************************************************************
1526 template< typename Type // Data type of the vector
1527  , size_t N // Number of elements
1528  , bool TF > // Transpose flag
1530 {
1531  using std::swap;
1532 
1533  for( size_t i=0UL; i<N; ++i )
1534  swap( v_[i], v.v_[i] );
1535 }
1536 //*************************************************************************************************
1537 
1538 
1539 
1540 
1541 //=================================================================================================
1542 //
1543 // NUMERIC FUNCTIONS
1544 //
1545 //=================================================================================================
1546 
1547 //*************************************************************************************************
1564 template< typename Type // Data type of the vector
1565  , size_t N // Number of elements
1566  , bool TF > // Transpose flag
1567 template< typename Other > // Data type of the scalar value
1569 {
1570  for( size_t i=0; i<N; ++i )
1571  v_[i] *= scalar;
1572  return *this;
1573 }
1574 //*************************************************************************************************
1575 
1576 
1577 
1578 
1579 //=================================================================================================
1580 //
1581 // MEMORY FUNCTIONS
1582 //
1583 //=================================================================================================
1584 
1585 //*************************************************************************************************
1595 template< typename Type // Data type of the vector
1596  , size_t N // Number of elements
1597  , bool TF > // Transpose flag
1598 inline void* StaticVector<Type,N,TF>::operator new( std::size_t size )
1599 {
1600  MAYBE_UNUSED( size );
1601 
1602  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticVector ), "Invalid number of bytes detected" );
1603 
1604  return allocate<StaticVector>( 1UL );
1605 }
1606 //*************************************************************************************************
1607 
1608 
1609 //*************************************************************************************************
1619 template< typename Type // Data type of the vector
1620  , size_t N // Number of elements
1621  , bool TF > // Transpose flag
1622 inline void* StaticVector<Type,N,TF>::operator new[]( std::size_t size )
1623 {
1624  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticVector ) , "Invalid number of bytes detected" );
1625  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticVector ) == 0UL, "Invalid number of bytes detected" );
1626 
1627  return allocate<StaticVector>( size/sizeof(StaticVector) );
1628 }
1629 //*************************************************************************************************
1630 
1631 
1632 //*************************************************************************************************
1642 template< typename Type // Data type of the vector
1643  , size_t N // Number of elements
1644  , bool TF > // Transpose flag
1645 inline void* StaticVector<Type,N,TF>::operator new( std::size_t size, const std::nothrow_t& )
1646 {
1647  MAYBE_UNUSED( size );
1648 
1649  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticVector ), "Invalid number of bytes detected" );
1650 
1651  return allocate<StaticVector>( 1UL );
1652 }
1653 //*************************************************************************************************
1654 
1655 
1656 //*************************************************************************************************
1666 template< typename Type // Data type of the vector
1667  , size_t N // Number of elements
1668  , bool TF > // Transpose flag
1669 inline void* StaticVector<Type,N,TF>::operator new[]( std::size_t size, const std::nothrow_t& )
1670 {
1671  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticVector ) , "Invalid number of bytes detected" );
1672  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticVector ) == 0UL, "Invalid number of bytes detected" );
1673 
1674  return allocate<StaticVector>( size/sizeof(StaticVector) );
1675 }
1676 //*************************************************************************************************
1677 
1678 
1679 //*************************************************************************************************
1685 template< typename Type // Data type of the vector
1686  , size_t N // Number of elements
1687  , bool TF > // Transpose flag
1688 inline void StaticVector<Type,N,TF>::operator delete( void* ptr )
1689 {
1690  deallocate( static_cast<StaticVector*>( ptr ) );
1691 }
1692 //*************************************************************************************************
1693 
1694 
1695 //*************************************************************************************************
1701 template< typename Type // Data type of the vector
1702  , size_t N // Number of elements
1703  , bool TF > // Transpose flag
1704 inline void StaticVector<Type,N,TF>::operator delete[]( void* ptr )
1705 {
1706  deallocate( static_cast<StaticVector*>( ptr ) );
1707 }
1708 //*************************************************************************************************
1709 
1710 
1711 //*************************************************************************************************
1717 template< typename Type // Data type of the vector
1718  , size_t N // Number of elements
1719  , bool TF > // Transpose flag
1720 inline void StaticVector<Type,N,TF>::operator delete( void* ptr, const std::nothrow_t& )
1721 {
1722  deallocate( static_cast<StaticVector*>( ptr ) );
1723 }
1724 //*************************************************************************************************
1725 
1726 
1727 //*************************************************************************************************
1733 template< typename Type // Data type of the vector
1734  , size_t N // Number of elements
1735  , bool TF > // Transpose flag
1736 inline void StaticVector<Type,N,TF>::operator delete[]( void* ptr, const std::nothrow_t& )
1737 {
1738  deallocate( static_cast<StaticVector*>( ptr ) );
1739 }
1740 //*************************************************************************************************
1741 
1742 
1743 
1744 
1745 //=================================================================================================
1746 //
1747 // DEBUGGING FUNCTIONS
1748 //
1749 //=================================================================================================
1750 
1751 //*************************************************************************************************
1760 template< typename Type // Data type of the vector
1761  , size_t N // Number of elements
1762  , bool TF > // Transpose flag
1763 inline constexpr bool StaticVector<Type,N,TF>::isIntact() const noexcept
1764 {
1765  if( IsNumeric_v<Type> ) {
1766  for( size_t i=N; i<NN; ++i ) {
1767  if( v_[i] != Type() )
1768  return false;
1769  }
1770  }
1771 
1772  return true;
1773 }
1774 //*************************************************************************************************
1775 
1776 
1777 
1778 
1779 //=================================================================================================
1780 //
1781 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1782 //
1783 //=================================================================================================
1784 
1785 //*************************************************************************************************
1795 template< typename Type // Data type of the vector
1796  , size_t N // Number of elements
1797  , bool TF > // Transpose flag
1798 template< typename Other > // Data type of the foreign expression
1799 inline bool StaticVector<Type,N,TF>::canAlias( const Other* alias ) const noexcept
1800 {
1801  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1802 }
1803 //*************************************************************************************************
1804 
1805 
1806 //*************************************************************************************************
1816 template< typename Type // Data type of the vector
1817  , size_t N // Number of elements
1818  , bool TF > // Transpose flag
1819 template< typename Other > // Data type of the foreign expression
1820 inline bool StaticVector<Type,N,TF>::isAliased( const Other* alias ) const noexcept
1821 {
1822  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1823 }
1824 //*************************************************************************************************
1825 
1826 
1827 //*************************************************************************************************
1836 template< typename Type // Data type of the vector
1837  , size_t N // Number of elements
1838  , bool TF > // Transpose flag
1839 inline constexpr bool StaticVector<Type,N,TF>::isAligned() noexcept
1840 {
1841  return align;
1842 }
1843 //*************************************************************************************************
1844 
1845 
1846 //*************************************************************************************************
1858 template< typename Type // Data type of the vector
1859  , size_t N // Number of elements
1860  , bool TF > // Transpose flag
1862  StaticVector<Type,N,TF>::load( size_t index ) const noexcept
1863 {
1864  return loada( index );
1865 }
1866 //*************************************************************************************************
1867 
1868 
1869 //*************************************************************************************************
1882 template< typename Type // Data type of the vector
1883  , size_t N // Number of elements
1884  , bool TF > // Transpose flag
1886  StaticVector<Type,N,TF>::loada( size_t index ) const noexcept
1887 {
1888  using blaze::loada;
1889 
1891 
1892  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1893  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
1894  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
1895  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1896 
1897  return loada( &v_[index] );
1898 }
1899 //*************************************************************************************************
1900 
1901 
1902 //*************************************************************************************************
1915 template< typename Type // Data type of the vector
1916  , size_t N // Number of elements
1917  , bool TF > // Transpose flag
1919  StaticVector<Type,N,TF>::loadu( size_t index ) const noexcept
1920 {
1921  using blaze::loadu;
1922 
1924 
1925  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1926  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
1927 
1928  return loadu( &v_[index] );
1929 }
1930 //*************************************************************************************************
1931 
1932 
1933 //*************************************************************************************************
1946 template< typename Type // Data type of the vector
1947  , size_t N // Number of elements
1948  , bool TF > // Transpose flag
1950  StaticVector<Type,N,TF>::store( size_t index, const SIMDType& value ) noexcept
1951 {
1952  storea( index, value );
1953 }
1954 //*************************************************************************************************
1955 
1956 
1957 //*************************************************************************************************
1970 template< typename Type // Data type of the vector
1971  , size_t N // Number of elements
1972  , bool TF > // Transpose flag
1974  StaticVector<Type,N,TF>::storea( size_t index, const SIMDType& value ) noexcept
1975 {
1976  using blaze::storea;
1977 
1979 
1980  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
1981  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN , "Invalid vector access index" );
1982  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
1983  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
1984 
1985  storea( &v_[index], value );
1986 }
1987 //*************************************************************************************************
1988 
1989 
1990 //*************************************************************************************************
2003 template< typename Type // Data type of the vector
2004  , size_t N // Number of elements
2005  , bool TF > // Transpose flag
2007  StaticVector<Type,N,TF>::storeu( size_t index, const SIMDType& value ) noexcept
2008 {
2009  using blaze::storeu;
2010 
2012 
2013  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2014  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2015 
2016  storeu( &v_[index], value );
2017 }
2018 //*************************************************************************************************
2019 
2020 
2021 //*************************************************************************************************
2035 template< typename Type // Data type of the vector
2036  , size_t N // Number of elements
2037  , bool TF > // Transpose flag
2039  StaticVector<Type,N,TF>::stream( size_t index, const SIMDType& value ) noexcept
2040 {
2041  using blaze::stream;
2042 
2044 
2045  BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2046  BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2047  BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2048  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
2049 
2050  stream( &v_[index], value );
2051 }
2052 //*************************************************************************************************
2053 
2054 
2055 //*************************************************************************************************
2066 template< typename Type // Data type of the vector
2067  , size_t N // Number of elements
2068  , bool TF > // Transpose flag
2069 template< typename VT > // Type of the right-hand side dense vector
2072 {
2073  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2074 
2075  for( size_t i=0UL; i<N; ++i )
2076  v_[i] = (~rhs)[i];
2077 }
2078 //*************************************************************************************************
2079 
2080 
2081 //*************************************************************************************************
2092 template< typename Type // Data type of the vector
2093  , size_t N // Number of elements
2094  , bool TF > // Transpose flag
2095 template< typename VT > // Type of the right-hand side dense vector
2096 inline auto StaticVector<Type,N,TF>::assign( const DenseVector<VT,TF>& rhs )
2098 {
2100 
2101  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2102 
2103  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2104 
2105  constexpr size_t ipos( ( remainder )?( N & size_t(-SIMDSIZE) ):( N ) );
2106  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2107 
2108  size_t i( 0UL );
2109 
2110  for( ; i<ipos; i+=SIMDSIZE ) {
2111  store( i, (~rhs).load(i) );
2112  }
2113  for( ; remainder && i<N; ++i ) {
2114  v_[i] = (~rhs)[i];
2115  }
2116 }
2117 //*************************************************************************************************
2118 
2119 
2120 //*************************************************************************************************
2131 template< typename Type // Data type of the vector
2132  , size_t N // Number of elements
2133  , bool TF > // Transpose flag
2134 template< typename VT > // Type of the right-hand side sparse vector
2136 {
2137  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2138 
2139  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2140  v_[element->index()] = element->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() == N, "Invalid vector sizes" );
2164 
2165  for( size_t i=0UL; i<N; ++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
2188 {
2190 
2191  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2192 
2193  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2194 
2195  constexpr size_t ipos( ( remainder )?( N & size_t(-SIMDSIZE) ):( N ) );
2196  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2197 
2198  size_t i( 0UL );
2199 
2200  for( ; i<ipos; i+=SIMDSIZE ) {
2201  store( i, load(i) + (~rhs).load(i) );
2202  }
2203  for( ; remainder && i<N; ++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() == N, "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() == N, "Invalid vector sizes" );
2254 
2255  for( size_t i=0UL; i<N; ++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() == N, "Invalid vector sizes" );
2282 
2283  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2284 
2285  constexpr size_t ipos( ( remainder )?( N & size_t(-SIMDSIZE) ):( N ) );
2286  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (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<N; ++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() == N, "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() == N, "Invalid vector sizes" );
2344 
2345  for( size_t i=0UL; i<N; ++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() == N, "Invalid vector sizes" );
2372 
2373  constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2374 
2375  constexpr size_t ipos( ( remainder )?( N & size_t(-SIMDSIZE) ):( N ) );
2376  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (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<N; ++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() == N, "Invalid vector sizes" );
2408 
2409  const StaticVector tmp( serial( *this ) );
2410 
2411  reset();
2412 
2413  for( auto element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2414  v_[element->index()] = tmp[element->index()] * element->value();
2415 }
2416 //*************************************************************************************************
2417 
2418 
2419 //*************************************************************************************************
2430 template< typename Type // Data type of the vector
2431  , size_t N // Number of elements
2432  , bool TF > // Transpose flag
2433 template< typename VT > // Type of the right-hand side dense vector
2436 {
2437  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2438 
2439  for( size_t i=0UL; i<N; ++i )
2440  v_[i] /= (~rhs)[i];
2441 }
2442 //*************************************************************************************************
2443 
2444 
2445 //*************************************************************************************************
2456 template< typename Type // Data type of the vector
2457  , size_t N // Number of elements
2458  , bool TF > // Transpose flag
2459 template< typename VT > // Type of the right-hand side dense vector
2462 {
2464 
2465  BLAZE_INTERNAL_ASSERT( (~rhs).size() == N, "Invalid vector sizes" );
2466 
2467  constexpr size_t ipos( N & size_t(-SIMDSIZE) );
2468  BLAZE_INTERNAL_ASSERT( ( N - ( N % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
2469 
2470  size_t i( 0UL );
2471 
2472  for( ; i<ipos; i+=SIMDSIZE ) {
2473  store( i, load(i) / (~rhs).load(i) );
2474  }
2475  for( ; i<N; ++i ) {
2476  v_[i] /= (~rhs)[i];
2477  }
2478 }
2479 //*************************************************************************************************
2480 
2481 
2482 
2483 
2484 
2485 
2486 
2487 
2488 //=================================================================================================
2489 //
2490 // STATICVECTOR OPERATORS
2491 //
2492 //=================================================================================================
2493 
2494 //*************************************************************************************************
2497 template< typename Type, size_t N, bool TF >
2498 constexpr void reset( StaticVector<Type,N,TF>& v );
2499 
2500 template< typename Type, size_t N, bool TF >
2501 constexpr void clear( StaticVector<Type,N,TF>& v );
2502 
2503 template< bool RF, typename Type, size_t N, bool TF >
2504 bool isDefault( const StaticVector<Type,N,TF>& v );
2505 
2506 template< typename Type, size_t N, bool TF >
2507 constexpr bool isIntact( const StaticVector<Type,N,TF>& v ) noexcept;
2508 
2509 template< typename Type, bool TF >
2510 const StaticVector<Type,2UL,TF> perp( const StaticVector<Type,2UL,TF>& v );
2511 
2512 template< typename Type, bool TF >
2513 const StaticVector<Type,3UL,TF> perp( const StaticVector<Type,3UL,TF>& v );
2514 
2515 template< typename Type, size_t N, bool TF >
2516 void swap( StaticVector<Type,N,TF>& a, StaticVector<Type,N,TF>& b ) noexcept;
2517 
2518 template< size_t I, typename Type, size_t N, bool TF >
2519 constexpr Type& get( StaticVector<Type,N,TF>& v ) noexcept;
2520 
2521 template< size_t I, typename Type, size_t N, bool TF >
2522 constexpr Type&& get( StaticVector<Type,N,TF>&& v ) noexcept;
2523 
2524 template< size_t I, typename Type, size_t N, bool TF >
2525 constexpr const Type& get( const StaticVector<Type,N,TF>& v) noexcept;
2526 
2527 template< size_t I, typename Type, size_t N, bool TF >
2528 constexpr const Type&& get( const StaticVector<Type,N,TF>&& v ) noexcept;
2530 //*************************************************************************************************
2531 
2532 
2533 //*************************************************************************************************
2540 template< typename Type // Data type of the vector
2541  , size_t N // Number of elements
2542  , bool TF > // Transpose flag
2543 inline constexpr void reset( StaticVector<Type,N,TF>& v )
2544 {
2545  v.reset();
2546 }
2547 //*************************************************************************************************
2548 
2549 
2550 //*************************************************************************************************
2559 template< typename Type // Data type of the vector
2560  , size_t N // Number of elements
2561  , bool TF > // Transpose flag
2562 inline constexpr void clear( StaticVector<Type,N,TF>& v )
2563 {
2564  v.reset();
2565 }
2566 //*************************************************************************************************
2567 
2568 
2569 //*************************************************************************************************
2594 template< bool RF // Relaxation flag
2595  , typename Type // Data type of the vector
2596  , size_t N // Number of elements
2597  , bool TF > // Transpose flag
2598 inline bool isDefault( const StaticVector<Type,N,TF>& v )
2599 {
2600  for( size_t i=0UL; i<N; ++i )
2601  if( !isDefault<RF>( v[i] ) ) return false;
2602  return true;
2603 }
2604 //*************************************************************************************************
2605 
2606 
2607 //*************************************************************************************************
2625 template< typename Type // Data type of the vector
2626  , size_t N // Number of elements
2627  , bool TF > // Transpose flag
2628 inline constexpr bool isIntact( const StaticVector<Type,N,TF>& v ) noexcept
2629 {
2630  return v.isIntact();
2631 }
2632 //*************************************************************************************************
2633 
2634 
2635 //*************************************************************************************************
2646 template< typename Type // Data type of the vector
2647  , bool TF > // Transpose flag
2649 {
2650  return StaticVector<Type,2UL,TF>( -v[1UL], v[0UL] );
2651 }
2652 //*************************************************************************************************
2653 
2654 
2655 //*************************************************************************************************
2663 template< typename Type // Data type of the vector
2664  , bool TF > // Transpose flag
2666 {
2667  if( v[0] != Type() || v[1] != Type() )
2668  return StaticVector<Type,3UL,TF>( v[1UL], -v[0UL], Type() );
2669  else
2670  return StaticVector<Type,3UL,TF>( Type(), v[2UL], -v[1UL] );
2671 }
2672 //*************************************************************************************************
2673 
2674 
2675 //*************************************************************************************************
2683 template< typename Type // Data type of the vector
2684  , size_t N // Number of elements
2685  , bool TF > // Transpose flag
2687 {
2688  a.swap( b );
2689 }
2690 //*************************************************************************************************
2691 
2692 
2693 //*************************************************************************************************
2700 template< size_t I // Compile time access index
2701  , typename Type // Data type of the vector
2702  , size_t N // Number of elements
2703  , bool TF > // Transpose flag
2704 constexpr Type& get( StaticVector<Type,N,TF>& v ) noexcept
2705 {
2706  BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
2707  return v[I];
2708 }
2709 //*************************************************************************************************
2710 
2711 
2712 //*************************************************************************************************
2719 template< size_t I // Compile time access index
2720  , typename Type // Data type of the vector
2721  , size_t N // Number of elements
2722  , bool TF > // Transpose flag
2723 constexpr Type&& get( StaticVector<Type,N,TF>&& v ) noexcept
2724 {
2725  BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
2726  return std::move( v[I] );
2727 }
2728 //*************************************************************************************************
2729 
2730 
2731 //*************************************************************************************************
2738 template< size_t I // Compile time access index
2739  , typename Type // Data type of the vector
2740  , size_t N // Number of elements
2741  , bool TF > // Transpose flag
2742 constexpr const Type& get( const StaticVector<Type,N,TF>& v) noexcept
2743 {
2744  BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
2745  return v[I];
2746 }
2747 //*************************************************************************************************
2748 
2749 
2750 //*************************************************************************************************
2757 template< size_t I // Compile time access index
2758  , typename Type // Data type of the vector
2759  , size_t N // Number of elements
2760  , bool TF > // Transpose flag
2761 constexpr const Type&& get( const StaticVector<Type,N,TF>&& v ) noexcept
2762 {
2763  BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
2764  return std::move( v[I] );
2765 }
2766 //*************************************************************************************************
2767 
2768 
2769 
2770 
2771 //=================================================================================================
2772 //
2773 // SIZE SPECIALIZATIONS
2774 //
2775 //=================================================================================================
2776 
2777 //*************************************************************************************************
2779 template< typename T, size_t N, bool TF >
2780 struct Size< StaticVector<T,N,TF>, 0UL >
2781  : public Ptrdiff_t<N>
2782 {};
2784 //*************************************************************************************************
2785 
2786 
2787 
2788 
2789 //=================================================================================================
2790 //
2791 // MAXSIZE SPECIALIZATIONS
2792 //
2793 //=================================================================================================
2794 
2795 //*************************************************************************************************
2797 template< typename T, size_t N, bool TF >
2798 struct MaxSize< StaticVector<T,N,TF>, 0UL >
2799  : public Ptrdiff_t<N>
2800 {};
2802 //*************************************************************************************************
2803 
2804 
2805 
2806 
2807 //=================================================================================================
2808 //
2809 // HASCONSTDATAACCESS SPECIALIZATIONS
2810 //
2811 //=================================================================================================
2812 
2813 //*************************************************************************************************
2815 template< typename T, size_t N, bool TF >
2816 struct HasConstDataAccess< StaticVector<T,N,TF> >
2817  : public TrueType
2818 {};
2820 //*************************************************************************************************
2821 
2822 
2823 
2824 
2825 //=================================================================================================
2826 //
2827 // HASMUTABLEDATAACCESS SPECIALIZATIONS
2828 //
2829 //=================================================================================================
2830 
2831 //*************************************************************************************************
2833 template< typename T, size_t N, bool TF >
2834 struct HasMutableDataAccess< StaticVector<T,N,TF> >
2835  : public TrueType
2836 {};
2838 //*************************************************************************************************
2839 
2840 
2841 
2842 
2843 //=================================================================================================
2844 //
2845 // ISSTATIC SPECIALIZATIONS
2846 //
2847 //=================================================================================================
2848 
2849 //*************************************************************************************************
2851 template< typename T, size_t N, bool TF >
2852 struct IsStatic< StaticVector<T,N,TF> >
2853  : public TrueType
2854 {};
2856 //*************************************************************************************************
2857 
2858 
2859 
2860 
2861 //=================================================================================================
2862 //
2863 // ISALIGNED SPECIALIZATIONS
2864 //
2865 //=================================================================================================
2866 
2867 //*************************************************************************************************
2869 template< typename T, size_t N, bool TF >
2870 struct IsAligned< StaticVector<T,N,TF> >
2871  : public BoolConstant< StaticVector<T,N,TF>::isAligned() >
2872 {};
2874 //*************************************************************************************************
2875 
2876 
2877 
2878 
2879 //=================================================================================================
2880 //
2881 // ISCONTIGUOUS SPECIALIZATIONS
2882 //
2883 //=================================================================================================
2884 
2885 //*************************************************************************************************
2887 template< typename T, size_t N, bool TF >
2888 struct IsContiguous< StaticVector<T,N,TF> >
2889  : public TrueType
2890 {};
2892 //*************************************************************************************************
2893 
2894 
2895 
2896 
2897 //=================================================================================================
2898 //
2899 // ISPADDED SPECIALIZATIONS
2900 //
2901 //=================================================================================================
2902 
2903 //*************************************************************************************************
2905 template< typename T, size_t N, bool TF >
2906 struct IsPadded< StaticVector<T,N,TF> >
2907  : public BoolConstant<usePadding>
2908 {};
2910 //*************************************************************************************************
2911 
2912 
2913 
2914 
2915 //=================================================================================================
2916 //
2917 // ADDTRAIT SPECIALIZATIONS
2918 //
2919 //=================================================================================================
2920 
2921 //*************************************************************************************************
2923 template< typename T1, typename T2 >
2924 struct AddTraitEval2< T1, T2
2925  , EnableIf_t< IsVector_v<T1> &&
2926  IsVector_v<T2> &&
2927  ( Size_v<T1,0UL> != DefaultSize_v ||
2928  Size_v<T2,0UL> != DefaultSize_v ) > >
2929 {
2930  using ET1 = ElementType_t<T1>;
2931  using ET2 = ElementType_t<T2>;
2932 
2933  static constexpr size_t N = max( Size_v<T1,0UL>, Size_v<T2,0UL> );
2934 
2935  using Type = StaticVector< AddTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2936 };
2938 //*************************************************************************************************
2939 
2940 
2941 
2942 
2943 //=================================================================================================
2944 //
2945 // SUBTRAIT SPECIALIZATIONS
2946 //
2947 //=================================================================================================
2948 
2949 //*************************************************************************************************
2951 template< typename T1, typename T2 >
2952 struct SubTraitEval2< T1, T2
2953  , EnableIf_t< IsVector_v<T1> &&
2954  IsVector_v<T2> &&
2955  ( Size_v<T1,0UL> != DefaultSize_v ||
2956  Size_v<T2,0UL> != DefaultSize_v ) > >
2957 {
2958  using ET1 = ElementType_t<T1>;
2959  using ET2 = ElementType_t<T2>;
2960 
2961  static constexpr size_t N = max( Size_v<T1,0UL>, Size_v<T2,0UL> );
2962 
2963  using Type = StaticVector< SubTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2964 };
2966 //*************************************************************************************************
2967 
2968 
2969 
2970 
2971 //=================================================================================================
2972 //
2973 // MULTTRAIT SPECIALIZATIONS
2974 //
2975 //=================================================================================================
2976 
2977 //*************************************************************************************************
2979 template< typename T1, typename T2 >
2980 struct MultTraitEval2< T1, T2
2981  , EnableIf_t< IsVector_v<T1> &&
2982  IsNumeric_v<T2> &&
2983  ( Size_v<T1,0UL> != DefaultSize_v ) > >
2984 {
2985  using ET1 = ElementType_t<T1>;
2986 
2987  static constexpr size_t N = Size_v<T1,0UL>;
2988 
2989  using Type = StaticVector< MultTrait_t<ET1,T2>, N, TransposeFlag_v<T1> >;
2990 };
2991 
2992 template< typename T1, typename T2 >
2993 struct MultTraitEval2< T1, T2
2994  , EnableIf_t< IsNumeric_v<T1> &&
2995  IsVector_v<T2> &&
2996  ( Size_v<T2,0UL> != DefaultSize_v ) > >
2997 {
2998  using ET2 = ElementType_t<T2>;
2999 
3000  static constexpr size_t N = Size_v<T2,0UL>;
3001 
3002  using Type = StaticVector< MultTrait_t<T1,ET2>, N, TransposeFlag_v<T2> >;
3003 };
3004 
3005 template< typename T1, typename T2 >
3006 struct MultTraitEval2< T1, T2
3007  , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
3008  ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
3009  IsDenseVector_v<T1> &&
3010  IsDenseVector_v<T2> &&
3011  ( Size_v<T1,0UL> != DefaultSize_v || Size_v<T2,0UL> != DefaultSize_v ) > >
3012 {
3013  using ET1 = ElementType_t<T1>;
3014  using ET2 = ElementType_t<T2>;
3015 
3016  static constexpr size_t N = max( Size_v<T1,0UL>, Size_v<T2,0UL> );
3017 
3018  using Type = StaticVector< MultTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
3019 };
3020 
3021 template< typename T1, typename T2 >
3022 struct MultTraitEval2< T1, T2
3023  , EnableIf_t< IsMatrix_v<T1> &&
3024  IsColumnVector_v<T2> &&
3025  ( Size_v<T1,0UL> != DefaultSize_v ||
3026  ( IsSquare_v<T1> && Size_v<T2,0UL> != DefaultSize_v ) ) > >
3027 {
3028  using ET1 = ElementType_t<T1>;
3029  using ET2 = ElementType_t<T2>;
3030 
3031  static constexpr size_t N = ( Size_v<T1,0UL> != DefaultSize_v ? Size_v<T1,0UL> : Size_v<T2,0UL> );
3032 
3033  using Type = StaticVector< MultTrait_t<ET1,ET2>, N, false >;
3034 };
3035 
3036 template< typename T1, typename T2 >
3037 struct MultTraitEval2< T1, T2
3038  , EnableIf_t< IsRowVector_v<T1> &&
3039  IsMatrix_v<T2> &&
3040  ( Size_v<T2,1UL> != DefaultSize_v ||
3041  ( IsSquare_v<T2> && Size_v<T1,0UL> != DefaultSize_v ) ) > >
3042 {
3043  using ET1 = ElementType_t<T1>;
3044  using ET2 = ElementType_t<T2>;
3045 
3046  static constexpr size_t N = ( Size_v<T2,1UL> != DefaultSize_v ? Size_v<T2,1UL> : Size_v<T1,0UL> );
3047 
3048  using Type = StaticVector< MultTrait_t<ET1,ET2>, N, true >;
3049 };
3051 //*************************************************************************************************
3052 
3053 
3054 
3055 
3056 //=================================================================================================
3057 //
3058 // KRONTRAIT SPECIALIZATIONS
3059 //
3060 //=================================================================================================
3061 
3062 //*************************************************************************************************
3064 template< typename T1, typename T2 >
3065 struct KronTraitEval2< T1, T2
3066  , EnableIf_t< IsDenseVector_v<T1> &&
3067  IsDenseVector_v<T2> &&
3068  ( Size_v<T1,0UL> != DefaultSize_v ) &&
3069  ( Size_v<T2,0UL> != DefaultSize_v ) > >
3070 {
3071  using ET1 = ElementType_t<T1>;
3072  using ET2 = ElementType_t<T2>;
3073 
3074  static constexpr size_t N = Size_v<T1,0UL> * Size_v<T2,0UL>;
3075 
3076  using Type = StaticVector< MultTrait_t<ET1,ET2>, N, TransposeFlag_v<T2> >;
3077 };
3079 //*************************************************************************************************
3080 
3081 
3082 
3083 
3084 //=================================================================================================
3085 //
3086 // DIVTRAIT SPECIALIZATIONS
3087 //
3088 //=================================================================================================
3089 
3090 //*************************************************************************************************
3092 template< typename T1, typename T2 >
3093 struct DivTraitEval2< T1, T2
3094  , EnableIf_t< IsVector_v<T1> &&
3095  IsNumeric_v<T2> &&
3096  ( Size_v<T1,0UL> != DefaultSize_v ) > >
3097 {
3098  using ET1 = ElementType_t<T1>;
3099 
3100  static constexpr size_t N = Size_v<T1,0UL>;
3101 
3102  using Type = StaticVector< DivTrait_t<ET1,T2>, N, TransposeFlag_v<T1> >;
3103 };
3104 
3105 template< typename T1, typename T2 >
3106 struct DivTraitEval2< T1, T2
3107  , EnableIf_t< IsDenseVector_v<T1> &&
3108  IsDenseVector_v<T2> &&
3109  ( Size_v<T1,0UL> != DefaultSize_v ||
3110  Size_v<T2,0UL> != DefaultSize_v ) > >
3111 {
3112  using ET1 = ElementType_t<T1>;
3113  using ET2 = ElementType_t<T2>;
3114 
3115  static constexpr size_t N = max( Size_v<T1,0UL>, Size_v<T2,0UL> );
3116 
3117  using Type = StaticVector< DivTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
3118 };
3120 //*************************************************************************************************
3121 
3122 
3123 
3124 
3125 //=================================================================================================
3126 //
3127 // CROSSTRAIT SPECIALIZATIONS
3128 //
3129 //=================================================================================================
3130 
3131 //*************************************************************************************************
3133 template< typename T1, typename T2 >
3134 struct CrossTraitEval2< T1, T2
3135  , EnableIf_t< IsVector_v<T1> && IsVector_v<T2> > >
3136 {
3137  using Tmp = MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >;
3138 
3139  using Type = StaticVector< SubTrait_t<Tmp,Tmp>, 3UL, TransposeFlag_v<T1> >;
3140 };
3142 //*************************************************************************************************
3143 
3144 
3145 
3146 
3147 //=================================================================================================
3148 //
3149 // MAPTRAIT SPECIALIZATIONS
3150 //
3151 //=================================================================================================
3152 
3153 //*************************************************************************************************
3155 template< typename T, typename OP >
3156 struct UnaryMapTraitEval2< T, OP
3157  , EnableIf_t< IsVector_v<T> &&
3158  Size_v<T,0UL> != DefaultSize_v > >
3159 {
3160  using ET = ElementType_t<T>;
3161 
3162  using Type = StaticVector< MapTrait_t<ET,OP>, Size_v<T,0UL>, TransposeFlag_v<T> >;
3163 };
3165 //*************************************************************************************************
3166 
3167 
3168 //*************************************************************************************************
3170 template< typename T1, typename T2, typename OP >
3171 struct BinaryMapTraitEval2< T1, T2, OP
3172  , EnableIf_t< IsVector_v<T1> &&
3173  IsVector_v<T2> &&
3174  ( Size_v<T1,0UL> != DefaultSize_v ||
3175  Size_v<T2,0UL> != DefaultSize_v ) > >
3176 {
3177  using ET1 = ElementType_t<T1>;
3178  using ET2 = ElementType_t<T2>;
3179 
3180  static constexpr size_t N = max( Size_v<T1,0UL>, Size_v<T2,0UL> );
3181 
3182  using Type = StaticVector< MapTrait_t<ET1,ET2,OP>, N, TransposeFlag_v<T1> >;
3183 };
3185 //*************************************************************************************************
3186 
3187 
3188 
3189 
3190 //=================================================================================================
3191 //
3192 // REDUCETRAIT SPECIALIZATIONS
3193 //
3194 //=================================================================================================
3195 
3196 //*************************************************************************************************
3198 template< typename T, typename OP, size_t RF >
3199 struct PartialReduceTraitEval2< T, OP, RF
3200  , EnableIf_t< IsMatrix_v<T> &&
3201  Size_v<T,0UL> != DefaultSize_v &&
3202  Size_v<T,1UL> != DefaultSize_v > >
3203 {
3204  using ET = ElementType_t<T>;
3205  using RT = decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) );
3206 
3207  static constexpr bool TF = ( RF == 0UL );
3208 
3209  static constexpr size_t N = Size_v< T, TF ? 1UL : 0UL >;
3210 
3211  using Type = StaticVector<RT,N,TF>;
3212 };
3214 //*************************************************************************************************
3215 
3216 
3217 
3218 
3219 //=================================================================================================
3220 //
3221 // HIGHTYPE SPECIALIZATIONS
3222 //
3223 //=================================================================================================
3224 
3225 //*************************************************************************************************
3227 template< typename T1, size_t N, bool TF, typename T2 >
3228 struct HighType< StaticVector<T1,N,TF>, StaticVector<T2,N,TF> >
3229 {
3230  using Type = StaticVector< typename HighType<T1,T2>::Type, N, TF >;
3231 };
3233 //*************************************************************************************************
3234 
3235 
3236 
3237 
3238 //=================================================================================================
3239 //
3240 // LOWTYPE SPECIALIZATIONS
3241 //
3242 //=================================================================================================
3243 
3244 //*************************************************************************************************
3246 template< typename T1, size_t N, bool TF, typename T2 >
3247 struct LowType< StaticVector<T1,N,TF>, StaticVector<T2,N,TF> >
3248 {
3249  using Type = StaticVector< typename LowType<T1,T2>::Type, N, TF >;
3250 };
3252 //*************************************************************************************************
3253 
3254 
3255 
3256 
3257 //=================================================================================================
3258 //
3259 // SUBVECTORTRAIT SPECIALIZATIONS
3260 //
3261 //=================================================================================================
3262 
3263 //*************************************************************************************************
3265 template< typename VT, size_t I, size_t N >
3266 struct SubvectorTraitEval2< VT, I, N
3267  , EnableIf_t< I != inf && N != inf &&
3268  IsDenseVector_v<VT> > >
3269 {
3270  using Type = StaticVector< RemoveConst_t< ElementType_t<VT> >, N, TransposeFlag_v<VT> >;
3271 };
3273 //*************************************************************************************************
3274 
3275 
3276 
3277 
3278 //=================================================================================================
3279 //
3280 // ELEMENTSTRAIT SPECIALIZATIONS
3281 //
3282 //=================================================================================================
3283 
3284 //*************************************************************************************************
3286 template< typename VT, size_t N >
3287 struct ElementsTraitEval2< VT, N
3288  , EnableIf_t< N != 0UL &&
3289  IsDenseVector_v<VT> > >
3290 {
3291  using Type = StaticVector< RemoveConst_t< ElementType_t<VT> >, N, TransposeFlag_v<VT> >;
3292 };
3294 //*************************************************************************************************
3295 
3296 
3297 
3298 
3299 //=================================================================================================
3300 //
3301 // ROWTRAIT SPECIALIZATIONS
3302 //
3303 //=================================================================================================
3304 
3305 //*************************************************************************************************
3307 template< typename MT, size_t I >
3308 struct RowTraitEval2< MT, I
3309  , EnableIf_t< IsDenseMatrix_v<MT> &&
3310  Size_v<MT,1UL> != DefaultSize_v > >
3311 {
3312  using Type = StaticVector< RemoveConst_t< ElementType_t<MT> >, Size_v<MT,1UL>, true >;
3313 };
3315 //*************************************************************************************************
3316 
3317 
3318 
3319 
3320 //=================================================================================================
3321 //
3322 // COLUMNTRAIT SPECIALIZATIONS
3323 //
3324 //=================================================================================================
3325 
3326 //*************************************************************************************************
3328 template< typename MT, size_t I >
3329 struct ColumnTraitEval2< MT, I
3330  , EnableIf_t< IsDenseMatrix_v<MT> &&
3331  Size_v<MT,0UL> != DefaultSize_v > >
3332 {
3333  using Type = StaticVector< RemoveConst_t< ElementType_t<MT> >, Size_v<MT,0UL>, false >;
3334 };
3336 //*************************************************************************************************
3337 
3338 
3339 
3340 
3341 //=================================================================================================
3342 //
3343 // BANDTRAIT SPECIALIZATIONS
3344 //
3345 //=================================================================================================
3346 
3347 //*************************************************************************************************
3349 template< typename MT, ptrdiff_t I >
3350 struct BandTraitEval2< MT, I
3351  , EnableIf_t< IsDenseMatrix_v<MT> &&
3352  Size_v<MT,0UL> != DefaultSize_v &&
3353  Size_v<MT,1UL> != DefaultSize_v > >
3354 {
3355  static constexpr size_t M = Size_v<MT,0UL>;
3356  static constexpr size_t N = Size_v<MT,1UL>;
3357  static constexpr size_t Min = min( M - ( I >= 0L ? 0UL : -I ), N - ( I >= 0L ? I : 0UL ) );
3358 
3359  using Type = StaticVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
3360 };
3362 //*************************************************************************************************
3363 
3364 } // namespace blaze
3365 
3366 
3367 
3368 
3369 //=================================================================================================
3370 //
3371 // STD::TUPLE SUPPORT
3372 //
3373 //=================================================================================================
3374 
3375 //*************************************************************************************************
3377 namespace std
3378 {
3379  template< typename Type, size_t N, bool TF >
3380  class tuple_size< blaze::StaticVector<Type,N,TF> >
3381  : public integral_constant< size_t, N >
3382  {};
3383 
3384  template< size_t I, typename Type, size_t N, bool TF >
3385  class tuple_element< I, blaze::StaticVector<Type,N,TF> >
3386  {
3387  public:
3388  using type = Type;
3389  };
3390 }
3392 //*************************************************************************************************
3393 
3394 #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
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
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: StaticVector.h:1820
Header file for the AlignmentOf type trait.
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
static constexpr size_t spacing() noexcept
Returns the minimum capacity of the vector.
Definition: StaticVector.h:1456
constexpr Iterator begin() noexcept
Returns an iterator to the first element of the static vector.
Definition: StaticVector.h:954
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.
static constexpr bool align
Compilation switch for the choice of alignment.
Definition: StaticVector.h:212
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
static constexpr bool simdEnabled
Compilation flag for SIMD optimization.
Definition: StaticVector.h:259
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
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
Header file for the DenseVector base class.
Header file for the MAYBE_UNUSED function template.
constexpr ConstIterator cbegin() const noexcept
Returns an iterator to the first element of the static vector.
Definition: StaticVector.h:986
#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
SIMDTrait_t< ElementType > SIMDType
SIMD type of the vector elements.
Definition: StaticVector.h:222
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
auto addAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
Default implementation of the addition assignment of a dense vector.
Definition: StaticVector.h:2160
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
#define BLAZE_STATIC_ASSERT_MSG(expr, msg)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:123
Header file for the reduce trait.
Header file for the MaxSize type trait.
Header file for the elements trait.
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.
Constraint on the data type.
Type ElementType
Type of the vector elements.
Definition: StaticVector.h:221
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.The IsDenseMatrix_v variable template pr...
Definition: IsDenseMatrix.h:138
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
Header file for the IsMatrix type trait.
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: StaticVector.h:265
Header file for the IsSquare type trait.
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
void swap(StaticVector &v) noexcept
Swapping the contents of two static vectors.
Definition: StaticVector.h:1529
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.
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
Resize mechanism to obtain a StaticVector with a different fixed number of elements.
Definition: StaticVector.h:248
Compile time assertion.
#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
BLAZE_ALWAYS_INLINE void stream(size_t index, const SIMDType &value) noexcept
Aligned, non-temporal store of a SIMD element of the vector.
Definition: StaticVector.h:2039
Reference at(size_t index)
Checked access to the vector elements.
Definition: StaticVector.h:875
Type & Reference
Reference to a non-constant vector value.
Definition: StaticVector.h:226
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.
static constexpr size_t capacity() noexcept
Returns the maximum capacity of the vector.
Definition: StaticVector.h:1471
Header file for the DenseIterator class template.
const Type * ConstPointer
Pointer to a constant vector value.
Definition: StaticVector.h:229
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
static constexpr size_t size() noexcept
Returns the current size/dimension of the vector.
Definition: StaticVector.h:1438
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 ConstIterator cend() const noexcept
Returns an iterator just past the last element of the static vector.
Definition: StaticVector.h:1034
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
Constraint on the data type.
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
StaticVector< Type, N, TF > This
Type of this StaticVector instance.
Definition: StaticVector.h:217
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
Aligned load of a SIMD element of the vector.
Definition: StaticVector.h:1886
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.
auto divAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
Default implementation of the division assignment of a dense vector.
Definition: StaticVector.h:2434
AlignedStorage v_
The statically allocated vector elements.
Definition: StaticVector.h:511
Constraint on the data type.
Header file for the exception macros of the math module.
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
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.
const StaticVector< Type, 2UL, TF > perp(const StaticVector< Type, 2UL, TF > &v)
Unary perp dot product operator for the calculation of a perpendicular vector ( ).
Definition: StaticVector.h:2648
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
constexpr void reset()
Reset to the default initial values.
Definition: StaticVector.h:1511
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
constexpr bool isIntact() const noexcept
Returns whether the invariants of the static vector are intact.
Definition: StaticVector.h:1763
Header file for the IsVectorizable type trait.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Header file for the RemoveConst type trait.
Header file for the IsSIMDCombinable type trait.
auto assign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
Default implementation of the assignment of a dense vector.
Definition: StaticVector.h:2070
Header file for the IsSparseVector type trait.
Header file for the HasSIMDMult type trait.
static constexpr size_t Alignment
Alignment of the data elements.
Definition: StaticVector.h:501
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
StaticVector()
The default constructor for StaticVector.
Definition: StaticVector.h:558
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the cross product trait.
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: StaticVector.h:1799
Header file for the division trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticVector.h:223
Constraint on the data type.
Header file for the IsContiguous type trait.
static constexpr size_t NN
Alignment adjustment.
Definition: StaticVector.h:209
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
Header file for the IsStatic type trait.
constexpr StaticVector & operator=(const Type &rhs)
Homogenous assignment to all vector elements.
Definition: StaticVector.h:1059
#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
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
Unaligned load of a SIMD element of the vector.
Definition: StaticVector.h:1919
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
static constexpr bool isAligned() noexcept
Returns whether the vector is properly aligned in memory.
Definition: StaticVector.h:1839
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
Type * Pointer
Pointer to a non-constant vector value.
Definition: StaticVector.h:228
Header file for the HasMutableDataAccess type trait.
#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
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
constexpr Iterator end() noexcept
Returns an iterator just past the last element of the static vector.
Definition: StaticVector.h:1002
constexpr Pointer data() noexcept
Low-level data access to the vector elements.
Definition: StaticVector.h:920
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
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
#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
constexpr size_t AlignmentOf_v
Auxiliary variable template for the AlignmentOf type trait.The AlignmentOf_v variable template provid...
Definition: AlignmentOf.h:238
Header file for the HasSIMDDiv type trait.
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: StaticVector.h:1489
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 Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition: StaticVector.h:832
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.
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Aligned store of a SIMD element of the vector.
Definition: StaticVector.h:1974
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
auto multAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
Default implementation of the multiplication assignment of a dense vector.
Definition: StaticVector.h:2340
BLAZE_ALWAYS_INLINE void storeu(size_t index, const SIMDType &value) noexcept
Unaligned store of a SIMD element of the vector.
Definition: StaticVector.h:2007
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
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
void swap(StaticVector< Type, N, TF > &a, StaticVector< Type, N, TF > &b) noexcept
Swapping the contents of two static vectors.
Definition: StaticVector.h:2686
auto subAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
Default implementation of the subtraction assignment of a dense vector.
Definition: StaticVector.h:2250
System settings for the inline keywords.
const Type & ConstReference
Reference to a constant vector value.
Definition: StaticVector.h:227
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
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD vector.
Definition: StaticVector.h:206
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
Load of a SIMD element of the vector.
Definition: StaticVector.h:1862
Rebind mechanism to obtain a StaticVector with different data/element type.
Definition: StaticVector.h:239
Header file for the HighType type trait.
Header file for the clear shim.
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Store of a SIMD element of the vector.
Definition: StaticVector.h:1950
constexpr Type & get(StaticVector< Type, N, TF > &v) noexcept
Tuple-like index-based access the contents of a static vector.
Definition: StaticVector.h:2704