35 #ifndef _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_ 36 #define _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_ 195 template<
typename Type
196 ,
bool TF = defaultTransposeFlag >
223 template<
typename NewType >
232 template<
size_t NewN >
261 template< typename Other >
262 explicit inline
DynamicVector(
size_t n, const Other* array );
264 template< typename Other,
size_t Dim >
283 inline
Reference operator[](
size_t index ) noexcept;
304 template< typename Other,
size_t Dim >
305 inline
DynamicVector& operator=( const Other (&array)[Dim] );
322 inline
size_t size() const noexcept;
323 inline
size_t spacing() const noexcept;
324 inline
size_t capacity() const noexcept;
328 inline
void resize(
size_t n,
bool preserve=true );
329 inline
void extend(
size_t n,
bool preserve=true );
330 inline
void reserve(
size_t n );
339 template< typename Other > inline
DynamicVector& scale( const Other& scalar );
346 template< typename VT >
348 static constexpr
bool VectorizedAssign_v =
349 ( useOptimizedKernels &&
357 template< typename VT >
359 static constexpr
bool VectorizedAddAssign_v =
360 ( useOptimizedKernels &&
369 template< typename VT >
371 static constexpr
bool VectorizedSubAssign_v =
372 ( useOptimizedKernels &&
381 template< typename VT >
383 static constexpr
bool VectorizedMultAssign_v =
384 ( useOptimizedKernels &&
393 template< typename VT >
395 static constexpr
bool VectorizedDivAssign_v =
396 ( useOptimizedKernels &&
412 inline
bool isIntact() const noexcept;
419 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
420 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
434 template< typename VT >
437 template< typename VT >
442 template< typename VT >
445 template< typename VT >
450 template< typename VT >
453 template< typename VT >
458 template< typename VT >
461 template< typename VT >
466 template< typename VT >
469 template< typename VT >
478 inline
size_t addPadding(
size_t value ) const noexcept;
519 template< typename Type
537 template<
typename Type
544 if( IsVectorizable_v<Type> ) {
562 template<
typename Type
567 for(
size_t i=0UL; i<
size_; ++i )
590 template<
typename Type
595 std::fill( std::copy( list.begin(), list.end(),
begin() ),
end(), Type() );
622 template<
typename Type
624 template<
typename Other >
628 for(
size_t i=0UL; i<n; ++i )
653 template<
typename Type
655 template<
typename Other
660 for(
size_t i=0UL; i<Dim; ++i )
676 template<
typename Type
695 template<
typename Type
714 template<
typename Type
716 template<
typename VT >
720 if( IsSparseVector_v<VT> ) {
721 for(
size_t i=0UL; i<
size_; ++i ) {
744 template<
typename Type
770 template<
typename Type
790 template<
typename Type
811 template<
typename Type
816 if( index >= size_ ) {
819 return (*
this)[index];
834 template<
typename Type
839 if( index >= size_ ) {
842 return (*
this)[index];
854 template<
typename Type
870 template<
typename Type
884 template<
typename Type
898 template<
typename Type
912 template<
typename Type
926 template<
typename Type
940 template<
typename Type
954 template<
typename Type
977 template<
typename Type
981 for(
size_t i=0UL; i<size_; ++i )
1004 template<
typename Type
1008 resize( list.size(), false );
1009 std::copy( list.begin(), list.end(), v_ );
1034 template<
typename Type
1036 template<
typename Other
1042 for(
size_t i=0UL; i<Dim; ++i )
1059 template<
typename Type
1063 if( &rhs ==
this )
return *
this;
1081 template<
typename Type
1092 rhs.capacity_ = 0UL;
1108 template<
typename Type
1110 template<
typename VT >
1113 if( (~rhs).canAlias(
this ) ) {
1119 if( IsSparseVector_v<VT> )
1141 template<
typename Type
1143 template<
typename VT >
1146 if( (~rhs).
size() != size_ ) {
1150 if( (~rhs).canAlias(
this ) ) {
1176 template<
typename Type
1178 template<
typename VT >
1181 if( (~rhs).
size() != size_ ) {
1185 if( (~rhs).canAlias(
this ) ) {
1211 template<
typename Type
1213 template<
typename VT >
1216 if( (~rhs).
size() != size_ ) {
1220 if( IsSparseVector_v<VT> || (~rhs).canAlias(
this ) ) {
1245 template<
typename Type
1247 template<
typename VT >
1250 if( (~rhs).
size() != size_ ) {
1254 if( (~rhs).canAlias(
this ) ) {
1280 template<
typename Type
1282 template<
typename VT >
1285 using blaze::assign;
1296 if( size_ != 3UL || (~rhs).
size() != 3UL ) {
1300 const CrossType tmp( *
this % (~rhs) );
1301 assign( *
this, tmp );
1323 template<
typename Type
1340 template<
typename Type
1344 return addPadding( size_ );
1354 template<
typename Type
1371 template<
typename Type
1375 size_t nonzeros( 0 );
1377 for(
size_t i=0UL; i<size_; ++i ) {
1392 template<
typename Type
1397 for(
size_t i=0UL; i<size_; ++i )
1410 template<
typename Type
1448 template<
typename Type
1457 const size_t newCapacity( addPadding( n ) );
1465 if( IsVectorizable_v<Type> ) {
1466 for(
size_t i=size_; i<newCapacity; ++i )
1475 else if( IsVectorizable_v<Type> && n < size_ )
1477 for(
size_t i=n; i<size_; ++i )
1498 template<
typename Type
1502 resize( size_+n, preserve );
1516 template<
typename Type
1525 const size_t newCapacity( addPadding( n ) );
1531 if( IsVectorizable_v<Type> ) {
1532 for(
size_t i=size_; i<newCapacity; ++i )
1555 template<
typename Type
1572 template<
typename Type
1578 swap( size_, v.size_ );
1594 template<
typename Type
1598 if( usePadding && IsVectorizable_v<Type> )
1599 return nextMultiple<size_t>( value, SIMDSIZE );
1630 template<
typename Type
1632 template<
typename Other >
1635 for(
size_t i=0UL; i<size_; ++i )
1659 template<
typename Type
1666 if( IsVectorizable_v<Type> ) {
1667 for(
size_t i=size_; i<
capacity_; ++i ) {
1668 if( v_[i] != Type() )
1696 template<
typename Type
1698 template<
typename Other >
1701 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1716 template<
typename Type
1718 template<
typename Other >
1721 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1735 template<
typename Type
1754 template<
typename Type
1758 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1775 template<
typename Type
1780 return loada( index );
1798 template<
typename Type
1812 return loada( v_+index );
1830 template<
typename Type
1842 return loadu( v_+index );
1860 template<
typename Type
1883 template<
typename Type
1897 storea( v_+index, value );
1915 template<
typename Type
1927 storeu( v_+index, value );
1946 template<
typename Type
1960 stream( v_+index, value );
1976 template<
typename Type
1978 template<
typename VT >
1984 const size_t ipos( size_ &
size_t(-2) );
1987 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1988 v_[i ] = (~rhs)[i ];
1989 v_[i+1UL] = (~rhs)[i+1UL];
1991 if( ipos < (~rhs).size() )
1992 v_[ipos] = (~rhs)[ipos];
2008 template<
typename Type
2010 template<
typename VT >
2018 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2020 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2021 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2027 if( useStreaming && size_ > ( cacheSize/(
sizeof(Type) * 3UL ) ) && !(~rhs).isAliased(
this ) )
2029 for( ; i<ipos; i+=SIMDSIZE ) {
2030 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2032 for( ; remainder && i<size_; ++i ) {
2033 *left = *right; ++left; ++right;
2038 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2039 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2044 for( ; i<ipos; i+=SIMDSIZE ) {
2045 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2047 for( ; remainder && i<size_; ++i ) {
2048 *left = *right; ++left; ++right;
2066 template<
typename Type
2068 template<
typename VT >
2073 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2074 v_[element->index()] = element->value();
2090 template<
typename Type
2092 template<
typename VT >
2098 const size_t ipos( size_ &
size_t(-2) );
2101 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2102 v_[i ] += (~rhs)[i ];
2103 v_[i+1UL] += (~rhs)[i+1UL];
2105 if( ipos < (~rhs).size() )
2106 v_[ipos] += (~rhs)[ipos];
2122 template<
typename Type
2124 template<
typename VT >
2132 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2134 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2135 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2141 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2142 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2147 for( ; i<ipos; i+=SIMDSIZE ) {
2148 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2150 for( ; remainder && i<size_; ++i ) {
2151 *left += *right; ++left; ++right;
2168 template<
typename Type
2170 template<
typename VT >
2175 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2176 v_[element->index()] += element->value();
2192 template<
typename Type
2194 template<
typename VT >
2200 const size_t ipos( size_ &
size_t(-2) );
2203 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2204 v_[i ] -= (~rhs)[i ];
2205 v_[i+1UL] -= (~rhs)[i+1UL];
2207 if( ipos < (~rhs).size() )
2208 v_[ipos] -= (~rhs)[ipos];
2224 template<
typename Type
2226 template<
typename VT >
2234 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2236 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2237 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2243 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2244 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2249 for( ; i<ipos; i+=SIMDSIZE ) {
2250 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2252 for( ; remainder && i<size_; ++i ) {
2253 *left -= *right; ++left; ++right;
2270 template<
typename Type
2272 template<
typename VT >
2277 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2278 v_[element->index()] -= element->value();
2294 template<
typename Type
2296 template<
typename VT >
2302 const size_t ipos( size_ &
size_t(-2) );
2305 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2306 v_[i ] *= (~rhs)[i ];
2307 v_[i+1UL] *= (~rhs)[i+1UL];
2309 if( ipos < (~rhs).size() )
2310 v_[ipos] *= (~rhs)[ipos];
2326 template<
typename Type
2328 template<
typename VT >
2336 constexpr
bool remainder( !usePadding || !IsPadded_v<VT> );
2338 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2339 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2345 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2346 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2351 for( ; i<ipos; i+=SIMDSIZE ) {
2352 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2354 for( ; remainder && i<size_; ++i ) {
2355 *left *= *right; ++left; ++right;
2372 template<
typename Type
2374 template<
typename VT >
2383 for(
auto element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2384 v_[element->index()] = tmp[element->index()] * element->value();
2400 template<
typename Type
2402 template<
typename VT >
2408 const size_t ipos( size_ &
size_t(-2) );
2411 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2412 v_[i ] /= (~rhs)[i ];
2413 v_[i+1UL] /= (~rhs)[i+1UL];
2415 if( ipos < (~rhs).size() )
2416 v_[ipos] /= (~rhs)[ipos];
2432 template<
typename Type
2434 template<
typename VT >
2442 const size_t ipos( size_ &
size_t(-SIMDSIZE) );
2449 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2450 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2455 for( ; i<ipos; i+=SIMDSIZE ) {
2456 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2458 for( ; i<size_; ++i ) {
2459 *left /= *right; ++left; ++right;
2476 template<
typename Type,
bool TF >
2477 void reset( DynamicVector<Type,TF>& v );
2479 template<
typename Type,
bool TF >
2480 void clear( DynamicVector<Type,TF>& v );
2482 template<
bool RF,
typename Type,
bool TF >
2483 bool isDefault(
const DynamicVector<Type,TF>& v );
2485 template<
typename Type,
bool TF >
2486 bool isIntact(
const DynamicVector<Type,TF>& v ) noexcept;
2488 template<
typename Type,
bool TF >
2489 void swap( DynamicVector<Type,TF>& a, DynamicVector<Type,TF>& b ) noexcept;
2501 template<
typename Type
2517 template<
typename Type
2555 return ( v.
size() == 0UL );
2578 template<
typename Type
2582 return v.isIntact();
2595 template<
typename Type
2614 template<
typename T,
bool TF >
2615 struct HasConstDataAccess< DynamicVector<T,TF> >
2632 template<
typename T,
bool TF >
2633 struct HasMutableDataAccess< DynamicVector<T,TF> >
2650 template<
typename T,
bool TF >
2651 struct IsAligned< DynamicVector<T,TF> >
2668 template<
typename T,
bool TF >
2669 struct IsContiguous< DynamicVector<T,TF> >
2686 template<
typename T,
bool TF >
2687 struct IsPadded< DynamicVector<T,TF> >
2704 template<
typename T,
bool TF >
2705 struct IsResizable< DynamicVector<T,TF> >
2722 template<
typename T,
bool TF >
2723 struct IsShrinkable< DynamicVector<T,TF> >
2740 template<
typename T1,
typename T2 >
2741 struct AddTraitEval2< T1, T2
2744 ( IsDenseVector_v<T1> || IsDenseVector_v<T2> ) &&
2750 using ET1 = ElementType_t<T1>;
2751 using ET2 = ElementType_t<T2>;
2753 using Type = DynamicVector< AddTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2769 template<
typename T1,
typename T2 >
2770 struct SubTraitEval2< T1, T2
2773 ( IsDenseVector_v<T1> || IsDenseVector_v<T2> ) &&
2779 using ET1 = ElementType_t<T1>;
2780 using ET2 = ElementType_t<T2>;
2782 using Type = DynamicVector< SubTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2798 template<
typename T1,
typename T2 >
2799 struct MultTraitEval2< T1, T2
2805 using ET1 = ElementType_t<T1>;
2807 using Type = DynamicVector< MultTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
2810 template<
typename T1,
typename T2 >
2811 struct MultTraitEval2< T1, T2
2813 IsDenseVector_v<T2> &&
2817 using ET2 = ElementType_t<T2>;
2819 using Type = DynamicVector< MultTrait_t<T1,ET2>, TransposeFlag_v<T2> >;
2822 template<
typename T1,
typename T2 >
2823 struct MultTraitEval2< T1, T2
2825 ( IsColumnVector_v<T1> && IsColumnVector_v<T2> ) ) &&
2826 IsDenseVector_v<T1> &&
2827 IsDenseVector_v<T2> &&
2833 using ET1 = ElementType_t<T1>;
2834 using ET2 = ElementType_t<T2>;
2836 using Type = DynamicVector< MultTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2839 template<
typename T1,
typename T2 >
2840 struct MultTraitEval2< T1, T2
2842 IsColumnVector_v<T2> &&
2843 ( IsDenseMatrix_v<T1> || IsDenseVector_v<T2> ) &&
2849 using ET1 = ElementType_t<T1>;
2850 using ET2 = ElementType_t<T2>;
2852 using Type = DynamicVector< MultTrait_t<ET1,ET2>,
false >;
2855 template<
typename T1,
typename T2 >
2856 struct MultTraitEval2< T1, T2
2859 ( IsDenseVector_v<T1> || IsDenseMatrix_v<T2> ) &&
2865 using ET1 = ElementType_t<T1>;
2866 using ET2 = ElementType_t<T2>;
2868 using Type = DynamicVector< MultTrait_t<ET1,ET2>,
true >;
2884 template<
typename T1,
typename T2 >
2885 struct DivTraitEval2< T1, T2
2891 using ET1 = ElementType_t<T1>;
2893 using Type = DynamicVector< DivTrait_t<ET1,T2>, TransposeFlag_v<T1> >;
2896 template<
typename T1,
typename T2 >
2897 struct DivTraitEval2< T1, T2
2899 IsDenseVector_v<T2> &&
2905 using ET1 = ElementType_t<T1>;
2906 using ET2 = ElementType_t<T2>;
2908 using Type = DynamicVector< DivTrait_t<ET1,ET2>, TransposeFlag_v<T1> >;
2924 template<
typename T,
typename OP >
2925 struct UnaryMapTraitEval2< T, OP
2930 using ET = ElementType_t<T>;
2932 using Type = DynamicVector< MapTrait_t<ET,OP>, TransposeFlag_v<T> >;
2940 template<
typename T1,
typename T2,
typename OP >
2941 struct BinaryMapTraitEval2< T1, T2, OP
2949 using ET1 = ElementType_t<T1>;
2950 using ET2 = ElementType_t<T2>;
2952 using Type = DynamicVector< MapTrait_t<ET1,ET2,OP>, TransposeFlag_v<T1> >;
2968 template<
typename T,
typename OP,
size_t RF >
2969 struct PartialReduceTraitEval2< T, OP, RF
2976 static constexpr
bool TF = ( RF == 0UL );
2978 using Type = DynamicVector< ElementType_t<T>, TF >;
2994 template<
typename T1,
bool TF,
typename T2 >
2995 struct HighType< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2997 using Type = DynamicVector< typename HighType<T1,T2>::Type, TF >;
3013 template<
typename T1,
bool TF,
typename T2 >
3014 struct LowType< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
3016 using Type = DynamicVector< typename LowType<T1,T2>::Type, TF >;
3032 template<
typename VT >
3033 struct SubvectorTraitEval2< VT,
inf,
inf 3038 using Type = DynamicVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
3054 template<
typename VT >
3055 struct ElementsTraitEval2< VT, 0UL
3060 using Type = DynamicVector< RemoveConst_t< ElementType_t<VT> >, TransposeFlag_v<VT> >;
3076 template<
typename MT,
size_t I >
3077 struct RowTraitEval2< MT, I
3082 using Type = DynamicVector< RemoveConst_t< ElementType_t<MT> >,
true >;
3098 template<
typename MT,
size_t I >
3099 struct ColumnTraitEval2< MT, I
3104 using Type = DynamicVector< RemoveConst_t< ElementType_t<MT> >,
false >;
3120 template<
typename MT, ptrdiff_t I >
3121 struct BandTraitEval2< MT, I
3128 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, a compilation error is created.
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:1949
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Store of a SIMD element of the vector.
Definition: DynamicVector.h:1863
Header file for auxiliary alias declarations.
Type *BLAZE_RESTRICT v_
The dynamically allocated vector elements.
Definition: DynamicVector.h:487
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, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Type * Pointer
Pointer to a non-constant vector value.
Definition: DynamicVector.h:213
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Aligned store of a SIMD element of the vector.
Definition: DynamicVector.h:1886
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:1325
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:188
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for the row trait.
size_t spacing() const noexcept
Returns the minimum capacity of the vector.
Definition: DynamicVector.h:1342
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
void clear()
Clearing the vector.
Definition: DynamicVector.h:1412
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:1979
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:1661
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: DynamicVector.h:1756
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: DynamicVector.h:250
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
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:2093
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:1918
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
ConstIterator cbegin() const noexcept
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:914
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:197
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:1801
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:3291
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:252
~DynamicVector()
The destructor for DynamicVector.
Definition: DynamicVector.h:746
Iterator begin() noexcept
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:886
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
Unaligned load of a SIMD element of the vector.
Definition: DynamicVector.h:1833
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:1450
Header file for the multiplication trait.
constexpr ptrdiff_t DefaultMaxSize_v
Default size of the MaxSize type trait.
Definition: MaxSize.h:72
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
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(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
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:2195
Header file for the IsShrinkable type trait.
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:189
Header file for all forward declarations of the math module.
#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.
DynamicVector() noexcept
The default constructor for DynamicVector.
Definition: DynamicVector.h:521
#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:1356
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:2297
Header file for the HasSIMDAdd type trait.
constexpr bool HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.The HasSIMDDiv_v variable template provides...
Definition: HasSIMDDiv.h:172
Header file for the DenseIterator class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
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:1394
Resize mechanism to obtain a DynamicVector with a different fixed number of elements.
Definition: DynamicVector.h:233
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition: DynamicVector.h:773
bool isAligned() const noexcept
Returns whether the vector is properly aligned in memory.
Definition: DynamicVector.h:1737
Header file for the IsAligned type trait.
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.The IsDenseVector_v variable template pr...
Definition: IsDenseVector.h:139
Constraint on the data type.
ConstIterator cend() const noexcept
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:956
size_t size_
The current size/dimension of the vector.
Definition: DynamicVector.h:485
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
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:140
#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:244
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
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:611
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:1778
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.The CrossTrait_t alias declaration prov...
Definition: CrossTrait.h:165
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:486
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicVector.h:208
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:207
DynamicVector< Type, TF > This
Type of this DynamicVector instance.
Definition: DynamicVector.h:202
Header file for run time assertion macros.
const Type & ConstReference
Reference to a constant vector value.
Definition: DynamicVector.h:212
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:405
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:856
Headerfile for the generic transfer algorithm.
Type & Reference
Reference to a non-constant vector value.
Definition: DynamicVector.h:211
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: DynamicVector.h:1500
size_t addPadding(size_t value) const noexcept
Add the necessary amount of padding to the given value.
Definition: DynamicVector.h:1596
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, a compilation error is created.
Definition: Reference.h:79
Rebind mechanism to obtain a DynamicVector with different data/element type.
Definition: DynamicVector.h:224
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:281
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.
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.The IsDenseMatrix_v variable template pr...
Definition: IsDenseMatrix.h:139
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:1518
#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 class template represents ...
Definition: IntegralConstant.h:101
void swap(DynamicVector &v) noexcept
Swapping the contents of two vectors.
Definition: DynamicVector.h:1574
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: DynamicVector.h:1373
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:2403
#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:1719
Type ElementType
Type of the vector elements.
Definition: DynamicVector.h:206
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: DynamicVector.h:1557
Iterator end() noexcept
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:928
Header file for the HasSIMDDiv type trait.
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.The IsRowVector_v variable template provid...
Definition: IsRowVector.h:143
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:186
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.
Header file for the alignment check function.
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:188
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:138
const Type * ConstPointer
Pointer to a constant vector value.
Definition: DynamicVector.h:214
DynamicVector & operator=(const Type &rhs)
Homogenous assignment to all vector elements.
Definition: DynamicVector.h:979
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:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
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:814
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:1699
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
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 TrueType type/value trait base class.
Header file for the clear shim.