26 #ifndef _BLAZE_MATH_DENSE_HYBRIDVECTOR_H_ 27 #define _BLAZE_MATH_DENSE_HYBRIDVECTOR_H_ 193 template<
typename Type
195 ,
bool TF = defaultTransposeFlag >
197 :
public DenseVector< HybridVector<Type,N,TF>, TF >
234 template<
typename NewType >
243 template<
size_t NewN >
269 explicit inline HybridVector(
size_t n,
const Type& init );
272 template<
typename Other >
273 explicit inline HybridVector(
size_t n,
const Other* array );
275 template<
typename Other,
size_t Dim >
276 explicit inline HybridVector(
const Other (&array)[Dim] );
314 template< typename Other,
size_t Dim >
315 inline
HybridVector& operator=( const Other (&array)[Dim] );
330 inline
size_t size() const noexcept;
331 static inline constexpr
size_t spacing() noexcept;
332 static inline constexpr
size_t capacity() noexcept;
336 inline
void resize(
size_t n,
bool preserve=true );
337 inline
void extend(
size_t n,
bool preserve=true );
345 template< typename Other > inline
HybridVector& scale( const Other& scalar );
352 static inline
void* operator new ( std::
size_t size );
353 static inline
void* operator new[]( std::
size_t size );
354 static inline
void* operator new ( std::
size_t size, const std::nothrow_t& );
355 static inline
void* operator new[]( std::
size_t size, const std::nothrow_t& );
357 static inline
void operator delete (
void* ptr );
358 static inline
void operator delete[](
void* ptr );
359 static inline
void operator delete (
void* ptr, const std::nothrow_t& );
360 static inline
void operator delete[](
void* ptr, const std::nothrow_t& );
367 template< typename VT >
369 static constexpr
bool VectorizedAssign_v =
370 ( useOptimizedKernels &&
378 template< typename VT >
380 static constexpr
bool VectorizedAddAssign_v =
381 ( useOptimizedKernels &&
390 template< typename VT >
392 static constexpr
bool VectorizedSubAssign_v =
393 ( useOptimizedKernels &&
402 template< typename VT >
404 static constexpr
bool VectorizedMultAssign_v =
405 ( useOptimizedKernels &&
414 template< typename VT >
416 static constexpr
bool VectorizedDivAssign_v =
417 ( useOptimizedKernels &&
428 inline
bool isIntact() const noexcept;
435 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
436 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
438 static inline constexpr
bool isAligned() noexcept;
449 template< typename VT >
452 template< typename VT >
457 template< typename VT >
460 template< typename VT >
465 template< typename VT >
468 template< typename VT >
473 template< typename VT >
476 template< typename VT >
481 template< typename VT >
484 template< typename VT >
539 template< typename Type
548 if( IsNumeric_v<Type> ) {
549 for(
size_t i=0UL; i<
NN; ++i )
568 template<
typename Type
581 if( IsNumeric_v<Type> ) {
582 for(
size_t i=0UL; i<
NN; ++i )
602 template<
typename Type
615 for(
size_t i=0UL; i<n; ++i )
618 if( IsNumeric_v<Type> ) {
619 for(
size_t i=n; i<
NN; ++i )
646 template<
typename Type
651 , size_( list.
size() )
659 std::fill( std::copy( list.begin(), list.end(),
v_.
data() ),
v_.
data()+
NN, Type() );
689 template<
typename Type
692 template<
typename Other >
703 for(
size_t i=0UL; i<n; ++i )
706 if( IsNumeric_v<Type> ) {
707 for(
size_t i=n; i<
NN; ++i )
734 template<
typename Type
737 template<
typename Other
746 for(
size_t i=0UL; i<Dim; ++i )
749 if( IsNumeric_v<Type> ) {
750 for(
size_t i=Dim; i<
NN; ++i )
766 template<
typename Type
775 for(
size_t i=0UL; i<
size_; ++i )
778 if( IsNumeric_v<Type> ) {
779 for(
size_t i=
size_; i<
NN; ++i )
798 template<
typename Type
801 template<
typename VT >
804 , size_( (~v).
size() )
810 if( (~v).
size() > N ) {
814 for(
size_t i=( IsSparseVector_v<VT> ? 0UL :
size_ );
815 i<( IsNumeric_v<Type> ?
NN :
size_ ); ++i ) {
843 template<
typename Type
864 template<
typename Type
886 template<
typename Type
892 if( index >= size_ ) {
895 return (*
this)[index];
910 template<
typename Type
916 if( index >= size_ ) {
919 return (*
this)[index];
931 template<
typename Type
948 template<
typename Type
963 template<
typename Type
978 template<
typename Type
993 template<
typename Type
1008 template<
typename Type
1024 template<
typename Type
1040 template<
typename Type
1065 template<
typename Type
1072 for(
size_t i=0UL; i<size_; ++i )
1098 template<
typename Type
1103 if( list.size() > N ) {
1107 resize( list.size(), false );
1108 std::copy( list.begin(), list.end(), v_.data() );
1134 template<
typename Type
1137 template<
typename Other
1145 for(
size_t i=0UL; i<Dim; ++i )
1161 template<
typename Type
1166 using blaze::assign;
1171 assign( *
this, ~rhs );
1190 template<
typename Type
1193 template<
typename VT >
1196 using blaze::assign;
1198 if( (~rhs).
size() > N ) {
1202 if( (~rhs).canAlias(
this ) ) {
1208 if( IsSparseVector_v<VT> )
1210 assign( *
this, ~rhs );
1230 template<
typename Type
1233 template<
typename VT >
1236 using blaze::addAssign;
1238 if( (~rhs).
size() != size_ ) {
1242 if( (~rhs).canAlias(
this ) ) {
1244 addAssign( *
this, tmp );
1247 addAssign( *
this, ~rhs );
1267 template<
typename Type
1270 template<
typename VT >
1273 using blaze::subAssign;
1275 if( (~rhs).
size() != size_ ) {
1279 if( (~rhs).canAlias(
this ) ) {
1281 subAssign( *
this, tmp );
1284 subAssign( *
this, ~rhs );
1305 template<
typename Type
1308 template<
typename VT >
1311 using blaze::assign;
1312 using blaze::multAssign;
1314 if( (~rhs).
size() != size_ ) {
1318 if( IsSparseVector_v<VT> || (~rhs).canAlias(
this ) ) {
1320 assign( *
this, tmp );
1323 multAssign( *
this, ~rhs );
1343 template<
typename Type
1346 template<
typename VT >
1349 using blaze::assign;
1350 using blaze::divAssign;
1352 if( (~rhs).
size() != size_ ) {
1356 if( (~rhs).canAlias(
this ) ) {
1358 assign( *
this, tmp );
1361 divAssign( *
this, ~rhs );
1382 template<
typename Type
1385 template<
typename VT >
1388 using blaze::assign;
1399 if( size_ != 3UL || (~rhs).
size() != 3UL ) {
1403 const CrossType tmp( *
this % (~rhs) );
1404 assign( *
this, tmp );
1426 template<
typename Type
1444 template<
typename Type
1459 template<
typename Type
1477 template<
typename Type
1482 size_t nonzeros( 0 );
1484 for(
size_t i=0UL; i<size_; ++i ) {
1499 template<
typename Type
1505 for(
size_t i=0UL; i<size_; ++i )
1518 template<
typename Type
1559 template<
typename Type
1570 if( IsNumeric_v<Type> && n < size_ ) {
1571 for(
size_t i=n; i<size_; ++i )
1594 template<
typename Type
1611 template<
typename Type
1618 const size_t maxsize(
max( size_, v.size_ ) );
1619 for(
size_t i=0UL; i<maxsize; ++i )
1620 swap( v_[i], v.v_[i] );
1621 swap( size_, v.size_ );
1651 template<
typename Type
1654 template<
typename Other >
1657 for(
size_t i=0; i<size_; ++i )
1682 template<
typename Type
1691 return allocate<HybridVector>( 1UL );
1706 template<
typename Type
1729 template<
typename Type
1738 return allocate<HybridVector>( 1UL );
1753 template<
typename Type
1772 template<
typename Type
1777 deallocate( static_cast<HybridVector*>( ptr ) );
1788 template<
typename Type
1793 deallocate( static_cast<HybridVector*>( ptr ) );
1804 template<
typename Type
1809 deallocate( static_cast<HybridVector*>( ptr ) );
1820 template<
typename Type
1825 deallocate( static_cast<HybridVector*>( ptr ) );
1847 template<
typename Type
1855 if( IsVectorizable_v<Type> ) {
1856 for(
size_t i=size_; i<NN; ++i ) {
1857 if( v_[i] != Type() )
1885 template<
typename Type
1888 template<
typename Other >
1891 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
1906 template<
typename Type
1909 template<
typename Other >
1912 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
1926 template<
typename Type
1948 template<
typename Type
1954 return loada( index );
1972 template<
typename Type
1987 return loada( &v_[index] );
2005 template<
typename Type
2018 return loadu( &v_[index] );
2036 template<
typename Type
2060 template<
typename Type
2075 storea( &v_[index], value );
2093 template<
typename Type
2106 storeu( &v_[index], value );
2125 template<
typename Type
2140 stream( &v_[index], value );
2156 template<
typename Type
2159 template<
typename VT >
2165 for(
size_t i=0UL; i<size_; ++i )
2182 template<
typename Type
2185 template<
typename VT >
2193 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2195 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2196 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2200 for( ; i<ipos; i+=SIMDSIZE ) {
2201 store( i, (~rhs).load(i) );
2203 for( ; remainder && i<size_; ++i ) {
2221 template<
typename Type
2224 template<
typename VT >
2229 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2230 v_[element->index()] = element->value();
2246 template<
typename Type
2249 template<
typename VT >
2255 for(
size_t i=0UL; i<size_; ++i )
2272 template<
typename Type
2275 template<
typename VT >
2283 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2285 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2286 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2290 for( ; i<ipos; i+=SIMDSIZE ) {
2291 store( i, load(i) + (~rhs).load(i) );
2293 for( ; remainder && i<size_; ++i ) {
2311 template<
typename Type
2314 template<
typename VT >
2319 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2320 v_[element->index()] += element->value();
2336 template<
typename Type
2339 template<
typename VT >
2345 for(
size_t i=0UL; i<size_; ++i )
2362 template<
typename Type
2365 template<
typename VT >
2373 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2375 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2376 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2380 for( ; i<ipos; i+=SIMDSIZE ) {
2381 store( i, load(i) - (~rhs).load(i) );
2383 for( ; remainder && i<size_; ++i ) {
2401 template<
typename Type
2404 template<
typename VT >
2409 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2410 v_[element->index()] -= element->value();
2426 template<
typename Type
2429 template<
typename VT >
2435 for(
size_t i=0UL; i<size_; ++i )
2452 template<
typename Type
2455 template<
typename VT >
2463 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2465 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2466 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2470 for( ; i<ipos; i+=SIMDSIZE ) {
2471 store( i, load(i) * (~rhs).load(i) );
2473 for( ; remainder && i<size_; ++i ) {
2491 template<
typename Type
2494 template<
typename VT >
2503 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2504 v_[element->index()] = tmp[element->index()] * element->value();
2520 template<
typename Type
2523 template<
typename VT >
2529 for(
size_t i=0UL; i<size_; ++i )
2546 template<
typename Type
2549 template<
typename VT >
2557 const size_t ipos( size_ &
size_t(-SIMDSIZE) );
2562 for( ; i<ipos; i+=SIMDSIZE ) {
2563 store( i, load(i) / (~rhs).load(i) );
2565 for( ; i<size_; ++i ) {
2587 template<
typename Type,
size_t N,
bool TF >
2588 void reset( HybridVector<Type,N,TF>& v );
2590 template<
typename Type,
size_t N,
bool TF >
2591 void clear( HybridVector<Type,N,TF>& v );
2593 template<
bool RF,
typename Type,
size_t N,
bool TF >
2594 bool isDefault(
const HybridVector<Type,N,TF>& v );
2596 template<
typename Type,
size_t N,
bool TF >
2597 bool isIntact(
const HybridVector<Type,N,TF>& v );
2599 template<
typename Type,
size_t N,
bool TF >
2600 void swap( HybridVector<Type,N,TF>& a, HybridVector<Type,N,TF>& b ) noexcept;
2612 template<
typename Type
2629 template<
typename Type
2669 return ( v.size() == 0UL );
2692 template<
typename Type
2697 return v.isIntact();
2710 template<
typename Type
2730 template<
typename T,
size_t N,
bool TF >
2731 struct MaxSize< HybridVector<T,N,TF>, 0UL >
2748 template<
typename T,
size_t N,
bool TF >
2749 struct HasConstDataAccess< HybridVector<T,N,TF> >
2766 template<
typename T,
size_t N,
bool TF >
2767 struct HasMutableDataAccess< HybridVector<T,N,TF> >
2784 template<
typename T,
size_t N,
bool TF >
2785 struct IsAligned< HybridVector<T,N,TF> >
2786 :
public BoolConstant< HybridVector<T,N,TF>::isAligned() >
2802 template<
typename T,
size_t N,
bool TF >
2803 struct IsContiguous< HybridVector<T,N,TF> >
2820 template<
typename T,
size_t N,
bool TF >
2821 struct IsPadded< HybridVector<T,N,TF> >
2838 template<
typename T,
size_t N,
bool TF >
2839 struct IsResizable< HybridVector<T,N,TF> >
2856 template<
typename T1,
typename T2 >
2857 struct AddTraitEval2< T1, T2
2865 using ET1 = ElementType_t<T1>;
2866 using ET2 = ElementType_t<T2>;
2868 static constexpr
size_t N =
min(
size_t( MaxSize_v<T1,0UL> ),
size_t( MaxSize_v<T2,0UL> ) );
2870 using Type = HybridVector< AddTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2886 template<
typename T1,
typename T2 >
2887 struct SubTraitEval2< T1, T2
2895 using ET1 = ElementType_t<T1>;
2896 using ET2 = ElementType_t<T2>;
2898 static constexpr
size_t N =
min(
size_t( MaxSize_v<T1,0UL> ),
size_t( MaxSize_v<T2,0UL> ) );
2900 using Type = HybridVector< SubTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2916 template<
typename T1,
typename T2 >
2917 struct MultTraitEval2< T1, T2
2923 using ET1 = ElementType_t<T1>;
2925 static constexpr
size_t N = MaxSize_v<T1,0UL>;
2927 using Type = HybridVector< MultTrait_t<ET1,T2>, N, TransposeFlag_v<T1> >;
2930 template<
typename T1,
typename T2 >
2931 struct MultTraitEval2< T1, T2
2937 using ET2 = ElementType_t<T2>;
2939 static constexpr
size_t N = MaxSize_v<T2,0UL>;
2941 using Type = HybridVector< MultTrait_t<T1,ET2>, N, TransposeFlag_v<T2> >;
2944 template<
typename T1,
typename T2 >
2945 struct MultTraitEval2< T1, T2
2947 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
2948 IsDenseVector_v<T1> &&
2949 IsDenseVector_v<T2> &&
2955 using ET1 = ElementType_t<T1>;
2956 using ET2 = ElementType_t<T2>;
2958 static constexpr
size_t N =
min(
size_t( MaxSize_v<T1,0UL> ),
size_t( MaxSize_v<T2,0UL> ) );
2960 using Type = HybridVector< MultTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
2963 template<
typename T1,
typename T2 >
2964 struct MultTraitEval2< T1, T2
2966 IsColumnVector_v<T2> &&
2972 using ET1 = ElementType_t<T1>;
2973 using ET2 = ElementType_t<T2>;
2975 static constexpr
size_t N = ( MaxSize_v<T1,0UL> !=
DefaultMaxSize_v ? MaxSize_v<T1,0UL> : MaxSize_v<T2,0UL> );
2977 using Type = HybridVector< MultTrait_t<ET1,ET2>, N,
false >;
2980 template<
typename T1,
typename T2 >
2981 struct MultTraitEval2< T1, T2
2989 using ET1 = ElementType_t<T1>;
2990 using ET2 = ElementType_t<T2>;
2992 static constexpr
size_t N = ( MaxSize_v<T2,1UL> !=
DefaultMaxSize_v ? MaxSize_v<T2,1UL> : MaxSize_v<T1,0UL> );
2994 using Type = HybridVector< MultTrait_t<ET1,ET2>, N,
true >;
3010 template<
typename T1,
typename T2 >
3011 struct KronTraitEval2< T1, T2
3013 IsDenseVector_v<T2> &&
3019 using ET1 = ElementType_t<T1>;
3020 using ET2 = ElementType_t<T2>;
3022 static constexpr
size_t N = MaxSize_v<T1,0UL> * MaxSize_v<T2,0UL>;
3024 using Type = HybridVector< MultTrait_t<ET1,ET2>, N, TransposeFlag_v<T2> >;
3040 template<
typename T1,
typename T2 >
3041 struct DivTraitEval2< T1, T2
3047 using ET1 = ElementType_t<T1>;
3049 static constexpr
size_t N = MaxSize_v<T1,0UL>;
3051 using Type = HybridVector< DivTrait_t<ET1,T2>, N, TransposeFlag_v<T1> >;
3054 template<
typename T1,
typename T2 >
3055 struct DivTraitEval2< T1, T2
3057 IsDenseVector_v<T2> &&
3063 using ET1 = ElementType_t<T1>;
3064 using ET2 = ElementType_t<T2>;
3066 static constexpr
size_t N =
min(
size_t( MaxSize_v<T1,0UL> ),
size_t( MaxSize_v<T2,0UL> ) );
3068 using Type = HybridVector< DivTrait_t<ET1,ET2>, N, TransposeFlag_v<T1> >;
3084 template<
typename T,
typename OP >
3085 struct UnaryMapTraitEval2< T, OP
3090 using ET = ElementType_t<T>;
3092 using Type = HybridVector< MapTrait_t<ET,OP>, MaxSize_v<T,0UL>, TransposeFlag_v<T> >;
3100 template<
typename T1,
typename T2,
typename OP >
3101 struct BinaryMapTraitEval2< T1, T2, OP
3109 using ET1 = ElementType_t<T1>;
3110 using ET2 = ElementType_t<T2>;
3112 static constexpr
size_t N =
min(
size_t( MaxSize_v<T1,0UL> ),
size_t( MaxSize_v<T2,0UL> ) );
3114 using Type = HybridVector< MapTrait_t<ET1,ET2,OP>, N, TransposeFlag_v<T1> >;
3130 template<
typename T,
typename OP,
size_t RF >
3131 struct PartialReduceTraitEval2< T, OP, RF
3138 using ET = ElementType_t<T>;
3139 using RT = decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) );
3141 static constexpr
bool TF = ( RF == 0UL );
3143 static constexpr
size_t N = MaxSize_v< T, TF ? 1UL : 0UL >;
3145 using Type = HybridVector<RT,N,TF>;
3161 template<
typename T1,
size_t N,
bool TF,
typename T2 >
3162 struct HighType< HybridVector<T1,N,TF>, HybridVector<T2,N,TF> >
3164 using Type = StaticVector< typename HighType<T1,T2>::Type, N, TF >;
3180 template<
typename T1,
size_t N,
bool TF,
typename T2 >
3181 struct LowType< HybridVector<T1,N,TF>, HybridVector<T2,N,TF> >
3183 using Type = StaticVector< typename LowType<T1,T2>::Type, N, TF >;
3199 template<
typename VT >
3200 struct SubvectorTraitEval2< VT,
inf,
inf 3205 static constexpr
size_t N =
max( Size_v<VT,0UL>, MaxSize_v<VT,0UL> );
3207 using Type = HybridVector< RemoveConst_t< ElementType_t<VT> >, N, TransposeFlag_v<VT> >;
3223 template<
typename VT >
3224 struct ElementsTraitEval2< VT, 0UL
3229 static constexpr
size_t N =
max( Size_v<VT,0UL>, MaxSize_v<VT,0UL> );
3231 using Type = HybridVector< RemoveConst_t< ElementType_t<VT> >, N, TransposeFlag_v<VT> >;
3247 template<
typename MT,
size_t I >
3248 struct RowTraitEval2< MT, I
3253 using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, MaxSize_v<MT,1UL>,
true >;
3269 template<
typename MT,
size_t I >
3270 struct ColumnTraitEval2< MT, I
3275 using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, MaxSize_v<MT,0UL>,
false >;
3291 template<
typename MT, ptrdiff_t I >
3292 struct BandTraitEval2< MT, I
3299 static constexpr
size_t M = MaxSize_v<MT,0UL>;
3300 static constexpr
size_t N = MaxSize_v<MT,1UL>;
3301 static constexpr
size_t Min =
min( M - ( I >= 0L ? 0UL : -I ), N - ( I >= 0L ? I : 0UL ) );
3303 using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
3306 template<
typename MT >
3307 struct BandTraitEval2< MT,
inf 3312 static constexpr
size_t Min =
min( Size_v<MT,0UL>, Size_v<MT,1UL> );
3314 using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
3317 template<
typename MT >
3318 struct BandTraitEval2< MT,
inf 3325 static constexpr
size_t Min =
min( MaxSize_v<MT,0UL>, MaxSize_v<MT,1UL> );
3327 using Type = HybridVector< RemoveConst_t< ElementType_t<MT> >, Min, defaultTransposeFlag >;
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
static constexpr size_t Alignment
Alignment of the data elements.
Definition: HybridVector.h:492
Header file for the nextMultiple shim.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the AlignmentOf type trait.
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: HybridVector.h:1597
auto multAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
Default implementation of the multiplication assignment of a dense vector.
Definition: HybridVector.h:2430
HybridVector()
The default constructor for HybridVector.
Definition: HybridVector.h:542
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
static constexpr size_t capacity() noexcept
Returns the maximum capacity of the vector.
Definition: HybridVector.h:1462
Header file for the row trait.
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.The Ptrdiff_t alias template represents an integ...
Definition: IntegralConstant.h:237
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.The IsRowVector_v variable template provid...
Definition: IsRowVector.h:142
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
Header file for the serial shim.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Iterator end() noexcept
Returns an iterator just past the last element of the hybrid vector.
Definition: HybridVector.h:1011
Header file for the IsRowVector type trait.
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: HybridVector.h:1429
Header file for the DenseVector base class.
Header file for the MAYBE_UNUSED function template.
Pointer data() noexcept
Low-level data access to the vector elements.
Definition: HybridVector.h:934
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:187
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for all forward declarations of the math module.
Header file for memory allocation and deallocation functionality.
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
Header file for the reduce trait.
Header file for the MaxSize type trait.
Type ElementType
Type of the vector elements.
Definition: HybridVector.h:217
Header file for the elements trait.
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: HybridVector.h:1910
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Header file for the band trait.
static constexpr bool align
Compilation switch for the choice of alignment.
Definition: HybridVector.h:208
Constraint on the data type.
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.The IsDenseMatrix_v variable template pr...
Definition: IsDenseMatrix.h:138
Header file for the IsMatrix type trait.
Efficient implementation of a dynamically sized vector with static memory.The HybridVector class temp...
Definition: Forward.h:59
Header file for the IsSquare type trait.
Type & Reference
Reference to a non-constant vector value.
Definition: HybridVector.h:222
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Rebind mechanism to obtain a HybridVector with different data/element type.
Definition: HybridVector.h:235
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition: HybridVector.h:847
BLAZE_ALWAYS_INLINE void storeu(size_t index, const SIMDType &value) noexcept
Unaligned store of a SIMD element of the vector.
Definition: HybridVector.h:2097
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the LowType type trait.
Header file for the multiplication trait.
constexpr ptrdiff_t DefaultMaxSize_v
Default size of the MaxSize type trait.
Definition: MaxSize.h:72
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(HybridVector< Type, N, TF > &a, HybridVector< Type, N, TF > &b) noexcept
Swapping the contents of two hybrid vectors.
Definition: HybridVector.h:2713
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:187
Type * Pointer
Pointer to a non-constant vector value.
Definition: HybridVector.h:224
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
Header file for the DenseIterator class template.
Iterator begin() noexcept
Returns an iterator to the first element of the hybrid vector.
Definition: HybridVector.h:966
Numerical infinity for built-in data types.
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
Aligned load of a SIMD element of the vector.
Definition: HybridVector.h:1976
Header file for the subvector trait.
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: HybridVector.h:261
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Aligned store of a SIMD element of the vector.
Definition: HybridVector.h:2064
Constraint on the data type.
auto divAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
Default implementation of the division assignment of a dense vector.
Definition: HybridVector.h:2524
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
Header file for the Kron product trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type,...
Definition: Vectorizable.h:61
Header file for the TransposeFlag type trait.
Constraint on the data type.
Header file for the exception macros of the math module.
auto assign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
Default implementation of the assignment of a dense vector.
Definition: HybridVector.h:2160
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
Unaligned load of a SIMD element of the vector.
Definition: HybridVector.h:2009
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
Load of a SIMD element of the vector.
Definition: HybridVector.h:1952
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
constexpr bool HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.The HasSIMDDiv_v variable template provides...
Definition: HasSIMDDiv.h:171
Constraint on the data type.
Header file for the IsVector type trait.
Header file for the IsDenseMatrix type trait.
void clear()
Clearing the vector.
Definition: HybridVector.h:1521
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
Header file for the IsPadded type trait.
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_t alias declaration prov...
Definition: CrossTrait.h:164
Header file for the IsVectorizable type trait.
auto addAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
Default implementation of the addition assignment of a dense vector.
Definition: HybridVector.h:2250
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
void resize(size_t n, bool preserve=true)
Changing the size of the vector.
Definition: HybridVector.h:1562
size_t size_
The current size/dimension of the vector.
Definition: HybridVector.h:508
Header file for the RemoveConst type trait.
ConstIterator cend() const noexcept
Returns an iterator just past the last element of the hybrid vector.
Definition: HybridVector.h:1043
Header file for the IsSIMDCombinable type trait.
AlignedStorage v_
The statically allocated vector elements.
Definition: HybridVector.h:502
Header file for the IsSparseVector type trait.
Header file for the HasSIMDMult type trait.
BLAZE_ALWAYS_INLINE constexpr auto nextMultiple(T1 value, T2 factor) noexcept
Rounds up an integral value to the next multiple of a given factor.
Definition: NextMultiple.h:68
Header file for run time assertion macros.
HybridVector & operator=(const Type &rhs)
Homogenous assignment to all vector elements.
Definition: HybridVector.h:1068
SIMDTrait_t< ElementType > SIMDType
SIMD type of the vector elements.
Definition: HybridVector.h:218
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
bool isIntact() const noexcept
Returns whether the invariants of the hybrid vector are intact.
Definition: HybridVector.h:1850
Constraint on the data type.
Header file for the IsContiguous type trait.
constexpr Pointer data() noexcept
Low-level data access to the array elements.
Definition: AlignedArray.h:367
static constexpr size_t NN
Alignment adjustment.
Definition: HybridVector.h:205
ConstIterator cbegin() const noexcept
Returns an iterator to the first element of the hybrid vector.
Definition: HybridVector.h:996
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:139
Header file for the AlignedArray implementation.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type,...
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
BLAZE_ALWAYS_INLINE void stream(size_t index, const SIMDType &value) noexcept
Aligned, non-temporal store of a SIMD element of the vector.
Definition: HybridVector.h:2129
Constraint on the data type.
Header file for the HasSIMDSub type trait.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMutableDataAccess type trait.
static constexpr bool simdEnabled
Compilation flag for SIMD optimization.
Definition: HybridVector.h:255
void swap(HybridVector &v) noexcept
Swapping the contents of two hybrid vectors.
Definition: HybridVector.h:1614
auto subAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
Default implementation of the subtraction assignment of a dense vector.
Definition: HybridVector.h:2340
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
const Type & ConstReference
Reference to a constant vector value.
Definition: HybridVector.h:223
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
Header file for the IsDenseVector type trait.
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
const Type * ConstPointer
Pointer to a constant vector value.
Definition: HybridVector.h:225
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
void reset()
Reset to the default initial values.
Definition: HybridVector.h:1502
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type,...
Definition: DenseVector.h:61
Reference at(size_t index)
Checked access to the vector elements.
Definition: HybridVector.h:890
HybridVector< Type, N, TF > This
Type of this HybridVector instance.
Definition: HybridVector.h:213
constexpr size_t AlignmentOf_v
Auxiliary variable template for the AlignmentOf type trait.The AlignmentOf_v variable template provid...
Definition: AlignmentOf.h:238
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD vector.
Definition: HybridVector.h:202
static constexpr size_t spacing() noexcept
Returns the minimum capacity of the vector.
Definition: HybridVector.h:1447
Resize mechanism to obtain a HybridVector with a different fixed number of elements.
Definition: HybridVector.h:244
Header file for the HasSIMDDiv type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:198
EnableIf_t< IsBuiltin_v< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:224
Header file for the default transpose flag for all vectors of the Blaze library.
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:188
Header file for the alignment check function.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:146
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.The IsDenseVector_v variable template pr...
Definition: IsDenseVector.h:138
Header file for the IntegralConstant class template.
constexpr Infinity inf
Global Infinity instance.The blaze::inf instance can be used wherever a built-in data type is expecte...
Definition: Infinity.h:1080
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
static constexpr bool isAligned() noexcept
Returns whether the vector is properly aligned in memory.
Definition: HybridVector.h:1929
Header file for the IsColumnVector type trait.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Store of a SIMD element of the vector.
Definition: HybridVector.h:2040
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: HybridVector.h:1480
Header file for the HighType type trait.
Header file for the clear shim.
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: HybridVector.h:1889
const Type & ReturnType
Return type for expression template evaluations.
Definition: HybridVector.h:219