35 #ifndef _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_
36 #define _BLAZE_MATH_DENSE_DYNAMICVECTOR_H_
174 template<
typename Type
201 template<
typename ET >
228 explicit inline
DynamicVector( initializer_list<Type> list );
230 template< typename Other >
231 explicit inline
DynamicVector(
size_t n, const Other* array );
233 template< typename Other,
size_t N >
238 template< typename VT > inline
DynamicVector( const Vector<VT,TF>& v );
252 inline Reference operator[](
size_t index ) noexcept;
253 inline ConstReference operator[](
size_t index ) const noexcept;
254 inline Reference
at(
size_t index );
255 inline ConstReference
at(
size_t index ) const;
256 inline Pointer
data () noexcept;
257 inline ConstPointer
data () const noexcept;
258 inline Iterator
begin () noexcept;
259 inline ConstIterator
begin () const noexcept;
260 inline ConstIterator
cbegin() const noexcept;
261 inline Iterator
end () noexcept;
262 inline ConstIterator
end () const noexcept;
263 inline ConstIterator
cend () const noexcept;
270 inline DynamicVector& operator=( const Type& rhs );
271 inline DynamicVector& operator=( initializer_list<Type> list );
273 template< typename Other,
size_t N >
274 inline DynamicVector& operator=( const Other (&array)[N] );
276 inline DynamicVector& operator=( const DynamicVector& rhs );
277 inline DynamicVector& operator=( DynamicVector&& rhs ) noexcept;
279 template< typename VT > inline DynamicVector& operator= ( const Vector<VT,TF>& rhs );
280 template< typename VT > inline DynamicVector& operator+=( const Vector<VT,TF>& rhs );
281 template< typename VT > inline DynamicVector& operator-=( const Vector<VT,TF>& rhs );
282 template< typename VT > inline DynamicVector& operator*=( const Vector<VT,TF>& rhs );
283 template< typename VT > inline DynamicVector& operator/=( const DenseVector<VT,TF>& rhs );
285 template< typename Other >
286 inline
EnableIf_<IsNumeric<Other>, DynamicVector >& operator*=( Other rhs );
288 template< typename Other >
289 inline
EnableIf_<IsNumeric<Other>, DynamicVector >& operator/=( Other rhs );
296 inline
size_t size() const noexcept;
297 inline
size_t capacity() const noexcept;
301 inline
void resize(
size_t n,
bool preserve=true );
302 inline
void extend(
size_t n,
bool preserve=true );
303 inline
void reserve(
size_t n );
304 template< typename Other > inline DynamicVector& scale( const Other& scalar );
305 inline
void swap( DynamicVector& v ) noexcept;
312 template< typename VT >
314 struct VectorizedAssign {
316 simdEnabled && VT::simdEnabled &&
317 AreSIMDCombinable< Type, ElementType_<VT> >::value };
324 template<
typename VT >
326 struct VectorizedAddAssign {
328 simdEnabled && VT::simdEnabled &&
329 AreSIMDCombinable< Type, ElementType_<VT> >::value &&
330 HasSIMDAdd< Type, ElementType_<VT> >::value };
337 template<
typename VT >
339 struct VectorizedSubAssign {
341 simdEnabled && VT::simdEnabled &&
342 AreSIMDCombinable< Type, ElementType_<VT> >::value &&
343 HasSIMDSub< Type, ElementType_<VT> >::value };
350 template<
typename VT >
352 struct VectorizedMultAssign {
354 simdEnabled && VT::simdEnabled &&
355 AreSIMDCombinable< Type, ElementType_<VT> >::value &&
356 HasSIMDMult< Type, ElementType_<VT> >::value };
363 template<
typename VT >
365 struct VectorizedDivAssign {
367 simdEnabled && VT::simdEnabled &&
368 AreSIMDCombinable< Type, ElementType_<VT> >::value &&
369 HasSIMDDiv< Type, ElementType_<VT> >::value };
383 inline bool isIntact() const noexcept;
390 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
391 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
405 template< typename VT >
406 inline
DisableIf_<VectorizedAssign<VT> > assign( const DenseVector<VT,TF>& rhs );
408 template< typename VT >
409 inline
EnableIf_<VectorizedAssign<VT> > assign( const DenseVector<VT,TF>& rhs );
411 template< typename VT > inline
void assign( const SparseVector<VT,TF>& rhs );
413 template< typename VT >
414 inline
DisableIf_<VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,TF>& rhs );
416 template< typename VT >
417 inline
EnableIf_<VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,TF>& rhs );
419 template< typename VT > inline
void addAssign( const SparseVector<VT,TF>& rhs );
421 template< typename VT >
422 inline
DisableIf_<VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,TF>& rhs );
424 template< typename VT >
425 inline
EnableIf_<VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,TF>& rhs );
427 template< typename VT > inline
void subAssign( const SparseVector<VT,TF>& rhs );
429 template< typename VT >
430 inline
DisableIf_<VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,TF>& rhs );
432 template< typename VT >
433 inline
EnableIf_<VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,TF>& rhs );
435 template< typename VT > inline
void multAssign( const SparseVector<VT,TF>& rhs );
437 template< typename VT >
438 inline
DisableIf_<VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,TF>& rhs );
440 template< typename VT >
441 inline
EnableIf_<VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,TF>& rhs );
449 inline
size_t adjustCapacity(
size_t minCapacity ) const noexcept;
490 template< typename Type
508 template<
typename Type
533 template<
typename Type
540 for(
size_t i=0UL; i<
size_; ++i )
568 template<
typename Type
571 : size_ ( list.
size() )
575 std::fill( std::copy( list.begin(), list.end(),
v_ ),
v_+
capacity_, Type() );
602 template<
typename Type
604 template<
typename Other >
610 for(
size_t i=0UL; i<n; ++i )
640 template<
typename Type
642 template<
typename Other
649 for(
size_t i=0UL; i<N; ++i )
670 template<
typename Type
692 template<
typename Type
711 template<
typename Type
713 template<
typename VT >
715 : size_ ( (~v).
size() )
742 template<
typename Type
768 template<
typename Type
788 template<
typename Type
809 template<
typename Type
814 if( index >= size_ ) {
817 return (*
this)[index];
832 template<
typename Type
837 if( index >= size_ ) {
840 return (*
this)[index];
852 template<
typename Type
868 template<
typename Type
882 template<
typename Type
896 template<
typename Type
910 template<
typename Type
924 template<
typename Type
938 template<
typename Type
952 template<
typename Type
975 template<
typename Type
979 for(
size_t i=0UL; i<size_; ++i )
1002 template<
typename Type
1006 resize( list.size(), false );
1007 std::copy( list.begin(), list.end(), v_ );
1032 template<
typename Type
1034 template<
typename Other
1040 for(
size_t i=0UL; i<N; ++i )
1057 template<
typename Type
1061 if( &rhs ==
this )
return *
this;
1079 template<
typename Type
1090 rhs.capacity_ = 0UL;
1106 template<
typename Type
1108 template<
typename VT >
1111 if( (~rhs).canAlias(
this ) ) {
1139 template<
typename Type
1141 template<
typename VT >
1144 if( (~rhs).
size() != size_ ) {
1148 if( (~rhs).canAlias(
this ) ) {
1174 template<
typename Type
1176 template<
typename VT >
1179 if( (~rhs).
size() != size_ ) {
1183 if( (~rhs).canAlias(
this ) ) {
1209 template<
typename Type
1211 template<
typename VT >
1214 if( (~rhs).
size() != size_ ) {
1243 template<
typename Type
1245 template<
typename VT >
1248 if( (~rhs).
size() != size_ ) {
1252 if( (~rhs).canAlias(
this ) ) {
1274 template<
typename Type
1276 template<
typename Other >
1298 template<
typename Type
1300 template<
typename Other >
1328 template<
typename Type
1342 template<
typename Type
1359 template<
typename Type
1363 size_t nonzeros( 0 );
1365 for(
size_t i=0UL; i<size_; ++i ) {
1380 template<
typename Type
1385 for(
size_t i=0UL; i<size_; ++i )
1398 template<
typename Type
1436 template<
typename Type
1443 const size_t newCapacity( adjustCapacity( n ) );
1452 for(
size_t i=size_; i<newCapacity; ++i )
1463 for(
size_t i=n; i<size_; ++i )
1484 template<
typename Type
1488 resize( size_+n, preserve );
1502 template<
typename Type
1509 const size_t newCapacity( adjustCapacity( n ) );
1516 for(
size_t i=size_; i<newCapacity; ++i )
1535 template<
typename Type
1537 template<
typename Other >
1540 for(
size_t i=0UL; i<size_; ++i )
1553 template<
typename Type
1570 template<
typename Type
1575 return nextMultiple<size_t>( minCapacity, SIMDSIZE );
1576 else return minCapacity;
1598 template<
typename Type
1606 for(
size_t i=size_; i<
capacity_; ++i ) {
1607 if( v_[i] != Type() )
1635 template<
typename Type
1637 template<
typename Other >
1640 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1655 template<
typename Type
1657 template<
typename Other >
1660 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1674 template<
typename Type
1693 template<
typename Type
1697 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1714 template<
typename Type
1719 return loada( index );
1737 template<
typename Type
1751 return loada( v_+index );
1769 template<
typename Type
1781 return loadu( v_+index );
1799 template<
typename Type
1822 template<
typename Type
1836 storea( v_+index, value );
1854 template<
typename Type
1866 storeu( v_+index, value );
1885 template<
typename Type
1899 stream( v_+index, value );
1915 template<
typename Type
1917 template<
typename VT >
1923 const size_t ipos( size_ &
size_t(-2) );
1926 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1927 v_[i ] = (~rhs)[i ];
1928 v_[i+1UL] = (~rhs)[i+1UL];
1930 if( ipos < (~rhs).size() )
1931 v_[ipos] = (~rhs)[ipos];
1947 template<
typename Type
1949 template<
typename VT >
1959 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
1960 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
1963 Iterator left(
begin() );
1968 for( ; i<ipos; i+=SIMDSIZE ) {
1969 left.
stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1971 for( ; remainder && i<size_; ++i ) {
1972 *left = *right; ++left; ++right;
1977 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
1978 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1979 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1980 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1981 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1983 for( ; i<ipos; i+=SIMDSIZE ) {
1984 left.
store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1986 for( ; remainder && i<size_; ++i ) {
1987 *left = *right; ++left; ++right;
2005 template<
typename Type
2007 template<
typename VT >
2013 v_[element->index()] = element->value();
2029 template<
typename Type
2031 template<
typename VT >
2037 const size_t ipos( size_ &
size_t(-2) );
2040 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2041 v_[i ] += (~rhs)[i ];
2042 v_[i+1UL] += (~rhs)[i+1UL];
2044 if( ipos < (~rhs).size() )
2045 v_[ipos] += (~rhs)[ipos];
2061 template<
typename Type
2063 template<
typename VT >
2073 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2074 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2077 Iterator left(
begin() );
2080 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2081 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2082 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2083 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2084 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2086 for( ; i<ipos; i+=SIMDSIZE ) {
2087 left.
store( left.
load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2089 for( ; remainder && i<size_; ++i ) {
2090 *left += *right; ++left; ++right;
2107 template<
typename Type
2109 template<
typename VT >
2115 v_[element->index()] += element->value();
2131 template<
typename Type
2133 template<
typename VT >
2139 const size_t ipos( size_ &
size_t(-2) );
2142 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2143 v_[i ] -= (~rhs)[i ];
2144 v_[i+1UL] -= (~rhs)[i+1UL];
2146 if( ipos < (~rhs).size() )
2147 v_[ipos] -= (~rhs)[ipos];
2163 template<
typename Type
2165 template<
typename VT >
2175 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2176 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2179 Iterator left(
begin() );
2182 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2183 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2184 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2185 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2186 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2188 for( ; i<ipos; i+=SIMDSIZE ) {
2189 left.
store( left.
load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2191 for( ; remainder && i<size_; ++i ) {
2192 *left -= *right; ++left; ++right;
2209 template<
typename Type
2211 template<
typename VT >
2217 v_[element->index()] -= element->value();
2233 template<
typename Type
2235 template<
typename VT >
2241 const size_t ipos( size_ &
size_t(-2) );
2244 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2245 v_[i ] *= (~rhs)[i ];
2246 v_[i+1UL] *= (~rhs)[i+1UL];
2248 if( ipos < (~rhs).size() )
2249 v_[ipos] *= (~rhs)[ipos];
2265 template<
typename Type
2267 template<
typename VT >
2277 const size_t ipos( ( remainder )?( size_ &
size_t(-SIMDSIZE) ):( size_ ) );
2278 BLAZE_INTERNAL_ASSERT( !remainder || ( size_ - ( size_ % (SIMDSIZE) ) ) == ipos,
"Invalid end calculation" );
2281 Iterator left(
begin() );
2284 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2285 left.
store( left.
load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2286 left.
store( left.
load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2287 left.
store( left.
load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2288 left.
store( left.
load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2290 for( ; i<ipos; i+=SIMDSIZE ) {
2291 left.
store( left.
load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2293 for( ; remainder && i<size_; ++i ) {
2294 *left *= *right; ++left; ++right;
2311 template<
typename Type
2313 template<
typename VT >
2323 v_[element->index()] = tmp[element->index()] * element->value();
2339 template<
typename Type
2341 template<
typename VT >
2347 const size_t ipos( size_ &
size_t(-2) );
2350 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2351 v_[i ] /= (~rhs)[i ];
2352 v_[i+1UL] /= (~rhs)[i+1UL];
2354 if( ipos < (~rhs).size() )
2355 v_[ipos] /= (~rhs)[ipos];
2371 template<
typename Type
2373 template<
typename VT >
2381 const size_t ipos( size_ &
size_t(-SIMDSIZE) );
2385 Iterator left(
begin() );
2388 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2389 left.
store( left.
load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2390 left.
store( left.
load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2391 left.
store( left.
load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2392 left.
store( left.
load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2394 for( ; i<ipos; i+=SIMDSIZE ) {
2395 left.
store( left.
load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2397 for( ; i<size_; ++i ) {
2398 *left /= *right; ++left; ++right;
2415 template<
typename Type,
bool TF >
2418 template<
typename Type,
bool TF >
2421 template<
typename Type,
bool TF >
2424 template<
typename Type,
bool TF >
2427 template<
typename Type,
bool TF >
2440 template<
typename Type
2456 template<
typename Type
2482 template<
typename Type
2486 return ( v.
size() == 0UL );
2509 template<
typename Type
2513 return v.isIntact();
2526 template<
typename Type
2545 template<
typename T,
bool TF >
2546 struct HasConstDataAccess< DynamicVector<T,TF> > :
public TrueType
2562 template<
typename T,
bool TF >
2563 struct HasMutableDataAccess< DynamicVector<T,TF> > :
public TrueType
2579 template<
typename T,
bool TF >
2580 struct IsAligned< DynamicVector<T,TF> > :
public TrueType
2596 template<
typename T,
bool TF >
2597 struct IsPadded< DynamicVector<T,TF> > :
public BoolConstant<usePadding>
2613 template<
typename T,
bool TF >
2614 struct IsResizable< DynamicVector<T,TF> > :
public TrueType
2630 template<
typename T1,
bool TF,
typename T2,
size_t N >
2631 struct AddTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2633 using Type = StaticVector< AddTrait_<T1,T2>, N, TF >;
2636 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2637 struct AddTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2639 using Type = StaticVector< AddTrait_<T1,T2>, N, TF >;
2642 template<
typename T1,
bool TF,
typename T2,
size_t N >
2643 struct AddTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2645 using Type = HybridVector< AddTrait_<T1,T2>, N, TF >;
2648 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2649 struct AddTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2651 using Type = HybridVector< AddTrait_<T1,T2>, N, TF >;
2654 template<
typename T1,
bool TF,
typename T2 >
2655 struct AddTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2657 using Type = DynamicVector< AddTrait_<T1,T2>, TF >;
2673 template<
typename T1,
bool TF,
typename T2,
size_t N >
2674 struct SubTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2676 using Type = StaticVector< SubTrait_<T1,T2>, N, TF >;
2679 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2680 struct SubTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2682 using Type = StaticVector< SubTrait_<T1,T2>, N, TF >;
2685 template<
typename T1,
bool TF,
typename T2,
size_t N >
2686 struct SubTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2688 using Type = HybridVector< SubTrait_<T1,T2>, N, TF >;
2691 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2692 struct SubTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2694 using Type = HybridVector< SubTrait_<T1,T2>, N, TF >;
2697 template<
typename T1,
bool TF,
typename T2 >
2698 struct SubTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2700 using Type = DynamicVector< SubTrait_<T1,T2>, TF >;
2716 template<
typename T1,
bool TF,
typename T2 >
2717 struct MultTrait< DynamicVector<T1,TF>, T2,
EnableIf_<IsNumeric<T2> > >
2719 using Type = DynamicVector< MultTrait_<T1,T2>, TF >;
2722 template<
typename T1,
typename T2,
bool TF >
2723 struct MultTrait< T1, DynamicVector<T2,TF>,
EnableIf_<IsNumeric<T1> > >
2725 using Type = DynamicVector< MultTrait_<T1,T2>, TF >;
2728 template<
typename T1,
bool TF,
typename T2,
size_t N >
2729 struct MultTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2731 using Type = StaticVector< MultTrait_<T1,T2>, N, TF >;
2734 template<
typename T1,
typename T2,
size_t N >
2735 struct MultTrait< DynamicVector<T1,false>, StaticVector<T2,N,true> >
2737 using Type = DynamicMatrix< MultTrait_<T1,T2>,
false >;
2740 template<
typename T1,
typename T2,
size_t N >
2741 struct MultTrait< DynamicVector<T1,true>, StaticVector<T2,N,false> >
2743 using Type = MultTrait_<T1,T2>;
2746 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2747 struct MultTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2749 using Type = StaticVector< MultTrait_<T1,T2>, N, TF >;
2752 template<
typename T1,
size_t N,
typename T2 >
2753 struct MultTrait< StaticVector<T1,N,false>, DynamicVector<T2,true> >
2755 using Type = DynamicMatrix< MultTrait_<T1,T2>,
false >;
2758 template<
typename T1,
size_t N,
typename T2 >
2759 struct MultTrait< StaticVector<T1,N,true>, DynamicVector<T2,false> >
2761 using Type = MultTrait_<T1,T2>;
2764 template<
typename T1,
bool TF,
typename T2,
size_t N >
2765 struct MultTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2767 using Type = HybridVector< MultTrait_<T1,T2>, N, TF >;
2770 template<
typename T1,
typename T2,
size_t N >
2771 struct MultTrait< DynamicVector<T1,false>, HybridVector<T2,N,true> >
2773 using Type = DynamicMatrix< MultTrait_<T1,T2>,
false >;
2776 template<
typename T1,
typename T2,
size_t N >
2777 struct MultTrait< DynamicVector<T1,true>, HybridVector<T2,N,false> >
2779 using Type = MultTrait_<T1,T2>;
2782 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2783 struct MultTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2785 using Type = HybridVector< MultTrait_<T1,T2>, N, TF >;
2788 template<
typename T1,
size_t N,
typename T2 >
2789 struct MultTrait< HybridVector<T1,N,false>, DynamicVector<T2,true> >
2791 using Type = DynamicMatrix< MultTrait_<T1,T2>,
false >;
2794 template<
typename T1,
size_t N,
typename T2 >
2795 struct MultTrait< HybridVector<T1,N,true>, DynamicVector<T2,false> >
2797 using Type = MultTrait_<T1,T2>;
2800 template<
typename T1,
bool TF,
typename T2 >
2801 struct MultTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2803 using Type = DynamicVector< MultTrait_<T1,T2>, TF >;
2806 template<
typename T1,
typename T2 >
2807 struct MultTrait< DynamicVector<T1,false>, DynamicVector<T2,true> >
2809 using Type = DynamicMatrix< MultTrait_<T1,T2>,
false >;
2812 template<
typename T1,
typename T2 >
2813 struct MultTrait< DynamicVector<T1,true>, DynamicVector<T2,false> >
2815 using Type = MultTrait_<T1,T2>;
2831 template<
typename T1,
bool TF,
typename T2 >
2832 struct CrossTrait< DynamicVector<T1,TF>, StaticVector<T2,3UL,TF> >
2835 using T = MultTrait_<T1,T2>;
2838 using Type = StaticVector< SubTrait_<T,T>, 3UL, TF >;
2841 template<
typename T1,
bool TF,
typename T2 >
2842 struct CrossTrait< StaticVector<T1,3UL,TF>, DynamicVector<T2,TF> >
2845 using T = MultTrait_<T1,T2>;
2848 using Type = StaticVector< SubTrait_<T,T>, 3UL, TF >;
2851 template<
typename T1,
bool TF,
typename T2,
size_t N >
2852 struct CrossTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2855 using T = MultTrait_<T1,T2>;
2858 using Type = StaticVector< SubTrait_<T,T>, 3UL, TF >;
2861 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2862 struct CrossTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2865 using T = MultTrait_<T1,T2>;
2868 using Type = StaticVector< SubTrait_<T,T>, 3UL, TF >;
2871 template<
typename T1,
bool TF,
typename T2 >
2872 struct CrossTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2875 using T = MultTrait_<T1,T2>;
2878 using Type = StaticVector< SubTrait_<T,T>, 3UL, TF >;
2894 template<
typename T1,
bool TF,
typename T2 >
2895 struct DivTrait< DynamicVector<T1,TF>, T2,
EnableIf_<IsNumeric<T2> > >
2897 using Type = DynamicVector< DivTrait_<T1,T2>, TF >;
2900 template<
typename T1,
bool TF,
typename T2,
size_t N >
2901 struct DivTrait< DynamicVector<T1,TF>, StaticVector<T2,N,TF> >
2903 using Type = StaticVector< DivTrait_<T1,T2>, N, TF >;
2906 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2907 struct DivTrait< StaticVector<T1,N,TF>, DynamicVector<T2,TF> >
2909 using Type = StaticVector< DivTrait_<T1,T2>, N, TF >;
2912 template<
typename T1,
bool TF,
typename T2,
size_t N >
2913 struct DivTrait< DynamicVector<T1,TF>, HybridVector<T2,N,TF> >
2915 using Type = HybridVector< DivTrait_<T1,T2>, N, TF >;
2918 template<
typename T1,
size_t N,
bool TF,
typename T2 >
2919 struct DivTrait< HybridVector<T1,N,TF>, DynamicVector<T2,TF> >
2921 using Type = HybridVector< DivTrait_<T1,T2>, N, TF >;
2924 template<
typename T1,
bool TF,
typename T2 >
2925 struct DivTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2927 using Type = DynamicVector< DivTrait_<T1,T2>, TF >;
2943 template<
typename T1,
bool TF,
typename T2 >
2944 struct MathTrait< DynamicVector<T1,TF>, DynamicVector<T2,TF> >
2946 using HighType = DynamicVector< typename MathTrait<T1,T2>::HighType, TF >;
2947 using LowType = DynamicVector< typename MathTrait<T1,T2>::LowType , TF >;
2963 template<
typename T1,
bool TF >
2964 struct SubvectorTrait< DynamicVector<T1,TF> >
2966 using Type = DynamicVector<T1,TF>;
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:133
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:1888
BLAZE_ALWAYS_INLINE void store(size_t index, const SIMDType &value) noexcept
Store of a SIMD element of the vector.
Definition: DynamicVector.h:1802
Header file for auxiliary alias declarations.
DenseIterator< Type, aligned > Iterator
Iterator over non-constant elements.
Definition: DynamicVector.h:194
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
Type *BLAZE_RESTRICT v_
The dynamically allocated vector elements.
Definition: DynamicVector.h:458
BLAZE_ALWAYS_INLINE SIMDType load(size_t index) const noexcept
Load of a SIMD element of the vector.
Definition: DynamicVector.h:1717
Header file for mathematical functions.
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
#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.
BLAZE_ALWAYS_INLINE void storea(size_t index, const SIMDType &value) noexcept
Aligned store of a SIMD element of the vector.
Definition: DynamicVector.h:1825
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the SparseVector base class.
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: DynamicVector.h:1361
bool isAligned() const noexcept
Returns whether the vector is properly aligned in memory.
Definition: DynamicVector.h:1676
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
void clear()
Clearing the vector.
Definition: DynamicVector.h:1400
Header file for the serial shim.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
constexpr size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
SIMDTrait_< ElementType > SIMDType
SIMD type of the vector elements.
Definition: DynamicVector.h:185
bool canSMPAssign() const noexcept
Returns whether the vector can be used in SMP assignments.
Definition: DynamicVector.h:1695
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:315
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const Type * ConstPointer
Pointer to a constant vector value.
Definition: DynamicVector.h:192
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Algorithm.h:71
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:1857
#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
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
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
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:176
Header file for memory allocation and deallocation functionality.
System settings for performance optimizations.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
DenseVector< This, TF > BaseType
Base type of this DynamicVector instance.
Definition: DynamicVector.h:181
bool canAlias(const Other *alias) const noexcept
Returns whether the vector can alias with the given address alias.
Definition: DynamicVector.h:1638
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t index) const noexcept
Unaligned load of a SIMD element of the vector.
Definition: DynamicVector.h:1772
ConstIterator cend() const noexcept
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:954
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2807
Header file for the std::initializer_list aliases.
~DynamicVector()
The destructor for DynamicVector.
Definition: DynamicVector.h:744
Iterator begin() noexcept
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:884
EnableIf_< IsBuiltin< T >, T * > allocate(size_t size)
Aligned array allocation for built-in data types.
Definition: Memory.h:150
DynamicVector< ET, TF > Other
The type of the other DynamicVector.
Definition: DynamicVector.h:203
DenseIterator< const Type, aligned > ConstIterator
Iterator over constant elements.
Definition: DynamicVector.h:195
Header file for the DisableIf class template.
This ResultType
Result type for expression template evaluations.
Definition: DynamicVector.h:182
void resize(size_t n, bool preserve=true)
Changing the size of the vector.
Definition: DynamicVector.h:1438
Header file for the multiplication trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
bool isIntact() const noexcept
Returns whether the invariants of the dynamic vector are intact.
Definition: DynamicVector.h:1600
Header file for nested template disabiguation.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5148
constexpr bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.This value specifies the default tran...
Definition: TransposeFlag.h:56
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
const Type & ReturnType
Return type for expression template evaluations.
Definition: DynamicVector.h:186
#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.
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
DynamicVector() noexcept
The default constructor for DynamicVector.
Definition: DynamicVector.h:492
#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
void stream(const SIMDType &value) const noexcept
Aligned, non-temporal store of the SIMD element at the current iterator position. ...
Definition: DenseIterator.h:531
Header file for the HasSIMDAdd type trait.
Header file for the DenseIterator class template.
size_t capacity() const noexcept
Returns the maximum capacity of the vector.
Definition: DynamicVector.h:1344
size_t adjustCapacity(size_t minCapacity) const noexcept
Adjusting the new capacity of the vector according to its data type Type.
Definition: DynamicVector.h:1572
Header file for the subvector trait.
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:70
Compile time check for sparse vector types.This type trait tests whether or not the given template pa...
Definition: IsSparseVector.h:78
void reset()
Reset to the default initial values.
Definition: DynamicVector.h:1382
Reference operator[](size_t index) noexcept
Subscript operator for the direct access to the vector elements.
Definition: DynamicVector.h:771
Header file for the IsAligned type trait.
size_t size_
The current size/dimension of the vector.
Definition: DynamicVector.h:456
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
#define BLAZE_RESTRICT
Platform dependent setup of the restrict keyword.
Definition: Restrict.h:81
Type & Reference
Reference to a non-constant vector value.
Definition: DynamicVector.h:189
#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
const Type & ConstReference
Reference to a constant vector value.
Definition: DynamicVector.h:190
Header file for the exception macros of the math module.
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:119
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE 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:254
Headerfile for generic algorithms.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsPadded type trait.
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:457
size_t size() const noexcept
Returns the current size/dimension of the vector.
Definition: DynamicVector.h:1330
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< 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:75
Header file for the IsSparseVector type trait.
Header file for the HasSIMDMult type trait.
BLAZE_ALWAYS_INLINE SIMDType loada(size_t index) const noexcept
Aligned load of a SIMD element of the vector.
Definition: DynamicVector.h:1740
Header file for run time assertion macros.
ConstIterator cbegin() const noexcept
Returns an iterator to the first element of the dynamic vector.
Definition: DynamicVector.h:912
Header file for the addition trait.
Header file for the cross product trait.
const SIMDType load() const noexcept
Load of the SIMD element at the current iterator position.
Definition: DenseIterator.h:403
Header file for the division trait.
Constraint on the data type.
Pointer data() noexcept
Low-level data access to the vector elements.
Definition: DynamicVector.h:854
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
const DynamicVector & CompositeType
Data type for composite expression templates.
Definition: DynamicVector.h:187
void extend(size_t n, bool preserve=true)
Extending the size of the vector.
Definition: DynamicVector.h:1486
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
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
Rebind mechanism to obtain a DynamicVector with different data/element type.
Definition: DynamicVector.h:202
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:258
System settings for the restrict keyword.
Type ElementType
Type of the vector elements.
Definition: DynamicVector.h:184
Type * Pointer
Pointer to a non-constant vector value.
Definition: DynamicVector.h:191
Constraint on the data type.
Header file for the HasSIMDSub type trait.
Header file for the HasMutableDataAccess type trait.
void reserve(size_t n)
Setting the minimum capacity of the vector.
Definition: DynamicVector.h:1504
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
void swap(DynamicVector &v) noexcept
Swapping the contents of two vectors.
Definition: DynamicVector.h:1555
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:225
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
Header file for the mathematical trait.
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Header file for the AreSIMDCombinable type trait.
constexpr bool usePadding
Configuration of the padding of dense vectors and matrices.This configuration switch enables/disables...
Definition: Optimizations.h:52
Iterator end() noexcept
Returns an iterator just past the last element of the dynamic vector.
Definition: DynamicVector.h:926
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:154
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.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:110
DynamicVector & operator=(const Type &rhs)
Homogenous assignment to all vector elements.
Definition: DynamicVector.h:977
Header file for the IntegralConstant class template.
bool isAliased(const Other *alias) const noexcept
Returns whether the vector is aliased with the given address alias.
Definition: DynamicVector.h:1658
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
Reference at(size_t index)
Checked access to the vector elements.
Definition: DynamicVector.h:812
void store(const SIMDType &value) const noexcept
Store of the SIMD element at the current iterator position.
Definition: DenseIterator.h:468
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
Header file for the TrueType type/value trait base class.
DynamicVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: DynamicVector.h:183
DynamicVector< Type, TF > This
Type of this DynamicVector instance.
Definition: DynamicVector.h:180