35 #ifndef _BLAZE_MATH_DENSE_CUSTOMVECTOR_H_
36 #define _BLAZE_MATH_DENSE_CUSTOMVECTOR_H_
44 #include <boost/smart_ptr/shared_array.hpp>
412 template<
typename Type
445 template<
typename ET >
471 explicit inline CustomVector( Type* ptr,
size_t n,
size_t nn );
473 template<
typename Deleter >
474 explicit inline CustomVector( Type* ptr,
size_t n, Deleter d );
476 template<
typename Deleter >
477 explicit inline CustomVector( Type* ptr,
size_t n,
size_t nn, Deleter d );
491 inline ConstReference
operator[](
size_t index )
const;
492 inline Reference
at(
size_t index );
493 inline ConstReference
at(
size_t index )
const;
494 inline Pointer
data ();
495 inline ConstPointer
data ()
const;
496 inline Iterator
begin ();
497 inline ConstIterator
begin ()
const;
498 inline ConstIterator
cbegin()
const;
499 inline Iterator
end ();
500 inline ConstIterator
end ()
const;
501 inline ConstIterator
cend ()
const;
508 template<
typename Other,
size_t N >
509 inline CustomVector& operator=(
const Other (&array)[N] );
513 template<
typename VT >
inline CustomVector& operator= (
const Vector<VT,TF>& rhs );
514 template<
typename VT >
inline CustomVector& operator+=(
const Vector<VT,TF>& rhs );
515 template<
typename VT >
inline CustomVector& operator-=(
const Vector<VT,TF>& rhs );
516 template<
typename VT >
inline CustomVector& operator*=(
const Vector<VT,TF>& rhs );
518 template<
typename Other >
519 inline typename EnableIf< IsNumeric<Other>,
CustomVector >::Type&
520 operator*=( Other rhs );
522 template<
typename Other >
523 inline typename EnableIf< IsNumeric<Other>,
CustomVector >::Type&
524 operator/=( Other rhs );
531 inline size_t size()
const;
536 template<
typename Other >
inline CustomVector& scale(
const Other& scalar );
544 inline void reset( Type* ptr,
size_t n );
545 inline void reset( Type* ptr,
size_t n,
size_t nn );
546 template<
typename Deleter >
inline void reset( Type* ptr,
size_t n, Deleter d );
547 template<
typename Deleter >
inline void reset( Type* ptr,
size_t n,
size_t nn, Deleter d );
554 template<
typename VT >
556 struct VectorizedAssign {
558 vectorizable && VT::vectorizable &&
559 IsSame<Type,typename VT::ElementType>::value };
566 template<
typename VT >
568 struct VectorizedAddAssign {
570 vectorizable && VT::vectorizable &&
571 IsSame<Type,typename VT::ElementType>::value &&
572 IntrinsicTrait<Type>::addition };
579 template<
typename VT >
581 struct VectorizedSubAssign {
583 vectorizable && VT::vectorizable &&
584 IsSame<Type,typename VT::ElementType>::value &&
585 IntrinsicTrait<Type>::subtraction };
592 template<
typename VT >
594 struct VectorizedMultAssign {
596 vectorizable && VT::vectorizable &&
597 IsSame<Type,typename VT::ElementType>::value &&
598 IntrinsicTrait<Type>::multiplication };
607 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
608 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
622 template<
typename VT >
623 inline typename DisableIf< VectorizedAssign<VT> >::Type
624 assign(
const DenseVector<VT,TF>& rhs );
626 template<
typename VT >
627 inline typename EnableIf< VectorizedAssign<VT> >::Type
628 assign(
const DenseVector<VT,TF>& rhs );
630 template<
typename VT >
inline void assign(
const SparseVector<VT,TF>& rhs );
632 template<
typename VT >
633 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
634 addAssign(
const DenseVector<VT,TF>& rhs );
636 template<
typename VT >
637 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
638 addAssign(
const DenseVector<VT,TF>& rhs );
640 template<
typename VT >
inline void addAssign(
const SparseVector<VT,TF>& rhs );
642 template<
typename VT >
643 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
644 subAssign(
const DenseVector<VT,TF>& rhs );
646 template<
typename VT >
647 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
648 subAssign(
const DenseVector<VT,TF>& rhs );
650 template<
typename VT >
inline void subAssign(
const SparseVector<VT,TF>& rhs );
652 template<
typename VT >
653 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
654 multAssign(
const DenseVector<VT,TF>& rhs );
656 template<
typename VT >
657 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
658 multAssign(
const DenseVector<VT,TF>& rhs );
660 template<
typename VT >
inline void multAssign(
const SparseVector<VT,TF>& rhs );
669 boost::shared_array<Type>
v_;
701 template<
typename Type
730 template<
typename Type
773 template<
typename Type
783 BLAZE_UNUSED_PARAMETER( ptr, n, nn );
806 template<
typename Type
810 template<
typename Deleter >
850 template<
typename Type
854 template<
typename Deleter >
861 BLAZE_UNUSED_PARAMETER( ptr, n, nn, d );
873 template<
typename Type
901 template<
typename Type
923 template<
typename Type
946 template<
typename Type
953 if( index >= size_ ) {
956 return (*
this)[index];
971 template<
typename Type
978 if( index >= size_ ) {
981 return (*
this)[index];
993 template<
typename Type
1011 template<
typename Type
1027 template<
typename Type
1043 template<
typename Type
1059 template<
typename Type
1075 template<
typename Type
1081 return Iterator( v_.get() + size_ );
1091 template<
typename Type
1107 template<
typename Type
1153 template<
typename Type
1157 template<
typename Other
1165 for(
size_t i=0UL; i<N; ++i )
1179 template<
typename Type
1185 for(
size_t i=0UL; i<size_; ++i )
1202 template<
typename Type
1208 if( rhs.
size() != size_ ) {
1229 template<
typename Type
1233 template<
typename VT >
1236 if( (~rhs).
size() != size_ ) {
1240 if( (~rhs).canAlias(
this ) ) {
1265 template<
typename Type
1269 template<
typename VT >
1272 if( (~rhs).
size() != size_ ) {
1276 if( (~rhs).canAlias(
this ) ) {
1300 template<
typename Type
1304 template<
typename VT >
1307 if( (~rhs).
size() != size_ ) {
1311 if( (~rhs).canAlias(
this ) ) {
1335 template<
typename Type
1339 template<
typename VT >
1350 if( (~rhs).
size() != size_ ) {
1355 const MultType tmp( *
this * (~rhs) );
1356 this->operator=( tmp );
1374 template<
typename Type
1378 template<
typename Other >
1397 template<
typename Type
1401 template<
typename Other >
1426 template<
typename Type
1442 template<
typename Type
1461 template<
typename Type
1467 size_t nonzeros( 0 );
1469 for(
size_t i=0UL; i<size_; ++i ) {
1484 template<
typename Type
1491 for(
size_t i=0UL; i<size_; ++i )
1505 template<
typename Type
1523 template<
typename Type
1527 template<
typename Other >
1530 for(
size_t i=0UL; i<size_; ++i )
1544 template<
typename Type
1588 template<
typename Type
1625 template<
typename Type
1633 BLAZE_UNUSED_PARAMETER( ptr, n, nn );
1660 template<
typename Type
1664 template<
typename Deleter >
1698 template<
typename Type
1702 template<
typename Deleter >
1707 BLAZE_UNUSED_PARAMETER( ptr, n, nn, d );
1730 template<
typename Type
1734 template<
typename Other >
1737 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1752 template<
typename Type
1756 template<
typename Other >
1759 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1773 template<
typename Type
1794 template<
typename Type
1800 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1818 template<
typename Type
1826 return loada( index );
1828 return loadu( index );
1846 template<
typename Type
1862 return loada( v_.get()+index );
1880 template<
typename Type
1894 return loadu( v_.get()+index );
1913 template<
typename Type
1941 template<
typename Type
1956 storea( v_.get()+index, value );
1975 template<
typename Type
1988 storeu( v_.get()+index, value );
2007 template<
typename Type
2022 stream( v_.get()+index, value );
2038 template<
typename Type
2042 template<
typename VT >
2048 const size_t ipos( size_ &
size_t(-2) );
2051 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2052 v_[i ] = (~rhs)[i ];
2053 v_[i+1UL] = (~rhs)[i+1UL];
2055 if( ipos < (~rhs).size() )
2056 v_[ipos] = (~rhs)[ipos];
2072 template<
typename Type
2076 template<
typename VT >
2084 const size_t ipos( size_ &
size_t(-
IT::size) );
2087 if( AF &&
useStreaming && size_ > (
cacheSize/(
sizeof(Type) * 3UL ) ) && !(~rhs).isAliased(
this ) )
2092 stream( i, (~rhs).load(i) );
2094 for( ; i<size_; ++i ) {
2100 const size_t i4way( size_ &
size_t(-IT::size*4) );
2101 BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % (IT::size*4UL) ) ) == i4way,
"Invalid end calculation" );
2107 for( ; i<i4way; i+=IT::size*4UL ) {
2108 store( i , it.load() ); it +=
IT::size;
2109 store( i+IT::size , it.load() ); it +=
IT::size;
2110 store( i+IT::size*2UL, it.load() ); it +=
IT::size;
2111 store( i+IT::size*3UL, it.load() ); it +=
IT::size;
2114 store( i, it.load() );
2116 for( ; i<size_; ++i, ++it ) {
2135 template<
typename Type
2139 template<
typename VT >
2145 v_[element->index()] = element->value();
2161 template<
typename Type
2165 template<
typename VT >
2171 const size_t ipos( size_ &
size_t(-2) );
2174 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2175 v_[i ] += (~rhs)[i ];
2176 v_[i+1UL] += (~rhs)[i+1UL];
2178 if( ipos < (~rhs).size() )
2179 v_[ipos] += (~rhs)[ipos];
2195 template<
typename Type
2199 template<
typename VT >
2207 const size_t ipos( size_ &
size_t(-
IT::size) );
2210 const size_t i4way( size_ &
size_t(-IT::size*4) );
2211 BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % (IT::size*4UL) ) ) == i4way,
"Invalid end calculation" );
2217 for( ; i<i4way; i+=IT::size*4UL ) {
2218 store( i , load(i ) + it.load() ); it +=
IT::size;
2219 store( i+IT::size , load(i+IT::size ) + it.load() ); it +=
IT::size;
2220 store( i+IT::size*2UL, load(i+IT::size*2UL) + it.load() ); it +=
IT::size;
2221 store( i+IT::size*3UL, load(i+IT::size*3UL) + it.load() ); it +=
IT::size;
2224 store( i, load(i) + it.load() );
2226 for( ; i<size_; ++i, ++it ) {
2244 template<
typename Type
2248 template<
typename VT >
2254 v_[element->index()] += element->value();
2270 template<
typename Type
2274 template<
typename VT >
2280 const size_t ipos( size_ &
size_t(-2) );
2283 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2284 v_[i ] -= (~rhs)[i ];
2285 v_[i+1UL] -= (~rhs)[i+1UL];
2287 if( ipos < (~rhs).size() )
2288 v_[ipos] -= (~rhs)[ipos];
2304 template<
typename Type
2308 template<
typename VT >
2316 const size_t ipos( size_ &
size_t(-
IT::size) );
2319 const size_t i4way( size_ &
size_t(-IT::size*4) );
2320 BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % (IT::size*4UL) ) ) == i4way,
"Invalid end calculation" );
2326 for( ; i<i4way; i+=IT::size*4UL ) {
2327 store( i , load(i ) - it.load() ); it +=
IT::size;
2328 store( i+IT::size , load(i+IT::size ) - it.load() ); it +=
IT::size;
2329 store( i+IT::size*2UL, load(i+IT::size*2UL) - it.load() ); it +=
IT::size;
2330 store( i+IT::size*3UL, load(i+IT::size*3UL) - it.load() ); it +=
IT::size;
2333 store( i, load(i) - it.load() );
2335 for( ; i<size_; ++i, ++it ) {
2353 template<
typename Type
2357 template<
typename VT >
2363 v_[element->index()] -= element->value();
2379 template<
typename Type
2383 template<
typename VT >
2389 const size_t ipos( size_ &
size_t(-2) );
2392 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2393 v_[i ] *= (~rhs)[i ];
2394 v_[i+1UL] *= (~rhs)[i+1UL];
2396 if( ipos < (~rhs).size() )
2397 v_[ipos] *= (~rhs)[ipos];
2413 template<
typename Type
2417 template<
typename VT >
2425 const size_t ipos( size_ &
size_t(-
IT::size) );
2428 const size_t i4way( size_ &
size_t(-IT::size*4) );
2429 BLAZE_INTERNAL_ASSERT( ( size_ - ( size_ % (IT::size*4UL) ) ) == i4way,
"Invalid end calculation" );
2435 for( ; i<i4way; i+=IT::size*4UL ) {
2436 store( i , load(i ) * it.load() ); it +=
IT::size;
2437 store( i+IT::size , load(i+IT::size ) * it.load() ); it +=
IT::size;
2438 store( i+IT::size*2UL, load(i+IT::size*2UL) * it.load() ); it +=
IT::size;
2439 store( i+IT::size*3UL, load(i+IT::size*3UL) * it.load() ); it +=
IT::size;
2442 store( i, load(i) * it.load() );
2444 for( ; i<size_; ++i, ++it ) {
2462 template<
typename Type
2466 template<
typename VT >
2476 v_[element->index()] = tmp[element->index()] * element->value();
2501 template<
typename Type
2505 :
public DenseVector< CustomVector<Type,AF,padded,TF>, TF >
2534 template<
typename ET >
2546 enum { vectorizable = IsVectorizable<Type>::value };
2552 enum { smpAssignable = !IsSMPAssignable<Type>::value };
2559 explicit inline CustomVector( Type* ptr,
size_t n,
size_t nn );
2561 template<
typename Deleter >
2562 explicit inline CustomVector( Type* ptr,
size_t n,
size_t nn, Deleter d );
2576 inline ConstReference
operator[](
size_t index )
const;
2577 inline Reference
at(
size_t index );
2578 inline ConstReference
at(
size_t index )
const;
2579 inline Pointer
data ();
2580 inline ConstPointer
data ()
const;
2581 inline Iterator
begin ();
2582 inline ConstIterator
begin ()
const;
2583 inline ConstIterator
cbegin()
const;
2584 inline Iterator
end ();
2585 inline ConstIterator
end ()
const;
2586 inline ConstIterator
cend ()
const;
2593 template<
typename Other,
size_t N >
2594 inline CustomVector& operator=(
const Other (&array)[N] );
2598 template<
typename VT >
inline CustomVector& operator= (
const Vector<VT,TF>& rhs );
2599 template<
typename VT >
inline CustomVector& operator+=(
const Vector<VT,TF>& rhs );
2600 template<
typename VT >
inline CustomVector& operator-=(
const Vector<VT,TF>& rhs );
2601 template<
typename VT >
inline CustomVector& operator*=(
const Vector<VT,TF>& rhs );
2603 template<
typename Other >
2604 inline typename EnableIf< IsNumeric<Other>,
CustomVector >::Type&
2605 operator*=( Other rhs );
2607 template<
typename Other >
2608 inline typename EnableIf< IsNumeric<Other>,
CustomVector >::Type&
2609 operator/=( Other rhs );
2616 inline size_t size()
const;
2619 inline void reset();
2620 inline void clear();
2621 template<
typename Other >
inline CustomVector& scale(
const Other& scalar );
2629 inline void reset( Type* ptr,
size_t n,
size_t nn );
2630 template<
typename Deleter >
inline void reset( Type* ptr,
size_t n,
size_t nn, Deleter d );
2637 template<
typename VT >
2638 struct VectorizedAssign {
2640 vectorizable && VT::vectorizable &&
2641 IsSame<Type,typename VT::ElementType>::value };
2647 template<
typename VT >
2648 struct VectorizedAddAssign {
2650 vectorizable && VT::vectorizable &&
2651 IsSame<Type,typename VT::ElementType>::value &&
2652 IntrinsicTrait<Type>::addition };
2658 template<
typename VT >
2659 struct VectorizedSubAssign {
2661 vectorizable && VT::vectorizable &&
2662 IsSame<Type,typename VT::ElementType>::value &&
2663 IntrinsicTrait<Type>::subtraction };
2669 template<
typename VT >
2670 struct VectorizedMultAssign {
2672 vectorizable && VT::vectorizable &&
2673 IsSame<Type,typename VT::ElementType>::value &&
2674 IntrinsicTrait<Type>::multiplication };
2682 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2683 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2697 template<
typename VT >
2698 inline typename DisableIf< VectorizedAssign<VT> >::Type
2699 assign(
const DenseVector<VT,TF>& rhs );
2701 template<
typename VT >
2702 inline typename EnableIf< VectorizedAssign<VT> >::Type
2703 assign(
const DenseVector<VT,TF>& rhs );
2705 template<
typename VT >
inline void assign(
const SparseVector<VT,TF>& rhs );
2707 template<
typename VT >
2708 inline typename DisableIf< VectorizedAddAssign<VT> >::Type
2709 addAssign(
const DenseVector<VT,TF>& rhs );
2711 template<
typename VT >
2712 inline typename EnableIf< VectorizedAddAssign<VT> >::Type
2713 addAssign(
const DenseVector<VT,TF>& rhs );
2715 template<
typename VT >
inline void addAssign(
const SparseVector<VT,TF>& rhs );
2717 template<
typename VT >
2718 inline typename DisableIf< VectorizedSubAssign<VT> >::Type
2719 subAssign(
const DenseVector<VT,TF>& rhs );
2721 template<
typename VT >
2722 inline typename EnableIf< VectorizedSubAssign<VT> >::Type
2723 subAssign(
const DenseVector<VT,TF>& rhs );
2725 template<
typename VT >
inline void subAssign(
const SparseVector<VT,TF>& rhs );
2727 template<
typename VT >
2728 inline typename DisableIf< VectorizedMultAssign<VT> >::Type
2729 multAssign(
const DenseVector<VT,TF>& rhs );
2731 template<
typename VT >
2732 inline typename EnableIf< VectorizedMultAssign<VT> >::Type
2733 multAssign(
const DenseVector<VT,TF>& rhs );
2735 template<
typename VT >
inline void multAssign(
const SparseVector<VT,TF>& rhs );
2745 boost::shared_array<Type>
v_;
2777 template<
typename Type
2811 template<
typename Type
2831 v_.reset( ptr, NoDelete() );
2833 if( IsVectorizable<Type>::value ) {
2863 template<
typename Type
2866 template<
typename Deleter >
2886 if( IsVectorizable<Type>::value ) {
2903 template<
typename Type
2933 template<
typename Type
2956 template<
typename Type
2980 template<
typename Type
2986 if( index >= size_ ) {
2989 return (*
this)[index];
3006 template<
typename Type
3012 if( index >= size_ ) {
3015 return (*
this)[index];
3029 template<
typename Type
3032 inline typename CustomVector<Type,AF,padded,TF>::Pointer
3049 template<
typename Type
3052 inline typename CustomVector<Type,AF,padded,TF>::ConstPointer
3067 template<
typename Type
3085 template<
typename Type
3103 template<
typename Type
3121 template<
typename Type
3127 return Iterator( v_.get() + size_ );
3139 template<
typename Type
3157 template<
typename Type
3205 template<
typename Type
3208 template<
typename Other
3210 inline CustomVector<Type,AF,padded,TF>&
3211 CustomVector<Type,AF,padded,TF>::operator=(
const Other (&array)[N] )
3217 for(
size_t i=0UL; i<N; ++i )
3233 template<
typename Type
3236 inline CustomVector<Type,AF,padded,TF>&
3237 CustomVector<Type,AF,padded,TF>::operator=(
const Type& rhs )
3239 for(
size_t i=0UL; i<size_; ++i )
3258 template<
typename Type
3261 inline CustomVector<Type,AF,padded,TF>&
3262 CustomVector<Type,AF,padded,TF>::operator=(
const CustomVector& rhs )
3264 if( rhs.size() != size_ ) {
3287 template<
typename Type
3290 template<
typename VT >
3291 inline CustomVector<Type,AF,padded,TF>&
3292 CustomVector<Type,AF,padded,TF>::operator=(
const Vector<VT,TF>& rhs )
3294 if( (~rhs).
size() != size_ ) {
3298 if( (~rhs).canAlias(
this ) ) {
3303 if( IsSparseVector<VT>::value )
3325 template<
typename Type
3328 template<
typename VT >
3329 inline CustomVector<Type,AF,padded,TF>&
3330 CustomVector<Type,AF,padded,TF>::operator+=(
const Vector<VT,TF>& rhs )
3332 if( (~rhs).
size() != size_ ) {
3336 if( (~rhs).canAlias(
this ) ) {
3362 template<
typename Type
3365 template<
typename VT >
3366 inline CustomVector<Type,AF,padded,TF>&
3367 CustomVector<Type,AF,padded,TF>::operator-=(
const Vector<VT,TF>& rhs )
3369 if( (~rhs).
size() != size_ ) {
3373 if( (~rhs).canAlias(
this ) ) {
3399 template<
typename Type
3402 template<
typename VT >
3403 inline CustomVector<Type,AF,padded,TF>&
3404 CustomVector<Type,AF,padded,TF>::operator*=(
const Vector<VT,TF>& rhs )
3409 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
3414 if( (~rhs).
size() != size_ ) {
3418 if( IsSparseVector<VT>::value || (~rhs).canAlias(
this ) ) {
3419 const MultType tmp( *
this * (~rhs) );
3420 this->operator=( tmp );
3440 template<
typename Type
3443 template<
typename Other >
3444 inline typename EnableIf< IsNumeric<Other>, CustomVector<Type,AF,padded,TF> >::Type&
3445 CustomVector<Type,AF,padded,TF>::operator*=( Other rhs )
3464 template<
typename Type
3467 template<
typename Other >
3468 inline typename EnableIf< IsNumeric<Other>, CustomVector<Type,AF,padded,TF> >::Type&
3469 CustomVector<Type,AF,padded,TF>::operator/=( Other rhs )
3494 template<
typename Type
3511 template<
typename Type
3531 template<
typename Type
3536 size_t nonzeros( 0 );
3538 for(
size_t i=0UL; i<size_; ++i ) {
3555 template<
typename Type
3561 for(
size_t i=0UL; i<size_; ++i )
3577 template<
typename Type
3597 template<
typename Type
3600 template<
typename Other >
3601 inline CustomVector<Type,AF,padded,TF>&
3602 CustomVector<Type,AF,padded,TF>::scale(
const Other& scalar )
3604 for(
size_t i=0UL; i<size_; ++i )
3620 template<
typename Type
3627 swap( size_, v.size_ );
3666 template<
typename Type
3671 CustomVector tmp( ptr, n, nn );
3701 template<
typename Type
3704 template<
typename Deleter >
3707 CustomVector tmp( ptr, n, nn, d );
3733 template<
typename Type
3736 template<
typename Other >
3739 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
3756 template<
typename Type
3759 template<
typename Other >
3762 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
3778 template<
typename Type
3800 template<
typename Type
3805 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3825 template<
typename Type
3832 return loada( index );
3834 return loadu( index );
3854 template<
typename Type
3869 return loada( v_.get()+index );
3889 template<
typename Type
3902 return loadu( v_.get()+index );
3923 template<
typename Type
3953 template<
typename Type
3968 storea( v_.get()+index, value );
3989 template<
typename Type
4002 storeu( v_.get()+index, value );
4023 template<
typename Type
4037 stream( v_.get()+index, value );
4055 template<
typename Type
4058 template<
typename VT >
4059 inline typename DisableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
4060 CustomVector<Type,AF,padded,TF>::assign(
const DenseVector<VT,TF>& rhs )
4064 const size_t ipos( size_ &
size_t(-2) );
4067 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4068 v_[i ] = (~rhs)[i ];
4069 v_[i+1UL] = (~rhs)[i+1UL];
4071 if( ipos < (~rhs).size() )
4072 v_[ipos] = (~rhs)[ipos];
4090 template<
typename Type
4093 template<
typename VT >
4094 inline typename EnableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedAssign<VT> >::Type
4095 CustomVector<Type,AF,padded,TF>::assign(
const DenseVector<VT,TF>& rhs )
4101 const bool remainder( !IsPadded<VT>::value );
4103 const size_t ipos( ( remainder )?( size_ &
size_t(-
IT::size) ):( size_ ) );
4106 if( AF &&
useStreaming && size_ > (
cacheSize/(
sizeof(Type) * 3UL ) ) && !(~rhs).isAliased(
this ) )
4111 stream( i, (~rhs).load(i) );
4113 for( ; remainder && i<size_; ++i ) {
4119 const size_t i4way( size_ &
size_t(-
IT::size*4) );
4126 for( ; i<i4way; i+=
IT::size*4UL ) {
4127 store( i , it.load() ); it +=
IT::size;
4133 store( i, it.load() );
4135 for( ; remainder && i<size_; ++i, ++it ) {
4156 template<
typename Type
4159 template<
typename VT >
4160 inline void CustomVector<Type,AF,padded,TF>::assign(
const SparseVector<VT,TF>& rhs )
4165 v_[element->index()] = element->value();
4183 template<
typename Type
4186 template<
typename VT >
4187 inline typename DisableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
4188 CustomVector<Type,AF,padded,TF>::addAssign(
const DenseVector<VT,TF>& rhs )
4192 const size_t ipos( size_ &
size_t(-2) );
4195 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4196 v_[i ] += (~rhs)[i ];
4197 v_[i+1UL] += (~rhs)[i+1UL];
4199 if( ipos < (~rhs).size() )
4200 v_[ipos] += (~rhs)[ipos];
4218 template<
typename Type
4221 template<
typename VT >
4222 inline typename EnableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >::Type
4223 CustomVector<Type,AF,padded,TF>::addAssign(
const DenseVector<VT,TF>& rhs )
4229 const bool remainder( !IsPadded<VT>::value );
4231 const size_t ipos( ( remainder )?( size_ &
size_t(-
IT::size) ):( size_ ) );
4234 const size_t i4way( size_ &
size_t(-
IT::size*4) );
4241 for( ; i<i4way; i+=
IT::size*4UL ) {
4242 store( i , load(i ) + it.load() ); it +=
IT::size;
4248 store( i, load(i) + it.load() );
4250 for( ; remainder && i<size_; ++i, ++it ) {
4270 template<
typename Type
4273 template<
typename VT >
4274 inline void CustomVector<Type,AF,padded,TF>::addAssign(
const SparseVector<VT,TF>& rhs )
4279 v_[element->index()] += element->value();
4297 template<
typename Type
4300 template<
typename VT >
4301 inline typename DisableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
4302 CustomVector<Type,AF,padded,TF>::subAssign(
const DenseVector<VT,TF>& rhs )
4306 const size_t ipos( size_ &
size_t(-2) );
4309 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4310 v_[i ] -= (~rhs)[i ];
4311 v_[i+1UL] -= (~rhs)[i+1UL];
4313 if( ipos < (~rhs).size() )
4314 v_[ipos] -= (~rhs)[ipos];
4332 template<
typename Type
4335 template<
typename VT >
4336 inline typename EnableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >::Type
4337 CustomVector<Type,AF,padded,TF>::subAssign(
const DenseVector<VT,TF>& rhs )
4343 const bool remainder( !IsPadded<VT>::value );
4345 const size_t ipos( ( remainder )?( size_ &
size_t(-
IT::size) ):( size_ ) );
4348 const size_t i4way( size_ &
size_t(-
IT::size*4) );
4355 for( ; i<i4way; i+=
IT::size*4UL ) {
4356 store( i , load(i ) - it.load() ); it +=
IT::size;
4362 store( i, load(i) - it.load() );
4364 for( ; remainder && i<size_; ++i, ++it ) {
4384 template<
typename Type
4387 template<
typename VT >
4388 inline void CustomVector<Type,AF,padded,TF>::subAssign(
const SparseVector<VT,TF>& rhs )
4393 v_[element->index()] -= element->value();
4411 template<
typename Type
4414 template<
typename VT >
4415 inline typename DisableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
4416 CustomVector<Type,AF,padded,TF>::multAssign(
const DenseVector<VT,TF>& rhs )
4420 const size_t ipos( size_ &
size_t(-2) );
4423 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4424 v_[i ] *= (~rhs)[i ];
4425 v_[i+1UL] *= (~rhs)[i+1UL];
4427 if( ipos < (~rhs).size() )
4428 v_[ipos] *= (~rhs)[ipos];
4446 template<
typename Type
4449 template<
typename VT >
4450 inline typename EnableIf< typename CustomVector<Type,AF,padded,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >::Type
4451 CustomVector<Type,AF,padded,TF>::multAssign(
const DenseVector<VT,TF>& rhs )
4457 const bool remainder( !IsPadded<VT>::value );
4459 const size_t ipos( ( remainder )?( size_ &
size_t(-
IT::size) ):( size_ ) );
4462 const size_t i4way( size_ &
size_t(-
IT::size*4) );
4469 for( ; i<i4way; i+=
IT::size*4UL ) {
4470 store( i , load(i ) * it.load() ); it +=
IT::size;
4476 store( i, load(i) * it.load() );
4478 for( ; remainder && i<size_; ++i, ++it ) {
4498 template<
typename Type
4501 template<
typename VT >
4502 inline void CustomVector<Type,AF,padded,TF>::multAssign(
const SparseVector<VT,TF>& rhs )
4506 const DynamicVector<Type,TF> tmp(
serial( *
this ) );
4511 v_[element->index()] = tmp[element->index()] * element->value();
4532 template<
typename Type,
bool AF,
bool PF,
bool TF >
4533 inline void reset( CustomVector<Type,AF,PF,TF>& v );
4535 template<
typename Type,
bool AF,
bool PF,
bool TF >
4536 inline void clear( CustomVector<Type,AF,PF,TF>& v );
4538 template<
typename Type,
bool AF,
bool PF,
bool TF >
4539 inline bool isDefault(
const CustomVector<Type,AF,PF,TF>& v );
4541 template<
typename Type,
bool AF,
bool PF,
bool TF >
4542 inline bool isIntact(
const CustomVector<Type,AF,PF,TF>& v );
4544 template<
typename Type,
bool AF,
bool PF,
bool TF >
4545 inline void swap( CustomVector<Type,AF,PF,TF>& a, CustomVector<Type,AF,PF,TF>& b ) ;
4547 template<
typename Type,
bool AF,
bool PF,
bool TF >
4548 inline void move( CustomVector<Type,AF,PF,TF>& dst, CustomVector<Type,AF,PF,TF>& src ) ;
4560 template<
typename Type
4578 template<
typename Type
4610 template<
typename Type
4616 return ( v.
size() == 0UL );
4642 template<
typename Type
4662 template<
typename Type
4682 template<
typename Type
4703 template<
typename T,
bool AF,
bool PF,
bool TF >
4704 struct HasConstDataAccess< CustomVector<T,AF,PF,TF> > :
public IsTrue<true>
4720 template<
typename T,
bool AF,
bool PF,
bool TF >
4721 struct HasMutableDataAccess< CustomVector<T,AF,PF,TF> > :
public IsTrue<true>
4737 template<
typename T,
bool AF,
bool PF,
bool TF >
4738 struct IsCustom< CustomVector<T,AF,PF,TF> > :
public IsTrue<true>
4754 template<
typename T,
bool PF,
bool TF >
4755 struct IsAligned< CustomVector<T,
aligned,PF,TF> > :
public IsTrue<true>
4771 template<
typename T,
bool AF,
bool TF >
4772 struct IsPadded< CustomVector<T,AF,
padded,TF> > :
public IsTrue<true>
4788 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2,
size_t N >
4789 struct AddTrait< CustomVector<T1,AF,PF,TF>, StaticVector<T2,N,TF> >
4791 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
4794 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool AF,
bool PF >
4795 struct AddTrait< StaticVector<T1,N,TF>, CustomVector<T2,AF,PF,TF> >
4797 typedef StaticVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
4800 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2,
size_t N >
4801 struct AddTrait< CustomVector<T1,AF,PF,TF>, HybridVector<T2,N,TF> >
4803 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
4806 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool AF,
bool PF >
4807 struct AddTrait< HybridVector<T1,N,TF>, CustomVector<T2,AF,PF,TF> >
4809 typedef HybridVector< typename AddTrait<T1,T2>::Type, N, TF > Type;
4812 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
4813 struct AddTrait< CustomVector<T1,AF,PF,TF>, DynamicVector<T2,TF> >
4815 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
4818 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
4819 struct AddTrait< DynamicVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
4821 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
4824 template<
typename T1,
bool AF1,
bool PF1,
bool TF,
typename T2,
bool AF2,
bool PF2 >
4825 struct AddTrait< CustomVector<T1,AF1,PF1,TF>, CustomVector<T2,AF2,PF2,TF> >
4827 typedef DynamicVector< typename AddTrait<T1,T2>::Type, TF > Type;
4843 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2,
size_t N >
4844 struct SubTrait< CustomVector<T1,AF,PF,TF>, StaticVector<T2,N,TF> >
4846 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
4849 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool AF,
bool PF >
4850 struct SubTrait< StaticVector<T1,N,TF>, CustomVector<T2,AF,PF,TF> >
4852 typedef StaticVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
4855 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2,
size_t N >
4856 struct SubTrait< CustomVector<T1,AF,PF,TF>, HybridVector<T2,N,TF> >
4858 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
4861 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool AF,
bool PF >
4862 struct SubTrait< HybridVector<T1,N,TF>, CustomVector<T2,AF,PF,TF> >
4864 typedef HybridVector< typename SubTrait<T1,T2>::Type, N, TF > Type;
4867 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
4868 struct SubTrait< CustomVector<T1,AF,PF,TF>, DynamicVector<T2,TF> >
4870 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
4873 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
4874 struct SubTrait< DynamicVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
4876 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
4879 template<
typename T1,
bool AF1,
bool PF1,
bool TF,
typename T2,
bool AF2,
bool PF2 >
4880 struct SubTrait< CustomVector<T1,AF1,PF1,TF>, CustomVector<T2,AF2,PF2,TF> >
4882 typedef DynamicVector< typename SubTrait<T1,T2>::Type, TF > Type;
4898 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
4899 struct MultTrait< CustomVector<T1,AF,PF,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
4901 typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
4904 template<
typename T1,
typename T2,
bool AF,
bool PF,
bool TF >
4905 struct MultTrait< T1, CustomVector<T2,AF,PF,TF>, typename EnableIf< IsNumeric<T1> >::Type >
4907 typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
4910 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2,
size_t N >
4911 struct MultTrait< CustomVector<T1,AF,PF,TF>, StaticVector<T2,N,TF> >
4913 typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
4916 template<
typename T1,
bool AF,
bool PF,
typename T2,
size_t N >
4917 struct MultTrait< CustomVector<T1,AF,PF,false>, StaticVector<T2,N,true> >
4919 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
4922 template<
typename T1,
bool AF,
bool PF,
typename T2,
size_t N >
4923 struct MultTrait< CustomVector<T1,AF,PF,true>, StaticVector<T2,N,false> >
4925 typedef typename MultTrait<T1,T2>::Type Type;
4928 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool AF,
bool PF >
4929 struct MultTrait< StaticVector<T1,N,TF>, CustomVector<T2,AF,PF,TF> >
4931 typedef StaticVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
4934 template<
typename T1,
size_t N,
typename T2,
bool AF,
bool PF >
4935 struct MultTrait< StaticVector<T1,N,false>, CustomVector<T2,AF,PF,true> >
4937 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
4940 template<
typename T1,
size_t N,
typename T2,
bool AF,
bool PF >
4941 struct MultTrait< StaticVector<T1,N,true>, CustomVector<T2,AF,PF,false> >
4943 typedef typename MultTrait<T1,T2>::Type Type;
4946 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2,
size_t N >
4947 struct MultTrait< CustomVector<T1,AF,PF,TF>, HybridVector<T2,N,TF> >
4949 typedef HybridVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
4952 template<
typename T1,
bool AF,
bool PF,
typename T2,
size_t N >
4953 struct MultTrait< CustomVector<T1,AF,PF,false>, HybridVector<T2,N,true> >
4955 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
4958 template<
typename T1,
bool AF,
bool PF,
typename T2,
size_t N >
4959 struct MultTrait< CustomVector<T1,AF,PF,true>, HybridVector<T2,N,false> >
4961 typedef typename MultTrait<T1,T2>::Type Type;
4964 template<
typename T1,
size_t N,
bool TF,
typename T2,
bool AF,
bool PF >
4965 struct MultTrait< HybridVector<T1,N,TF>, CustomVector<T2,AF,PF,TF> >
4967 typedef HybridVector< typename MultTrait<T1,T2>::Type, N, TF > Type;
4970 template<
typename T1,
size_t N,
typename T2,
bool AF,
bool PF >
4971 struct MultTrait< HybridVector<T1,N,false>, CustomVector<T2,AF,PF,true> >
4973 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
4976 template<
typename T1,
size_t N,
typename T2,
bool AF,
bool PF >
4977 struct MultTrait< HybridVector<T1,N,true>, CustomVector<T2,AF,PF,false> >
4979 typedef typename MultTrait<T1,T2>::Type Type;
4982 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
4983 struct MultTrait< CustomVector<T1,AF,PF,TF>, DynamicVector<T2,TF> >
4985 typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
4988 template<
typename T1,
bool AF,
bool PF,
typename T2 >
4989 struct MultTrait< CustomVector<T1,AF,PF,false>, DynamicVector<T2,true> >
4991 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
4994 template<
typename T1,
bool AF,
bool PF,
typename T2 >
4995 struct MultTrait< CustomVector<T1,AF,PF,true>, DynamicVector<T2,false> >
4997 typedef typename MultTrait<T1,T2>::Type Type;
5000 template<
typename T1,
bool TF,
typename T2,
bool AF,
bool PF >
5001 struct MultTrait< DynamicVector<T1,TF>, CustomVector<T2,AF,PF,TF> >
5003 typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
5006 template<
typename T1,
typename T2,
bool AF,
bool PF >
5007 struct MultTrait< DynamicVector<T1,false>, CustomVector<T2,AF,PF,true> >
5009 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
5012 template<
typename T1,
typename T2,
bool AF,
bool PF >
5013 struct MultTrait< DynamicVector<T1,true>, CustomVector<T2,AF,PF,false> >
5015 typedef typename MultTrait<T1,T2>::Type Type;
5018 template<
typename T1,
bool AF1,
bool PF1,
bool TF,
typename T2,
bool AF2,
bool PF2 >
5019 struct MultTrait< CustomVector<T1,AF1,PF1,TF>, CustomVector<T2,AF2,PF2,TF> >
5021 typedef DynamicVector< typename MultTrait<T1,T2>::Type, TF > Type;
5024 template<
typename T1,
bool AF1,
bool PF1,
typename T2,
bool AF2,
bool PF2 >
5025 struct MultTrait< CustomVector<T1,AF1,PF1,false>, CustomVector<T2,AF2,PF2,true> >
5027 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type,
false > Type;
5030 template<
typename T1,
bool AF1,
bool PF1,
typename T2,
bool AF2,
bool PF2 >
5031 struct MultTrait< CustomVector<T1,AF1,PF1,true>, CustomVector<T2,AF2,PF2,false> >
5033 typedef typename MultTrait<T1,T2>::Type Type;
5049 template<
typename T1,
bool AF,
bool PF,
typename T2 >
5050 struct CrossTrait< CustomVector<T1,AF,PF,false>, StaticVector<T2,3UL,false> >
5053 typedef typename MultTrait<T1,T2>::Type T;
5056 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5059 template<
typename T1,
typename T2,
bool AF,
bool PF >
5060 struct CrossTrait< StaticVector<T1,3UL,false>, CustomVector<T2,AF,PF,false> >
5063 typedef typename MultTrait<T1,T2>::Type T;
5066 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5069 template<
typename T1,
bool AF,
bool PF,
typename T2,
size_t N >
5070 struct CrossTrait< CustomVector<T1,AF,PF,false>, HybridVector<T2,N,false> >
5073 typedef typename MultTrait<T1,T2>::Type T;
5076 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5079 template<
typename T1,
size_t N,
typename T2,
bool AF,
bool PF >
5080 struct CrossTrait< HybridVector<T1,N,false>, CustomVector<T2,AF,PF,false> >
5083 typedef typename MultTrait<T1,T2>::Type T;
5086 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5089 template<
typename T1,
bool AF,
bool PF,
typename T2 >
5090 struct CrossTrait< CustomVector<T1,AF,PF,false>, DynamicVector<T2,false> >
5093 typedef typename MultTrait<T1,T2>::Type T;
5096 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5099 template<
typename T1,
typename T2,
bool AF,
bool PF >
5100 struct CrossTrait< DynamicVector<T1,false>, CustomVector<T2,AF,PF,false> >
5103 typedef typename MultTrait<T1,T2>::Type T;
5106 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5109 template<
typename T1,
bool AF1,
bool PF1,
typename T2,
bool AF2,
bool PF2 >
5110 struct CrossTrait< CustomVector<T1,AF1,PF1,false>, CustomVector<T2,AF2,PF2,false> >
5113 typedef typename MultTrait<T1,T2>::Type T;
5116 typedef StaticVector< typename SubTrait<T,T>::Type, 3UL,
false > Type;
5132 template<
typename T1,
bool AF,
bool PF,
bool TF,
typename T2 >
5133 struct DivTrait< CustomVector<T1,AF,PF,TF>, T2, typename EnableIf< IsNumeric<T2> >::Type >
5135 typedef DynamicVector< typename DivTrait<T1,T2>::Type, TF > Type;
5151 template<
typename T1,
bool AF,
bool PF,
bool TF >
5152 struct SubvectorTrait< CustomVector<T1,AF,PF,TF> >
5154 typedef DynamicVector<T1,TF> Type;
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:118
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:116
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
const bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.This value specifies the default tran...
Definition: TransposeFlag.h:56
IT::Type IntrinsicType
Intrinsic type of the vector elements.
Definition: CustomVector.h:429
#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 AlignmentOf type trait.
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
CustomVector()
The default constructor for CustomVector.
Definition: CustomVector.h:705
BLAZE_ALWAYS_INLINE void store(size_t index, const IntrinsicType &value)
Store of an intrinsic element of the vector.
Definition: CustomVector.h:1917
Header file for basic type definitions.
No-delete policy class.
Definition: NoDelete.h:51
Header file for the SparseVector base class.
size_t size_
The size/dimension of the custom vector.
Definition: CustomVector.h:668
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
const Type & ReturnType
Return type for expression template evaluations.
Definition: CustomVector.h:430
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:250
const Type * ConstPointer
Pointer to a constant vector value.
Definition: CustomVector.h:436
const Type & ConstReference
Reference to a constant vector value.
Definition: CustomVector.h:434
const bool aligned
Alignment flag for aligned vectors and matrices.Via this flag it is possible to specify subvectors...
Definition: AlignmentFlag.h:85
Header file for the IsSame and IsStrictlySame type traits.
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
DynamicVector< Type,!TF > TransposeType
Transpose type for expression template evaluations.
Definition: CustomVector.h:427
Header file for the DenseVector base class.
#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:116
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Efficient implementation of an arbitrary sized vector.The DynamicVector class template is the represe...
Definition: DynamicVector.h:168
void move(CustomMatrix< Type, AF, PF, SO > &dst, CustomMatrix< Type, AF, PF, SO > &src)
Moving the contents of one custom matrix to another.
Definition: CustomMatrix.h:6085
System settings for performance optimizations.
Header file for the implementation of an arbitrarily sized vector.
Header file for the NoDelete policy classes.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2751
Header file for the DisableIf class template.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:74
Pointer data()
Low-level data access to the vector elements.
Definition: CustomVector.h:997
Header file for the IsCustom type trait.
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
Header file for nested template disabiguation.
Iterator begin()
Returns an iterator to the first element of the custom vector.
Definition: CustomVector.h:1031
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const simd_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:75
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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:116
Header file for the IsSMPAssignable type trait.
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the vector.
Definition: CustomVector.h:1885
const bool padded
Padding flag for padded vectors and matrices.Via this flag it is possible to specify custom vectors a...
Definition: PaddingFlag.h:86
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the DenseIterator class template.
void clear()
Clearing the vector to its default state.
Definition: CustomVector.h:1509
Header file for the subvector trait.
DenseIterator< const Type, AF > ConstIterator
Iterator over constant elements.
Definition: CustomVector.h:439
Constraint on the data type.
boost::shared_array< Type > v_
The custom array of elements.
Definition: CustomVector.h:669
size_t capacity() const
Returns the maximum capacity of the vector.
Definition: CustomVector.h:1446
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:103
bool isAligned() const
Returns whether the vector is properly aligned in memory.
Definition: CustomVector.h:1777
Constraint on the data type.
Efficient implementation of a customizable vector.
Definition: CustomVector.h:416
ConstIterator cend() const
Returns an iterator just past the last element of the custom vector.
Definition: CustomVector.h:1111
void reset()
Reset to the default initial values.
Definition: CustomVector.h:1488
#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:79
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:187
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:120
size_t size() const
Returns the size/dimension of the vector.
Definition: CustomVector.h:1430
DenseIterator< Type, AF > Iterator
Iterator over non-constant elements.
Definition: CustomVector.h:438
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
size_t nonZeros() const
Returns the number of non-zero elements in the vector.
Definition: CustomVector.h:1465
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
ConstIterator cbegin() const
Returns an iterator to the first element of the custom vector.
Definition: CustomVector.h:1063
bool canAlias(const Other *alias) const
Returns whether the vector can alias with the given address alias.
Definition: CustomVector.h:1735
Header file for the IsPadded type trait.
DynamicVector< Type, TF > ResultType
Result type for expression template evaluations.
Definition: CustomVector.h:426
Header file for the serial shim.
Header file for the IsVectorizable type trait.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type loada(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loada.h:77
EnableIf< IsDenseMatrix< MT1 > >::Type 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
Header file for the IsSparseVector type trait.
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:1232
Rebind mechanism to obtain a CustomVector with different data/element type.
Definition: CustomVector.h:446
Type * Pointer
Pointer to a non-constant vector value.
Definition: CustomVector.h:435
Reference operator[](size_t index)
Subscript operator for the direct access to the vector elements.
Definition: CustomVector.h:906
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t index) const
Load of an intrinsic element of the vector.
Definition: CustomVector.h:1823
Base template for the MultTrait class.
Definition: MultTrait.h:138
BLAZE_ALWAYS_INLINE void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the dense vector.
Definition: CustomVector.h:1979
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division trait.
IntrinsicTrait< Type > IT
Intrinsic trait for the vector element type.
Definition: CustomVector.h:420
Constraint on the data type.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
const bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
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:116
Iterator end()
Returns an iterator just past the last element of the custom vector.
Definition: CustomVector.h:1079
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Reference at(size_t index)
Checked access to the vector elements.
Definition: CustomVector.h:951
Header file for the isDefault shim.
Type & Reference
Reference to a non-constant vector value.
Definition: CustomVector.h:433
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
#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:118
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Header file for the padding flag values.
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:59
Header file for all intrinsic functionality.
CustomVector< ET, AF, PF, TF > Other
The type of the other CustomVector.
Definition: CustomVector.h:447
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
bool canSMPAssign() const
Returns whether the vector can be used in SMP assignments.
Definition: CustomVector.h:1798
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
Header file for the default transpose flag for all vectors of the Blaze library.
EnableIf< IsDenseMatrix< MT1 > >::Type 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
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:118
BLAZE_ALWAYS_INLINE void storea(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the vector.
Definition: CustomVector.h:1945
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type stream(T *address, const simd_int16_t &value)
Aligned, non-temporal store of a vector of 2-byte integral values.
Definition: Stream.h:74
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
BLAZE_ALWAYS_INLINE void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the dense vector.
Definition: CustomVector.h:2011
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2599
Header file for exception macros.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:143
BLAZE_ALWAYS_INLINE IntrinsicType loada(size_t index) const
Aligned load of an intrinsic element of the vector.
Definition: CustomVector.h:1851
Type ElementType
Type of the vector elements.
Definition: CustomVector.h:428
const size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
CustomVector< Type, AF, PF, TF > This
Type of this CustomVector instance.
Definition: CustomVector.h:425
bool isAliased(const Other *alias) const
Returns whether the vector is aliased with the given address alias.
Definition: CustomVector.h:1757
System settings for the inline keywords.
const CustomVector & CompositeType
Data type for composite expression templates.
Definition: CustomVector.h:431
EnableIf< IsDenseVector< VT1 > >::Type 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:189
#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:81
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
void swap(CustomVector &v)
Swapping the contents of two vectors.
Definition: CustomVector.h:1548
#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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storea(T *address, const simd_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Storea.h:78
Header file for a safe C++ NULL pointer implementation.