35 #ifndef _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_ 36 #define _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_ 196 template<
typename Type
197 ,
bool TF = defaultTransposeFlag >
224 template<
typename NewType >
233 template<
size_t NewN >
262 template< typename Other >
263 explicit inline
DynamicVector(
size_t n, const Other* array );
265 template< typename Other,
size_t Dim >
284 inline
Reference operator[](
size_t index ) noexcept;
305 template< typename Other,
size_t Dim >
306 inline
DynamicVector& operator=( const Other (&array)[Dim] );
323 inline
size_t size() const noexcept;
324 inline
size_t spacing() const noexcept;
325 inline
size_t capacity() const noexcept;
329 inline
void resize(
size_t n,
bool preserve=true );
330 inline
void extend(
size_t n,
bool preserve=true );
331 inline
void reserve(
size_t n );
340 template< typename Other > inline
DynamicVector& scale( const Other& scalar );
347 template< typename VT >
349 static constexpr
bool VectorizedAssign_v =
350 ( useOptimizedKernels &&
358 template< typename VT >
360 static constexpr
bool VectorizedAddAssign_v =
361 ( useOptimizedKernels &&
370 template< typename VT >
372 static constexpr
bool VectorizedSubAssign_v =
373 ( useOptimizedKernels &&
382 template< typename VT >
384 static constexpr
bool VectorizedMultAssign_v =
385 ( useOptimizedKernels &&
394 template< typename VT >
396 static constexpr
bool VectorizedDivAssign_v =
397 ( useOptimizedKernels &&
413 inline
bool isIntact() const noexcept;
420 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
421 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
435 template< typename VT >
438 template< typename VT >
443 template< typename VT >
446 template< typename VT >
451 template< typename VT >
454 template< typename VT >
459 template< typename VT >
462 template< typename VT >
467 template< typename VT >
470 template< typename VT >
479 inline
size_t addPadding(
size_t value ) const noexcept;
520 template< typename Type
538 template<
typename Type
545 if( IsVectorizable_v<Type> ) {
563 template<
typename Type
568 for(
size_t i=0UL; i<
size_; ++i )
591 template<
typename Type
596 std::fill( std::copy( list.begin(), list.end(),
begin() ),
end(), Type() );
623 template<
typename Type
625 template<
typename Other >
629 for(
size_t i=0UL; i<n; ++i )
654 template<
typename Type
656 template<
typename Other
661 for(
size_t i=0UL; i<Dim; ++i )
677 template<
typename Type
696 template<
typename Type
700 , capacity_( v.capacity_ )
715 template<
typename Type
717 template<
typename VT >
721 if( IsSparseVector_v<VT> ) {
722 for(
size_t i=0UL; i<
size_; ++i ) {
745 template<
typename Type
771 template<
typename Type
791 template<
typename Type
812 template<
typename Type
817 if( index >= size_ ) {
820 return (*
this)[index];
835 template<
typename Type
840 if( index >= size_ ) {
843 return (*
this)[index];
855 template<
typename Type
871 template<
typename Type
885 template<
typename Type
899 template<
typename Type
913 template<
typename Type
927 template<
typename Type
941 template<
typename Type
955 template<
typename Type
978 template<
typename Type
982 for(
size_t i=0UL; i<size_; ++i )
1005 template<
typename Type
1009 resize( list.size(), false );
1010 std::copy( list.begin(), list.end(), v_ );
1035 template<
typename Type
1037 template<
typename Other
1043 for(
size_t i=0UL; i<Dim; ++i )
1060 template<
typename Type
1064 if( &rhs ==
this )
return *
this;
1082 template<
typename Type
1089 capacity_ = rhs.capacity_;
1093 rhs.capacity_ = 0UL;
1109 template<
typename Type
1111 template<
typename VT >
1114 if( (~rhs).canAlias(
this ) ) {
1120 if( IsSparseVector_v<VT> )
1142 template<
typename Type
1144 template<
typename VT >
1147 if( (~rhs).
size() != size_ ) {
1151 if( (~rhs).canAlias(
this ) ) {
1177 template<
typename Type
1179 template<
typename VT >
1182 if( (~rhs).
size() != size_ ) {
1186 if( (~rhs).canAlias(
this ) ) {
1212 template<
typename Type
1214 template<
typename VT >
1217 if( (~rhs).
size() != size_ ) {
1221 if( IsSparseVector_v<VT> || (~rhs).canAlias(
this ) ) {
1246 template<
typename Type
1248 template<
typename VT >
1251 if( (~rhs).
size() != size_ ) {
1255 if( (~rhs).canAlias(
this ) ) {
1281 template<
typename Type
1283 template<
typename VT >
1286 using blaze::assign;
1297 if( size_ != 3UL || (~rhs).
size() != 3UL ) {
1301 const CrossType tmp( *
this % (~rhs) );
1302 assign( *
this, tmp );
1324 template<
typename Type
1341 template<
typename Type
1345 return addPadding( size_ );
1355 template<
typename Type
1372 template<
typename Type
1376 size_t nonzeros( 0 );
1378 for(
size_t i=0UL; i<size_; ++i ) {
1393 template<
typename Type
1398 for(
size_t i=0UL; i<size_; ++i )
1411 template<
typename Type
1449 template<
typename Type
1458 const size_t newCapacity( addPadding( n ) );
1466 if( IsVectorizable_v<Type> ) {
1467 for(
size_t i=size_; i<newCapacity; ++i )
1474 capacity_ = newCapacity;
1476 else if( IsVectorizable_v<Type> && n < size_ )
1478 for(
size_t i=n; i<size_; ++i )
1499 template<
typename Type
1503 resize( size_+n, preserve );
1517 template<
typename Type
1526 const size_t newCapacity( addPadding( n ) );
1532 if( IsVectorizable_v<Type> ) {
1533 for(
size_t i=size_; i<newCapacity; ++i )
1540 capacity_ = newCapacity;
1556 template<
typename Type
1573 template<
typename Type
1579 swap( size_, v.size_ );
1580 swap( capacity_, v.capacity_ );
1595 template<
typename Type
1599 if( usePadding && IsVectorizable_v<Type> )
1600 return nextMultiple<size_t>( value, SIMDSIZE );
1631 template<
typename Type
1633 template<
typename Other >
1636 for(
size_t i=0UL; i<size_; ++i )
1660 template<
typename Type
1664 if( size_ > capacity_ )
1667 if( IsVectorizable_v<Type> ) {
1668 for(
size_t i=size_; i<capacity_; ++i ) {
1669 if( v_[i] != Type() )
1697 template<
typename Type
1699 template<
typename Other >
1702 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
1717 template<
typename Type
1719 template<
typename Other >
1722 return static_cast<const void*>(
this ) == static_cast<const void*>( alias );
1736 template<
typename Type
1755 template<
typename Type
1759 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1776 template<
typename Type
1781 return loada( index );
1799 template<
typename Type
1813 return loada( v_+index );
1831 template<
typename Type
1843 return loadu( v_+index );
1861 template<
typename Type
1884 template<
typename Type
1898 storea( v_+index, value );
1916 template<
typename Type
1928 storeu( v_+index, value );
1947 template<
typename Type
1961 stream( v_+index, value );
1977 template<
typename Type
1979 template<
typename VT >
1985 const size_t ipos( size_ &
size_t(-2) );
1988 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1989 v_[i ] = (~rhs)[i ];
1990 v_[i+1UL] = (~rhs)[i+1UL];
1992 if( ipos < (~rhs).size() )
1993 v_[ipos] = (~rhs)[ipos];
2009 template<
typename Type
2011 template<
typename VT >
2019 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2021 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2022 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2025 Iterator left(
begin() );
2028 if( useStreaming && size_ > ( cacheSize/(
sizeof(Type) * 3UL ) ) && !(~rhs).isAliased(
this ) )
2030 for( ; i<ipos; i+=SIMDSIZE ) {
2031 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2033 for( ; remainder && i<size_; ++i ) {
2034 *left = *right; ++left; ++right;
2039 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2040 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2041 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2042 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2043 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2045 for( ; i<ipos; i+=SIMDSIZE ) {
2046 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2048 for( ; remainder && i<size_; ++i ) {
2049 *left = *right; ++left; ++right;
2067 template<
typename Type
2069 template<
typename VT >
2074 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2075 v_[element->index()] = element->value();
2091 template<
typename Type
2093 template<
typename VT >
2099 const size_t ipos( size_ &
size_t(-2) );
2102 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2103 v_[i ] += (~rhs)[i ];
2104 v_[i+1UL] += (~rhs)[i+1UL];
2106 if( ipos < (~rhs).size() )
2107 v_[ipos] += (~rhs)[ipos];
2123 template<
typename Type
2125 template<
typename VT >
2133 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2135 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2136 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2139 Iterator left(
begin() );
2142 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2143 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2144 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2145 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2146 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2148 for( ; i<ipos; i+=SIMDSIZE ) {
2149 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2151 for( ; remainder && i<size_; ++i ) {
2152 *left += *right; ++left; ++right;
2169 template<
typename Type
2171 template<
typename VT >
2176 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2177 v_[element->index()] += element->value();
2193 template<
typename Type
2195 template<
typename VT >
2201 const size_t ipos( size_ &
size_t(-2) );
2204 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2205 v_[i ] -= (~rhs)[i ];
2206 v_[i+1UL] -= (~rhs)[i+1UL];
2208 if( ipos < (~rhs).size() )
2209 v_[ipos] -= (~rhs)[ipos];
2225 template<
typename Type
2227 template<
typename VT >
2235 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2237 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2238 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2241 Iterator left(
begin() );
2244 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2245 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2246 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2247 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2248 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2250 for( ; i<ipos; i+=SIMDSIZE ) {
2251 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2253 for( ; remainder && i<size_; ++i ) {
2254 *left -= *right; ++left; ++right;
2271 template<
typename Type
2273 template<
typename VT >
2278 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2279 v_[element->index()] -= element->value();
2295 template<
typename Type
2297 template<
typename VT >
2303 const size_t ipos( size_ &
size_t(-2) );
2306 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2307 v_[i ] *= (~rhs)[i ];
2308 v_[i+1UL] *= (~rhs)[i+1UL];
2310 if( ipos < (~rhs).size() )
2311 v_[ipos] *= (~rhs)[ipos];
2327 template<
typename Type
2329 template<
typename VT >
2337 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2339 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2340 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2343 Iterator left(
begin() );
2346 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2347 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2348 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2349 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2350 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2352 for( ; i<ipos; i+=SIMDSIZE ) {
2353 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2355 for( ; remainder && i<size_; ++i ) {
2356 *left *= *right; ++left; ++right;
2373 template<
typename Type
2375 template<
typename VT >
2384 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2385 v_[element->index()] = tmp[element->index()] * element->value();
2401 template<
typename Type
2403 template<
typename VT >
2409 const size_t ipos( size_ &
size_t(-2) );
2412 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2413 v_[i ] /= (~rhs)[i ];
2414 v_[i+1UL] /= (~rhs)[i+1UL];
2416 if( ipos < (~rhs).size() )
2417 v_[ipos] /= (~rhs)[ipos];
2433 template<
typename Type
2435 template<
typename VT >
2443 const size_t ipos( size_ &
size_t(-SIMDSIZE) );
2447 Iterator left(
begin() );
2450 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2451 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2452 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2453 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2454 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2456 for( ; i<ipos; i+=SIMDSIZE ) {
2457 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2459 for( ; i<size_; ++i ) {
2460 *left /= *right; ++left; ++right;
2477 template<
typename Type,
bool TF >
2478 void reset( DynamicVector<Type,TF>& v );
2480 template<
typename Type,
bool TF >
2481 void clear( DynamicVector<Type,TF>& v );
2483 template<
bool RF,
typename Type,
bool TF >
2484 bool isDefault(
const DynamicVector<Type,TF>& v );
2486 template<
typename Type,
bool TF >
2487 bool isIntact(
const DynamicVector<Type,TF>& v ) noexcept;
2489 template<
typename Type,
bool TF >
2490 void swap( DynamicVector<Type,TF>& a, DynamicVector<Type,TF>& b ) noexcept;
2502 template<
typename Type
2518 template<
typename Type
2556 return ( v.
size() == 0UL );
2579 template<
typename Type
2583 return v.isIntact();
2596 template<
typename Type
2615 template<
typename T,
bool TF >
2616 struct HasConstDataAccess< DynamicVector<T,TF> >
2633 template<
typename T,
bool TF >
2634 struct HasMutableDataAccess< DynamicVector<T,TF> >
2651 template<
typename T,
bool TF >
2652 struct IsAligned< DynamicVector<T,TF> >
2669 template<
typename T,
bool TF >
2670 struct IsContiguous< DynamicVector<T,TF> >
2687 template<
typename T,
bool TF >
2688 struct IsPadded< DynamicVector<T,TF> >
2705 template<
typename T,
bool TF >
2706 struct IsResizable< DynamicVector<T,TF> >
2723 template<
typename T,
bool TF >
2724 struct IsShrinkable< DynamicVector<T,TF> >
2741 template<
typename T1,
typename T2 >
2742 struct AddTraitEval2< T1, T2
2745 ( IsDenseVector_v<T1> || IsDenseVector_v<T2> ) &&
2751 using ET1 = ElementType_t<T1>;
2752 using ET2 = ElementType_t<T2>;
2754 using Type = DynamicVector< AddTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2770 template<
typename T1,
typename T2 >
2771 struct SubTraitEval2< T1, T2
2774 ( IsDenseVector_v<T1> || IsDenseVector_v<T2> ) &&
2780 using ET1 = ElementType_t<T1>;
2781 using ET2 = ElementType_t<T2>;
2783 using Type = DynamicVector< SubTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2799 template<
typename T1,
typename T2 >
2800 struct MultTraitEval2< T1, T2
2806 using ET1 = ElementType_t<T1>;
2808 using Type = DynamicVector< MultTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
2811 template<
typename T1,
typename T2 >
2812 struct MultTraitEval2< T1, T2
2814 IsDenseVector_v<T2> &&
2818 using ET2 = ElementType_t<T2>;
2820 using Type = DynamicVector< MultTrait_t<T1,ET2>, TransposeFlag_v<T2> >;
2823 template<
typename T1,
typename T2 >
2824 struct MultTraitEval2< T1, T2
2826 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
2827 IsDenseVector_v<T1> &&
2828 IsDenseVector_v<T2> &&
2834 using ET1 = ElementType_t<T1>;
2835 using ET2 = ElementType_t<T2>;
2837 using Type = DynamicVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2840 template<
typename T1,
typename T2 >
2841 struct MultTraitEval2< T1, T2
2843 IsColumnVector_v<T2> &&
2844 ( IsDenseMatrix_v<T1> || IsDenseVector_v<T2> ) &&
2850 using ET1 = ElementType_t<T1>;
2851 using ET2 = ElementType_t<T2>;
2853 using Type = DynamicVector< MultTrait_t<ET1,ET2>,
false >;
2856 template<
typename T1,
typename T2 >
2857 struct MultTraitEval2< T1, T2
2860 ( IsDenseVector_v<T1> || IsDenseMatrix_v<T2> ) &&
2866 using ET1 = ElementType_t<T1>;
2867 using ET2 = ElementType_t<T2>;
2869 using Type = DynamicVector< MultTrait_t<ET1,ET2>,
true >;
2885 template<
typename T1,
typename T2 >
2886 struct KronTraitEval2< T1, T2
2888 IsDenseVector_v<T2> &&
2894 using ET1 = ElementType_t<T1>;
2895 using ET2 = ElementType_t<T2>;
2897 using Type = DynamicVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T2> >;
2913 template<
typename T1,
typename T2 >
2914 struct DivTraitEval2< T1, T2
2920 using ET1 = ElementType_t<T1>;
2922 using Type = DynamicVector< DivTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
2925 template<
typename T1,
typename T2 >
2926 struct DivTraitEval2< T1, T2
2928 IsDenseVector_v<T2> &&
2934 using ET1 = ElementType_t<T1>;
2935 using ET2 = ElementType_t<T2>;
2937 using Type = DynamicVector< DivTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2953 template<
typename T,
typename OP >
2954 struct UnaryMapTraitEval2< T, OP
2959 using ET = ElementType_t<T>;
2961 using Type = DynamicVector< MapTrait_t<ET,OP>, TransposeFlag_v<T> >;
2969 template<
typename T1,
typename T2,
typename OP >
2970 struct BinaryMapTraitEval2< T1, T2, OP
2978 using ET1 = ElementType_t<T1>;
2979 using ET2 = ElementType_t<T2>;
2981 using Type = DynamicVector< MapTrait_t<ET1,ET2,OP>, TransposeFlag_v<T1> >;
2997 template<
typename T,
typename OP,
size_t RF >
2998 struct PartialReduceTraitEval2< T, OP, RF
3005 using ET = ElementType_t<T>;
3006 using RT = decltype( std::declval<OP>()( std::declval<ET>(), std::declval<ET>() ) );
3008 static constexpr
bool TF = ( RF == 0UL );
3010 using Type = DynamicVector<RT,TF>;
3026 template<
typename T1,
bool TF,
typename T2 >
3027 struct HighType< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
3029 using Type = DynamicVector< typename HighType<T1,T2>::Type, TF >;
3045 template<
typename T1,
bool TF,
typename T2 >
3046 struct LowType< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
3048 using Type = DynamicVector< typename LowType<T1,T2>::Type, TF >;
3064 template<
typename VT >
3065 struct SubvectorTraitEval2< VT,
inf,
inf 3070 using Type = DynamicVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
3086 template<
typename VT >
3087 struct ElementsTraitEval2< VT, 0UL
3092 using Type = DynamicVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
3108 template<
typename MT,
size_t I >
3109 struct RowTraitEval2< MT, I
3114 using Type = DynamicVector< RemoveConst_t< ElementType_t<MT> >,
true >;
3130 template<
typename MT,
size_t I >
3131 struct ColumnTraitEval2< MT, I
3136 using Type = DynamicVector< RemoveConst_t< ElementType_t<MT> >,
false >;
3152 template<
typename MT, ptrdiff_t I >
3153 struct BandTraitEval2< MT, I
3160 using Type = DynamicVector< RemoveConst_t< ElementType_t<MT> >, 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
BLAZE_ALWAYS_INLINE void stream(size_t index, const SIMDType &value) noexcept
Aligned, non-temporal store of a SIMD element of the vector.
Definition: DynamicVector.h:1950
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Store of a SIMD element of the vector.
Definition: DynamicVector.h:1864
Header file for auxiliary alias declarations.
Type *BLAZE_RESTRICT v_
The dynamically allocated vector elements.
Definition: DynamicVector.h:488
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
Header file for the nextMultiple shim.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the alignment flag values.
Type * Pointer
Pointer to a non-constant vector value.
Definition: DynamicVector.h:214
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Aligned store of a SIMD element of the vector.
Definition: DynamicVector.h:1887
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DynamicVector.h:1326
Header file for the row trait.
size_t spacing() const noexcept
Returns the minimum capacity of the vector.
Definition: DynamicVector.h:1343
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
void clear()
Clearing the vector.
Definition: DynamicVector.h:1413
Header file for the serial shim.
auto assign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAssign_v< VT > >
Default implementation of the assignment of a dense vector.
Definition: DynamicVector.h:1980
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
bool isIntact() const noexcept
Returns whether the invariants of the dynamic vector are intact.
Definition: DynamicVector.h:1662
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: DynamicVector.h:1757
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: DynamicVector.h:251
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
auto addAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedAddAssign_v< VT > >
Default implementation of the addition assignment of a dense vector.
Definition: DynamicVector.h:2094
Header file for the IsRowVector type trait.
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
Header file for the DenseVector base class.
BLAZE_ALWAYS_INLINE void storeu(size_t index, const SIMDType &value) noexcept
Unaligned store of a SIMD element of the vector.
Definition: DynamicVector.h:1919
#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
ConstIterator cbegin() const noexcept
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:915
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.
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:198
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.
Header file for the elements trait.
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
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:220
Header file for the band trait.
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
Aligned load of a SIMD element of the vector.
Definition: DynamicVector.h:1802
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.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:253
~DynamicVector()
The destructor for DynamicVector.
Definition: DynamicVector.h:747
Iterator begin() noexcept
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:887
Header file for the IsSquare type trait.
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
Unaligned load of a SIMD element of the vector.
Definition: DynamicVector.h:1834
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
Header file for the DisableIf class template.
Header file for the LowType type trait.
void resize(size_t n, bool preserve=true)
Changing the size of the vector.
Definition: DynamicVector.h:1451
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
auto subAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedSubAssign_v< VT > >
Default implementation of the subtraction assignment of a dense vector.
Definition: DynamicVector.h:2196
Header file for the IsShrinkable type trait.
#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
Header file for the IsSMPAssignable type trait.
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:187
DynamicVector() noexcept
The default constructor for DynamicVector.
Definition: DynamicVector.h:522
#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
size_t capacity() const noexcept
Returns the maximum capacity of the vector.
Definition: DynamicVector.h:1357
auto multAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedMultAssign_v< VT > >
Default implementation of the multiplication assignment of a dense vector.
Definition: DynamicVector.h:2298
Header file for the HasSIMDAdd type trait.
Header file for the DenseIterator class template.
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
void reset()
Reset to the default initial values.
Definition: DynamicVector.h:1395
Resize mechanism to obtain a DynamicVector with a different fixed number of elements.
Definition: DynamicVector.h:234
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition: DynamicVector.h:774
bool isAligned() const noexcept
Returns whether the vector is properly aligned in memory.
Definition: DynamicVector.h:1738
Header file for the IsAligned type trait.
Constraint on the data type.
ConstIterator cend() const noexcept
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:957
size_t size_
The current size/dimension of the vector.
Definition: DynamicVector.h:486
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
#define BLAZE_RESTRICT
Platform dependent setup of the restrict keyword.
Definition: Restrict.h:81
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.
static constexpr bool simdEnabled
Compilation flag for SIMD optimization.
Definition: DynamicVector.h:245
Header file for the exception macros of the math module.
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.
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.
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
Load of a SIMD element of the vector.
Definition: DynamicVector.h:1779
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.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
size_t capacity_
The maximum capacity of the vector.
Definition: DynamicVector.h:487
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicVector.h:209
Header file for the RemoveConst type trait.
Header file for the IsSIMDCombinable type trait.
Header file for the IsSparseVector type trait.
Header file for the HasSIMDMult type trait.
SIMDTrait_t< ElementType > SIMDType
SIMD type of the vector elements.
Definition: DynamicVector.h:208
DynamicVector< Type, TF > This
Type of this DynamicVector instance.
Definition: DynamicVector.h:203
Header file for run time assertion macros.
const Type & ConstReference
Reference to a constant vector value.
Definition: DynamicVector.h:213
Header file for the addition trait.
Header file for the cross product trait.
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DynamicVector.h:406
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
Header file for the division trait.
Constraint on the data type.
Header file for the IsContiguous type trait.
Pointer data() noexcept
Low-level data access to the vector elements.
Definition: DynamicVector.h:857
Headerfile for the generic transfer algorithm.
Type & Reference
Reference to a non-constant vector value.
Definition: DynamicVector.h:212
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: DynamicVector.h:1501
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:139
size_t addPadding(size_t value) const noexcept
Add the necessary amount of padding to the given value.
Definition: DynamicVector.h:1597
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
Header file for the cache size of the target architecture.
#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
Rebind mechanism to obtain a DynamicVector with different data/element type.
Definition: DynamicVector.h:225
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
System settings for the restrict keyword.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
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
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.
void reserve(size_t n)
Setting the minimum capacity of the vector.
Definition: DynamicVector.h:1519
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
void swap(DynamicVector &v) noexcept
Swapping the contents of two vectors.
Definition: DynamicVector.h:1575
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: DynamicVector.h:1374
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
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
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
auto divAssign(const DenseVector< VT, TF > &rhs) -> DisableIf_t< VectorizedDivAssign_v< VT > >
Default implementation of the division assignment of a dense vector.
Definition: DynamicVector.h:2404
#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
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: DynamicVector.h:1720
Type ElementType
Type of the vector elements.
Definition: DynamicVector.h:207
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: DynamicVector.h:1558
Iterator end() noexcept
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:929
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
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
Header file for the default transpose flag for all vectors of the Blaze library.
Initializer list type 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
const Type * ConstPointer
Pointer to a constant vector value.
Definition: DynamicVector.h:215
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.The IsDenseVector_v variable template pr...
Definition: IsDenseVector.h:138
DynamicVector & operator=(const Type &rhs)
Homogenous assignment to all vector elements.
Definition: DynamicVector.h:980
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
void swap(DynamicVector< Type, TF > &a, DynamicVector< Type, TF > &b) noexcept
Swapping the contents of two vectors.
Definition: DynamicVector.h:2598
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the IsColumnVector type trait.
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Transfer.h:70
Reference at(size_t index)
Checked access to the vector elements.
Definition: DynamicVector.h:815
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
EnableIf_t< IsBuiltin_v< T >, T * > allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:156
#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
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: DynamicVector.h:1700
#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
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:191
Header file for the HighType type trait.
Header file for the clear shim.