Blaze 3.9
Loading...
Searching...
No Matches
DynamicVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_
36#define _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <array>
44#include <algorithm>
45#include <memory>
46#include <utility>
47#include <blaze/math/Aliases.h>
58#include <blaze/math/Forward.h>
67#include <blaze/math/SIMD.h>
112#include <blaze/system/Inline.h>
121#include <blaze/util/Assert.h>
127#include <blaze/util/EnableIf.h>
129#include <blaze/util/Types.h>
134
135
136namespace blaze {
137
138//=================================================================================================
139//
140// CLASS DEFINITION
141//
142//=================================================================================================
143
144//*************************************************************************************************
217template< typename Type // Data type of the vector
218 , bool TF // Transpose flag
219 , typename Alloc // Type of the allocator
220 , typename Tag > // Type tag
222 : public DenseVector< DynamicVector<Type,TF,Alloc,Tag>, TF >
223{
224 public:
225 //**Type definitions****************************************************************************
227 using BaseType = DenseVector<This,TF>;
228 using ResultType = This;
229
232
236 using TagType = Tag;
237 using ReturnType = const Type&;
239
240 using Reference = Type&;
241 using ConstReference = const Type&;
242 using Pointer = Type*;
243 using ConstPointer = const Type*;
244
247 //**********************************************************************************************
248
249 //**Rebind struct definition********************************************************************
252 template< typename NewType > // Data type of the other vector
253 struct Rebind
254 {
256 using NewAlloc = typename std::allocator_traits<Alloc>::template rebind_alloc<NewType>;
257
260 };
261 //**********************************************************************************************
262
263 //**Resize struct definition********************************************************************
266 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 = !IsSMPAssignable_v<Type>;
286 //**********************************************************************************************
287
288 //**Constructors********************************************************************************
291 inline DynamicVector( const Alloc& alloc = Alloc{} ) noexcept;
292 explicit inline DynamicVector( size_t n, const Alloc& alloc = Alloc{} );
293 inline DynamicVector( size_t n, const Type& init, const Alloc& alloc = Alloc{} );
294 inline DynamicVector( initializer_list<Type> list, const Alloc& alloc = Alloc{} );
295
296 template< typename Other >
297 inline DynamicVector( size_t n, const Other* array, const Alloc& alloc = Alloc{} );
298
299 template< typename Other, size_t Dim >
300 inline DynamicVector( const Other (&array)[Dim], const Alloc& alloc = Alloc{} );
301
302 template< typename Other, size_t Dim >
303 inline DynamicVector( const std::array<Other,Dim>& array, const Alloc& alloc = Alloc{} );
304
305 inline DynamicVector( const DynamicVector& v );
306 inline DynamicVector( DynamicVector&& v ) noexcept;
307 template< typename VT > inline DynamicVector( const Vector<VT,TF>& v );
309 //**********************************************************************************************
310
311 //**Destructor**********************************************************************************
316 //**********************************************************************************************
317
318 //**Data access functions***********************************************************************
321 inline Reference operator[]( size_t index ) noexcept;
322 inline ConstReference operator[]( size_t index ) const noexcept;
323 inline Reference at( size_t index );
324 inline ConstReference at( size_t index ) const;
325 inline Pointer data () noexcept;
326 inline ConstPointer data () const noexcept;
327 inline Iterator begin () noexcept;
328 inline ConstIterator begin () const noexcept;
329 inline ConstIterator cbegin() const noexcept;
330 inline Iterator end () noexcept;
331 inline ConstIterator end () const noexcept;
332 inline ConstIterator cend () const noexcept;
334 //**********************************************************************************************
335
336 //**Assignment operators************************************************************************
339 inline DynamicVector& operator=( const Type& rhs ) &;
340 inline DynamicVector& operator=( initializer_list<Type> list ) &;
341
342 template< typename Other, size_t Dim >
343 inline DynamicVector& operator=( const Other (&array)[Dim] ) &;
344
345 template< typename Other, size_t Dim >
346 inline DynamicVector& operator=( const std::array<Other,Dim>& array ) &;
347
348 inline DynamicVector& operator=( const DynamicVector& rhs ) &;
349 inline DynamicVector& operator=( DynamicVector&& rhs ) & noexcept;
350
351 template< typename VT > inline DynamicVector& operator= ( const Vector<VT,TF>& rhs ) &;
352 template< typename VT > inline DynamicVector& operator+=( const Vector<VT,TF>& rhs ) &;
353 template< typename VT > inline DynamicVector& operator-=( const Vector<VT,TF>& rhs ) &;
354 template< typename VT > inline DynamicVector& operator*=( const Vector<VT,TF>& rhs ) &;
355 template< typename VT > inline DynamicVector& operator/=( const DenseVector<VT,TF>& rhs ) &;
356 template< typename VT > inline DynamicVector& operator%=( const Vector<VT,TF>& rhs ) &;
358 //**********************************************************************************************
359
360 //**Utility functions***************************************************************************
363 inline size_t size() const noexcept;
364 inline size_t spacing() const noexcept;
365 inline size_t capacity() const noexcept;
366 inline size_t nonZeros() const;
367 inline void reset();
368 inline void clear();
369 inline void resize( size_t n, bool preserve=true );
370 inline void extend( size_t n, bool preserve=true );
371 inline void reserve( size_t n );
372 inline void shrinkToFit();
373 inline void swap( DynamicVector& v ) noexcept;
375 //**********************************************************************************************
376
377 //**Numeric functions***************************************************************************
380 template< typename Other > inline DynamicVector& scale( const Other& scalar );
382 //**********************************************************************************************
383
384 private:
385 //**********************************************************************************************
388 template< typename VT >
389 static constexpr bool VectorizedAssign_v =
390 ( useOptimizedKernels &&
391 simdEnabled && VT::simdEnabled &&
394 //**********************************************************************************************
395
396 //**********************************************************************************************
399 template< typename VT >
400 static constexpr bool VectorizedAddAssign_v =
401 ( VectorizedAssign_v<VT> &&
404 //**********************************************************************************************
405
406 //**********************************************************************************************
409 template< typename VT >
410 static constexpr bool VectorizedSubAssign_v =
411 ( VectorizedAssign_v<VT> &&
414 //**********************************************************************************************
415
416 //**********************************************************************************************
419 template< typename VT >
420 static constexpr bool VectorizedMultAssign_v =
421 ( VectorizedAssign_v<VT> &&
424 //**********************************************************************************************
425
426 //**********************************************************************************************
429 template< typename VT >
430 static constexpr bool VectorizedDivAssign_v =
431 ( VectorizedAssign_v<VT> &&
434 //**********************************************************************************************
435
436 //**********************************************************************************************
438 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
439 //**********************************************************************************************
440
441 public:
442 //**Debugging functions*************************************************************************
445 inline bool isIntact() const noexcept;
447 //**********************************************************************************************
448
449 //**Expression template evaluation functions****************************************************
452 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
453 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
454
455 inline bool isAligned () const noexcept;
456 inline bool canSMPAssign() const noexcept;
457
458 BLAZE_ALWAYS_INLINE SIMDType load ( size_t index ) const noexcept;
459 BLAZE_ALWAYS_INLINE SIMDType loada( size_t index ) const noexcept;
460 BLAZE_ALWAYS_INLINE SIMDType loadu( size_t index ) const noexcept;
461
462 BLAZE_ALWAYS_INLINE void store ( size_t index, const SIMDType& value ) noexcept;
463 BLAZE_ALWAYS_INLINE void storea( size_t index, const SIMDType& value ) noexcept;
464 BLAZE_ALWAYS_INLINE void storeu( size_t index, const SIMDType& value ) noexcept;
465 BLAZE_ALWAYS_INLINE void stream( size_t index, const SIMDType& value ) noexcept;
466
467 template< typename VT >
468 inline auto assign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT> >;
469
470 template< typename VT >
471 inline auto assign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT> >;
472
473 template< typename VT > inline void assign( const SparseVector<VT,TF>& rhs );
474
475 template< typename VT >
476 inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT> >;
477
478 template< typename VT >
479 inline auto addAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT> >;
480
481 template< typename VT > inline void addAssign( const SparseVector<VT,TF>& rhs );
482
483 template< typename VT >
484 inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT> >;
485
486 template< typename VT >
487 inline auto subAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT> >;
488
489 template< typename VT > inline void subAssign( const SparseVector<VT,TF>& rhs );
490
491 template< typename VT >
492 inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT> >;
493
494 template< typename VT >
495 inline auto multAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT> >;
496
497 template< typename VT > inline void multAssign( const SparseVector<VT,TF>& rhs );
498
499 template< typename VT >
500 inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT> >;
501
502 template< typename VT >
503 inline auto divAssign( const DenseVector<VT,TF>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT> >;
505 //**********************************************************************************************
506
507 private:
508 //**Uninitialized struct definition*************************************************************
511 struct Uninitialized {};
512 //**********************************************************************************************
513
514 //**Constructors********************************************************************************
517 inline DynamicVector( size_t n, size_t capa, const Alloc& alloc, Uninitialized );
519 //**********************************************************************************************
520
521 //**Utility functions***************************************************************************
524 inline size_t addPadding( size_t value ) const noexcept;
526 //**********************************************************************************************
527
528 //**Member variables****************************************************************************
531 size_t size_;
532 size_t capacity_;
533
540
541 BLAZE_NO_UNIQUE_ADDRESS Alloc alloc_;
543 //**********************************************************************************************
544
545 //**Compile time checks*************************************************************************
552 //**********************************************************************************************
553};
554//*************************************************************************************************
555
556
557
558
559//=================================================================================================
560//
561// DEDUCTION GUIDES
562//
563//=================================================================================================
564
565//*************************************************************************************************
566#if BLAZE_CPP17_MODE
567
568template< typename Type >
570
571template< typename Type, size_t N >
573
574template< typename Type, size_t N >
575DynamicVector( std::array<Type,N> ) -> DynamicVector<Type>;
576
577#endif
578//*************************************************************************************************
579
580
581
582
583//=================================================================================================
584//
585// CONSTRUCTORS
586//
587//=================================================================================================
588
589//*************************************************************************************************
594template< typename Type // Data type of the vector
595 , bool TF // Transpose flag
596 , typename Alloc // Type of the allocator
597 , typename Tag > // Type tag
598inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( const Alloc& alloc ) noexcept
599 : size_ ( 0UL ) // The current size/dimension of the vector
600 , capacity_( 0UL ) // The maximum capacity of the vector
601 , v_ ( nullptr ) // The vector elements
602 , alloc_ ( alloc ) // The allocator of the vector
603{}
604//*************************************************************************************************
605
606
607//*************************************************************************************************
615template< typename Type // Data type of the vector
616 , bool TF // Transpose flag
617 , typename Alloc // Type of the allocator
618 , typename Tag > // Type tag
619inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( size_t n, size_t capa, const Alloc& alloc, Uninitialized )
620 : size_ ( n ) // The current size/dimension of the vector
621 , capacity_( capa ) // The maximum capacity of the vector
622 , v_ ( nullptr ) // The vector elements
623 , alloc_ ( alloc ) // The allocator of the vector
624{
625 v_ = alloc_.allocate( capacity_ );
626
627 if( !checkAlignment( v_ ) ) {
628 alloc_.deallocate( v_, capacity_ );
630 }
631}
632//*************************************************************************************************
633
634
635//*************************************************************************************************
644template< typename Type // Data type of the vector
645 , bool TF // Transpose flag
646 , typename Alloc // Type of the allocator
647 , typename Tag > // Type tag
648inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( size_t n, const Alloc& alloc )
649 : DynamicVector( n, addPadding(n), alloc, Uninitialized{} )
650{
651 using blaze::clear;
652
654
656 for( size_t i=size_; i<capacity_; ++i )
657 clear( v_[i] );
658 }
659
660 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
661}
662//*************************************************************************************************
663
664
665//*************************************************************************************************
674template< typename Type // Data type of the vector
675 , bool TF // Transpose flag
676 , typename Alloc // Type of the allocator
677 , typename Tag > // Type tag
678inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( size_t n, const Type& init, const Alloc& alloc )
679 : DynamicVector( n, alloc )
680{
681 for( size_t i=0UL; i<size_; ++i )
682 v_[i] = init;
683
684 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
685}
686//*************************************************************************************************
687
688
689//*************************************************************************************************
705template< typename Type // Data type of the vector
706 , bool TF // Transpose flag
707 , typename Alloc // Type of the allocator
708 , typename Tag > // Type tag
710 : DynamicVector( list.size(), alloc )
711{
712 std::copy( list.begin(), list.end(), v_ );
713
714 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
715}
716//*************************************************************************************************
717
718
719//*************************************************************************************************
740template< typename Type // Data type of the vector
741 , bool TF // Transpose flag
742 , typename Alloc // Type of the allocator
743 , typename Tag > // Type tag
744template< typename Other > // Data type of the initialization array
745inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( size_t n, const Other* array, const Alloc& alloc )
746 : DynamicVector( n, alloc )
747{
748 for( size_t i=0UL; i<n; ++i )
749 v_[i] = array[i];
750
751 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
752}
753//*************************************************************************************************
754
755
756//*************************************************************************************************
774template< typename Type // Data type of the vector
775 , bool TF // Transpose flag
776 , typename Alloc // Type of the allocator
777 , typename Tag > // Type tag
778template< typename Other // Data type of the static array
779 , size_t Dim > // Dimension of the static array
780inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( const Other (&array)[Dim], const Alloc& alloc )
781 : DynamicVector( Dim, alloc )
782{
783 for( size_t i=0UL; i<Dim; ++i )
784 v_[i] = array[i];
785
786 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
787}
788//*************************************************************************************************
789
790
791//*************************************************************************************************
809template< typename Type // Data type of the vector
810 , bool TF // Transpose flag
811 , typename Alloc // Type of the allocator
812 , typename Tag > // Type tag
813template< typename Other // Data type of the std::array
814 , size_t Dim > // Dimension of the std::array
815inline DynamicVector<Type,TF,Alloc,Tag>::DynamicVector( const std::array<Other,Dim>& array, const Alloc& alloc )
816 : DynamicVector( Dim, alloc )
817{
818 for( size_t i=0UL; i<Dim; ++i )
819 v_[i] = array[i];
820
821 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
822}
823//*************************************************************************************************
824
825
826//*************************************************************************************************
834template< typename Type // Data type of the vector
835 , bool TF // Transpose flag
836 , typename Alloc // Type of the allocator
837 , typename Tag > // Type tag
839 : DynamicVector( v.size_ )
840{
841 BLAZE_INTERNAL_ASSERT( capacity_ <= v.capacity_, "Invalid capacity estimation" );
842
843 smpAssign( *this, *v );
844
845 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
846}
847//*************************************************************************************************
848
849
850//*************************************************************************************************
855template< typename Type // Data type of the vector
856 , bool TF // Transpose flag
857 , typename Alloc // Type of the allocator
858 , typename Tag > // Type tag
860 : size_ ( v.size_ ) // The current size/dimension of the vector
861 , capacity_( v.capacity_ ) // The maximum capacity of the vector
862 , v_ ( v.v_ ) // The vector elements
863{
864 v.size_ = 0UL;
865 v.capacity_ = 0UL;
866 v.v_ = nullptr;
867}
868//*************************************************************************************************
869
870
871//*************************************************************************************************
876template< typename Type // Data type of the vector
877 , bool TF // Transpose flag
878 , typename Alloc // Type of the allocator
879 , typename Tag > // Type tag
880template< typename VT > // Type of the foreign vector
882 : DynamicVector( (*v).size() )
883{
885
887 reset();
888 }
889
890 smpAssign( *this, *v );
891
892 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
893}
894//*************************************************************************************************
895
896
897
898
899//=================================================================================================
900//
901// DESTRUCTOR
902//
903//=================================================================================================
904
905//*************************************************************************************************
908template< typename Type // Data type of the vector
909 , bool TF // Transpose flag
910 , typename Alloc // Type of the allocator
911 , typename Tag > // Type tag
917//*************************************************************************************************
918
919
920
921
922//=================================================================================================
923//
924// DATA ACCESS FUNCTIONS
925//
926//=================================================================================================
927
928//*************************************************************************************************
937template< typename Type // Data type of the vector
938 , bool TF // Transpose flag
939 , typename Alloc // Type of the allocator
940 , typename Tag > // Type tag
943{
944 BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
945 return v_[index];
946}
947//*************************************************************************************************
948
949
950//*************************************************************************************************
959template< typename Type // Data type of the vector
960 , bool TF // Transpose flag
961 , typename Alloc // Type of the allocator
962 , typename Tag > // Type tag
964 DynamicVector<Type,TF,Alloc,Tag>::operator[]( size_t index ) const noexcept
965{
966 BLAZE_USER_ASSERT( index < size_, "Invalid vector access index" );
967 return v_[index];
968}
969//*************************************************************************************************
970
971
972//*************************************************************************************************
982template< typename Type // Data type of the vector
983 , bool TF // Transpose flag
984 , typename Alloc // Type of the allocator
985 , typename Tag > // Type tag
988{
989 if( index >= size_ ) {
990 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
991 }
992 return (*this)[index];
993}
994//*************************************************************************************************
995
996
997//*************************************************************************************************
1007template< typename Type // Data type of the vector
1008 , bool TF // Transpose flag
1009 , typename Alloc // Type of the allocator
1010 , typename Tag > // Type tag
1013{
1014 if( index >= size_ ) {
1015 BLAZE_THROW_OUT_OF_RANGE( "Invalid vector access index" );
1016 }
1017 return (*this)[index];
1018}
1019//*************************************************************************************************
1020
1021
1022//*************************************************************************************************
1029template< typename Type // Data type of the vector
1030 , bool TF // Transpose flag
1031 , typename Alloc // Type of the allocator
1032 , typename Tag > // Type tag
1035{
1036 return v_;
1037}
1038//*************************************************************************************************
1039
1040
1041//*************************************************************************************************
1048template< typename Type // Data type of the vector
1049 , bool TF // Transpose flag
1050 , typename Alloc // Type of the allocator
1051 , typename Tag > // Type tag
1054{
1055 return v_;
1056}
1057//*************************************************************************************************
1058
1059
1060//*************************************************************************************************
1065template< typename Type // Data type of the vector
1066 , bool TF // Transpose flag
1067 , typename Alloc // Type of the allocator
1068 , typename Tag > // Type tag
1071{
1072 return Iterator( v_ );
1073}
1074//*************************************************************************************************
1075
1076
1077//*************************************************************************************************
1082template< typename Type // Data type of the vector
1083 , bool TF // Transpose flag
1084 , typename Alloc // Type of the allocator
1085 , typename Tag > // Type tag
1088{
1089 return ConstIterator( v_ );
1090}
1091//*************************************************************************************************
1092
1093
1094//*************************************************************************************************
1099template< typename Type // Data type of the vector
1100 , bool TF // Transpose flag
1101 , typename Alloc // Type of the allocator
1102 , typename Tag > // Type tag
1105{
1106 return ConstIterator( v_ );
1107}
1108//*************************************************************************************************
1109
1110
1111//*************************************************************************************************
1116template< typename Type // Data type of the vector
1117 , bool TF // Transpose flag
1118 , typename Alloc // Type of the allocator
1119 , typename Tag > // Type tag
1122{
1123 return Iterator( v_ + size_ );
1124}
1125//*************************************************************************************************
1126
1127
1128//*************************************************************************************************
1133template< typename Type // Data type of the vector
1134 , bool TF // Transpose flag
1135 , typename Alloc // Type of the allocator
1136 , typename Tag > // Type tag
1139{
1140 return ConstIterator( v_ + size_ );
1141}
1142//*************************************************************************************************
1143
1144
1145//*************************************************************************************************
1150template< typename Type // Data type of the vector
1151 , bool TF // Transpose flag
1152 , typename Alloc // Type of the allocator
1153 , typename Tag > // Type tag
1156{
1157 return ConstIterator( v_ + size_ );
1158}
1159//*************************************************************************************************
1160
1161
1162
1163
1164//=================================================================================================
1165//
1166// ASSIGNMENT OPERATORS
1167//
1168//=================================================================================================
1169
1170//*************************************************************************************************
1176template< typename Type // Data type of the vector
1177 , bool TF // Transpose flag
1178 , typename Alloc // Type of the allocator
1179 , typename Tag > // Type tag
1182{
1183 for( size_t i=0UL; i<size_; ++i )
1184 v_[i] = rhs;
1185 return *this;
1186}
1187//*************************************************************************************************
1188
1189
1190//*************************************************************************************************
1206template< typename Type // Data type of the vector
1207 , bool TF // Transpose flag
1208 , typename Alloc // Type of the allocator
1209 , typename Tag > // Type tag
1212{
1213 resize( list.size(), false );
1214 std::copy( list.begin(), list.end(), v_ );
1215
1216 return *this;
1217}
1218//*************************************************************************************************
1219
1220
1221//*************************************************************************************************
1239template< typename Type // Data type of the vector
1240 , bool TF // Transpose flag
1241 , typename Alloc // Type of the allocator
1242 , typename Tag > // Type tag
1243template< typename Other // Data type of the static array
1244 , size_t Dim > // Dimension of the static array
1246 DynamicVector<Type,TF,Alloc,Tag>::operator=( const Other (&array)[Dim] ) &
1247{
1248 resize( Dim, false );
1249
1250 for( size_t i=0UL; i<Dim; ++i )
1251 v_[i] = array[i];
1252
1253 return *this;
1254}
1255//*************************************************************************************************
1256
1257
1258//*************************************************************************************************
1276template< typename Type // Data type of the vector
1277 , bool TF // Transpose flag
1278 , typename Alloc // Type of the allocator
1279 , typename Tag > // Type tag
1280template< typename Other // Data type of the std::array
1281 , size_t Dim > // Dimension of the std::array
1283 DynamicVector<Type,TF,Alloc,Tag>::operator=( const std::array<Other,Dim>& array ) &
1284{
1285 resize( Dim, false );
1286
1287 for( size_t i=0UL; i<Dim; ++i )
1288 v_[i] = array[i];
1289
1290 return *this;
1291}
1292//*************************************************************************************************
1293
1294
1295//*************************************************************************************************
1304template< typename Type // Data type of the vector
1305 , bool TF // Transpose flag
1306 , typename Alloc // Type of the allocator
1307 , typename Tag > // Type tag
1310{
1311 if( &rhs == this ) return *this;
1312
1313 resize( rhs.size_, false );
1314 smpAssign( *this, *rhs );
1315
1316 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1317
1318 return *this;
1319}
1320//*************************************************************************************************
1321
1322
1323//*************************************************************************************************
1329template< typename Type // Data type of the vector
1330 , bool TF // Transpose flag
1331 , typename Alloc // Type of the allocator
1332 , typename Tag > // Type tag
1335{
1337 alloc_.deallocate( v_, capacity_ );
1338
1339 size_ = rhs.size_;
1340 capacity_ = rhs.capacity_;
1341 v_ = rhs.v_;
1342
1343 rhs.size_ = 0UL;
1344 rhs.capacity_ = 0UL;
1345 rhs.v_ = nullptr;
1346
1347 return *this;
1348}
1349//*************************************************************************************************
1350
1351
1352//*************************************************************************************************
1360template< typename Type // Data type of the vector
1361 , bool TF // Transpose flag
1362 , typename Alloc // Type of the allocator
1363 , typename Tag > // Type tag
1364template< typename VT > // Type of the right-hand side vector
1367{
1369
1370 if( (*rhs).canAlias( this ) ) {
1371 DynamicVector tmp( *rhs );
1372 swap( tmp );
1373 }
1374 else {
1375 resize( (*rhs).size(), false );
1377 reset();
1378 smpAssign( *this, *rhs );
1379 }
1380
1381 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1382
1383 return *this;
1384}
1385//*************************************************************************************************
1386
1387
1388//*************************************************************************************************
1398template< typename Type // Data type of the vector
1399 , bool TF // Transpose flag
1400 , typename Alloc // Type of the allocator
1401 , typename Tag > // Type tag
1402template< typename VT > // Type of the right-hand side vector
1404 DynamicVector<Type,TF,Alloc,Tag>::operator+=( const Vector<VT,TF>& rhs ) &
1405{
1407
1408 if( (*rhs).size() != size_ ) {
1409 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1410 }
1411
1412 if( (*rhs).canAlias( this ) ) {
1413 const ResultType_t<VT> tmp( *rhs );
1414 smpAddAssign( *this, tmp );
1415 }
1416 else {
1417 smpAddAssign( *this, *rhs );
1418 }
1419
1420 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1421
1422 return *this;
1423}
1424//*************************************************************************************************
1425
1426
1427//*************************************************************************************************
1438template< typename Type // Data type of the vector
1439 , bool TF // Transpose flag
1440 , typename Alloc // Type of the allocator
1441 , typename Tag > // Type tag
1442template< typename VT > // Type of the right-hand side vector
1444 DynamicVector<Type,TF,Alloc,Tag>::operator-=( const Vector<VT,TF>& rhs ) &
1445{
1447
1448 if( (*rhs).size() != size_ ) {
1449 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1450 }
1451
1452 if( (*rhs).canAlias( this ) ) {
1453 const ResultType_t<VT> tmp( *rhs );
1454 smpSubAssign( *this, tmp );
1455 }
1456 else {
1457 smpSubAssign( *this, *rhs );
1458 }
1459
1460 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1461
1462 return *this;
1463}
1464//*************************************************************************************************
1465
1466
1467//*************************************************************************************************
1478template< typename Type // Data type of the vector
1479 , bool TF // Transpose flag
1480 , typename Alloc // Type of the allocator
1481 , typename Tag > // Type tag
1482template< typename VT > // Type of the right-hand side vector
1484 DynamicVector<Type,TF,Alloc,Tag>::operator*=( const Vector<VT,TF>& rhs ) &
1485{
1487
1488 if( (*rhs).size() != size_ ) {
1489 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1490 }
1491
1492 if( IsSparseVector_v<VT> || (*rhs).canAlias( this ) ) {
1493 DynamicVector tmp( *this * (*rhs) );
1494 swap( tmp );
1495 }
1496 else {
1497 smpMultAssign( *this, *rhs );
1498 }
1499
1500 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1501
1502 return *this;
1503}
1504//*************************************************************************************************
1505
1506
1507//*************************************************************************************************
1517template< typename Type // Data type of the vector
1518 , bool TF // Transpose flag
1519 , typename Alloc // Type of the allocator
1520 , typename Tag > // Type tag
1521template< typename VT > // Type of the right-hand side vector
1523 DynamicVector<Type,TF,Alloc,Tag>::operator/=( const DenseVector<VT,TF>& rhs ) &
1524{
1526
1527 if( (*rhs).size() != size_ ) {
1528 BLAZE_THROW_INVALID_ARGUMENT( "Vector sizes do not match" );
1529 }
1530
1531 if( (*rhs).canAlias( this ) ) {
1532 DynamicVector tmp( *this / (*rhs) );
1533 swap( tmp );
1534 }
1535 else {
1536 smpDivAssign( *this, *rhs );
1537 }
1538
1539 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1540
1541 return *this;
1542}
1543//*************************************************************************************************
1544
1545
1546//*************************************************************************************************
1557template< typename Type // Data type of the vector
1558 , bool TF // Transpose flag
1559 , typename Alloc // Type of the allocator
1560 , typename Tag > // Type tag
1561template< typename VT > // Type of the right-hand side vector
1563 DynamicVector<Type,TF,Alloc,Tag>::operator%=( const Vector<VT,TF>& rhs ) &
1564{
1565 using blaze::assign;
1566
1568
1571
1572 using CrossType = CrossTrait_t< This, ResultType_t<VT> >;
1573
1577
1578 if( size_ != 3UL || (*rhs).size() != 3UL ) {
1579 BLAZE_THROW_INVALID_ARGUMENT( "Invalid vector size for cross product" );
1580 }
1581
1582 const CrossType tmp( *this % (*rhs) );
1583 assign( *this, tmp );
1584
1585 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1586
1587 return *this;
1588}
1589//*************************************************************************************************
1590
1591
1592
1593
1594//=================================================================================================
1595//
1596// UTILITY FUNCTIONS
1597//
1598//=================================================================================================
1599
1600//*************************************************************************************************
1605template< typename Type // Data type of the vector
1606 , bool TF // Transpose flag
1607 , typename Alloc // Type of the allocator
1608 , typename Tag > // Type tag
1609inline size_t DynamicVector<Type,TF,Alloc,Tag>::size() const noexcept
1610{
1611 return size_;
1612}
1613//*************************************************************************************************
1614
1615
1616//*************************************************************************************************
1624template< typename Type // Data type of the vector
1625 , bool TF // Transpose flag
1626 , typename Alloc // Type of the allocator
1627 , typename Tag > // Type tag
1628inline size_t DynamicVector<Type,TF,Alloc,Tag>::spacing() const noexcept
1629{
1630 return addPadding( size_ );
1631}
1632//*************************************************************************************************
1633
1634
1635//*************************************************************************************************
1640template< typename Type // Data type of the vector
1641 , bool TF // Transpose flag
1642 , typename Alloc // Type of the allocator
1643 , typename Tag > // Type tag
1645{
1646 return capacity_;
1647}
1648//*************************************************************************************************
1649
1650
1651//*************************************************************************************************
1660template< typename Type // Data type of the vector
1661 , bool TF // Transpose flag
1662 , typename Alloc // Type of the allocator
1663 , typename Tag > // Type tag
1665{
1666 size_t nonzeros( 0 );
1667
1668 for( size_t i=0UL; i<size_; ++i ) {
1669 if( !isDefault<strict>( v_[i] ) )
1670 ++nonzeros;
1671 }
1672
1673 return nonzeros;
1674}
1675//*************************************************************************************************
1676
1677
1678//*************************************************************************************************
1683template< typename Type // Data type of the vector
1684 , bool TF // Transpose flag
1685 , typename Alloc // Type of the allocator
1686 , typename Tag > // Type tag
1688{
1689 using blaze::clear;
1690 for( size_t i=0UL; i<size_; ++i )
1691 clear( v_[i] );
1692}
1693//*************************************************************************************************
1694
1695
1696//*************************************************************************************************
1703template< typename Type // Data type of the vector
1704 , bool TF // Transpose flag
1705 , typename Alloc // Type of the allocator
1706 , typename Tag > // Type tag
1708{
1709 resize( 0UL, false );
1710}
1711//*************************************************************************************************
1712
1713
1714//*************************************************************************************************
1743template< typename Type // Data type of the vector
1744 , bool TF // Transpose flag
1745 , typename Alloc // Type of the allocator
1746 , typename Tag > // Type tag
1747inline void DynamicVector<Type,TF,Alloc,Tag>::resize( size_t n, bool preserve )
1748{
1749 using blaze::clear;
1750
1751 if( n > capacity_ )
1752 {
1753 DynamicVector tmp( n, addPadding(n), Alloc{}, Uninitialized{} );
1754
1755 if( preserve ) {
1757 blaze::uninitialized_default_construct( tmp.v_+size_, tmp.v_+tmp.capacity_ );
1758 }
1759 else {
1760 blaze::uninitialized_default_construct( tmp.v_, tmp.v_+tmp.capacity_ );
1761 }
1762
1764 for( size_t i=size_; i<tmp.capacity_; ++i )
1765 clear( tmp.v_[i] );
1766 }
1767
1768 std::swap( capacity_, tmp.capacity_ );
1769 std::swap( v_, tmp.v_ );
1770 }
1771 else if( IsVectorizable_v<Type> && n < size_ )
1772 {
1773 for( size_t i=n; i<size_; ++i )
1774 clear( v_[i] );
1775 }
1776
1777 size_ = n;
1778
1779 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1780}
1781//*************************************************************************************************
1782
1783
1784//*************************************************************************************************
1797template< typename Type // Data type of the vector
1798 , bool TF // Transpose flag
1799 , typename Alloc // Type of the allocator
1800 , typename Tag > // Type tag
1801inline void DynamicVector<Type,TF,Alloc,Tag>::extend( size_t n, bool preserve )
1802{
1803 resize( size_+n, preserve );
1804}
1805//*************************************************************************************************
1806
1807
1808//*************************************************************************************************
1817template< typename Type // Data type of the vector
1818 , bool TF // Transpose flag
1819 , typename Alloc // Type of the allocator
1820 , typename Tag > // Type tag
1822{
1823 using blaze::clear;
1824
1825 if( n > capacity_ )
1826 {
1827 DynamicVector tmp( size_, addPadding(n), Alloc{}, Uninitialized{} );
1828
1830 blaze::uninitialized_value_construct( tmp.v_+size_, tmp.v_+tmp.capacity_ );
1831
1832 std::swap( capacity_, tmp.capacity_ );
1833 std::swap( v_, tmp.v_ );
1834 }
1835}
1836//*************************************************************************************************
1837
1838
1839//*************************************************************************************************
1849template< typename Type // Data type of the vector
1850 , bool TF // Transpose flag
1851 , typename Alloc // Type of the allocator
1852 , typename Tag > // Type tag
1854{
1855 if( spacing() < capacity_ ) {
1856 DynamicVector( *this ).swap( *this );
1857 }
1858}
1859//*************************************************************************************************
1860
1861
1862//*************************************************************************************************
1868template< typename Type // Data type of the vector
1869 , bool TF // Transpose flag
1870 , typename Alloc // Type of the allocator
1871 , typename Tag > // Type tag
1873{
1874 using std::swap;
1875
1876 swap( size_, v.size_ );
1877 swap( capacity_, v.capacity_ );
1878 swap( v_, v.v_ );
1879}
1880//*************************************************************************************************
1881
1882
1883//*************************************************************************************************
1892template< typename Type // Data type of the vector
1893 , bool TF // Transpose flag
1894 , typename Alloc // Type of the allocator
1895 , typename Tag > // Type tag
1896inline size_t DynamicVector<Type,TF,Alloc,Tag>::addPadding( size_t value ) const noexcept
1897{
1898 if( usePadding && IsVectorizable_v<Type> )
1899 return nextMultiple<size_t>( value, SIMDSIZE );
1900 else return value;
1901}
1902//*************************************************************************************************
1903
1904
1905
1906
1907//=================================================================================================
1908//
1909// NUMERIC FUNCTIONS
1910//
1911//=================================================================================================
1912
1913//*************************************************************************************************
1930template< typename Type // Data type of the vector
1931 , bool TF // Transpose flag
1932 , typename Alloc // Type of the allocator
1933 , typename Tag > // Type tag
1934template< typename Other > // Data type of the scalar value
1936 DynamicVector<Type,TF,Alloc,Tag>::scale( const Other& scalar )
1937{
1938 for( size_t i=0UL; i<size_; ++i )
1939 v_[i] *= scalar;
1940 return *this;
1941}
1942//*************************************************************************************************
1943
1944
1945
1946
1947//=================================================================================================
1948//
1949// DEBUGGING FUNCTIONS
1950//
1951//=================================================================================================
1952
1953//*************************************************************************************************
1962template< typename Type // Data type of the vector
1963 , bool TF // Transpose flag
1964 , typename Alloc // Type of the allocator
1965 , typename Tag > // Type tag
1967{
1968 if( size_ > capacity_ )
1969 return false;
1970
1972 for( size_t i=size_; i<capacity_; ++i ) {
1973 if( !isDefault<strict>( v_[i] ) )
1974 return false;
1975 }
1976 }
1977
1978 return true;
1979}
1980//*************************************************************************************************
1981
1982
1983
1984
1985//=================================================================================================
1986//
1987// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1988//
1989//=================================================================================================
1990
1991//*************************************************************************************************
2001template< typename Type // Data type of the vector
2002 , bool TF // Transpose flag
2003 , typename Alloc // Type of the allocator
2004 , typename Tag > // Type tag
2005template< typename Other > // Data type of the foreign expression
2006inline bool DynamicVector<Type,TF,Alloc,Tag>::canAlias( const Other* alias ) const noexcept
2007{
2008 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2009}
2010//*************************************************************************************************
2011
2012
2013//*************************************************************************************************
2023template< typename Type // Data type of the vector
2024 , bool TF // Transpose flag
2025 , typename Alloc // Type of the allocator
2026 , typename Tag > // Type tag
2027template< typename Other > // Data type of the foreign expression
2028inline bool DynamicVector<Type,TF,Alloc,Tag>::isAliased( const Other* alias ) const noexcept
2029{
2030 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2031}
2032//*************************************************************************************************
2033
2034
2035//*************************************************************************************************
2044template< typename Type // Data type of the vector
2045 , bool TF // Transpose flag
2046 , typename Alloc // Type of the allocator
2047 , typename Tag > // Type tag
2049{
2050 return true;
2051}
2052//*************************************************************************************************
2053
2054
2055//*************************************************************************************************
2065template< typename Type // Data type of the vector
2066 , bool TF // Transpose flag
2067 , typename Alloc // Type of the allocator
2068 , typename Tag > // Type tag
2070{
2071 return ( size() > SMP_DVECASSIGN_THRESHOLD );
2072}
2073//*************************************************************************************************
2074
2075
2076//*************************************************************************************************
2088template< typename Type // Data type of the vector
2089 , bool TF // Transpose flag
2090 , typename Alloc // Type of the allocator
2091 , typename Tag > // Type tag
2093 DynamicVector<Type,TF,Alloc,Tag>::load( size_t index ) const noexcept
2094{
2095 return loada( index );
2096}
2097//*************************************************************************************************
2098
2099
2100//*************************************************************************************************
2113template< typename Type // Data type of the vector
2114 , bool TF // Transpose flag
2115 , typename Alloc // Type of the allocator
2116 , typename Tag > // Type tag
2118 DynamicVector<Type,TF,Alloc,Tag>::loada( size_t index ) const noexcept
2119{
2120 using blaze::loada;
2121
2123
2124 BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2125 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= capacity_, "Invalid vector access index" );
2126 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2127 BLAZE_INTERNAL_ASSERT( checkAlignment( v_+index ), "Invalid alignment detected" );
2128
2129 return loada( v_+index );
2130}
2131//*************************************************************************************************
2132
2133
2134//*************************************************************************************************
2147template< typename Type // Data type of the vector
2148 , bool TF // Transpose flag
2149 , typename Alloc // Type of the allocator
2150 , typename Tag > // Type tag
2152 DynamicVector<Type,TF,Alloc,Tag>::loadu( size_t index ) const noexcept
2153{
2154 using blaze::loadu;
2155
2157
2158 BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2159 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= capacity_, "Invalid vector access index" );
2160
2161 return loadu( v_+index );
2162}
2163//*************************************************************************************************
2164
2165
2166//*************************************************************************************************
2179template< typename Type // Data type of the vector
2180 , bool TF // Transpose flag
2181 , typename Alloc // Type of the allocator
2182 , typename Tag > // Type tag
2184 DynamicVector<Type,TF,Alloc,Tag>::store( size_t index, const SIMDType& value ) noexcept
2185{
2186 storea( index, value );
2187}
2188//*************************************************************************************************
2189
2190
2191//*************************************************************************************************
2204template< typename Type // Data type of the vector
2205 , bool TF // Transpose flag
2206 , typename Alloc // Type of the allocator
2207 , typename Tag > // Type tag
2209 DynamicVector<Type,TF,Alloc,Tag>::storea( size_t index, const SIMDType& value ) noexcept
2210{
2211 using blaze::storea;
2212
2214
2215 BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2216 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= capacity_, "Invalid vector access index" );
2217 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2218 BLAZE_INTERNAL_ASSERT( checkAlignment( v_+index ), "Invalid alignment detected" );
2219
2220 storea( v_+index, value );
2221}
2222//*************************************************************************************************
2223
2224
2225//*************************************************************************************************
2238template< typename Type // Data type of the vector
2239 , bool TF // Transpose flag
2240 , typename Alloc // Type of the allocator
2241 , typename Tag > // Type tag
2243 DynamicVector<Type,TF,Alloc,Tag>::storeu( size_t index, const SIMDType& value ) noexcept
2244{
2245 using blaze::storeu;
2246
2248
2249 BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2250 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= capacity_, "Invalid vector access index" );
2251
2252 storeu( v_+index, value );
2253}
2254//*************************************************************************************************
2255
2256
2257//*************************************************************************************************
2271template< typename Type // Data type of the vector
2272 , bool TF // Transpose flag
2273 , typename Alloc // Type of the allocator
2274 , typename Tag > // Type tag
2276 DynamicVector<Type,TF,Alloc,Tag>::stream( size_t index, const SIMDType& value ) noexcept
2277{
2278 using blaze::stream;
2279
2281
2282 BLAZE_INTERNAL_ASSERT( index < size_, "Invalid vector access index" );
2283 BLAZE_INTERNAL_ASSERT( index + SIMDSIZE <= capacity_, "Invalid vector access index" );
2284 BLAZE_INTERNAL_ASSERT( index % SIMDSIZE == 0UL, "Invalid vector access index" );
2285 BLAZE_INTERNAL_ASSERT( checkAlignment( v_+index ), "Invalid alignment detected" );
2286
2287 stream( v_+index, value );
2288}
2289//*************************************************************************************************
2290
2291
2292//*************************************************************************************************
2303template< typename Type // Data type of the vector
2304 , bool TF // Transpose flag
2305 , typename Alloc // Type of the allocator
2306 , typename Tag > // Type tag
2307template< typename VT > // Type of the right-hand side dense vector
2308inline auto DynamicVector<Type,TF,Alloc,Tag>::assign( const DenseVector<VT,TF>& rhs )
2310{
2311 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2312
2313 const size_t ipos( prevMultiple( size_, 2UL ) );
2314 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2315
2316 for( size_t i=0UL; i<ipos; i+=2UL ) {
2317 v_[i ] = (*rhs)[i ];
2318 v_[i+1UL] = (*rhs)[i+1UL];
2319 }
2320 if( ipos < (*rhs).size() )
2321 v_[ipos] = (*rhs)[ipos];
2322}
2323//*************************************************************************************************
2324
2325
2326//*************************************************************************************************
2337template< typename Type // Data type of the vector
2338 , bool TF // Transpose flag
2339 , typename Alloc // Type of the allocator
2340 , typename Tag > // Type tag
2341template< typename VT > // Type of the right-hand side dense vector
2342inline auto DynamicVector<Type,TF,Alloc,Tag>::assign( const DenseVector<VT,TF>& rhs )
2344{
2346
2347 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2348
2349 constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2350
2351 const size_t ipos( remainder ? prevMultiple( size_, SIMDSIZE ) : size_ );
2352 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2353
2354 size_t i=0UL;
2355 Iterator left( begin() );
2356 ConstIterator_t<VT> right( (*rhs).begin() );
2357
2358 if( useStreaming &&
2359 ( size_ > ( cacheSize/( sizeof(Type) * 3UL ) ) ) &&
2360 !(*rhs).isAliased( this ) )
2361 {
2362 for( ; i<ipos; i+=SIMDSIZE ) {
2363 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2364 }
2365 for( ; remainder && i<size_; ++i ) {
2366 *left = *right; ++left; ++right;
2367 }
2368 }
2369 else
2370 {
2371 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2372 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2373 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2374 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2375 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2376 }
2377 for( ; i<ipos; i+=SIMDSIZE ) {
2378 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2379 }
2380 for( ; remainder && i<size_; ++i ) {
2381 *left = *right; ++left; ++right;
2382 }
2383 }
2384}
2385//*************************************************************************************************
2386
2387
2388//*************************************************************************************************
2399template< typename Type // Data type of the vector
2400 , bool TF // Transpose flag
2401 , typename Alloc // Type of the allocator
2402 , typename Tag > // Type tag
2403template< typename VT > // Type of the right-hand side sparse vector
2405{
2406 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2407
2408 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2409 v_[element->index()] = element->value();
2410}
2411//*************************************************************************************************
2412
2413
2414//*************************************************************************************************
2425template< typename Type // Data type of the vector
2426 , bool TF // Transpose flag
2427 , typename Alloc // Type of the allocator
2428 , typename Tag > // Type tag
2429template< typename VT > // Type of the right-hand side dense vector
2430inline auto DynamicVector<Type,TF,Alloc,Tag>::addAssign( const DenseVector<VT,TF>& rhs )
2432{
2433 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2434
2435 const size_t ipos( prevMultiple( size_, 2UL ) );
2436 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2437
2438 for( size_t i=0UL; i<ipos; i+=2UL ) {
2439 v_[i ] += (*rhs)[i ];
2440 v_[i+1UL] += (*rhs)[i+1UL];
2441 }
2442 if( ipos < (*rhs).size() )
2443 v_[ipos] += (*rhs)[ipos];
2444}
2445//*************************************************************************************************
2446
2447
2448//*************************************************************************************************
2459template< typename Type // Data type of the vector
2460 , bool TF // Transpose flag
2461 , typename Alloc // Type of the allocator
2462 , typename Tag > // Type tag
2463template< typename VT > // Type of the right-hand side dense vector
2464inline auto DynamicVector<Type,TF,Alloc,Tag>::addAssign( const DenseVector<VT,TF>& rhs )
2466{
2468
2469 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2470
2471 constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2472
2473 const size_t ipos( remainder ? prevMultiple( size_, SIMDSIZE ) : size_ );
2474 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2475
2476 size_t i( 0UL );
2477 Iterator left( begin() );
2478 ConstIterator_t<VT> right( (*rhs).begin() );
2479
2480 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2481 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2482 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2483 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2484 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2485 }
2486 for( ; i<ipos; i+=SIMDSIZE ) {
2487 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2488 }
2489 for( ; remainder && i<size_; ++i ) {
2490 *left += *right; ++left; ++right;
2491 }
2492}
2493//*************************************************************************************************
2494
2495
2496//*************************************************************************************************
2507template< typename Type // Data type of the vector
2508 , bool TF // Transpose flag
2509 , typename Alloc // Type of the allocator
2510 , typename Tag > // Type tag
2511template< typename VT > // Type of the right-hand side sparse vector
2513{
2514 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2515
2516 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2517 v_[element->index()] += element->value();
2518}
2519//*************************************************************************************************
2520
2521
2522//*************************************************************************************************
2533template< typename Type // Data type of the vector
2534 , bool TF // Transpose flag
2535 , typename Alloc // Type of the allocator
2536 , typename Tag > // Type tag
2537template< typename VT > // Type of the right-hand side dense vector
2538inline auto DynamicVector<Type,TF,Alloc,Tag>::subAssign( const DenseVector<VT,TF>& rhs )
2540{
2541 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2542
2543 const size_t ipos( prevMultiple( size_, 2UL ) );
2544 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2545
2546 for( size_t i=0UL; i<ipos; i+=2UL ) {
2547 v_[i ] -= (*rhs)[i ];
2548 v_[i+1UL] -= (*rhs)[i+1UL];
2549 }
2550 if( ipos < (*rhs).size() )
2551 v_[ipos] -= (*rhs)[ipos];
2552}
2553//*************************************************************************************************
2554
2555
2556//*************************************************************************************************
2567template< typename Type // Data type of the vector
2568 , bool TF // Transpose flag
2569 , typename Alloc // Type of the allocator
2570 , typename Tag > // Type tag
2571template< typename VT > // Type of the right-hand side dense vector
2572inline auto DynamicVector<Type,TF,Alloc,Tag>::subAssign( const DenseVector<VT,TF>& rhs )
2574{
2576
2577 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2578
2579 constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2580
2581 const size_t ipos( remainder ? prevMultiple( size_, SIMDSIZE ) : size_ );
2582 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2583
2584 size_t i( 0UL );
2585 Iterator left( begin() );
2586 ConstIterator_t<VT> right( (*rhs).begin() );
2587
2588 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2589 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2590 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2591 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2592 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2593 }
2594 for( ; i<ipos; i+=SIMDSIZE ) {
2595 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2596 }
2597 for( ; remainder && i<size_; ++i ) {
2598 *left -= *right; ++left; ++right;
2599 }
2600}
2601//*************************************************************************************************
2602
2603
2604//*************************************************************************************************
2615template< typename Type // Data type of the vector
2616 , bool TF // Transpose flag
2617 , typename Alloc // Type of the allocator
2618 , typename Tag > // Type tag
2619template< typename VT > // Type of the right-hand side sparse vector
2621{
2622 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2623
2624 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2625 v_[element->index()] -= element->value();
2626}
2627//*************************************************************************************************
2628
2629
2630//*************************************************************************************************
2641template< typename Type // Data type of the vector
2642 , bool TF // Transpose flag
2643 , typename Alloc // Type of the allocator
2644 , typename Tag > // Type tag
2645template< typename VT > // Type of the right-hand side dense vector
2646inline auto DynamicVector<Type,TF,Alloc,Tag>::multAssign( const DenseVector<VT,TF>& rhs )
2648{
2649 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2650
2651 const size_t ipos( prevMultiple( size_, 2UL ) );
2652 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2653
2654 for( size_t i=0UL; i<ipos; i+=2UL ) {
2655 v_[i ] *= (*rhs)[i ];
2656 v_[i+1UL] *= (*rhs)[i+1UL];
2657 }
2658 if( ipos < (*rhs).size() )
2659 v_[ipos] *= (*rhs)[ipos];
2660}
2661//*************************************************************************************************
2662
2663
2664//*************************************************************************************************
2675template< typename Type // Data type of the vector
2676 , bool TF // Transpose flag
2677 , typename Alloc // Type of the allocator
2678 , typename Tag > // Type tag
2679template< typename VT > // Type of the right-hand side dense vector
2680inline auto DynamicVector<Type,TF,Alloc,Tag>::multAssign( const DenseVector<VT,TF>& rhs )
2682{
2684
2685 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2686
2687 constexpr bool remainder( !usePadding || !IsPadded_v<VT> );
2688
2689 const size_t ipos( remainder ? prevMultiple( size_, SIMDSIZE ) : size_ );
2690 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2691
2692 size_t i( 0UL );
2693 Iterator left( begin() );
2694 ConstIterator_t<VT> right( (*rhs).begin() );
2695
2696 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2697 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2698 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2699 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2700 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2701 }
2702 for( ; i<ipos; i+=SIMDSIZE ) {
2703 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2704 }
2705 for( ; remainder && i<size_; ++i ) {
2706 *left *= *right; ++left; ++right;
2707 }
2708}
2709//*************************************************************************************************
2710
2711
2712//*************************************************************************************************
2723template< typename Type // Data type of the vector
2724 , bool TF // Transpose flag
2725 , typename Alloc // Type of the allocator
2726 , typename Tag > // Type tag
2727template< typename VT > // Type of the right-hand side sparse vector
2729{
2730 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2731
2732 const DynamicVector tmp( serial( *this ) );
2733
2734 reset();
2735
2736 for( auto element=(*rhs).begin(); element!=(*rhs).end(); ++element )
2737 v_[element->index()] = tmp[element->index()] * element->value();
2738}
2739//*************************************************************************************************
2740
2741
2742//*************************************************************************************************
2753template< typename Type // Data type of the vector
2754 , bool TF // Transpose flag
2755 , typename Alloc // Type of the allocator
2756 , typename Tag > // Type tag
2757template< typename VT > // Type of the right-hand side dense vector
2758inline auto DynamicVector<Type,TF,Alloc,Tag>::divAssign( const DenseVector<VT,TF>& rhs )
2760{
2761 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2762
2763 const size_t ipos( prevMultiple( size_, 2UL ) );
2764 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2765
2766 for( size_t i=0UL; i<ipos; i+=2UL ) {
2767 v_[i ] /= (*rhs)[i ];
2768 v_[i+1UL] /= (*rhs)[i+1UL];
2769 }
2770 if( ipos < (*rhs).size() )
2771 v_[ipos] /= (*rhs)[ipos];
2772}
2773//*************************************************************************************************
2774
2775
2776//*************************************************************************************************
2787template< typename Type // Data type of the vector
2788 , bool TF // Transpose flag
2789 , typename Alloc // Type of the allocator
2790 , typename Tag > // Type tag
2791template< typename VT > // Type of the right-hand side dense vector
2792inline auto DynamicVector<Type,TF,Alloc,Tag>::divAssign( const DenseVector<VT,TF>& rhs )
2794{
2796
2797 BLAZE_INTERNAL_ASSERT( size_ == (*rhs).size(), "Invalid vector sizes" );
2798
2799 const size_t ipos( prevMultiple( size_, SIMDSIZE ) );
2800 BLAZE_INTERNAL_ASSERT( ipos <= size_, "Invalid end calculation" );
2801
2802 size_t i( 0UL );
2803 Iterator left( begin() );
2804 ConstIterator_t<VT> right( (*rhs).begin() );
2805
2806 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2807 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2808 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2809 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2810 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2811 }
2812 for( ; i<ipos; i+=SIMDSIZE ) {
2813 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2814 }
2815 for( ; i<size_; ++i ) {
2816 *left /= *right; ++left; ++right;
2817 }
2818}
2819//*************************************************************************************************
2820
2821
2822
2823
2824//=================================================================================================
2825//
2826// DYNAMICVECTOR OPERATORS
2827//
2828//=================================================================================================
2829
2830//*************************************************************************************************
2833template< RelaxationFlag RF, typename Type, bool TF, typename Alloc, typename Tag >
2835
2836template< typename Type, bool TF, typename Alloc, typename Tag >
2837bool isIntact( const DynamicVector<Type,TF,Alloc,Tag>& v ) noexcept;
2838
2839template< typename Type, bool TF, typename Alloc, typename Tag >
2842//*************************************************************************************************
2843
2844
2845//*************************************************************************************************
2869template< RelaxationFlag RF // Relaxation flag
2870 , typename Type // Data type of the vector
2871 , bool TF // Transpose flag
2872 , typename Alloc // Type of the allocator
2873 , typename Tag > // Type tag
2875{
2876 return ( v.size() == 0UL );
2877}
2878//*************************************************************************************************
2879
2880
2881//*************************************************************************************************
2899template< typename Type // Data type of the vector
2900 , bool TF // Transpose flag
2901 , typename Alloc // Type of the allocator
2902 , typename Tag > // Type tag
2903inline bool isIntact( const DynamicVector<Type,TF,Alloc,Tag>& v ) noexcept
2904{
2905 return v.isIntact();
2906}
2907//*************************************************************************************************
2908
2909
2910//*************************************************************************************************
2918template< typename Type // Data type of the vector
2919 , bool TF // Transpose flag
2920 , typename Alloc // Type of the allocator
2921 , typename Tag > // Type tag
2923{
2924 a.swap( b );
2925}
2926//*************************************************************************************************
2927
2928
2929
2930
2931//=================================================================================================
2932//
2933// HASCONSTDATAACCESS SPECIALIZATIONS
2934//
2935//=================================================================================================
2936
2937//*************************************************************************************************
2939template< typename T, bool TF, typename Alloc, typename Tag >
2940struct HasConstDataAccess< DynamicVector<T,TF,Alloc,Tag> >
2941 : public TrueType
2942{};
2944//*************************************************************************************************
2945
2946
2947
2948
2949//=================================================================================================
2950//
2951// HASMUTABLEDATAACCESS SPECIALIZATIONS
2952//
2953//=================================================================================================
2954
2955//*************************************************************************************************
2957template< typename T, bool TF, typename Alloc, typename Tag >
2958struct HasMutableDataAccess< DynamicVector<T,TF,Alloc,Tag> >
2959 : public TrueType
2960{};
2962//*************************************************************************************************
2963
2964
2965
2966
2967//=================================================================================================
2968//
2969// ISALIGNED SPECIALIZATIONS
2970//
2971//=================================================================================================
2972
2973//*************************************************************************************************
2975template< typename T, bool TF, typename Alloc, typename Tag >
2976struct IsAligned< DynamicVector<T,TF,Alloc,Tag> >
2977 : public TrueType
2978{};
2980//*************************************************************************************************
2981
2982
2983
2984
2985//=================================================================================================
2986//
2987// ISCONTIGUOUS SPECIALIZATIONS
2988//
2989//=================================================================================================
2990
2991//*************************************************************************************************
2993template< typename T, bool TF, typename Alloc, typename Tag >
2994struct IsContiguous< DynamicVector<T,TF,Alloc,Tag> >
2995 : public TrueType
2996{};
2998//*************************************************************************************************
2999
3000
3001
3002
3003//=================================================================================================
3004//
3005// ISPADDED SPECIALIZATIONS
3006//
3007//=================================================================================================
3008
3009//*************************************************************************************************
3011template< typename T, bool TF, typename Alloc, typename Tag >
3012struct IsPadded< DynamicVector<T,TF,Alloc,Tag> >
3013 : public BoolConstant<usePadding>
3014{};
3016//*************************************************************************************************
3017
3018
3019
3020
3021//=================================================================================================
3022//
3023// ADDTRAIT SPECIALIZATIONS
3024//
3025//=================================================================================================
3026
3027//*************************************************************************************************
3029template< typename T1, typename T2 >
3030struct AddTraitEval2< T1, T2
3031 , EnableIf_t< IsVector_v<T1> &&
3038{
3040
3041 using Type = DynamicVector< ET
3045};
3047//*************************************************************************************************
3048
3049
3050
3051
3052//=================================================================================================
3053//
3054// SUBTRAIT SPECIALIZATIONS
3055//
3056//=================================================================================================
3057
3058//*************************************************************************************************
3060template< typename T1, typename T2 >
3061struct SubTraitEval2< T1, T2
3062 , EnableIf_t< IsVector_v<T1> &&
3069{
3071
3072 using Type = DynamicVector< ET
3076};
3078//*************************************************************************************************
3079
3080
3081
3082
3083//=================================================================================================
3084//
3085// MULTTRAIT SPECIALIZATIONS
3086//
3087//=================================================================================================
3088
3089//*************************************************************************************************
3091template< typename T1, typename T2 >
3092struct MultTraitEval2< T1, T2
3093 , EnableIf_t< IsDenseVector_v<T1> &&
3097{
3098 using ET = MultTrait_t< ElementType_t<T1>, T2 >;
3099
3100 using Type = DynamicVector< ET
3104};
3105
3106template< typename T1, typename T2 >
3107struct MultTraitEval2< T1, T2
3108 , EnableIf_t< IsScalar_v<T1> &&
3112{
3114
3115 using Type = DynamicVector< ET
3119};
3120
3121template< typename T1, typename T2 >
3122struct MultTraitEval2< T1, T2
3123 , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
3131{
3133
3134 using Type = DynamicVector< ET
3138};
3139
3140template< typename T1, typename T2 >
3141struct MultTraitEval2< T1, T2
3142 , EnableIf_t< IsMatrix_v<T1> &&
3149{
3152 using ET = AddTrait_t<M1,M1>;
3153
3154 using Type = DynamicVector< ET
3155 , false
3158};
3159
3160template< typename T1, typename T2 >
3161struct MultTraitEval2< T1, T2
3162 , EnableIf_t< IsRowVector_v<T1> &&
3169{
3172 using ET = AddTrait_t<M1,M1>;
3173
3174 using Type = DynamicVector< ET
3175 , true
3178};
3180//*************************************************************************************************
3181
3182
3183
3184
3185//=================================================================================================
3186//
3187// KRONTRAIT SPECIALIZATIONS
3188//
3189//=================================================================================================
3190
3191//*************************************************************************************************
3193template< typename T1, typename T2 >
3194struct KronTraitEval2< T1, T2
3195 , EnableIf_t< IsDenseVector_v<T1> &&
3197 ( ( Size_v<T1,0UL> == DefaultSize_v ) ||
3198 ( Size_v<T2,0UL> == DefaultSize_v ) ) &&
3201{
3203
3204 using Type = DynamicVector< ET
3208};
3210//*************************************************************************************************
3211
3212
3213
3214
3215//=================================================================================================
3216//
3217// DIVTRAIT SPECIALIZATIONS
3218//
3219//=================================================================================================
3220
3221//*************************************************************************************************
3223template< typename T1, typename T2 >
3224struct DivTraitEval2< T1, T2
3225 , EnableIf_t< IsDenseVector_v<T1> &&
3229{
3230 using ET = DivTrait_t< ElementType_t<T1>, T2 >;
3231
3232 using Type = DynamicVector< ET
3235 , DivTrait_t< TagType_t<T1>, T2 > >;
3236};
3237
3238template< typename T1, typename T2 >
3239struct DivTraitEval2< T1, T2
3240 , EnableIf_t< IsDenseVector_v<T1> &&
3246{
3248
3249 using Type = DynamicVector< ET
3253};
3255//*************************************************************************************************
3256
3257
3258
3259
3260//=================================================================================================
3261//
3262// MAPTRAIT SPECIALIZATIONS
3263//
3264//=================================================================================================
3265
3266//*************************************************************************************************
3268template< typename T, typename OP >
3269struct UnaryMapTraitEval2< T, OP
3273{
3274 using ET =
3275 EvaluateTrait_t< decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) ) >;
3276
3277 using Type = DynamicVector< ET
3280 , MapTrait_t< TagType_t<T>, OP > >;
3281};
3283//*************************************************************************************************
3284
3285
3286//*************************************************************************************************
3288template< typename T1, typename T2, typename OP >
3289struct BinaryMapTraitEval2< T1, T2, OP
3290 , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
3296{
3297 using ET =
3298 EvaluateTrait_t< decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
3299 , std::declval< ElementType_t<T2> >() ) ) >;
3300
3301 using Type = DynamicVector< ET
3305};
3307//*************************************************************************************************
3308
3309
3310
3311
3312//=================================================================================================
3313//
3314// REDUCETRAIT SPECIALIZATIONS
3315//
3316//=================================================================================================
3317
3318//*************************************************************************************************
3320template< typename T, typename OP, ReductionFlag RF >
3321struct PartialReduceTraitEval2< T, OP, RF
3322 , EnableIf_t< IsMatrix_v<T> &&
3327{
3328 using ET = decltype( std::declval<OP>()( std::declval< ElementType_t<T> >()
3329 , std::declval< ElementType_t<T> >() ) );
3330
3331 using Type = DynamicVector< ET
3332 , ( RF == columnwise )
3334 , MapTrait_t< TagType_t<T>, OP > >;
3335};
3337//*************************************************************************************************
3338
3339
3340
3341
3342//=================================================================================================
3343//
3344// REPEATTRAIT SPECIALIZATIONS
3345//
3346//=================================================================================================
3347
3348//*************************************************************************************************
3350template< typename T, size_t R0 >
3351struct RepeatTraitEval2< T, R0, inf, inf
3353 ( ( R0 == inf ) ||
3354 ( ( Size_v<T,0UL> == DefaultSize_v ) &&
3355 ( MaxSize_v<T,0UL> == DefaultMaxSize_v ) ) ) > >
3356{
3360 , TagType_t<T> >;
3361};
3363//*************************************************************************************************
3364
3365
3366
3367
3368//=================================================================================================
3369//
3370// SOLVETRAIT SPECIALIZATIONS
3371//
3372//=================================================================================================
3373
3374//*************************************************************************************************
3376template< typename T1, typename T2 >
3377struct SolveTraitEval2< T1, T2
3378 , EnableIf_t< IsDenseMatrix_v<T1> &&
3384{
3388 , TagType_t<T2> >;
3389};
3391//*************************************************************************************************
3392
3393
3394
3395
3396//=================================================================================================
3397//
3398// HIGHTYPE SPECIALIZATIONS
3399//
3400//=================================================================================================
3401
3402//*************************************************************************************************
3404template< typename T1, bool TF, typename Alloc, typename Tag, typename T2 >
3405struct HighType< DynamicVector<T1,TF,Alloc,Tag>, DynamicVector<T2,TF,Alloc,Tag> >
3406{
3407 using Type = DynamicVector< typename HighType<T1,T2>::Type, TF, Alloc, Tag >;
3408};
3410//*************************************************************************************************
3411
3412
3413
3414
3415//=================================================================================================
3416//
3417// LOWTYPE SPECIALIZATIONS
3418//
3419//=================================================================================================
3420
3421//*************************************************************************************************
3423template< typename T1, bool TF, typename Alloc, typename Tag, typename T2 >
3424struct LowType< DynamicVector<T1,TF,Alloc,Tag>, DynamicVector<T2,TF,Alloc,Tag> >
3425{
3426 using Type = DynamicVector< typename LowType<T1,T2>::Type, TF, Alloc, Tag >;
3427};
3429//*************************************************************************************************
3430
3431
3432
3433
3434//=================================================================================================
3435//
3436// SUBVECTORTRAIT SPECIALIZATIONS
3437//
3438//=================================================================================================
3439
3440//*************************************************************************************************
3442template< typename VT >
3443struct SubvectorTraitEval2< VT, inf, inf
3444 , EnableIf_t< IsDenseVector_v<VT> &&
3447{
3449
3450 using Type = DynamicVector< ET
3453 , TagType_t<VT> >;
3454};
3456//*************************************************************************************************
3457
3458
3459
3460
3461//=================================================================================================
3462//
3463// ELEMENTSTRAIT SPECIALIZATIONS
3464//
3465//=================================================================================================
3466
3467//*************************************************************************************************
3469template< typename VT >
3470struct ElementsTraitEval2< VT, 0UL
3471 , EnableIf_t< IsDenseVector_v<VT> > >
3472{
3473 using ET = RemoveConst_t< ElementType_t<VT> >;
3474
3475 using Type = DynamicVector< ET
3476 , TransposeFlag_v<VT>
3477 , DynamicAllocator_t< ET, GetAllocator_t<VT> >
3478 , TagType_t<VT> >;
3479};
3481//*************************************************************************************************
3482
3483
3484
3485
3486//=================================================================================================
3487//
3488// ROWTRAIT SPECIALIZATIONS
3489//
3490//=================================================================================================
3491
3492//*************************************************************************************************
3494template< typename MT, size_t I >
3495struct RowTraitEval2< MT, I
3496 , EnableIf_t< IsDenseMatrix_v<MT> &&
3499{
3501
3502 using Type = DynamicVector< ET
3503 , true
3505 , TagType_t<MT> >;
3506};
3508//*************************************************************************************************
3509
3510
3511
3512
3513//=================================================================================================
3514//
3515// COLUMNTRAIT SPECIALIZATIONS
3516//
3517//=================================================================================================
3518
3519//*************************************************************************************************
3521template< typename MT, size_t I >
3522struct ColumnTraitEval2< MT, I
3523 , EnableIf_t< IsDenseMatrix_v<MT> &&
3526{
3528
3529 using Type = DynamicVector< ET
3530 , false
3532 , TagType_t<MT> >;
3533};
3535//*************************************************************************************************
3536
3537
3538
3539
3540//=================================================================================================
3541//
3542// BANDTRAIT SPECIALIZATIONS
3543//
3544//=================================================================================================
3545
3546//*************************************************************************************************
3548template< typename MT, ptrdiff_t I >
3549struct BandTraitEval2< MT, I
3550 , EnableIf_t< IsDenseMatrix_v<MT> &&
3555{
3557
3558 using Type = DynamicVector< ET
3561 , TagType_t<MT> >;
3562};
3564//*************************************************************************************************
3565
3566} // namespace blaze
3567
3568#endif
Header file for the addition trait.
Header file for generic algorithms.
Header file for auxiliary alias declarations.
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition Aliases.h:130
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 AlignedAllocator implementation.
Header file for the alignment check function.
Header file for the alignment flag enumeration.
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 DynamicAllocator type 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 GetAllocator type trait.
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 IsBuiltin 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 IsPadded type trait.
Header file for the IsRowVector type trait.
Header file for the IsSIMDCombinable type trait.
Header file for the IsSMPAssignable 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 multiplication trait.
Header file for the nextMultiple shim.
System settings for the [[no_unique_address]] attribute.
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.
Header file for the subtraction trait.
Header file for the subvector trait.
Constraint on the data type.
Constraint on the data type.
Allocator for type-specific aligned memory.
Definition AlignedAllocator.h:72
Implementation of a generic iterator for dense vectors and matrices.
Definition DenseIterator.h:60
void store(const SIMDType &value) const noexcept
Store of the SIMD element at the current iterator position.
Definition DenseIterator.h:478
const SIMDType load() const noexcept
Load of the SIMD element at the current iterator position.
Definition DenseIterator.h:413
void stream(const SIMDType &value) const noexcept
Aligned, non-temporal store of the SIMD element at the current iterator position.
Definition DenseIterator.h:541
Efficient implementation of an arbitrary sized vector.
Definition DynamicVector.h:223
DynamicVector(const Alloc &alloc=Alloc{}) noexcept
The (default) constructor for DynamicVector.
Definition DynamicVector.h:598
DynamicVector(const Vector< VT, TF > &v)
Conversion constructor from different vectors.
Definition DynamicVector.h:881
AlignedAllocator< Type > AllocatorType
Definition DynamicVector.h:235
const DynamicVector & CompositeType
Definition DynamicVector.h:238
size_t capacity_
Definition DynamicVector.h:532
DenseVector< This, TF > BaseType
Base type of this DynamicVector instance.
Definition DynamicVector.h:227
static constexpr bool smpAssignable
Definition DynamicVector.h:285
void swap(DynamicVector &v) noexcept
DynamicVector(size_t n, const Alloc &alloc=Alloc{})
Constructor for a vector of size n. For built-in types no initialization is performed!
Definition DynamicVector.h:648
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Type * Pointer
Definition DynamicVector.h:242
auto assign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
DynamicVector< Type,!TF, Alloc, Tag > TransposeType
Transpose type for expression template evaluations.
Definition DynamicVector.h:231
DynamicVector(initializer_list< Type > list, const Alloc &alloc=Alloc{})
List initialization of all vector elements.
Definition DynamicVector.h:709
ConstIterator cbegin() const noexcept
bool canAlias(const Other *alias) const noexcept
Reference at(size_t index)
Checked access to the vector elements.
Definition DynamicVector.h:987
void resize(size_t n, bool preserve=true)
DynamicVector(const DynamicVector &v)
The copy constructor for DynamicVector.
Definition DynamicVector.h:838
DynamicVector< Type, TF, Alloc, Tag > This
Type of this DynamicVector instance.
Definition DynamicVector.h:226
ConstIterator cend() const noexcept
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Type & Reference
Definition DynamicVector.h:240
static constexpr bool simdEnabled
Definition DynamicVector.h:279
bool isAliased(const Other *alias) const noexcept
BLAZE_ALWAYS_INLINE void storeu(size_t index, const SIMDType &value) noexcept
DynamicVector(const std::array< Other, Dim > &array, const Alloc &alloc=Alloc{})
Initialization of all vector elements from the given std::array.
Definition DynamicVector.h:815
BLAZE_ALWAYS_INLINE void stream(size_t index, const SIMDType &value) noexcept
auto divAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
Type ElementType
Definition DynamicVector.h:233
size_t addPadding(size_t value) const noexcept
Add the necessary amount of padding to the given value.
Definition DynamicVector.h:1896
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition DynamicVector.h:942
auto addAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
ConstReference operator[](size_t index) const noexcept
Subscript operator for the direct access to the vector elements.
Definition DynamicVector.h:964
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
static constexpr size_t SIMDSIZE
Definition DynamicVector.h:438
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
BLAZE_NO_UNIQUE_ADDRESS Alloc alloc_
Definition DynamicVector.h:541
DenseIterator< Type, aligned > Iterator
Definition DynamicVector.h:245
const Type & ReturnType
Definition DynamicVector.h:237
~DynamicVector()
The destructor for DynamicVector.
Definition DynamicVector.h:912
SIMDTrait_t< ElementType > SIMDType
Definition DynamicVector.h:234
auto subAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
DynamicVector(DynamicVector &&v) noexcept
The move constructor for DynamicVector.
Definition DynamicVector.h:859
void extend(size_t n, bool preserve=true)
const Type & ConstReference
Definition DynamicVector.h:241
DynamicVector(size_t n, const Type &init, const Alloc &alloc=Alloc{})
Constructor for a homogeneous initialization of all n vector elements.
Definition DynamicVector.h:678
const Type * ConstPointer
Definition DynamicVector.h:243
Pointer data() noexcept
Low-level data access to the vector elements.
Definition DynamicVector.h:1034
DynamicVector(const Other(&array)[Dim], const Alloc &alloc=Alloc{})
Array initialization of all vector elements.
Definition DynamicVector.h:780
Tag TagType
Definition DynamicVector.h:236
DynamicVector(size_t n, size_t capa, const Alloc &alloc, Uninitialized)
Auxiliary constructor for DynamicVector.
Definition DynamicVector.h:619
ConstReference at(size_t index) const
Checked access to the vector elements.
Definition DynamicVector.h:1012
This ResultType
Result type for expression template evaluations.
Definition DynamicVector.h:228
DynamicVector(size_t n, const Other *array, const Alloc &alloc=Alloc{})
Array initialization of all vector elements.
Definition DynamicVector.h:745
DynamicVector & operator=(const Type &rhs) &
Homogenous assignment to all vector elements.
Definition DynamicVector.h:1181
auto multAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
Type *BLAZE_RESTRICT v_
Definition DynamicVector.h:534
DenseIterator< const Type, aligned > ConstIterator
Definition DynamicVector.h:246
size_t size_
Definition DynamicVector.h:531
Base class for sparse vectors.
Definition SparseVector.h:72
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.
void uninitialized_value_construct(ForwardIt first, ForwardIt last)
Value constructs elements in the given range.
Definition UninitializedValueConstruct.h:69
void uninitialized_default_construct_n(ForwardIt first, size_t n)
Default constructs elements in the given range.
Definition UninitializedDefaultConstruct.h:100
void uninitialized_default_construct(ForwardIt first, ForwardIt last)
Default constructs elements in the given range.
Definition UninitializedDefaultConstruct.h:69
void destroy_n(ForwardIt first, size_t n)
Destroys the given range of objects .
Definition Destroy.h:87
ForwardIt uninitialized_transfer(InputIt first, InputIt last, ForwardIt dest)
Transfers the elements from the given source range to the uninitialized destination range.
Definition UninitializedTransfer.h:73
#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) 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 EvaluateTrait< T >::Type EvaluateTrait_t
Auxiliary alias declaration for the EvaluateTrait type trait.
Definition EvaluateTrait.h:110
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 ptrdiff_t DefaultMaxSize_v
Default size of the MaxSize type trait.
Definition MaxSize.h:72
constexpr ptrdiff_t MaxSize_v
Auxiliary variable template for the MaxSize type trait.
Definition MaxSize.h:175
constexpr bool IsSquare_v
Auxiliary variable template for the IsSquare type trait.
Definition IsSquare.h:146
typename DynamicAllocator< As... >::template Type< T > DynamicAllocator_t
Auxiliary alias declaration for the DynamicAllocator type trait.
Definition DynamicAllocator.h:211
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
typename GetAllocator< T >::Type GetAllocator_t
Auxiliary alias declaration for the GetAllocator type trait.
Definition GetAllocator.h:98
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 IsSMPAssignable_v
Auxiliary variable template for the IsSMPAssignable type trait.
Definition IsSMPAssignable.h:132
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
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
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition DenseVector.h:221
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition DenseMatrix.h:131
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.
Definition TransposeFlag.h:75
#define BLAZE_RESTRICT
Compiler dependent setup of the [[no_unique_address]] attribute.
Definition Restrict.h:81
constexpr bool IsVectorizable_v
Auxiliary variable template for the IsVectorizable type trait.
Definition IsVectorizable.h:157
constexpr bool IsBuiltin_v
Auxiliary variable template for the IsBuiltin type trait.
Definition IsBuiltin.h:95
typename RemoveConst< T >::Type RemoveConst_t
Auxiliary alias declaration for the RemoveConst type trait.
Definition RemoveConst.h:96
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
#define BLAZE_THROW_BAD_ALLOC
Macro for the emission of a std::bad_alloc exception.
Definition Exception.h:139
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.
Rebind mechanism to obtain a DynamicVector with different data/element type.
Definition DynamicVector.h:254
typename std::allocator_traits< Alloc >::template rebind_alloc< NewType > NewAlloc
The new type of allocator.
Definition DynamicVector.h:256
DynamicVector< NewType, TF, NewAlloc, Tag > Other
The type of the other DynamicVector.
Definition DynamicVector.h:259
Resize mechanism to obtain a DynamicVector with a different fixed number of elements.
Definition DynamicVector.h:268
DynamicVector< Type, TF, Alloc, Tag > Other
The type of the other DynamicVector.
Definition DynamicVector.h:269
Definition of the nested auxiliary struct Uninitialized.
Definition DynamicVector.h:511
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
Header file for the cache size of the target architecture.
System settings for the inline keywords.
System settings for performance optimizations.
System settings for the restrict keyword.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the default transpose flag for all vectors of the Blaze library.
Header file for basic type definitions.