Blaze 3.9
Loading...
Searching...
No Matches
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 <array>
44#include <tuple>
45#include <utility>
46#include <blaze/math/Aliases.h>
57#include <blaze/math/Forward.h>
67#include <blaze/math/SIMD.h>
108#include <blaze/system/Inline.h>
116#include <blaze/util/Assert.h>
122#include <blaze/util/EnableIf.h>
125#include <blaze/util/Memory.h>
127#include <blaze/util/Types.h>
133
134
135namespace blaze {
136
137//=================================================================================================
138//
139// CLASS DEFINITION
140//
141//=================================================================================================
142
143//*************************************************************************************************
222template< typename Type // Data type of the vector
223 , size_t N // Number of elements
224 , bool TF // Transpose flag
225 , AlignmentFlag AF // Alignment flag
226 , PaddingFlag PF // Padding flag
227 , typename Tag > // Type tag
229 : public DenseVector< StaticVector<Type,N,TF,AF,PF,Tag>, TF >
230{
231 public:
232 //**Type definitions****************************************************************************
234 using BaseType = DenseVector<This,TF>;
235 using ResultType = This;
236
239
242 using TagType = Tag;
243 using ReturnType = const Type&;
245
246 using Reference = Type&;
247 using ConstReference = const Type&;
248 using Pointer = Type*;
249 using ConstPointer = const Type*;
250
253 //**********************************************************************************************
254
255 //**Rebind struct definition********************************************************************
258 template< typename NewType > // Data type of the other vector
262 //**********************************************************************************************
263
264 //**Resize struct definition********************************************************************
267 template< size_t NewN > // Number of elements of the other vector
271 //**********************************************************************************************
272
273 //**Compilation flags***************************************************************************
275
279 static constexpr bool simdEnabled = IsVectorizable_v<Type>;
280
282
285 static constexpr bool smpAssignable = false;
286 //**********************************************************************************************
287
288 //**Constructors********************************************************************************
291 inline StaticVector();
292 explicit inline StaticVector( const Type& init );
294
295 template< typename Other >
296 inline StaticVector( size_t n, const Other* array );
297
298 template< typename Other, size_t Dim >
299 constexpr StaticVector( const Other (&array)[Dim] );
300
301 template< typename Other, size_t Dim >
302 constexpr StaticVector( const std::array<Other,Dim>& array );
303
304 constexpr StaticVector( const StaticVector& v );
305
306 template< typename Other, AlignmentFlag AF2, PaddingFlag PF2 >
308
309 template< typename VT >
310 inline StaticVector( const Vector<VT,TF>& v );
312 //**********************************************************************************************
313
314 //**Destructor**********************************************************************************
317 ~StaticVector() = default;
319 //**********************************************************************************************
320
321 //**Data access functions***********************************************************************
324 constexpr Reference operator[]( size_t index ) noexcept;
325 constexpr ConstReference operator[]( size_t index ) const noexcept;
326 inline Reference at( size_t index );
327 inline ConstReference at( size_t index ) const;
328 constexpr Pointer data () noexcept;
329 constexpr ConstPointer data () const noexcept;
330 constexpr Iterator begin () noexcept;
331 constexpr ConstIterator begin () const noexcept;
332 constexpr ConstIterator cbegin() const noexcept;
333 constexpr Iterator end () noexcept;
334 constexpr ConstIterator end () const noexcept;
335 constexpr ConstIterator cend () const noexcept;
337 //**********************************************************************************************
338
339 //**Assignment operators************************************************************************
342 constexpr StaticVector& operator=( const Type& rhs ) &;
343 constexpr StaticVector& operator=( initializer_list<Type> list ) &;
344
345 template< typename Other, size_t Dim >
346 constexpr StaticVector& operator=( const Other (&array)[Dim] ) &;
347
348 template< typename Other, size_t Dim >
349 constexpr StaticVector& operator=( const std::array<Other,Dim>& array ) &;
350
351 constexpr StaticVector& operator=( const StaticVector& rhs ) &;
352
353 template< typename Other, AlignmentFlag AF2, PaddingFlag PF2 >
354 inline StaticVector& operator=( const StaticVector<Other,N,TF,AF2,PF2,Tag>& rhs ) &;
355
356 template< typename VT > inline StaticVector& operator= ( const Vector<VT,TF>& rhs ) &;
357 template< typename VT > inline StaticVector& operator+=( const Vector<VT,TF>& rhs ) &;
358 template< typename VT > inline StaticVector& operator-=( const Vector<VT,TF>& rhs ) &;
359 template< typename VT > inline StaticVector& operator*=( const Vector<VT,TF>& rhs ) &;
360 template< typename VT > inline StaticVector& operator/=( const DenseVector<VT,TF>& rhs ) &;
361 template< typename VT > inline StaticVector& operator%=( const Vector<VT,TF>& rhs ) &;
363 //**********************************************************************************************
364
365 //**Utility functions***************************************************************************
368 static constexpr size_t size() noexcept;
369 static constexpr size_t spacing() noexcept;
370 static constexpr size_t capacity() noexcept;
371 inline size_t nonZeros() const;
372 constexpr void reset();
373 inline void swap( StaticVector& v ) noexcept;
375 //**********************************************************************************************
376
377 //**Numeric functions***************************************************************************
380 template< typename Other > inline StaticVector& scale( const Other& scalar );
382 //**********************************************************************************************
383
384 //**Memory functions****************************************************************************
387 static inline void* operator new ( std::size_t size );
388 static inline void* operator new[]( std::size_t size );
389 static inline void* operator new ( std::size_t size, const std::nothrow_t& );
390 static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
391
392 static inline void operator delete ( void* ptr );
393 static inline void operator delete[]( void* ptr );
394 static inline void operator delete ( void* ptr, const std::nothrow_t& );
395 static inline void operator delete[]( void* ptr, const std::nothrow_t& );
397 //**********************************************************************************************
398
399 private:
400 //**********************************************************************************************
402 static constexpr size_t SIMDSIZE = SIMDTrait<Type>::size;
403
405 static constexpr size_t NN = ( PF == padded ? nextMultiple( N, SIMDSIZE ) : N );
406 //**********************************************************************************************
407
408 //**********************************************************************************************
411 template< typename VT >
412 static constexpr bool VectorizedAssign_v =
413 ( useOptimizedKernels &&
414 NN >= SIMDSIZE &&
415 simdEnabled && VT::simdEnabled &&
418 //**********************************************************************************************
419
420 //**********************************************************************************************
423 template< typename VT >
424 static constexpr bool VectorizedAddAssign_v =
425 ( VectorizedAssign_v<VT> &&
428 //**********************************************************************************************
429
430 //**********************************************************************************************
433 template< typename VT >
434 static constexpr bool VectorizedSubAssign_v =
435 ( VectorizedAssign_v<VT> &&
438 //**********************************************************************************************
439
440 //**********************************************************************************************
443 template< typename VT >
444 static constexpr bool VectorizedMultAssign_v =
445 ( VectorizedAssign_v<VT> &&
448 //**********************************************************************************************
449
450 //**********************************************************************************************
453 template< typename VT >
454 static constexpr bool VectorizedDivAssign_v =
455 ( VectorizedAssign_v<VT> &&
458 //**********************************************************************************************
459
460 public:
461 //**Debugging functions*************************************************************************
464 constexpr bool isIntact() const noexcept;
466 //**********************************************************************************************
467
468 //**Expression template evaluation functions****************************************************
471 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
472 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
473
474 static constexpr bool isAligned() noexcept;
475
476 BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
477 BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
478 BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
479
480 BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
481 BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
482 BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
483 BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
484
485 template< typename VT >
486 inline auto assign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT> >;
487
488 template< typename VT >
489 inline auto assign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT> >;
490
491 template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
492
493 template< typename VT >
494 inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT> >;
495
496 template< typename VT >
497 inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT> >;
498
499 template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
500
501 template< typename VT >
502 inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT> >;
503
504 template< typename VT >
505 inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT> >;
506
507 template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
508
509 template< typename VT >
510 inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT> >;
511
512 template< typename VT >
513 inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT> >;
514
515 template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
516
517 template< typename VT >
518 inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT> >;
519
520 template< typename VT >
521 inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT> >;
523 //**********************************************************************************************
524
525 private:
526 //**********************************************************************************************
528 static constexpr size_t Alignment =
529 ( AF == aligned ? AlignmentOf_v<Type> : std::alignment_of<Type>::value );
530
533 //**********************************************************************************************
534
535 //**Member variables****************************************************************************
545 //**********************************************************************************************
546
547 //**Compile time checks*************************************************************************
553 BLAZE_STATIC_ASSERT( PF == unpadded || ( NN % SIMDSIZE == 0UL ) );
554 BLAZE_STATIC_ASSERT( NN >= N );
557 //**********************************************************************************************
558};
559//*************************************************************************************************
560
561
562
563
564//=================================================================================================
565//
566// DEDUCTION GUIDES
567//
568//=================================================================================================
569
570//*************************************************************************************************
571#if BLAZE_CPP17_MODE
572
573template< typename Type, typename... Ts >
574StaticVector( Type, Ts... ) -> StaticVector<Type,1+sizeof...(Ts)>;
575
576template< typename Type, size_t N >
578
579template< typename Type, size_t N >
580StaticVector( std::array<Type,N> ) -> StaticVector<Type,N>;
581
582#endif
583//*************************************************************************************************
584
585
586
587
588//=================================================================================================
589//
590// CONSTRUCTORS
591//
592//=================================================================================================
593
594//*************************************************************************************************
607template< typename Type // Data type of the vector
608 , size_t N // Number of elements
609 , bool TF // Transpose flag
610 , AlignmentFlag AF // Alignment flag
611 , PaddingFlag PF // Padding flag
612 , typename Tag > // Type tag
614#if BLAZE_USE_DEFAULT_INITIALIZATION
615 : v_() // The statically allocated vector elements
616#endif
617{
618#if !BLAZE_USE_DEFAULT_INITIALIZATION
619 using blaze::clear;
620
621 if( IsNumeric_v<Type> && PF == unpadded ) {
622 for( size_t i=N; i<NN; ++i )
623 clear( v_[i] );
624 }
625#endif
626
627 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
628}
629//*************************************************************************************************
630
631
632//*************************************************************************************************
637template< typename Type // Data type of the vector
638 , size_t N // Number of elements
639 , bool TF // Transpose flag
640 , AlignmentFlag AF // Alignment flag
641 , PaddingFlag PF // Padding flag
642 , typename Tag > // Type tag
644 // v_ is intentionally left uninitialized
645{
646 using blaze::clear;
647
648 for( size_t i=0UL; i<N; ++i )
649 v_[i] = init;
650
651 for( size_t i=N; i<NN; ++i )
652 clear( v_[i] );
653
654 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
655}
656//*************************************************************************************************
657
658
659//*************************************************************************************************
676template< typename Type // Data type of the vector
677 , size_t N // Number of elements
678 , bool TF // Transpose flag
679 , AlignmentFlag AF // Alignment flag
680 , PaddingFlag PF // Padding flag
681 , typename Tag > // Type tag
683 : v_() // The statically allocated vector elements
684{
685 if( list.size() > N ) {
686 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
687 }
688
689 size_t i( 0UL );
690
691 for( const auto& element : list ) {
692 v_[i] = element;
693 ++i;
694 }
695
696 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
697}
698//*************************************************************************************************
699
700
701//*************************************************************************************************
723template< typename Type // Data type of the vector
724 , size_t N // Number of elements
725 , bool TF // Transpose flag
726 , AlignmentFlag AF // Alignment flag
727 , PaddingFlag PF // Padding flag
728 , typename Tag > // Type tag
729template< typename Other > // Data type of the initialization array
730inline StaticVector<Type,N,TF,AF,PF,Tag>::StaticVector( size_t n, const Other* array )
731 // v_ is intentionally left uninitialized
732{
733 using blaze::clear;
734
735 if( n > N ) {
736 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
737 }
738
739 for( size_t i=0UL; i<n; ++i )
740 v_[i] = array[i];
741
742 if( IsNumeric_v<Type> ) {
743 for( size_t i=n; i<NN; ++i )
744 clear( v_[i] );
745 }
746
747 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
748}
749//*************************************************************************************************
750
751
752//*************************************************************************************************
770template< typename Type // Data type of the vector
771 , size_t N // Number of elements
772 , bool TF // Transpose flag
773 , AlignmentFlag AF // Alignment flag
774 , PaddingFlag PF // Padding flag
775 , typename Tag > // Type tag
776template< typename Other // Data type of the static array
777 , size_t Dim > // Dimension of the static array
778constexpr StaticVector<Type,N,TF,AF,PF,Tag>::StaticVector( const Other (&array)[Dim] )
779 : v_( array ) // The statically allocated vector elements
780{
781 BLAZE_STATIC_ASSERT( Dim == N );
782
783 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
784}
785//*************************************************************************************************
786
787
788//*************************************************************************************************
806template< typename Type // Data type of the vector
807 , size_t N // Number of elements
808 , bool TF // Transpose flag
809 , AlignmentFlag AF // Alignment flag
810 , PaddingFlag PF // Padding flag
811 , typename Tag > // Type tag
812template< typename Other // Data type of the std::array
813 , size_t Dim > // Dimension of the std::array
814constexpr StaticVector<Type,N,TF,AF,PF,Tag>::StaticVector( const std::array<Other,Dim>& array )
815 : v_( array ) // The statically allocated vector elements
816{
817 BLAZE_STATIC_ASSERT( Dim == N );
818
819 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
820}
821//*************************************************************************************************
822
823
824//*************************************************************************************************
831template< typename Type // Data type of the vector
832 , size_t N // Number of elements
833 , bool TF // Transpose flag
834 , AlignmentFlag AF // Alignment flag
835 , PaddingFlag PF // Padding flag
836 , typename Tag > // Type tag
838 : BaseType() // Initialization of the base class
839 , v_( v.v_ ) // The statically allocated vector elements
840{
841 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
842}
843//*************************************************************************************************
844
845
846//*************************************************************************************************
851template< typename Type // Data type of the vector
852 , size_t N // Number of elements
853 , bool TF // Transpose flag
854 , AlignmentFlag AF // Alignment flag
855 , PaddingFlag PF // Padding flag
856 , typename Tag > // Type tag
857template< typename Other // Data type of the foreign vector
858 , AlignmentFlag AF2 // Alignment flag of the foreign vector
859 , PaddingFlag PF2 > // Padding flag of the foreign vector
861 // v_ is intentionally left uninitialized
862{
863 using blaze::clear;
864
865 for( size_t i=0UL; i<N; ++i )
866 v_[i] = v[i];
867
868 for( size_t i=N; i<NN; ++i )
869 clear( v_[i] );
870
871 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
872}
873//*************************************************************************************************
874
875
876//*************************************************************************************************
886template< typename Type // Data type of the vector
887 , size_t N // Number of elements
888 , bool TF // Transpose flag
889 , AlignmentFlag AF // Alignment flag
890 , PaddingFlag PF // Padding flag
891 , typename Tag > // Type tag
892template< typename VT > // Type of the foreign vector
894 // v_ is intentionally left uninitialized
895{
896 using blaze::assign;
897 using blaze::clear;
898
900
901 if( (*v).size() != N ) {
902 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static vector" );
903 }
904
905 for( size_t i=( IsSparseVector_v<VT> ? 0UL : N ); i<NN; ++i ) {
906 clear( v_[i] );
907 }
908
909 assign( *this, *v );
910
911 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
912}
913//*************************************************************************************************
914
915
916
917
918//=================================================================================================
919//
920// DATA ACCESS FUNCTIONS
921//
922//=================================================================================================
923
924//*************************************************************************************************
933template< typename Type // Data type of the vector
934 , size_t N // Number of elements
935 , bool TF // Transpose flag
936 , AlignmentFlag AF // Alignment flag
937 , PaddingFlag PF // Padding flag
938 , typename Tag > // Type tag
941{
942 BLAZE_USER_ASSERT( index < N, "Invalid vector access index" );
943 return v_[index];
944}
945//*************************************************************************************************
946
947
948//*************************************************************************************************
957template< typename Type // Data type of the vector
958 , size_t N // Number of elements
959 , bool TF // Transpose flag
960 , AlignmentFlag AF // Alignment flag
961 , PaddingFlag PF // Padding flag
962 , typename Tag > // Type tag
965{
966 BLAZE_USER_ASSERT( index < N, "Invalid vector access index" );
967 return v_[index];
968}
969//*************************************************************************************************
970
971
972//*************************************************************************************************
982template< typename Type // Data type of the vector
983 , size_t N // Number of elements
984 , bool TF // Transpose flag
985 , AlignmentFlag AF // Alignment flag
986 , PaddingFlag PF // Padding flag
987 , typename Tag > // Type tag
990{
991 if( index >= N ) {
992 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
993 }
994 return (*this)[index];
995}
996//*************************************************************************************************
997
998
999//*************************************************************************************************
1009template< typename Type // Data type of the vector
1010 , size_t N // Number of elements
1011 , bool TF // Transpose flag
1012 , AlignmentFlag AF // Alignment flag
1013 , PaddingFlag PF // Padding flag
1014 , typename Tag > // Type tag
1017{
1018 if( index >= N ) {
1019 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
1020 }
1021 return (*this)[index];
1022}
1023//*************************************************************************************************
1024
1025
1026//*************************************************************************************************
1033template< typename Type // Data type of the vector
1034 , size_t N // Number of elements
1035 , bool TF // Transpose flag
1036 , AlignmentFlag AF // Alignment flag
1037 , PaddingFlag PF // Padding flag
1038 , typename Tag > // Type tag
1041{
1042 return v_;
1043}
1044//*************************************************************************************************
1045
1046
1047//*************************************************************************************************
1054template< typename Type // Data type of the vector
1055 , size_t N // Number of elements
1056 , bool TF // Transpose flag
1057 , AlignmentFlag AF // Alignment flag
1058 , PaddingFlag PF // Padding flag
1059 , typename Tag > // Type tag
1062{
1063 return v_;
1064}
1065//*************************************************************************************************
1066
1067
1068//*************************************************************************************************
1073template< typename Type // Data type of the vector
1074 , size_t N // Number of elements
1075 , bool TF // Transpose flag
1076 , AlignmentFlag AF // Alignment flag
1077 , PaddingFlag PF // Padding flag
1078 , typename Tag > // Type tag
1081{
1082 return Iterator( v_ );
1083}
1084//*************************************************************************************************
1085
1086
1087//*************************************************************************************************
1092template< typename Type // Data type of the vector
1093 , size_t N // Number of elements
1094 , bool TF // Transpose flag
1095 , AlignmentFlag AF // Alignment flag
1096 , PaddingFlag PF // Padding flag
1097 , typename Tag > // Type tag
1100{
1101 return ConstIterator( v_ );
1102}
1103//*************************************************************************************************
1104
1105
1106//*************************************************************************************************
1111template< typename Type // Data type of the vector
1112 , size_t N // Number of elements
1113 , bool TF // Transpose flag
1114 , AlignmentFlag AF // Alignment flag
1115 , PaddingFlag PF // Padding flag
1116 , typename Tag > // Type tag
1119{
1120 return ConstIterator( v_ );
1121}
1122//*************************************************************************************************
1123
1124
1125//*************************************************************************************************
1130template< typename Type // Data type of the vector
1131 , size_t N // Number of elements
1132 , bool TF // Transpose flag
1133 , AlignmentFlag AF // Alignment flag
1134 , PaddingFlag PF // Padding flag
1135 , typename Tag > // Type tag
1138{
1139 return Iterator( v_ + N );
1140}
1141//*************************************************************************************************
1142
1143
1144//*************************************************************************************************
1149template< typename Type // Data type of the vector
1150 , size_t N // Number of elements
1151 , bool TF // Transpose flag
1152 , AlignmentFlag AF // Alignment flag
1153 , PaddingFlag PF // Padding flag
1154 , typename Tag > // Type tag
1157{
1158 return ConstIterator( v_ + N );
1159}
1160//*************************************************************************************************
1161
1162
1163//*************************************************************************************************
1168template< typename Type // Data type of the vector
1169 , size_t N // Number of elements
1170 , bool TF // Transpose flag
1171 , AlignmentFlag AF // Alignment flag
1172 , PaddingFlag PF // Padding flag
1173 , typename Tag > // Type tag
1176{
1177 return ConstIterator( v_ + N );
1178}
1179//*************************************************************************************************
1180
1181
1182
1183
1184//=================================================================================================
1185//
1186// ASSIGNMENT OPERATORS
1187//
1188//=================================================================================================
1189
1190//*************************************************************************************************
1196template< typename Type // Data type of the vector
1197 , size_t N // Number of elements
1198 , bool TF // Transpose flag
1199 , AlignmentFlag AF // Alignment flag
1200 , PaddingFlag PF // Padding flag
1201 , typename Tag > // Type tag
1204{
1205 for( size_t i=0UL; i<N; ++i )
1206 v_[i] = rhs;
1207 return *this;
1208}
1209//*************************************************************************************************
1210
1211
1212//*************************************************************************************************
1230template< typename Type // Data type of the vector
1231 , size_t N // Number of elements
1232 , bool TF // Transpose flag
1233 , AlignmentFlag AF // Alignment flag
1234 , PaddingFlag PF // Padding flag
1235 , typename Tag > // Type tag
1238{
1239 using blaze::clear;
1240
1241 if( list.size() > N ) {
1242 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static vector" );
1243 }
1244
1245 size_t i( 0UL );
1246
1247 for( const auto& element : list ) {
1248 v_[i] = element;
1249 ++i;
1250 }
1251
1252 for( ; i<N; ++i ) {
1253 clear( v_[i] );
1254 }
1255
1256 return *this;
1257}
1258//*************************************************************************************************
1259
1260
1261//*************************************************************************************************
1280template< typename Type // Data type of the vector
1281 , size_t N // Number of elements
1282 , bool TF // Transpose flag
1283 , AlignmentFlag AF // Alignment flag
1284 , PaddingFlag PF // Padding flag
1285 , typename Tag > // Type tag
1286template< typename Other // Data type of the static array
1287 , size_t Dim > // Dimension of the static array
1290{
1291 BLAZE_STATIC_ASSERT( Dim == N );
1292
1293 for( size_t i=0UL; i<N; ++i )
1294 v_[i] = array[i];
1295
1296 return *this;
1297}
1298//*************************************************************************************************
1299
1300
1301//*************************************************************************************************
1320template< typename Type // Data type of the vector
1321 , size_t N // Number of elements
1322 , bool TF // Transpose flag
1323 , AlignmentFlag AF // Alignment flag
1324 , PaddingFlag PF // Padding flag
1325 , typename Tag > // Type tag
1326template< typename Other // Data type of the std::array
1327 , size_t Dim > // Dimension of the std::array
1329 StaticVector<Type,N,TF,AF,PF,Tag>::operator=( const std::array<Other,Dim>& array ) &
1330{
1331 BLAZE_STATIC_ASSERT( Dim == N );
1332
1333 for( size_t i=0UL; i<N; ++i )
1334 v_[i] = array[i];
1335
1336 return *this;
1337}
1338//*************************************************************************************************
1339
1340
1341//*************************************************************************************************
1349template< typename Type // Data type of the vector
1350 , size_t N // Number of elements
1351 , bool TF // Transpose flag
1352 , AlignmentFlag AF // Alignment flag
1353 , PaddingFlag PF // Padding flag
1354 , typename Tag > // Type tag
1357{
1358 v_ = rhs.v_;
1359
1360 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1361
1362 return *this;
1363}
1364//*************************************************************************************************
1365
1366
1367//*************************************************************************************************
1373template< typename Type // Data type of the vector
1374 , size_t N // Number of elements
1375 , bool TF // Transpose flag
1376 , AlignmentFlag AF // Alignment flag
1377 , PaddingFlag PF // Padding flag
1378 , typename Tag > // Type tag
1379template< typename Other // Data type of the foreign vector
1380 , AlignmentFlag AF2 // Alignment flag of the foreign vector
1381 , PaddingFlag PF2 > // Padding flag of the foreign vector
1384{
1385 using blaze::assign;
1386
1387 assign( *this, *rhs );
1388
1389 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1390
1391 return *this;
1392}
1393//*************************************************************************************************
1394
1395
1396//*************************************************************************************************
1406template< typename Type // Data type of the vector
1407 , size_t N // Number of elements
1408 , bool TF // Transpose flag
1409 , AlignmentFlag AF // Alignment flag
1410 , PaddingFlag PF // Padding flag
1411 , typename Tag > // Type tag
1412template< typename VT > // Type of the right-hand side vector
1415{
1416 using blaze::assign;
1417
1419
1420 if( (*rhs).size() != N ) {
1421 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static vector" );
1422 }
1423
1424 if( (*rhs).canAlias( this ) ) {
1425 StaticVector tmp( *rhs );
1426 swap( tmp );
1427 }
1428 else {
1430 reset();
1431 assign( *this, *rhs );
1432 }
1433
1434 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1435
1436 return *this;
1437}
1438//*************************************************************************************************
1439
1440
1441//*************************************************************************************************
1451template< typename Type // Data type of the vector
1452 , size_t N // Number of elements
1453 , bool TF // Transpose flag
1454 , AlignmentFlag AF // Alignment flag
1455 , PaddingFlag PF // Padding flag
1456 , typename Tag > // Type tag
1457template< typename VT > // Type of the right-hand side vector
1459 StaticVector<Type,N,TF,AF,PF,Tag>::operator+=( const Vector<VT,TF>& rhs ) &
1460{
1461 using blaze::addAssign;
1462
1464
1465 if( (*rhs).size() != N ) {
1466 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1467 }
1468
1469 if( (*rhs).canAlias( this ) ) {
1470 StaticVector tmp( *rhs );
1471 addAssign( *this, tmp );
1472 }
1473 else {
1474 addAssign( *this, *rhs );
1475 }
1476
1477 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1478
1479 return *this;
1480}
1481//*************************************************************************************************
1482
1483
1484//*************************************************************************************************
1494template< typename Type // Data type of the vector
1495 , size_t N // Number of elements
1496 , bool TF // Transpose flag
1497 , AlignmentFlag AF // Alignment flag
1498 , PaddingFlag PF // Padding flag
1499 , typename Tag > // Type tag
1500template< typename VT > // Type of the right-hand side vector
1502 StaticVector<Type,N,TF,AF,PF,Tag>::operator-=( const Vector<VT,TF>& rhs ) &
1503{
1504 using blaze::subAssign;
1505
1507
1508 if( (*rhs).size() != N ) {
1509 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1510 }
1511
1512 if( (*rhs).canAlias( this ) ) {
1513 StaticVector tmp( *rhs );
1514 subAssign( *this, tmp );
1515 }
1516 else {
1517 subAssign( *this, *rhs );
1518 }
1519
1520 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1521
1522 return *this;
1523}
1524//*************************************************************************************************
1525
1526
1527//*************************************************************************************************
1538template< typename Type // Data type of the vector
1539 , size_t N // Number of elements
1540 , bool TF // Transpose flag
1541 , AlignmentFlag AF // Alignment flag
1542 , PaddingFlag PF // Padding flag
1543 , typename Tag > // Type tag
1544template< typename VT > // Type of the right-hand side vector
1546 StaticVector<Type,N,TF,AF,PF,Tag>::operator*=( const Vector<VT,TF>& rhs ) &
1547{
1548 using blaze::assign;
1549 using blaze::multAssign;
1550
1552
1553 if( (*rhs).size() != N ) {
1554 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1555 }
1556
1557 if( IsSparseVector_v<VT> || (*rhs).canAlias( this ) ) {
1558 const StaticVector tmp( *this * (*rhs) );
1559 assign( *this, tmp );
1560 }
1561 else {
1562 multAssign( *this, *rhs );
1563 }
1564
1565 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1566
1567 return *this;
1568}
1569//*************************************************************************************************
1570
1571
1572//*************************************************************************************************
1582template< typename Type // Data type of the vector
1583 , size_t N // Number of elements
1584 , bool TF // Transpose flag
1585 , AlignmentFlag AF // Alignment flag
1586 , PaddingFlag PF // Padding flag
1587 , typename Tag > // Type tag
1588template< typename VT > // Type of the right-hand side vector
1590 StaticVector<Type,N,TF,AF,PF,Tag>::operator/=( const DenseVector<VT,TF>& rhs ) &
1591{
1592 using blaze::assign;
1593 using blaze::divAssign;
1594
1596
1597 if( (*rhs).size() != N ) {
1598 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1599 }
1600
1601 if( (*rhs).canAlias( this ) ) {
1602 const StaticVector tmp( *this / (*rhs) );
1603 assign( *this, tmp );
1604 }
1605 else {
1606 divAssign( *this, *rhs );
1607 }
1608
1609 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1610
1611 return *this;
1612}
1613//*************************************************************************************************
1614
1615
1616//*************************************************************************************************
1627template< typename Type // Data type of the vector
1628 , size_t N // Number of elements
1629 , bool TF // Transpose flag
1630 , AlignmentFlag AF // Alignment flag
1631 , PaddingFlag PF // Padding flag
1632 , typename Tag > // Type tag
1633template< typename VT > // Type of the right-hand side vector
1635 StaticVector<Type,N,TF,AF,PF,Tag>::operator%=( const Vector<VT,TF>& rhs ) &
1636{
1637 using blaze::assign;
1638
1640
1643
1644 using CrossType = CrossTrait_t< This, ResultType_t<VT> >;
1645
1649
1650 if( N != 3UL || (*rhs).size() != 3UL ) {
1651 BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1652 }
1653
1654 const CrossType tmp( *this % (*rhs) );
1655 assign( *this, tmp );
1656
1657 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1658
1659 return *this;
1660}
1661//*************************************************************************************************
1662
1663
1664
1665
1666//=================================================================================================
1667//
1668// UTILITY FUNCTIONS
1669//
1670//=================================================================================================
1671
1672//*************************************************************************************************
1677template< typename Type // Data type of the vector
1678 , size_t N // Number of elements
1679 , bool TF // Transpose flag
1680 , AlignmentFlag AF // Alignment flag
1681 , PaddingFlag PF // Padding flag
1682 , typename Tag > // Type tag
1684{
1685 return N;
1686}
1687//*************************************************************************************************
1688
1689
1690//*************************************************************************************************
1698template< typename Type // Data type of the vector
1699 , size_t N // Number of elements
1700 , bool TF // Transpose flag
1701 , AlignmentFlag AF // Alignment flag
1702 , PaddingFlag PF // Padding flag
1703 , typename Tag > // Type tag
1705{
1706 return NN;
1707}
1708//*************************************************************************************************
1709
1710
1711//*************************************************************************************************
1716template< typename Type // Data type of the vector
1717 , size_t N // Number of elements
1718 , bool TF // Transpose flag
1719 , AlignmentFlag AF // Alignment flag
1720 , PaddingFlag PF // Padding flag
1721 , typename Tag > // Type tag
1723{
1724 return NN;
1725}
1726//*************************************************************************************************
1727
1728
1729//*************************************************************************************************
1738template< typename Type // Data type of the vector
1739 , size_t N // Number of elements
1740 , bool TF // Transpose flag
1741 , AlignmentFlag AF // Alignment flag
1742 , PaddingFlag PF // Padding flag
1743 , typename Tag > // Type tag
1745{
1746 size_t nonzeros( 0 );
1747
1748 for( size_t i=0UL; i<N; ++i ) {
1749 if( !isDefault<strict>( v_[i] ) )
1750 ++nonzeros;
1751 }
1752
1753 return nonzeros;
1754}
1755//*************************************************************************************************
1756
1757
1758//*************************************************************************************************
1763template< typename Type // Data type of the vector
1764 , size_t N // Number of elements
1765 , bool TF // Transpose flag
1766 , AlignmentFlag AF // Alignment flag
1767 , PaddingFlag PF // Padding flag
1768 , typename Tag > // Type tag
1770{
1771 using blaze::clear;
1772 for( size_t i=0UL; i<N; ++i )
1773 clear( v_[i] );
1774}
1775//*************************************************************************************************
1776
1777
1778//*************************************************************************************************
1784template< typename Type // Data type of the vector
1785 , size_t N // Number of elements
1786 , bool TF // Transpose flag
1787 , AlignmentFlag AF // Alignment flag
1788 , PaddingFlag PF // Padding flag
1789 , typename Tag > // Type tag
1791{
1792 using std::swap;
1793
1794 for( size_t i=0UL; i<N; ++i )
1795 swap( v_[i], v.v_[i] );
1796}
1797//*************************************************************************************************
1798
1799
1800
1801
1802//=================================================================================================
1803//
1804// NUMERIC FUNCTIONS
1805//
1806//=================================================================================================
1807
1808//*************************************************************************************************
1825template< typename Type // Data type of the vector
1826 , size_t N // Number of elements
1827 , bool TF // Transpose flag
1828 , AlignmentFlag AF // Alignment flag
1829 , PaddingFlag PF // Padding flag
1830 , typename Tag > // Type tag
1831template< typename Other > // Data type of the scalar value
1833 StaticVector<Type,N,TF,AF,PF,Tag>::scale( const Other& scalar )
1834{
1835 for( size_t i=0; i<N; ++i )
1836 v_[i] *= scalar;
1837 return *this;
1838}
1839//*************************************************************************************************
1840
1841
1842
1843
1844//=================================================================================================
1845//
1846// MEMORY FUNCTIONS
1847//
1848//=================================================================================================
1849
1850//*************************************************************************************************
1860template< typename Type // Data type of the vector
1861 , size_t N // Number of elements
1862 , bool TF // Transpose flag
1863 , AlignmentFlag AF // Alignment flag
1864 , PaddingFlag PF // Padding flag
1865 , typename Tag > // Type tag
1867{
1868 MAYBE_UNUSED( size );
1869
1870 BLAZE_INTERNAL_ASSERT( size == sizeof( StaticVector ), "Invalid number of bytes detected" );
1871
1872 return allocate<StaticVector>( 1UL );
1873}
1874//*************************************************************************************************
1875
1876
1877//*************************************************************************************************
1887template< typename Type // Data type of the vector
1888 , size_t N // Number of elements
1889 , bool TF // Transpose flag
1890 , AlignmentFlag AF // Alignment flag
1891 , PaddingFlag PF // Padding flag
1892 , typename Tag > // Type tag
1893inline void* StaticVector<Type,N,TF,AF,PF,Tag>::operator new[]( std::size_t size )
1894{
1895 BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticVector ) , "Invalid number of bytes detected" );
1896 BLAZE_INTERNAL_ASSERT( size % sizeof( StaticVector ) == 0UL, "Invalid number of bytes detected" );
1897
1898 return allocate<StaticVector>( size/sizeof(StaticVector) );
1899}
1900//*************************************************************************************************
1901
1902
1903//*************************************************************************************************
1913template< typename Type // Data type of the vector
1914 , size_t N // Number of elements
1915 , bool TF // Transpose flag
1916 , AlignmentFlag AF // Alignment flag
1917 , PaddingFlag PF // Padding flag
1918 , typename Tag > // Type tag
1919inline void* StaticVector<Type,N,TF,AF,PF,Tag>::operator new( std::size_t size, const std::nothrow_t& )
1920{
1921 MAYBE_UNUSED( size );
1922
1923 BLAZE_INTERNAL_ASSERT( size == sizeof( StaticVector ), "Invalid number of bytes detected" );
1924
1925 return allocate<StaticVector>( 1UL );
1926}
1927//*************************************************************************************************
1928
1929
1930//*************************************************************************************************
1940template< typename Type // Data type of the vector
1941 , size_t N // Number of elements
1942 , bool TF // Transpose flag
1943 , AlignmentFlag AF // Alignment flag
1944 , PaddingFlag PF // Padding flag
1945 , typename Tag > // Type tag
1946inline void* StaticVector<Type,N,TF,AF,PF,Tag>::operator new[]( std::size_t size, const std::nothrow_t& )
1947{
1948 BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticVector ) , "Invalid number of bytes detected" );
1949 BLAZE_INTERNAL_ASSERT( size % sizeof( StaticVector ) == 0UL, "Invalid number of bytes detected" );
1950
1951 return allocate<StaticVector>( size/sizeof(StaticVector) );
1952}
1953//*************************************************************************************************
1954
1955
1956//*************************************************************************************************
1962template< typename Type // Data type of the vector
1963 , size_t N // Number of elements
1964 , bool TF // Transpose flag
1965 , AlignmentFlag AF // Alignment flag
1966 , PaddingFlag PF // Padding flag
1967 , typename Tag > // Type tag
1968inline void StaticVector<Type,N,TF,AF,PF,Tag>::operator delete( void* ptr )
1969{
1970 deallocate( static_cast<StaticVector*>( ptr ) );
1971}
1972//*************************************************************************************************
1973
1974
1975//*************************************************************************************************
1981template< typename Type // Data type of the vector
1982 , size_t N // Number of elements
1983 , bool TF // Transpose flag
1984 , AlignmentFlag AF // Alignment flag
1985 , PaddingFlag PF // Padding flag
1986 , typename Tag > // Type tag
1987inline void StaticVector<Type,N,TF,AF,PF,Tag>::operator delete[]( void* ptr )
1988{
1989 deallocate( static_cast<StaticVector*>( ptr ) );
1990}
1991//*************************************************************************************************
1992
1993
1994//*************************************************************************************************
2000template< typename Type // Data type of the vector
2001 , size_t N // Number of elements
2002 , bool TF // Transpose flag
2003 , AlignmentFlag AF // Alignment flag
2004 , PaddingFlag PF // Padding flag
2005 , typename Tag > // Type tag
2006inline void StaticVector<Type,N,TF,AF,PF,Tag>::operator delete( void* ptr, const std::nothrow_t& )
2007{
2008 deallocate( static_cast<StaticVector*>( ptr ) );
2009}
2010//*************************************************************************************************
2011
2012
2013//*************************************************************************************************
2019template< typename Type // Data type of the vector
2020 , size_t N // Number of elements
2021 , bool TF // Transpose flag
2022 , AlignmentFlag AF // Alignment flag
2023 , PaddingFlag PF // Padding flag
2024 , typename Tag > // Type tag
2025inline void StaticVector<Type,N,TF,AF,PF,Tag>::operator delete[]( void* ptr, const std::nothrow_t& )
2026{
2027 deallocate( static_cast<StaticVector*>( ptr ) );
2028}
2029//*************************************************************************************************
2030
2031
2032
2033
2034//=================================================================================================
2035//
2036// DEBUGGING FUNCTIONS
2037//
2038//=================================================================================================
2039
2040//*************************************************************************************************
2049template< typename Type // Data type of the vector
2050 , size_t N // Number of elements
2051 , bool TF // Transpose flag
2052 , AlignmentFlag AF // Alignment flag
2053 , PaddingFlag PF // Padding flag
2054 , typename Tag > // Type tag
2055constexpr bool StaticVector<Type,N,TF,AF,PF,Tag>::isIntact() const noexcept
2056{
2057 if( IsNumeric_v<Type> ) {
2058 for( size_t i=N; i<NN; ++i ) {
2059 if( !isDefault<strict>( v_[i] ) )
2060 return false;
2061 }
2062 }
2063
2064 return true;
2065}
2066//*************************************************************************************************
2067
2068
2069
2070
2071//=================================================================================================
2072//
2073// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2074//
2075//=================================================================================================
2076
2077//*************************************************************************************************
2087template< typename Type // Data type of the vector
2088 , size_t N // Number of elements
2089 , bool TF // Transpose flag
2090 , AlignmentFlag AF // Alignment flag
2091 , PaddingFlag PF // Padding flag
2092 , typename Tag > // Type tag
2093template< typename Other > // Data type of the foreign expression
2094inline bool StaticVector<Type,N,TF,AF,PF,Tag>::canAlias( const Other* alias ) const noexcept
2095{
2096 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2097}
2098//*************************************************************************************************
2099
2100
2101//*************************************************************************************************
2111template< typename Type // Data type of the vector
2112 , size_t N // Number of elements
2113 , bool TF // Transpose flag
2114 , AlignmentFlag AF // Alignment flag
2115 , PaddingFlag PF // Padding flag
2116 , typename Tag > // Type tag
2117template< typename Other > // Data type of the foreign expression
2118inline bool StaticVector<Type,N,TF,AF,PF,Tag>::isAliased( const Other* alias ) const noexcept
2119{
2120 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2121}
2122//*************************************************************************************************
2123
2124
2125//*************************************************************************************************
2134template< typename Type // Data type of the vector
2135 , size_t N // Number of elements
2136 , bool TF // Transpose flag
2137 , AlignmentFlag AF // Alignment flag
2138 , PaddingFlag PF // Padding flag
2139 , typename Tag > // Type tag
2141{
2142 return AF == aligned;
2143}
2144//*************************************************************************************************
2145
2146
2147//*************************************************************************************************
2159template< typename Type // Data type of the vector
2160 , size_t N // Number of elements
2161 , bool TF // Transpose flag
2162 , AlignmentFlag AF // Alignment flag
2163 , PaddingFlag PF // Padding flag
2164 , typename Tag > // Type tag
2166 StaticVector<Type,N,TF,AF,PF,Tag>::load( size_t index ) const noexcept
2167{
2168 if( AF == aligned )
2169 return loada( index );
2170 else
2171 return loadu( index );
2172}
2173//*************************************************************************************************
2174
2175
2176//*************************************************************************************************
2189template< typename Type // Data type of the vector
2190 , size_t N // Number of elements
2191 , bool TF // Transpose flag
2192 , AlignmentFlag AF // Alignment flag
2193 , PaddingFlag PF // Padding flag
2194 , typename Tag > // Type tag
2196 StaticVector<Type,N,TF,AF,PF,Tag>::loada( size_t index ) const noexcept
2197{
2198 using blaze::loada;
2199
2201
2202 BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2203 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2204 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2205 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
2206
2207 return loada( &v_[index] );
2208}
2209//*************************************************************************************************
2210
2211
2212//*************************************************************************************************
2225template< typename Type // Data type of the vector
2226 , size_t N // Number of elements
2227 , bool TF // Transpose flag
2228 , AlignmentFlag AF // Alignment flag
2229 , PaddingFlag PF // Padding flag
2230 , typename Tag > // Type tag
2232 StaticVector<Type,N,TF,AF,PF,Tag>::loadu( size_t index ) const noexcept
2233{
2234 using blaze::loadu;
2235
2237
2238 BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2239 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2240
2241 return loadu( &v_[index] );
2242}
2243//*************************************************************************************************
2244
2245
2246//*************************************************************************************************
2259template< typename Type // Data type of the vector
2260 , size_t N // Number of elements
2261 , bool TF // Transpose flag
2262 , AlignmentFlag AF // Alignment flag
2263 , PaddingFlag PF // Padding flag
2264 , typename Tag > // Type tag
2266 StaticVector<Type,N,TF,AF,PF,Tag>::store( size_t index, const SIMDType& value ) noexcept
2267{
2268 if( AF == aligned )
2269 storea( index, value );
2270 else
2271 storeu( index, value );
2272}
2273//*************************************************************************************************
2274
2275
2276//*************************************************************************************************
2289template< typename Type // Data type of the vector
2290 , size_t N // Number of elements
2291 , bool TF // Transpose flag
2292 , AlignmentFlag AF // Alignment flag
2293 , PaddingFlag PF // Padding flag
2294 , typename Tag > // Type tag
2296 StaticVector<Type,N,TF,AF,PF,Tag>::storea( size_t index, const SIMDType& value ) noexcept
2297{
2298 using blaze::storea;
2299
2301
2302 BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2303 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN , "Invalid vector access index" );
2304 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2305 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
2306
2307 storea( &v_[index], value );
2308}
2309//*************************************************************************************************
2310
2311
2312//*************************************************************************************************
2325template< typename Type // Data type of the vector
2326 , size_t N // Number of elements
2327 , bool TF // Transpose flag
2328 , AlignmentFlag AF // Alignment flag
2329 , PaddingFlag PF // Padding flag
2330 , typename Tag > // Type tag
2332 StaticVector<Type,N,TF,AF,PF,Tag>::storeu( size_t index, const SIMDType& value ) noexcept
2333{
2334 using blaze::storeu;
2335
2337
2338 BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2339 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2340
2341 storeu( &v_[index], value );
2342}
2343//*************************************************************************************************
2344
2345
2346//*************************************************************************************************
2360template< typename Type // Data type of the vector
2361 , size_t N // Number of elements
2362 , bool TF // Transpose flag
2363 , AlignmentFlag AF // Alignment flag
2364 , PaddingFlag PF // Padding flag
2365 , typename Tag > // Type tag
2367 StaticVector<Type,N,TF,AF,PF,Tag>::stream( size_t index, const SIMDType& value ) noexcept
2368{
2369 using blaze::stream;
2370
2372
2373 BLAZE_INTERNAL_ASSERT( index < N, "Invalid vector access index" );
2374 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= NN, "Invalid vector access index" );
2375 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2376 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[index] ), "Invalid alignment detected" );
2377
2378 stream( &v_[index], value );
2379}
2380//*************************************************************************************************
2381
2382
2383//*************************************************************************************************
2394template< typename Type // Data type of the vector
2395 , size_t N // Number of elements
2396 , bool TF // Transpose flag
2397 , AlignmentFlag AF // Alignment flag
2398 , PaddingFlag PF // Padding flag
2399 , typename Tag > // Type tag
2400template< typename VT > // Type of the right-hand side dense vector
2401inline auto StaticVector<Type,N,TF,AF,PF,Tag>::assign( const DenseVector<VT,TF>& rhs )
2403{
2404 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2405
2406 for( size_t i=0UL; i<N; ++i )
2407 v_[i] = (*rhs)[i];
2408}
2409//*************************************************************************************************
2410
2411
2412//*************************************************************************************************
2423template< typename Type // Data type of the vector
2424 , size_t N // Number of elements
2425 , bool TF // Transpose flag
2426 , AlignmentFlag AF // Alignment flag
2427 , PaddingFlag PF // Padding flag
2428 , typename Tag > // Type tag
2429template< typename VT > // Type of the right-hand side dense vector
2430inline auto StaticVector<Type,N,TF,AF,PF,Tag>::assign( const DenseVector<VT,TF>& rhs )
2432{
2434
2435 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2436
2437 constexpr bool remainder( PF == unpadded || !IsPadded_v<VT> );
2438
2439 constexpr size_t ipos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
2440 BLAZE_INTERNAL_ASSERT( ipos <= N, "Invalid end calculation" );
2441
2442 size_t i( 0UL );
2443
2444 for( ; i<ipos; i+=SIMDSIZE ) {
2445 store( i, (*rhs).load(i) );
2446 }
2447 for( ; remainder && i<N; ++i ) {
2448 v_[i] = (*rhs)[i];
2449 }
2450}
2451//*************************************************************************************************
2452
2453
2454//*************************************************************************************************
2465template< typename Type // Data type of the vector
2466 , size_t N // Number of elements
2467 , bool TF // Transpose flag
2468 , AlignmentFlag AF // Alignment flag
2469 , PaddingFlag PF // Padding flag
2470 , typename Tag > // Type tag
2471template< typename VT > // Type of the right-hand side sparse vector
2473{
2474 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2475
2476 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2477 v_[element->index()] = element->value();
2478}
2479//*************************************************************************************************
2480
2481
2482//*************************************************************************************************
2493template< typename Type // Data type of the vector
2494 , size_t N // Number of elements
2495 , bool TF // Transpose flag
2496 , AlignmentFlag AF // Alignment flag
2497 , PaddingFlag PF // Padding flag
2498 , typename Tag > // Type tag
2499template< typename VT > // Type of the right-hand side dense vector
2500inline auto StaticVector<Type,N,TF,AF,PF,Tag>::addAssign( const DenseVector<VT,TF>& rhs )
2502{
2503 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2504
2505 for( size_t i=0UL; i<N; ++i )
2506 v_[i] += (*rhs)[i];
2507}
2508//*************************************************************************************************
2509
2510
2511//*************************************************************************************************
2522template< typename Type // Data type of the vector
2523 , size_t N // Number of elements
2524 , bool TF // Transpose flag
2525 , AlignmentFlag AF // Alignment flag
2526 , PaddingFlag PF // Padding flag
2527 , typename Tag > // Type tag
2528template< typename VT > // Type of the right-hand side dense vector
2529inline auto StaticVector<Type,N,TF,AF,PF,Tag>::addAssign( const DenseVector<VT,TF>& rhs )
2531{
2533
2534 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2535
2536 constexpr bool remainder( PF == unpadded || !IsPadded_v<VT> );
2537
2538 constexpr size_t ipos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
2539 BLAZE_INTERNAL_ASSERT( ipos <= N, "Invalid end calculation" );
2540
2541 size_t i( 0UL );
2542
2543 for( ; i<ipos; i+=SIMDSIZE ) {
2544 store( i, load(i) + (*rhs).load(i) );
2545 }
2546 for( ; remainder && i<N; ++i ) {
2547 v_[i] += (*rhs)[i];
2548 }
2549}
2550//*************************************************************************************************
2551
2552
2553//*************************************************************************************************
2564template< typename Type // Data type of the vector
2565 , size_t N // Number of elements
2566 , bool TF // Transpose flag
2567 , AlignmentFlag AF // Alignment flag
2568 , PaddingFlag PF // Padding flag
2569 , typename Tag > // Type tag
2570template< typename VT > // Type of the right-hand side sparse vector
2572{
2573 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2574
2575 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2576 v_[element->index()] += element->value();
2577}
2578//*************************************************************************************************
2579
2580
2581//*************************************************************************************************
2592template< typename Type // Data type of the vector
2593 , size_t N // Number of elements
2594 , bool TF // Transpose flag
2595 , AlignmentFlag AF // Alignment flag
2596 , PaddingFlag PF // Padding flag
2597 , typename Tag > // Type tag
2598template< typename VT > // Type of the right-hand side dense vector
2599inline auto StaticVector<Type,N,TF,AF,PF,Tag>::subAssign( const DenseVector<VT,TF>& rhs )
2601{
2602 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2603
2604 for( size_t i=0UL; i<N; ++i )
2605 v_[i] -= (*rhs)[i];
2606}
2607//*************************************************************************************************
2608
2609
2610//*************************************************************************************************
2621template< typename Type // Data type of the vector
2622 , size_t N // Number of elements
2623 , bool TF // Transpose flag
2624 , AlignmentFlag AF // Alignment flag
2625 , PaddingFlag PF // Padding flag
2626 , typename Tag > // Type tag
2627template< typename VT > // Type of the right-hand side dense vector
2628inline auto StaticVector<Type,N,TF,AF,PF,Tag>::subAssign( const DenseVector<VT,TF>& rhs )
2630{
2632
2633 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2634
2635 constexpr bool remainder( PF == unpadded || !IsPadded_v<VT> );
2636
2637 constexpr size_t ipos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
2638 BLAZE_INTERNAL_ASSERT( ipos <= N, "Invalid end calculation" );
2639
2640 size_t i( 0UL );
2641
2642 for( ; i<ipos; i+=SIMDSIZE ) {
2643 store( i, load(i) - (*rhs).load(i) );
2644 }
2645 for( ; remainder && i<N; ++i ) {
2646 v_[i] -= (*rhs)[i];
2647 }
2648}
2649//*************************************************************************************************
2650
2651
2652//*************************************************************************************************
2663template< typename Type // Data type of the vector
2664 , size_t N // Number of elements
2665 , bool TF // Transpose flag
2666 , AlignmentFlag AF // Alignment flag
2667 , PaddingFlag PF // Padding flag
2668 , typename Tag > // Type tag
2669template< typename VT > // Type of the right-hand side sparse vector
2671{
2672 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2673
2674 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2675 v_[element->index()] -= element->value();
2676}
2677//*************************************************************************************************
2678
2679
2680//*************************************************************************************************
2691template< typename Type // Data type of the vector
2692 , size_t N // Number of elements
2693 , bool TF // Transpose flag
2694 , AlignmentFlag AF // Alignment flag
2695 , PaddingFlag PF // Padding flag
2696 , typename Tag > // Type tag
2697template< typename VT > // Type of the right-hand side dense vector
2698inline auto StaticVector<Type,N,TF,AF,PF,Tag>::multAssign( const DenseVector<VT,TF>& rhs )
2700{
2701 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2702
2703 for( size_t i=0UL; i<N; ++i )
2704 v_[i] *= (*rhs)[i];
2705}
2706//*************************************************************************************************
2707
2708
2709//*************************************************************************************************
2720template< typename Type // Data type of the vector
2721 , size_t N // Number of elements
2722 , bool TF // Transpose flag
2723 , AlignmentFlag AF // Alignment flag
2724 , PaddingFlag PF // Padding flag
2725 , typename Tag > // Type tag
2726template< typename VT > // Type of the right-hand side dense vector
2727inline auto StaticVector<Type,N,TF,AF,PF,Tag>::multAssign( const DenseVector<VT,TF>& rhs )
2729{
2731
2732 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2733
2734 constexpr bool remainder( PF == unpadded || !IsPadded_v<VT> );
2735
2736 constexpr size_t ipos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
2737 BLAZE_INTERNAL_ASSERT( ipos <= N, "Invalid end calculation" );
2738
2739 size_t i( 0UL );
2740
2741 for( ; i<ipos; i+=SIMDSIZE ) {
2742 store( i, load(i) * (*rhs).load(i) );
2743 }
2744 for( ; remainder && i<N; ++i ) {
2745 v_[i] *= (*rhs)[i];
2746 }
2747}
2748//*************************************************************************************************
2749
2750
2751//*************************************************************************************************
2762template< typename Type // Data type of the vector
2763 , size_t N // Number of elements
2764 , bool TF // Transpose flag
2765 , AlignmentFlag AF // Alignment flag
2766 , PaddingFlag PF // Padding flag
2767 , typename Tag > // Type tag
2768template< typename VT > // Type of the right-hand side sparse vector
2770{
2771 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2772
2773 const StaticVector tmp( serial( *this ) );
2774
2775 reset();
2776
2777 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2778 v_[element->index()] = tmp[element->index()] * element->value();
2779}
2780//*************************************************************************************************
2781
2782
2783//*************************************************************************************************
2794template< typename Type // Data type of the vector
2795 , size_t N // Number of elements
2796 , bool TF // Transpose flag
2797 , AlignmentFlag AF // Alignment flag
2798 , PaddingFlag PF // Padding flag
2799 , typename Tag > // Type tag
2800template< typename VT > // Type of the right-hand side dense vector
2801inline auto StaticVector<Type,N,TF,AF,PF,Tag>::divAssign( const DenseVector<VT,TF>& rhs )
2803{
2804 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2805
2806 for( size_t i=0UL; i<N; ++i )
2807 v_[i] /= (*rhs)[i];
2808}
2809//*************************************************************************************************
2810
2811
2812//*************************************************************************************************
2823template< typename Type // Data type of the vector
2824 , size_t N // Number of elements
2825 , bool TF // Transpose flag
2826 , AlignmentFlag AF // Alignment flag
2827 , PaddingFlag PF // Padding flag
2828 , typename Tag > // Type tag
2829template< typename VT > // Type of the right-hand side dense vector
2830inline auto StaticVector<Type,N,TF,AF,PF,Tag>::divAssign( const DenseVector<VT,TF>& rhs )
2832{
2834
2835 BLAZE_INTERNAL_ASSERT( (*rhs).size() == N, "Invalid vector sizes" );
2836
2837 constexpr size_t ipos( prevMultiple( N, SIMDSIZE ) );
2838 BLAZE_INTERNAL_ASSERT( ipos <= N, "Invalid end calculation" );
2839
2840 size_t i( 0UL );
2841
2842 for( ; i<ipos; i+=SIMDSIZE ) {
2843 store( i, load(i) / (*rhs).load(i) );
2844 }
2845 for( ; i<N; ++i ) {
2846 v_[i] /= (*rhs)[i];
2847 }
2848}
2849//*************************************************************************************************
2850
2851
2852
2853
2854
2855
2856
2857
2858//=================================================================================================
2859//
2860// STATICVECTOR OPERATORS
2861//
2862//=================================================================================================
2863
2864//*************************************************************************************************
2867template< RelaxationFlag RF, typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2869
2870template< typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2871constexpr bool isIntact( const StaticVector<Type,N,TF,AF,PF,Tag>& v ) noexcept;
2872
2873template< typename Type, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2875
2876template< typename Type, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2878
2879template< typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2881
2882template< size_t I, typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2883constexpr Type& get( StaticVector<Type,N,TF,AF,PF,Tag>& v ) noexcept;
2884
2885template< size_t I, typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2886constexpr Type&& get( StaticVector<Type,N,TF,AF,PF,Tag>&& v ) noexcept;
2887
2888template< size_t I, typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2889constexpr const Type& get( const StaticVector<Type,N,TF,AF,PF,Tag>& v) noexcept;
2890
2891template< size_t I, typename Type, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
2892constexpr const Type&& get( const StaticVector<Type,N,TF,AF,PF,Tag>&& v ) noexcept;
2894//*************************************************************************************************
2895
2896
2897//*************************************************************************************************
2922template< RelaxationFlag RF // Relaxation flag
2923 , typename Type // Data type of the vector
2924 , size_t N // Number of elements
2925 , bool TF // Transpose flag
2926 , AlignmentFlag AF // Alignment flag
2927 , PaddingFlag PF // Padding flag
2928 , typename Tag > // Type tag
2930{
2931 for( size_t i=0UL; i<N; ++i )
2932 if( !isDefault<RF>( v[i] ) ) return false;
2933 return true;
2934}
2935//*************************************************************************************************
2936
2937
2938//*************************************************************************************************
2956template< typename Type // Data type of the vector
2957 , size_t N // Number of elements
2958 , bool TF // Transpose flag
2959 , AlignmentFlag AF // Alignment flag
2960 , PaddingFlag PF // Padding flag
2961 , typename Tag > // Type tag
2962constexpr bool isIntact( const StaticVector<Type,N,TF,AF,PF,Tag>& v ) noexcept
2963{
2964 return v.isIntact();
2965}
2966//*************************************************************************************************
2967
2968
2969//*************************************************************************************************
2980template< typename Type // Data type of the vector
2981 , bool TF // Transpose flag
2982 , AlignmentFlag AF // Alignment flag
2983 , PaddingFlag PF // Padding flag
2984 , typename Tag > // Type tag
2985inline const StaticVector<Type,2UL,TF,AF,PF,Tag>
2987{
2988 return StaticVector<Type,2UL,TF,AF,PF,Tag>( -v[1UL], v[0UL] );
2989}
2990//*************************************************************************************************
2991
2992
2993//*************************************************************************************************
3001template< typename Type // Data type of the vector
3002 , bool TF // Transpose flag
3003 , AlignmentFlag AF // Alignment flag
3004 , PaddingFlag PF // Padding flag
3005 , typename Tag > // Type tag
3006inline const StaticVector<Type,3UL,TF,AF,PF,Tag>
3008{
3009 if( v[0] != Type() || v[1] != Type() )
3010 return StaticVector<Type,3UL,TF,AF,PF,Tag>( v[1UL], -v[0UL], Type() );
3011 else
3012 return StaticVector<Type,3UL,TF,AF,PF,Tag>( Type(), v[2UL], -v[1UL] );
3013}
3014//*************************************************************************************************
3015
3016
3017//*************************************************************************************************
3025template< typename Type // Data type of the vector
3026 , size_t N // Number of elements
3027 , bool TF // Transpose flag
3028 , AlignmentFlag AF // Alignment flag
3029 , PaddingFlag PF // Padding flag
3030 , typename Tag > // Type tag
3032{
3033 a.swap( b );
3034}
3035//*************************************************************************************************
3036
3037
3038//*************************************************************************************************
3045template< size_t I // Compile time access index
3046 , typename Type // Data type of the vector
3047 , size_t N // Number of elements
3048 , bool TF // Transpose flag
3049 , AlignmentFlag AF // Alignment flag
3050 , PaddingFlag PF // Padding flag
3051 , typename Tag > // Type tag
3053{
3054 BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
3055 return v[I];
3056}
3057//*************************************************************************************************
3058
3059
3060//*************************************************************************************************
3067template< size_t I // Compile time access index
3068 , typename Type // Data type of the vector
3069 , size_t N // Number of elements
3070 , bool TF // Transpose flag
3071 , AlignmentFlag AF // Alignment flag
3072 , PaddingFlag PF // Padding flag
3073 , typename Tag > // Type tag
3074constexpr Type&& get( StaticVector<Type,N,TF,AF,PF,Tag>&& v ) noexcept
3075{
3076 BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
3077 return std::move( v[I] );
3078}
3079//*************************************************************************************************
3080
3081
3082//*************************************************************************************************
3089template< size_t I // Compile time access index
3090 , typename Type // Data type of the vector
3091 , size_t N // Number of elements
3092 , bool TF // Transpose flag
3093 , AlignmentFlag AF // Alignment flag
3094 , PaddingFlag PF // Padding flag
3095 , typename Tag > // Type tag
3096constexpr const Type& get( const StaticVector<Type,N,TF,AF,PF,Tag>& v) noexcept
3097{
3098 BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
3099 return v[I];
3100}
3101//*************************************************************************************************
3102
3103
3104//*************************************************************************************************
3111template< size_t I // Compile time access index
3112 , typename Type // Data type of the vector
3113 , size_t N // Number of elements
3114 , bool TF // Transpose flag
3115 , AlignmentFlag AF // Alignment flag
3116 , PaddingFlag PF // Padding flag
3117 , typename Tag > // Type tag
3118constexpr const Type&& get( const StaticVector<Type,N,TF,AF,PF,Tag>&& v ) noexcept
3119{
3120 BLAZE_STATIC_ASSERT_MSG( I < N, "Invalid vector access index" );
3121 return std::move( v[I] );
3122}
3123//*************************************************************************************************
3124
3125
3126
3127
3128//=================================================================================================
3129//
3130// SIZE SPECIALIZATIONS
3131//
3132//=================================================================================================
3133
3134//*************************************************************************************************
3136template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3137struct Size< StaticVector<T,N,TF,AF,PF,Tag>, 0UL >
3138 : public Ptrdiff_t< static_cast<ptrdiff_t>(N) >
3139{};
3141//*************************************************************************************************
3142
3143
3144
3145
3146//=================================================================================================
3147//
3148// MAXSIZE SPECIALIZATIONS
3149//
3150//=================================================================================================
3151
3152//*************************************************************************************************
3154template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3155struct MaxSize< StaticVector<T,N,TF,AF,PF,Tag>, 0UL >
3156 : public Ptrdiff_t< static_cast<ptrdiff_t>(N) >
3157{};
3159//*************************************************************************************************
3160
3161
3162
3163
3164//=================================================================================================
3165//
3166// HASCONSTDATAACCESS SPECIALIZATIONS
3167//
3168//=================================================================================================
3169
3170//*************************************************************************************************
3172template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3173struct HasConstDataAccess< StaticVector<T,N,TF,AF,PF,Tag> >
3174 : public TrueType
3175{};
3177//*************************************************************************************************
3178
3179
3180
3181
3182//=================================================================================================
3183//
3184// HASMUTABLEDATAACCESS SPECIALIZATIONS
3185//
3186//=================================================================================================
3187
3188//*************************************************************************************************
3190template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3191struct HasMutableDataAccess< StaticVector<T,N,TF,AF,PF,Tag> >
3192 : public TrueType
3193{};
3195//*************************************************************************************************
3196
3197
3198
3199
3200//=================================================================================================
3201//
3202// ISALIGNED SPECIALIZATIONS
3203//
3204//=================================================================================================
3205
3206//*************************************************************************************************
3208template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3209struct IsAligned< StaticVector<T,N,TF,AF,PF,Tag> >
3210 : public BoolConstant< AF == aligned >
3211{};
3213//*************************************************************************************************
3214
3215
3216
3217
3218//=================================================================================================
3219//
3220// ISCONTIGUOUS SPECIALIZATIONS
3221//
3222//=================================================================================================
3223
3224//*************************************************************************************************
3226template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3227struct IsContiguous< StaticVector<T,N,TF,AF,PF,Tag> >
3228 : public TrueType
3229{};
3231//*************************************************************************************************
3232
3233
3234
3235
3236//=================================================================================================
3237//
3238// ISPADDED SPECIALIZATIONS
3239//
3240//=================================================================================================
3241
3242//*************************************************************************************************
3244template< typename T, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag >
3245struct IsPadded< StaticVector<T,N,TF,AF,PF,Tag> >
3246 : public BoolConstant< PF == padded >
3247{};
3249//*************************************************************************************************
3250
3251
3252
3253
3254//=================================================================================================
3255//
3256// ADDTRAIT SPECIALIZATIONS
3257//
3258//=================================================================================================
3259
3260//*************************************************************************************************
3262template< typename T1, typename T2 >
3263struct AddTraitEval2< T1, T2
3264 , EnableIf_t< IsVector_v<T1> &&
3268{
3275};
3277//*************************************************************************************************
3278
3279
3280
3281
3282//=================================================================================================
3283//
3284// SUBTRAIT SPECIALIZATIONS
3285//
3286//=================================================================================================
3287
3288//*************************************************************************************************
3290template< typename T1, typename T2 >
3291struct SubTraitEval2< T1, T2
3292 , EnableIf_t< IsVector_v<T1> &&
3296{
3303};
3305//*************************************************************************************************
3306
3307
3308
3309
3310//=================================================================================================
3311//
3312// MULTTRAIT SPECIALIZATIONS
3313//
3314//=================================================================================================
3315
3316//*************************************************************************************************
3318template< typename T1, typename T2 >
3319struct MultTraitEval2< T1, T2
3320 , EnableIf_t< IsVector_v<T1> &&
3322 ( Size_v<T1,0UL> != DefaultSize_v ) > >
3323{
3330};
3331
3332template< typename T1, typename T2 >
3333struct MultTraitEval2< T1, T2
3334 , EnableIf_t< IsScalar_v<T1> &&
3336 ( Size_v<T2,0UL> != DefaultSize_v ) > >
3337{
3344};
3345
3346template< typename T1, typename T2 >
3347struct MultTraitEval2< T1, T2
3348 , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
3353{
3360};
3361
3362template< typename T1, typename T2 >
3363struct MultTraitEval2< T1, T2
3364 , EnableIf_t< IsMatrix_v<T1> &&
3368{
3370 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
3371
3374 , false
3378};
3379
3380template< typename T1, typename T2 >
3381struct MultTraitEval2< T1, T2
3382 , EnableIf_t< IsRowVector_v<T1> &&
3386{
3388 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
3389
3392 , true
3396};
3398//*************************************************************************************************
3399
3400
3401
3402
3403//=================================================================================================
3404//
3405// KRONTRAIT SPECIALIZATIONS
3406//
3407//=================================================================================================
3408
3409//*************************************************************************************************
3411template< typename T1, typename T2 >
3412struct KronTraitEval2< T1, T2
3413 , EnableIf_t< IsDenseVector_v<T1> &&
3416 ( Size_v<T2,0UL> != DefaultSize_v ) > >
3417{
3424};
3426//*************************************************************************************************
3427
3428
3429
3430
3431//=================================================================================================
3432//
3433// DIVTRAIT SPECIALIZATIONS
3434//
3435//=================================================================================================
3436
3437//*************************************************************************************************
3439template< typename T1, typename T2 >
3440struct DivTraitEval2< T1, T2
3441 , EnableIf_t< IsVector_v<T1> &&
3443 ( Size_v<T1,0UL> != DefaultSize_v ) > >
3444{
3450 , DivTrait_t< TagType_t<T1>, T2 > >;
3451};
3452
3453template< typename T1, typename T2 >
3454struct DivTraitEval2< T1, T2
3455 , EnableIf_t< IsDenseVector_v<T1> &&
3459{
3466};
3468//*************************************************************************************************
3469
3470
3471
3472
3473//=================================================================================================
3474//
3475// CROSSTRAIT SPECIALIZATIONS
3476//
3477//=================================================================================================
3478
3479//*************************************************************************************************
3481template< typename T1, typename T2 >
3482struct CrossTraitEval2< T1, T2
3484{
3486 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
3487
3489 , 3UL
3494};
3496//*************************************************************************************************
3497
3498
3499
3500
3501//=================================================================================================
3502//
3503// MAPTRAIT SPECIALIZATIONS
3504//
3505//=================================================================================================
3506
3507//*************************************************************************************************
3509template< typename T, typename OP >
3510struct UnaryMapTraitEval2< T, OP
3511 , EnableIf_t< IsVector_v<T> &&
3513{
3514 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
3515
3521 , MapTrait_t< TagType_t<T>, OP > >;
3522};
3524//*************************************************************************************************
3525
3526
3527//*************************************************************************************************
3529template< typename T1, typename T2, typename OP >
3530struct BinaryMapTraitEval2< T1, T2, OP
3531 , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
3535{
3536 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
3537 , std::declval< ElementType_t<T2> >() ) );
3538
3545};
3547//*************************************************************************************************
3548
3549
3550
3551
3552//=================================================================================================
3553//
3554// REDUCETRAIT SPECIALIZATIONS
3555//
3556//=================================================================================================
3557
3558//*************************************************************************************************
3560template< typename T, typename OP, ReductionFlag RF >
3561struct PartialReduceTraitEval2< T, OP, RF
3562 , EnableIf_t< IsMatrix_v<T> &&
3565{
3566 using ET = ElementType_t<T>;
3567
3568 static constexpr bool TF = ( RF == columnwise );
3569
3570 using Type = StaticVector< decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) )
3572 , TF
3575 , MapTrait_t< TagType_t<T>, OP > >;
3576};
3578//*************************************************************************************************
3579
3580
3581
3582
3583//=================================================================================================
3584//
3585// REPEATTRAIT SPECIALIZATIONS
3586//
3587//=================================================================================================
3588
3589//*************************************************************************************************
3591template< typename T, size_t R0 >
3592struct RepeatTraitEval2< T, R0, inf, inf
3594 ( R0 != inf ) &&
3595 ( Size_v<T,0UL> != DefaultSize_v ) > >
3596{
3598 , R0*Size_v<T,0UL>
3602 , TagType_t<T> >;
3603};
3605//*************************************************************************************************
3606
3607
3608
3609
3610//=================================================================================================
3611//
3612// SOLVETRAIT SPECIALIZATIONS
3613//
3614//=================================================================================================
3615
3616//*************************************************************************************************
3618template< typename T1, typename T2 >
3619struct SolveTraitEval2< T1, T2
3620 , EnableIf_t< IsDenseMatrix_v<T1> &&
3622 ( ( Size_v<T1,0UL> != DefaultSize_v ) ||
3624 ( Size_v<T2,0UL> != DefaultSize_v ) ) > >
3625{
3631 , TagType_t<T2> >;
3632};
3634//*************************************************************************************************
3635
3636
3637
3638
3639//=================================================================================================
3640//
3641// HIGHTYPE SPECIALIZATIONS
3642//
3643//=================================================================================================
3644
3645//*************************************************************************************************
3647template< typename T1, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag, typename T2 >
3648struct HighType< StaticVector<T1,N,TF,AF,PF,Tag>, StaticVector<T2,N,TF,AF,PF,Tag> >
3649{
3650 using Type = StaticVector< typename HighType<T1,T2>::Type, N, TF, AF, PF, Tag >;
3651};
3653//*************************************************************************************************
3654
3655
3656
3657
3658//=================================================================================================
3659//
3660// LOWTYPE SPECIALIZATIONS
3661//
3662//=================================================================================================
3663
3664//*************************************************************************************************
3666template< typename T1, size_t N, bool TF, AlignmentFlag AF, PaddingFlag PF, typename Tag, typename T2 >
3667struct LowType< StaticVector<T1,N,TF,AF,PF,Tag>, StaticVector<T2,N,TF,AF,PF,Tag> >
3668{
3669 using Type = StaticVector< typename LowType<T1,T2>::Type, N, TF, AF, PF, Tag >;
3670};
3672//*************************************************************************************************
3673
3674
3675
3676
3677//=================================================================================================
3678//
3679// SUBVECTORTRAIT SPECIALIZATIONS
3680//
3681//=================================================================================================
3682
3683//*************************************************************************************************
3685template< typename VT, size_t I, size_t N >
3686struct SubvectorTraitEval2< VT, I, N
3687 , EnableIf_t< I != inf && N != inf &&
3689{
3691 , N
3695 , TagType_t<VT> >;
3696};
3698//*************************************************************************************************
3699
3700
3701
3702
3703//=================================================================================================
3704//
3705// ELEMENTSTRAIT SPECIALIZATIONS
3706//
3707//=================================================================================================
3708
3709//*************************************************************************************************
3711template< typename VT, size_t N >
3712struct ElementsTraitEval2< VT, N
3713 , EnableIf_t< N != 0UL &&
3715{
3717 , N
3721 , TagType_t<VT> >;
3722};
3724//*************************************************************************************************
3725
3726
3727
3728
3729//=================================================================================================
3730//
3731// ROWTRAIT SPECIALIZATIONS
3732//
3733//=================================================================================================
3734
3735//*************************************************************************************************
3737template< typename MT, size_t I >
3738struct RowTraitEval2< MT, I
3739 , EnableIf_t< IsDenseMatrix_v<MT> &&
3741{
3744 , true
3747 , TagType_t<MT> >;
3748};
3750//*************************************************************************************************
3751
3752
3753
3754
3755//=================================================================================================
3756//
3757// COLUMNTRAIT SPECIALIZATIONS
3758//
3759//=================================================================================================
3760
3761//*************************************************************************************************
3763template< typename MT, size_t I >
3764struct ColumnTraitEval2< MT, I
3765 , EnableIf_t< IsDenseMatrix_v<MT> &&
3767{
3770 , false
3773 , TagType_t<MT> >;
3774};
3776//*************************************************************************************************
3777
3778
3779
3780
3781//=================================================================================================
3782//
3783// BANDTRAIT SPECIALIZATIONS
3784//
3785//=================================================================================================
3786
3787//*************************************************************************************************
3789template< typename MT, ptrdiff_t I >
3790struct BandTraitEval2< MT, I
3791 , EnableIf_t< IsDenseMatrix_v<MT> &&
3794{
3795 static constexpr size_t M = Size_v<MT,0UL>;
3796 static constexpr size_t N = Size_v<MT,1UL>;
3797 static constexpr size_t Min = min( M - ( I >= 0L ? 0UL : -I ), N - ( I >= 0L ? I : 0UL ) );
3798
3800 , Min
3804 , TagType_t<MT> >;
3805};
3807//*************************************************************************************************
3808
3809} // namespace blaze
3810
3811
3812
3813
3814//=================================================================================================
3815//
3816// STD::TUPLE SUPPORT
3817//
3818//=================================================================================================
3819
3820//*************************************************************************************************
3822namespace std
3823{
3824
3825template< typename Type
3826 , size_t N
3827 , bool TF
3830 , typename Tag >
3831class tuple_size< blaze::StaticVector<Type,N,TF,AF,PF,Tag> >
3832 : public integral_constant< size_t, N >
3833{};
3834
3835template< size_t I
3836 , typename Type
3837 , size_t N
3838 , bool TF
3841 , typename Tag >
3842class tuple_element< I, blaze::StaticVector<Type,N,TF,AF,PF,Tag> >
3843{
3844 public:
3845 using type = Type;
3846};
3847
3848}
3850//*************************************************************************************************
3851
3852#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename ResultType_t< T >::TagType TagType_t
Alias declaration for nested TagType type definitions.
Definition Aliases.h:530
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition Aliases.h:450
Header file for the AlignedArray implementation.
Header file for the alignment check function.
Header file for the alignment flag enumeration.
Header file for the AlignmentOf type trait.
Header file for run time assertion macros.
Header file for the band trait.
Header file for the column trait.
Constraint on the data type.
Header file for the cross product trait.
Header file for the DenseIterator class template.
Header file for the division trait.
Header file for the elements trait.
Header file for the EnableIf class template.
Header file for the EvaluateTrait class template.
Header file for the HasConstDataAccess type trait.
Header file for the HasMutableDataAccess type trait.
Header file for the HasSIMDAdd type trait.
Header file for the HasSIMDDiv type trait.
Header file for the HasSIMDMult type trait.
Header file for the HasSIMDSub type trait.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsColumnVector type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsDenseMatrix type trait.
Header file for the IsDenseVector type trait.
Header file for the IsMatrix type trait.
Header file for the IsNumeric type trait.
Header file for the IsPadded type trait.
Header file for the IsRowVector type trait.
Header file for the IsSIMDCombinable type trait.
Header file for the IsScalar type trait.
Header file for the IsSparseVector type trait.
Header file for the IsSquare type trait.
Header file for the IsVector type trait.
Header file for the IsVectorizable type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Header file for the map trait.
Header file for the MaxSize type trait.
Header file for the MAYBE_UNUSED function template.
Header file for memory allocation and deallocation functionality.
Header file for the multiplication trait.
Header file for the nextMultiple shim.
Header file for the padding flag enumeration.
Constraint on the data type.
Header file for the prevMultiple shim.
Header file for the reduce trait.
Header file for the reduction flags.
constexpr ReductionFlag columnwise
Reduction flag for column-wise reduction operations.
Definition ReductionFlag.h:97
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveCV type trait.
Header file for the RemoveConst type trait.
Header file for the repeat trait.
Header file for the row trait.
Header file for all SIMD functionality.
Data type constraint.
Header file for the Solver trait.
C++-standard-specific system settings.
Compile time assertion.
Header file for the subtraction trait.
Header file for the subvector trait.
Constraint on the data type.
Constraint on the data type.
Implementation of a static array with a fixed alignment.
Definition AlignedArray.h:101
Implementation of a generic iterator for dense vectors and matrices.
Definition DenseIterator.h:60
Base class for sparse vectors.
Definition SparseVector.h:72
Efficient implementation of a fixed-sized vector.
Definition StaticVector.h:230
static constexpr bool isAligned() noexcept
const Type & ReturnType
Definition StaticVector.h:243
BLAZE_ALWAYS_INLINE void storeu(size_t index, const SIMDType &value) noexcept
constexpr StaticVector(const StaticVector &v)
The copy constructor for StaticVector.
Definition StaticVector.h:837
Reference at(size_t index)
Checked access to the vector elements.
Definition StaticVector.h:989
constexpr StaticVector(const Other(&array)[Dim])
Array initialization of all vector elements.
Definition StaticVector.h:778
auto multAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
AlignedArray< Type, NN, Alignment > AlignedStorage
Definition StaticVector.h:532
static constexpr size_t capacity() noexcept
static constexpr size_t SIMDSIZE
Definition StaticVector.h:402
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
constexpr Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition StaticVector.h:940
StaticVector(const Vector< VT, TF > &v)
Conversion constructor from different vectors.
Definition StaticVector.h:893
Type * Pointer
Definition StaticVector.h:248
constexpr StaticVector(const std::array< Other, Dim > &array)
Initialization of all vector elements from the given std::array.
Definition StaticVector.h:814
StaticVector(const Type &init)
Constructor for a homogenous initialization of all elements.
Definition StaticVector.h:643
auto addAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
StaticVector()
The default constructor for StaticVector.
Definition StaticVector.h:613
DenseVector< This, TF > BaseType
Base type of this StaticVector instance.
Definition StaticVector.h:234
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
StaticVector(const StaticVector< Other, N, TF, AF2, PF2, Tag > &v)
Conversion constructor from different StaticVector instances.
Definition StaticVector.h:860
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
SIMDTrait_t< ElementType > SIMDType
Definition StaticVector.h:241
bool canAlias(const Other *alias) const noexcept
auto divAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
const Type * ConstPointer
Definition StaticVector.h:249
Type & Reference
Definition StaticVector.h:246
StaticVector< Type, N, TF, AF, PF, Tag > This
Type of this StaticVector instance.
Definition StaticVector.h:233
bool isAliased(const Other *alias) const noexcept
AlignedStorage v_
Definition StaticVector.h:538
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
auto assign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
static constexpr bool simdEnabled
Definition StaticVector.h:279
DenseIterator< const Type, AF > ConstIterator
Definition StaticVector.h:252
constexpr ConstIterator cend() const noexcept
const StaticVector & CompositeType
Definition StaticVector.h:244
constexpr StaticVector(initializer_list< Type > list)
List initialization of all vector elements.
Definition StaticVector.h:682
constexpr ConstReference operator[](size_t index) const noexcept
Subscript operator for the direct access to the vector elements.
Definition StaticVector.h:964
const Type & ConstReference
Definition StaticVector.h:247
Type ElementType
Definition StaticVector.h:240
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
auto subAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
DenseIterator< Type, AF > Iterator
Definition StaticVector.h:251
static constexpr bool smpAssignable
Definition StaticVector.h:285
Tag TagType
Definition StaticVector.h:242
constexpr ConstIterator cbegin() const noexcept
constexpr bool isIntact() const noexcept
StaticVector< Type, N,!TF, AF, PF, Tag > TransposeType
Transpose type for expression template evaluations.
Definition StaticVector.h:238
BLAZE_ALWAYS_INLINE void stream(size_t index, const SIMDType &value) noexcept
constexpr StaticVector & operator=(const Type &rhs) &
Homogenous assignment to all vector elements.
Definition StaticVector.h:1203
static constexpr size_t Alignment
Definition StaticVector.h:528
ConstReference at(size_t index) const
Checked access to the vector elements.
Definition StaticVector.h:1016
This ResultType
Result type for expression template evaluations.
Definition StaticVector.h:235
static constexpr size_t spacing() noexcept
static constexpr size_t NN
Definition StaticVector.h:405
constexpr Pointer data() noexcept
Low-level data access to the vector elements.
Definition StaticVector.h:1040
StaticVector(size_t n, const Other *array)
Array initialization of all vector elements.
Definition StaticVector.h:730
static constexpr size_t size() noexcept
Base class for N-dimensional vectors.
Definition Vector.h:82
Initializer list type of the Blaze library.
Constraint on the data type.
Constraint on the data type.
Header file for the DenseVector base class.
Header file for the SparseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.
Definition Vectorizable.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition Const.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TAG(A, B)
Data type constraint.
Definition SameTag.h:68
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition Reference.h:79
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:1339
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:1375
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition DMatSerialExpr.h:812
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition DiagonalMatrix.h:225
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition DenseVector.h:61
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.
Definition CrossTrait.h:138
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition SubTrait.h:163
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition AddTrait.h:163
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition MapTrait.h:131
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition DivTrait.h:164
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition MultTrait.h:165
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.
Definition HasSIMDSub.h:187
constexpr bool IsSquare_v
Auxiliary variable template for the IsSquare type trait.
Definition IsSquare.h:146
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition IsScalar.h:104
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.
Definition IsSIMDCombinable.h:137
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.
Definition Size.h:176
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition Size.h:72
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.
Definition IsVector.h:125
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition IsMatrix.h:124
constexpr bool IsColumnVector_v
Auxiliary variable template for the IsColumnVector type trait.
Definition IsColumnVector.h:126
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.
Definition HasSIMDAdd.h:187
constexpr bool HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.
Definition HasSIMDDiv.h:173
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.
Definition HasSIMDMult.h:188
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.
Definition IsRowVector.h:126
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.
Definition IsDenseMatrix.h:124
constexpr bool IsSparseVector_v
Auxiliary variable template for the IsSparseVector type trait.
Definition IsSparseVector.h:124
constexpr bool TransposeFlag_v
Auxiliary variable template for the TransposeFlag type trait.
Definition TransposeFlag.h:93
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.
Definition IsDenseVector.h:124
constexpr bool IsPadded_v
Auxiliary variable template for the IsPadded type trait.
Definition IsPadded.h:134
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition PrevMultiple.h:68
constexpr Infinity inf
Global Infinity instance.
Definition Infinity.h:1080
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
PaddingFlag
Padding flag for (un-)padded vectors and matrices.
Definition PaddingFlag.h:77
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition AlignmentFlag.h:63
@ padded
Flag for padded vectors and matrices.
Definition PaddingFlag.h:79
@ unpadded
Flag for unpadded vectors and matrices.
Definition PaddingFlag.h:78
@ aligned
Flag for aligned vectors and matrices.
Definition AlignmentFlag.h:65
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition Matrix.h:960
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition Assert.h:117
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.
Definition SIMDTrait.h:315
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
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
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 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
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
#define BLAZE_STATIC_ASSERT_MSG(expr, msg)
Compile time assertion macro.
Definition StaticAssert.h:123
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition StaticAssert.h:112
constexpr Type & get(StaticVector< Type, N, TF, AF, PF, Tag > &v) noexcept
Tuple-like index-based access the contents of a static vector.
Definition StaticVector.h:3052
const StaticVector< Type, 2UL, TF, AF, PF, Tag > perp(const StaticVector< Type, 2UL, TF, AF, PF, Tag > &v)
Unary perp dot product operator for the calculation of a perpendicular vector ( ).
Definition StaticVector.h:2986
constexpr PaddingFlag defaultPaddingFlag
The default padding flag for all vectors and matrices of the Blaze library.
Definition Padding.h:74
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
constexpr AlignmentFlag defaultAlignmentFlag
The default alignment for all vectors and matrices of the Blaze library.
Definition Alignment.h:75
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.
Definition TransposeFlag.h:75
constexpr bool IsVectorizable_v
Auxiliary variable template for the IsVectorizable type trait.
Definition IsVectorizable.h:157
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.
Definition IsNumeric.h:132
constexpr size_t AlignmentOf_v
Auxiliary variable template for the AlignmentOf type trait.
Definition AlignmentOf.h:239
void deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition Memory.h:230
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.
Definition IntegralConstant.h:237
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
BoolConstant< true > TrueType
Type traits base class.
Definition IntegralConstant.h:132
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition AlignmentCheck.h:68
T * allocate(size_t size)
Aligned array allocation for built-in data types.
Definition Memory.h:158
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:175
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition IntegralConstant.h:110
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for the extended initializer_list functionality.
Constraint on the data type.
Header file for all forward declarations for dense vectors and matrices.
Header file for the Size type trait.
Header file for the TransposeFlag type trait.
Header file for the clear shim.
Header file for the serial shim.
Compile time check for low-level access to constant data.
Definition HasConstDataAccess.h:76
Compile time check for low-level access to mutable data.
Definition HasMutableDataAccess.h:76
Base template for the HighType type trait.
Definition HighType.h:322
Compile time check for the alignment of data types.
Definition IsAligned.h:88
Compile time check for the memory layout of data types.
Definition IsContiguous.h:87
Compile time check for data types with padding.
Definition IsPadded.h:77
Base template for the LowType type trait.
Definition LowType.h:322
Compile time evaluation of the maximum size of vectors and matrices.
Definition MaxSize.h:118
Generic wrapper for the min() function.
Definition Min.h:82
Rebind mechanism to obtain a StaticVector with different data/element type.
Definition StaticVector.h:259
StaticVector< NewType, N, TF, AF, PF, Tag > Other
The type of the other StaticVector.
Definition StaticVector.h:260
Resize mechanism to obtain a StaticVector with a different fixed number of elements.
Definition StaticVector.h:268
StaticVector< Type, NewN, TF, AF, PF, Tag > Other
The type of the other StaticVector.
Definition StaticVector.h:269
System settings for the inline keywords.
System settings for performance optimizations.
Header file for the default transpose flag for all vectors of the Blaze library.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.