35 #ifndef _BLAZE_MATH_VIEWS_DENSESUBVECTOR_H_
36 #define _BLAZE_MATH_VIEWS_DENSESUBVECTOR_H_
379 template<
typename VT
381 ,
bool TF = IsRowVector<VT>::value >
431 template<
typename IteratorType >
440 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
443 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
446 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
449 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
479 size_t remainingElements,
bool isMemoryAligned )
481 ,
final_ ( finalIterator )
482 ,
rest_ ( remainingElements )
492 template<
typename IteratorType2 >
587 inline IntrinsicType
load()
const {
602 inline IntrinsicType
loadu()
const {
611 for(
size_t i=0UL; i<
rest_; ++i )
613 for(
size_t i=rest_; i<
IT::size; ++i )
738 inline IteratorType
base()
const {
748 inline IteratorType
final()
const {
793 enum { vectorizable = VT::vectorizable };
796 enum { smpAssignable = VT::smpAssignable };
802 explicit inline DenseSubvector( Operand vector,
size_t index,
size_t n );
815 inline ConstReference
operator[](
size_t index )
const;
816 inline Pointer
data ();
817 inline ConstPointer
data ()
const;
818 inline Iterator
begin ();
819 inline ConstIterator
begin ()
const;
820 inline ConstIterator
cbegin()
const;
821 inline Iterator
end ();
822 inline ConstIterator
end ()
const;
823 inline ConstIterator
cend ()
const;
833 template<
typename VT2 >
inline DenseSubvector& operator+=(
const Vector<VT2,TF>& rhs );
834 template<
typename VT2 >
inline DenseSubvector& operator-=(
const Vector<VT2,TF>& rhs );
835 template<
typename VT2 >
inline DenseSubvector& operator*=(
const Vector<VT2,TF>& rhs );
837 template<
typename Other >
838 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
839 operator*=( Other rhs );
841 template<
typename Other >
842 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
843 operator/=( Other rhs );
850 inline size_t size()
const;
854 template<
typename Other >
inline DenseSubvector& scale(
const Other& scalar );
861 template<
typename VT2 >
863 struct VectorizedAssign {
864 enum { value = vectorizable && VT2::vectorizable &&
865 IsSame<ElementType,typename VT2::ElementType>::value };
872 template<
typename VT2 >
874 struct VectorizedAddAssign {
875 enum { value = vectorizable && VT2::vectorizable &&
876 IsSame<ElementType,typename VT2::ElementType>::value &&
877 IntrinsicTrait<ElementType>::addition };
884 template<
typename VT2 >
886 struct VectorizedSubAssign {
887 enum { value = vectorizable && VT2::vectorizable &&
888 IsSame<ElementType,typename VT2::ElementType>::value &&
889 IntrinsicTrait<ElementType>::subtraction };
896 template<
typename VT2 >
898 struct VectorizedMultAssign {
899 enum { value = vectorizable && VT2::vectorizable &&
900 IsSame<ElementType,typename VT2::ElementType>::value &&
901 IntrinsicTrait<ElementType>::multiplication };
910 template<
typename Other >
911 inline bool canAlias(
const Other* alias )
const;
913 template<
typename VT2,
bool AF2,
bool TF2 >
914 inline bool canAlias(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
916 template<
typename Other >
917 inline bool isAliased(
const Other* alias )
const;
919 template<
typename VT2,
bool AF2,
bool TF2 >
920 inline bool isAliased(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
925 inline IntrinsicType
load (
size_t index )
const;
926 inline IntrinsicType
loadu(
size_t index )
const;
928 inline void store (
size_t index,
const IntrinsicType& value );
929 inline void storeu(
size_t index,
const IntrinsicType& value );
930 inline void stream(
size_t index,
const IntrinsicType& value );
932 template<
typename VT2 >
933 inline typename DisableIf< VectorizedAssign<VT2> >::Type
934 assign(
const DenseVector <VT2,TF>& rhs );
936 template<
typename VT2 >
937 inline typename EnableIf< VectorizedAssign<VT2> >::Type
938 assign(
const DenseVector <VT2,TF>& rhs );
940 template<
typename VT2 >
inline void assign(
const SparseVector<VT2,TF>& rhs );
942 template<
typename VT2 >
943 inline typename DisableIf< VectorizedAddAssign<VT2> >::Type
944 addAssign(
const DenseVector <VT2,TF>& rhs );
946 template<
typename VT2 >
947 inline typename EnableIf< VectorizedAddAssign<VT2> >::Type
948 addAssign (
const DenseVector <VT2,TF>& rhs );
950 template<
typename VT2 >
inline void addAssign(
const SparseVector<VT2,TF>& rhs );
952 template<
typename VT2 >
953 inline typename DisableIf< VectorizedSubAssign<VT2> >::Type
954 subAssign (
const DenseVector <VT2,TF>& rhs );
956 template<
typename VT2 >
957 inline typename EnableIf< VectorizedSubAssign<VT2> >::Type
958 subAssign(
const DenseVector <VT2,TF>& rhs );
960 template<
typename VT2 >
inline void subAssign(
const SparseVector<VT2,TF>& rhs );
962 template<
typename VT2 >
963 inline typename DisableIf< VectorizedMultAssign<VT2> >::Type
964 multAssign(
const DenseVector <VT2,TF>& rhs );
966 template<
typename VT2 >
967 inline typename EnableIf< VectorizedMultAssign<VT2> >::Type
968 multAssign(
const DenseVector <VT2,TF>& rhs );
970 template<
typename VT2 >
inline void multAssign(
const SparseVector<VT2,TF>& rhs );
1002 template<
typename VT2,
bool AF2,
bool TF2 >
friend class DenseSubvector;
1004 template<
bool AF1,
typename VT2,
bool AF2,
bool TF2 >
1008 template<
typename VT2,
bool AF2,
bool TF2 >
1011 template<
typename VT2,
bool AF2,
bool TF2 >
1014 template<
typename VT2,
bool AF2,
bool TF2 >
1017 template<
typename VT2,
bool AF2,
bool TF2 >
1056 template<
typename VT
1060 : vector_ ( vector )
1064 , final_ ( n - rest_ )
1065 , isAligned_( ( index %
IT::
size == 0UL ) &&
1066 ( index + n == vector.
size() || n %
IT::
size == 0UL ) )
1068 if( index + n > vector.size() )
1069 throw std::invalid_argument(
"Invalid subvector specification" );
1088 template<
typename VT
1095 return vector_[offset_+index];
1106 template<
typename VT
1113 return const_cast<const VT&
>( vector_ )[offset_+index];
1125 template<
typename VT
1130 return vector_.data() + offset_;
1142 template<
typename VT
1147 return vector_.data() + offset_;
1159 template<
typename VT
1164 const typename VT::Iterator first( vector_.begin() + offset_ );
1165 return Iterator( first, first + final_, rest_, isAligned_ );
1177 template<
typename VT
1183 return ConstIterator( first, first + final_, rest_, isAligned_ );
1195 template<
typename VT
1201 return ConstIterator( first, first + final_, rest_, isAligned_ );
1213 template<
typename VT
1218 const typename VT::Iterator last( vector_.begin() + offset_ + size_ );
1219 return Iterator( last, last, rest_, isAligned_ );
1231 template<
typename VT
1249 template<
typename VT
1274 template<
typename VT
1279 const size_t iend( offset_ + size_ );
1281 for(
size_t i=offset_; i<iend; ++i )
1299 template<
typename VT
1307 if( &rhs ==
this || ( &vector_ == &rhs.
vector_ && offset_ == rhs.
offset_ ) )
1311 throw std::invalid_argument(
"Subvector sizes do not match" );
1336 template<
typename VT
1339 template<
typename VT2 >
1346 throw std::invalid_argument(
"Vector sizes do not match" );
1348 if( (~rhs).canAlias( &vector_ ) ) {
1373 template<
typename VT
1376 template<
typename VT2 >
1383 throw std::invalid_argument(
"Vector sizes do not match" );
1385 if( (~rhs).canAlias( &vector_ ) ) {
1408 template<
typename VT
1411 template<
typename VT2 >
1418 throw std::invalid_argument(
"Vector sizes do not match" );
1420 if( (~rhs).canAlias( &vector_ ) ) {
1444 template<
typename VT
1447 template<
typename VT2 >
1454 throw std::invalid_argument(
"Vector sizes do not match" );
1476 template<
typename VT
1479 template<
typename Other >
1498 template<
typename VT
1501 template<
typename Other >
1526 template<
typename VT
1541 template<
typename VT
1546 return vector_.capacity() - offset_;
1559 template<
typename VT
1564 size_t nonzeros( 0 );
1566 const size_t iend( offset_ + size_ );
1567 for(
size_t i=offset_; i<iend; ++i ) {
1582 template<
typename VT
1589 const size_t iend( offset_ + size_ );
1590 for(
size_t i=offset_; i<iend; ++i )
1591 clear( vector_[i] );
1602 template<
typename VT
1605 template<
typename Other >
1608 const size_t iend( offset_ + size_ );
1609 for(
size_t i=offset_; i<iend; ++i )
1610 vector_[i] *= scalar;
1634 template<
typename VT
1637 template<
typename Other >
1640 return vector_.isAliased( alias );
1655 template<
typename VT
1658 template<
typename VT2
1663 return ( vector_.isAliased( &alias->
vector_ ) &&
1664 ( offset_ + size_ > alias->
offset_ ) && ( offset_ < alias->offset_ + alias->
size_ ) );
1679 template<
typename VT
1682 template<
typename Other >
1685 return vector_.isAliased( alias );
1700 template<
typename VT
1703 template<
typename VT2
1708 return ( vector_.isAliased( &alias->
vector_ ) &&
1709 ( offset_ + size_ > alias->
offset_ ) && ( offset_ < alias->offset_ + alias->
size_ ) );
1723 template<
typename VT
1743 template<
typename VT
1766 template<
typename VT
1772 return loadu( index );
1790 template<
typename VT
1804 return vector_.load( offset_+index );
1806 else if( index != final_ ) {
1807 return vector_.loadu( offset_+index );
1811 for(
size_t i=0UL; i<rest_; ++i )
1812 array[i] = vector_[offset_+index+i];
1813 for(
size_t i=rest_; i<
IT::size; ++i )
1835 template<
typename VT
1859 template<
typename VT
1872 vector_.store( offset_+index, value );
1874 else if( index != final_ ) {
1875 vector_.storeu( offset_+index, value );
1880 for(
size_t i=0UL; i<rest_; ++i )
1881 vector_[offset_+index+i] = array[i];
1901 template<
typename VT
1922 template<
typename VT
1925 template<
typename VT2 >
1931 const size_t ipos(
size() &
size_t(-2) );
1932 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1933 vector_[i+offset_ ] = (~rhs)[i ];
1934 vector_[i+offset_+1UL] = (~rhs)[i+1UL];
1936 if( ipos <
size() ) {
1937 vector_[ipos+offset_] = (~rhs)[ipos];
1954 template<
typename VT
1957 template<
typename VT2 >
1967 !(~rhs).isAliased( &vector_ ) )
1970 vector_.stream( offset_+i, (~rhs).
load(i) );
1975 const size_t ipos( size_ &
size_t(-
IT::size*4) );
1979 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
1980 vector_.storeu( offset_+i , it.load() ); it +=
IT::size;
2004 template<
typename VT
2007 template<
typename VT2 >
2013 vector_[element->index()+offset_] = element->value();
2029 template<
typename VT
2032 template<
typename VT2 >
2038 const size_t ipos(
size() &
size_t(-2) );
2039 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2040 vector_[i+offset_ ] += (~rhs)[i ];
2041 vector_[i+offset_+1UL] += (~rhs)[i+1UL];
2043 if( ipos <
size() ) {
2044 vector_[ipos+offset_] += (~rhs)[ipos];
2061 template<
typename VT
2064 template<
typename VT2 >
2072 const size_t ipos( size_ &
size_t(-
IT::size*4) );
2076 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
2077 vector_.storeu( offset_+i ,
load(i ) + it.load() ); it +=
IT::size;
2100 template<
typename VT
2103 template<
typename VT2 >
2109 vector_[element->index()+offset_] += element->value();
2125 template<
typename VT
2128 template<
typename VT2 >
2134 const size_t ipos(
size() &
size_t(-2) );
2135 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2136 vector_[i+offset_ ] -= (~rhs)[i ];
2137 vector_[i+offset_+1UL] -= (~rhs)[i+1UL];
2139 if( ipos <
size() ) {
2140 vector_[ipos+offset_] -= (~rhs)[ipos];
2157 template<
typename VT
2160 template<
typename VT2 >
2168 const size_t ipos( size_ &
size_t(-
IT::size*4) );
2172 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
2173 vector_.storeu( offset_+i ,
load(i ) - it.load() ); it +=
IT::size;
2196 template<
typename VT
2199 template<
typename VT2 >
2205 vector_[element->index()+offset_] -= element->value();
2221 template<
typename VT
2224 template<
typename VT2 >
2230 const size_t ipos(
size() &
size_t(-2) );
2231 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2232 vector_[i+offset_ ] *= (~rhs)[i ];
2233 vector_[i+offset_+1UL] *= (~rhs)[i+1UL];
2235 if( ipos <
size() ) {
2236 vector_[ipos+offset_] *= (~rhs)[ipos];
2253 template<
typename VT
2256 template<
typename VT2 >
2264 const size_t ipos( size_ &
size_t(-
IT::size*4) );
2268 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
2269 vector_.storeu( offset_+i ,
load(i ) * it.load() ); it +=
IT::size;
2292 template<
typename VT
2295 template<
typename VT2 >
2305 vector_[element->index()+offset_] = tmp[element->index()] * element->value();
2330 template<
typename VT
2357 typedef DenseSubvector<VT,aligned,TF>
This;
2358 typedef typename SubvectorTrait<VT>::Type
ResultType;
2369 typedef typename IfTrue< useConst, ConstReference, typename VT::Reference >::Type
Reference;
2375 typedef typename IfTrue< useConst, ConstPointer, ElementType* >::Type
Pointer;
2381 typedef typename IfTrue< useConst, ConstIterator, typename VT::Iterator >::Type
Iterator;
2386 enum { vectorizable = VT::vectorizable };
2389 enum { smpAssignable = VT::smpAssignable };
2395 explicit inline DenseSubvector( Operand vector,
size_t index,
size_t n );
2408 inline ConstReference
operator[](
size_t index )
const;
2409 inline Pointer
data ();
2410 inline ConstPointer
data ()
const;
2411 inline Iterator
begin ();
2412 inline ConstIterator
begin ()
const;
2413 inline ConstIterator
cbegin()
const;
2414 inline Iterator
end ();
2415 inline ConstIterator
end ()
const;
2416 inline ConstIterator
cend ()
const;
2426 template<
typename VT2 >
inline DenseSubvector& operator+=(
const Vector<VT2,TF>& rhs );
2427 template<
typename VT2 >
inline DenseSubvector& operator-=(
const Vector<VT2,TF>& rhs );
2428 template<
typename VT2 >
inline DenseSubvector& operator*=(
const Vector<VT2,TF>& rhs );
2430 template<
typename Other >
2431 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
2432 operator*=( Other rhs );
2434 template<
typename Other >
2435 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
2436 operator/=( Other rhs );
2443 inline size_t size()
const;
2446 inline void reset();
2447 template<
typename Other >
inline DenseSubvector& scale(
const Other& scalar );
2454 template<
typename VT2 >
2455 struct VectorizedAssign {
2456 enum { value = vectorizable && VT2::vectorizable &&
2457 IsSame<ElementType,typename VT2::ElementType>::value };
2463 template<
typename VT2 >
2464 struct VectorizedAddAssign {
2465 enum { value = vectorizable && VT2::vectorizable &&
2466 IsSame<ElementType,typename VT2::ElementType>::value &&
2467 IntrinsicTrait<ElementType>::addition };
2473 template<
typename VT2 >
2474 struct VectorizedSubAssign {
2475 enum { value = vectorizable && VT2::vectorizable &&
2476 IsSame<ElementType,typename VT2::ElementType>::value &&
2477 IntrinsicTrait<ElementType>::subtraction };
2483 template<
typename VT2 >
2484 struct VectorizedMultAssign {
2485 enum { value = vectorizable && VT2::vectorizable &&
2486 IsSame<ElementType,typename VT2::ElementType>::value &&
2487 IntrinsicTrait<ElementType>::multiplication };
2495 template<
typename Other >
2496 inline bool canAlias(
const Other* alias )
const;
2498 template<
typename VT2,
bool AF2,
bool TF2 >
2499 inline bool canAlias(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
2501 template<
typename Other >
2502 inline bool isAliased(
const Other* alias )
const;
2504 template<
typename VT2,
bool AF2,
bool TF2 >
2505 inline bool isAliased(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
2510 inline IntrinsicType
load (
size_t index )
const;
2511 inline IntrinsicType
loadu(
size_t index )
const;
2513 inline void store (
size_t index,
const IntrinsicType& value );
2514 inline void storeu(
size_t index,
const IntrinsicType& value );
2515 inline void stream(
size_t index,
const IntrinsicType& value );
2517 template<
typename VT2 >
2518 inline typename DisableIf< VectorizedAssign<VT2> >::Type
2519 assign(
const DenseVector <VT2,TF>& rhs );
2521 template<
typename VT2 >
2522 inline typename EnableIf< VectorizedAssign<VT2> >::Type
2523 assign(
const DenseVector <VT2,TF>& rhs );
2525 template<
typename VT2 >
inline void assign(
const SparseVector<VT2,TF>& rhs );
2527 template<
typename VT2 >
2528 inline typename DisableIf< VectorizedAddAssign<VT2> >::Type
2529 addAssign(
const DenseVector <VT2,TF>& rhs );
2531 template<
typename VT2 >
2532 inline typename EnableIf< VectorizedAddAssign<VT2> >::Type
2533 addAssign (
const DenseVector <VT2,TF>& rhs );
2535 template<
typename VT2 >
inline void addAssign(
const SparseVector<VT2,TF>& rhs );
2537 template<
typename VT2 >
2538 inline typename DisableIf< VectorizedSubAssign<VT2> >::Type
2539 subAssign (
const DenseVector <VT2,TF>& rhs );
2541 template<
typename VT2 >
2542 inline typename EnableIf< VectorizedSubAssign<VT2> >::Type
2543 subAssign(
const DenseVector <VT2,TF>& rhs );
2545 template<
typename VT2 >
inline void subAssign(
const SparseVector<VT2,TF>& rhs );
2547 template<
typename VT2 >
2548 inline typename DisableIf< VectorizedMultAssign<VT2> >::Type
2549 multAssign(
const DenseVector <VT2,TF>& rhs );
2551 template<
typename VT2 >
2552 inline typename EnableIf< VectorizedMultAssign<VT2> >::Type
2553 multAssign(
const DenseVector <VT2,TF>& rhs );
2555 template<
typename VT2 >
inline void multAssign(
const SparseVector<VT2,TF>& rhs );
2570 template<
typename VT2,
bool AF2,
bool TF2 >
friend class DenseSubvector;
2572 template<
bool AF1,
typename VT2,
bool AF2,
bool TF2 >
2573 friend const DenseSubvector<VT2,AF1,TF2>
2574 subvector(
const DenseSubvector<VT2,AF2,TF2>& dv,
size_t index,
size_t size );
2576 template<
typename VT2,
bool AF2,
bool TF2 >
2577 friend bool isSame(
const DenseSubvector<VT2,AF2,TF2>& a,
const DenseVector<VT2,TF2>& b );
2579 template<
typename VT2,
bool AF2,
bool TF2 >
2580 friend bool isSame(
const DenseVector<VT2,TF2>& a,
const DenseSubvector<VT2,AF2,TF2>& b );
2582 template<
typename VT2,
bool AF2,
bool TF2 >
2583 friend bool isSame(
const DenseSubvector<VT2,AF2,TF2>& a,
const DenseSubvector<VT2,AF2,TF2>& b );
2585 template<
typename VT2,
bool AF2,
bool TF2 >
2586 friend typename DerestrictTrait< DenseSubvector<VT2,AF2,TF2> >::Type
2587 derestrict( DenseSubvector<VT2,AF2,TF2>& dv );
2623 template<
typename VT
2630 if( index + n > vector.size() )
2631 throw std::invalid_argument(
"Invalid subvector specification" );
2634 throw std::invalid_argument(
"Invalid subvector alignment" );
2655 template<
typename VT
2661 return vector_[offset_+index];
2674 template<
typename VT
2680 return const_cast<const VT&
>( vector_ )[offset_+index];
2694 template<
typename VT
2698 return vector_.data() + offset_;
2712 template<
typename VT
2716 return vector_.data() + offset_;
2730 template<
typename VT
2734 return ( vector_.begin() + offset_ );
2748 template<
typename VT
2753 return ( vector_.cbegin() + offset_ );
2767 template<
typename VT
2772 return ( vector_.cbegin() + offset_ );
2786 template<
typename VT
2790 return ( vector_.begin() + offset_ + size_ );
2804 template<
typename VT
2809 return ( vector_.cbegin() + offset_ + size_ );
2823 template<
typename VT
2828 return ( vector_.cbegin() + offset_ + size_ );
2849 template<
typename VT
2851 inline DenseSubvector<VT,aligned,TF>&
2854 const size_t iend( offset_ + size_ );
2856 for(
size_t i=offset_; i<iend; ++i )
2876 template<
typename VT
2878 inline DenseSubvector<VT,aligned,TF>&
2884 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && offset_ == rhs.offset_ ) )
2887 if(
size() != rhs.size() )
2888 throw std::invalid_argument(
"Subvector sizes do not match" );
2890 if( rhs.canAlias( &vector_ ) ) {
2915 template<
typename VT
2917 template<
typename VT2 >
2918 inline DenseSubvector<VT,aligned,TF>&
2925 throw std::invalid_argument(
"Vector sizes do not match" );
2927 if( (~rhs).canAlias( &vector_ ) ) {
2932 if( IsSparseVector<VT2>::value )
2954 template<
typename VT
2956 template<
typename VT2 >
2957 inline DenseSubvector<VT,aligned,TF>&
2958 DenseSubvector<VT,aligned,TF>::operator+=(
const Vector<VT2,TF>& rhs )
2964 throw std::invalid_argument(
"Vector sizes do not match" );
2966 if( (~rhs).canAlias( &vector_ ) ) {
2991 template<
typename VT
2993 template<
typename VT2 >
2994 inline DenseSubvector<VT,aligned,TF>&
2995 DenseSubvector<VT,aligned,TF>::operator-=(
const Vector<VT2,TF>& rhs )
3001 throw std::invalid_argument(
"Vector sizes do not match" );
3003 if( (~rhs).canAlias( &vector_ ) ) {
3029 template<
typename VT
3031 template<
typename VT2 >
3032 inline DenseSubvector<VT,aligned,TF>&
3033 DenseSubvector<VT,aligned,TF>::operator*=(
const Vector<VT2,TF>& rhs )
3039 throw std::invalid_argument(
"Vector sizes do not match" );
3041 if( (~rhs).canAlias( &vector_ ) || IsSparseVector<VT2>::value ) {
3063 template<
typename VT
3065 template<
typename Other >
3066 inline typename EnableIf< IsNumeric<Other>, DenseSubvector<VT,aligned,TF> >::Type&
3067 DenseSubvector<VT,aligned,TF>::operator*=( Other rhs )
3086 template<
typename VT
3088 template<
typename Other >
3089 inline typename EnableIf< IsNumeric<Other>, DenseSubvector<VT,aligned,TF> >::Type&
3090 DenseSubvector<VT,aligned,TF>::operator/=( Other rhs )
3115 template<
typename VT
3131 template<
typename VT
3135 return vector_.capacity() - offset_;
3150 template<
typename VT
3154 size_t nonzeros( 0 );
3156 const size_t iend( offset_ + size_ );
3157 for(
size_t i=offset_; i<iend; ++i ) {
3174 template<
typename VT
3180 const size_t iend( offset_ + size_ );
3181 for(
size_t i=offset_; i<iend; ++i )
3182 clear( vector_[i] );
3195 template<
typename VT
3197 template<
typename Other >
3198 inline DenseSubvector<VT,aligned,TF>& DenseSubvector<VT,aligned,TF>::scale(
const Other& scalar )
3200 const size_t iend( offset_ + size_ );
3201 for(
size_t i=offset_; i<iend; ++i )
3202 vector_[i] *= scalar;
3228 template<
typename VT
3230 template<
typename Other >
3233 return vector_.isAliased( alias );
3250 template<
typename VT
3252 template<
typename VT2
3257 return ( vector_.isAliased( &alias->vector_ ) &&
3258 ( offset_ + size_ > alias->offset_ ) && ( offset_ < alias->offset_ + alias->size_ ) );
3275 template<
typename VT
3277 template<
typename Other >
3280 return vector_.isAliased( alias );
3297 template<
typename VT
3299 template<
typename VT2
3304 return ( vector_.isAliased( &alias->vector_ ) &&
3305 ( offset_ + size_ > alias->offset_ ) && ( offset_ < alias->offset_ + alias->size_ ) );
3321 template<
typename VT
3342 template<
typename VT
3366 template<
typename VT
3376 return vector_.load( offset_+index );
3396 template<
typename VT
3406 return vector_.loadu( offset_+index );
3427 template<
typename VT
3437 vector_.store( offset_+index, value );
3458 template<
typename VT
3468 vector_.storeu( offset_+index, value );
3489 template<
typename VT
3499 vector_.stream( offset_+index, value );
3517 template<
typename VT
3519 template<
typename VT2 >
3520 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAssign<VT2> >::Type
3525 const size_t ipos(
size() &
size_t(-2) );
3526 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3527 vector_[i+offset_ ] = (~rhs)[i ];
3528 vector_[i+offset_+1UL] = (~rhs)[i+1UL];
3530 if( ipos <
size() ) {
3531 vector_[ipos+offset_] = (~rhs)[ipos];
3550 template<
typename VT
3552 template<
typename VT2 >
3553 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAssign<VT2> >::Type
3563 vector_.stream( offset_+i, (~rhs).
load(i) );
3568 const size_t ipos( size_ &
size_t(-
IT::size*4) );
3572 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
3579 store( i, it.load() );
3599 template<
typename VT
3601 template<
typename VT2 >
3607 vector_[element->index()+offset_] = element->value();
3625 template<
typename VT
3627 template<
typename VT2 >
3628 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >::Type
3633 const size_t ipos(
size() &
size_t(-2) );
3634 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3635 vector_[i+offset_ ] += (~rhs)[i ];
3636 vector_[i+offset_+1UL] += (~rhs)[i+1UL];
3638 if( ipos <
size() ) {
3639 vector_[ipos+offset_] += (~rhs)[ipos];
3658 template<
typename VT
3660 template<
typename VT2 >
3661 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >::Type
3668 const size_t ipos( size_ &
size_t(-
IT::size*4) );
3672 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
3698 template<
typename VT
3700 template<
typename VT2 >
3706 vector_[element->index()+offset_] += element->value();
3724 template<
typename VT
3726 template<
typename VT2 >
3727 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >::Type
3732 const size_t ipos(
size() &
size_t(-2) );
3733 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3734 vector_[i+offset_ ] -= (~rhs)[i ];
3735 vector_[i+offset_+1UL] -= (~rhs)[i+1UL];
3737 if( ipos <
size() ) {
3738 vector_[ipos+offset_] -= (~rhs)[ipos];
3757 template<
typename VT
3759 template<
typename VT2 >
3760 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >::Type
3767 const size_t ipos( size_ &
size_t(-
IT::size*4) );
3771 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
3797 template<
typename VT
3799 template<
typename VT2 >
3805 vector_[element->index()+offset_] -= element->value();
3823 template<
typename VT
3825 template<
typename VT2 >
3826 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >::Type
3831 const size_t ipos(
size() &
size_t(-2) );
3832 for(
size_t i=0UL; i<ipos; i+=2UL ) {
3833 vector_[i+offset_ ] *= (~rhs)[i ];
3834 vector_[i+offset_+1UL] *= (~rhs)[i+1UL];
3836 if( ipos <
size() ) {
3837 vector_[ipos+offset_] *= (~rhs)[ipos];
3856 template<
typename VT
3858 template<
typename VT2 >
3859 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >::Type
3866 const size_t ipos( size_ &
size_t(-
IT::size*4) );
3870 for(
size_t i=0UL; i<ipos; i+=
IT::size*4UL ) {
3896 template<
typename VT
3898 template<
typename VT2 >
3908 vector_[element->index()+offset_] = tmp[element->index()] * element->value();
3934 template<
typename VT1
3936 class DenseSubvector< DVecDVecCrossExpr<VT1,VT2>,
unaligned, false >
3937 :
public DenseVector< DenseSubvector< DVecDVecCrossExpr<VT1,VT2>, unaligned, false >, false >
3942 typedef DVecDVecCrossExpr<VT1,VT2> CPE;
3948 typedef DenseSubvector<CPE,unaligned,false>
This;
3949 typedef typename SubvectorTrait<RT>::Type
ResultType;
3958 enum { vectorizable = 0 };
3961 enum { smpAssignable = 0 };
3971 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
3984 inline ReturnType
operator[](
size_t index )
const {
3995 inline size_t size()
const {
4006 template<
typename T >
4007 inline bool canAlias(
const T* alias )
const {
4008 return vector_.canAlias( alias );
4018 template<
typename T >
4019 inline bool isAliased(
const T* alias )
const {
4020 return vector_.isAliased( alias );
4035 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4036 friend const DenseSubvector<VT,AF1,TF>
4037 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4039 template<
typename VT3,
bool AF3,
bool TF3 >
4040 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4042 template<
typename VT3,
bool AF3,
bool TF3 >
4043 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4045 template<
typename VT3,
bool AF3,
bool TF3 >
4046 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4073 template<
typename VT1
4075 class DenseSubvector< DVecSVecCrossExpr<VT1,VT2>,
unaligned, false >
4076 :
public DenseVector< DenseSubvector< DVecSVecCrossExpr<VT1,VT2>, unaligned, false >, false >
4081 typedef DVecSVecCrossExpr<VT1,VT2> CPE;
4087 typedef DenseSubvector<CPE,unaligned,false>
This;
4088 typedef typename SubvectorTrait<RT>::Type
ResultType;
4097 enum { vectorizable = 0 };
4100 enum { smpAssignable = 0 };
4110 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
4123 inline ReturnType
operator[](
size_t index )
const {
4134 inline size_t size()
const {
4145 template<
typename T >
4146 inline bool canAlias(
const T* alias )
const {
4147 return vector_.canAlias( alias );
4157 template<
typename T >
4158 inline bool isAliased(
const T* alias )
const {
4159 return vector_.isAliased( alias );
4174 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4175 friend const DenseSubvector<VT,AF1,TF>
4176 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4178 template<
typename VT3,
bool AF3,
bool TF3 >
4179 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4181 template<
typename VT3,
bool AF3,
bool TF3 >
4182 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4184 template<
typename VT3,
bool AF3,
bool TF3 >
4185 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4212 template<
typename VT1
4214 class DenseSubvector< SVecDVecCrossExpr<VT1,VT2>,
unaligned, false >
4215 :
public DenseVector< DenseSubvector< SVecDVecCrossExpr<VT1,VT2>, unaligned, false >, false >
4220 typedef SVecDVecCrossExpr<VT1,VT2> CPE;
4226 typedef DenseSubvector<CPE,unaligned,false>
This;
4227 typedef typename SubvectorTrait<RT>::Type
ResultType;
4236 enum { vectorizable = 0 };
4239 enum { smpAssignable = 0 };
4249 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
4262 inline ReturnType
operator[](
size_t index )
const {
4273 inline size_t size()
const {
4284 template<
typename T >
4285 inline bool canAlias(
const T* alias )
const {
4286 return vector_.canAlias( alias );
4296 template<
typename T >
4297 inline bool isAliased(
const T* alias )
const {
4298 return vector_.isAliased( alias );
4313 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4314 friend const DenseSubvector<VT,AF1,TF>
4315 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4317 template<
typename VT3,
bool AF3,
bool TF3 >
4318 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4320 template<
typename VT3,
bool AF3,
bool TF3 >
4321 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4323 template<
typename VT3,
bool AF3,
bool TF3 >
4324 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4351 template<
typename VT1
4353 class DenseSubvector< SVecSVecCrossExpr<VT1,VT2>,
unaligned, false >
4354 :
public DenseVector< DenseSubvector< SVecSVecCrossExpr<VT1,VT2>, unaligned, false >, false >
4359 typedef SVecSVecCrossExpr<VT1,VT2> CPE;
4365 typedef DenseSubvector<CPE,unaligned,false>
This;
4366 typedef typename SubvectorTrait<RT>::Type
ResultType;
4375 enum { vectorizable = 0 };
4378 enum { smpAssignable = 0 };
4388 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
4401 inline ReturnType
operator[](
size_t index )
const {
4412 inline size_t size()
const {
4423 template<
typename T >
4424 inline bool canAlias(
const T* alias )
const {
4425 return vector_.canAlias( alias );
4435 template<
typename T >
4436 inline bool isAliased(
const T* alias )
const {
4437 return vector_.isAliased( alias );
4452 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4453 friend const DenseSubvector<VT,AF1,TF>
4454 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4456 template<
typename VT3,
bool AF3,
bool TF3 >
4457 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4459 template<
typename VT3,
bool AF3,
bool TF3 >
4460 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4462 template<
typename VT3,
bool AF3,
bool TF3 >
4463 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4485 template<
typename VT,
bool AF,
bool TF >
4486 inline void reset( DenseSubvector<VT,AF,TF>& dv );
4488 template<
typename VT,
bool AF,
bool TF >
4489 inline void clear( DenseSubvector<VT,AF,TF>& dv );
4491 template<
typename VT,
bool AF,
bool TF >
4492 inline bool isDefault(
const DenseSubvector<VT,AF,TF>& dv );
4494 template<
typename VT,
bool AF,
bool TF >
4495 inline bool isSame(
const DenseSubvector<VT,AF,TF>& a,
const DenseVector<VT,TF>& b );
4497 template<
typename VT,
bool AF,
bool TF >
4498 inline bool isSame(
const DenseVector<VT,TF>& a,
const DenseSubvector<VT,AF,TF>& b );
4500 template<
typename VT,
bool AF,
bool TF >
4501 inline bool isSame(
const DenseSubvector<VT,AF,TF>& a,
const DenseSubvector<VT,AF,TF>& b );
4513 template<
typename VT
4530 template<
typename VT
4559 template<
typename VT
4564 for(
size_t i=0UL; i<dv.size(); ++i )
4583 template<
typename VT
4588 return (
isSame( a.vector_, ~b ) && ( a.size() == (~b).
size() ) );
4605 template<
typename VT
4610 return (
isSame( ~a, b.vector_ ) && ( (~a).size() == b.size() ) );
4627 template<
typename VT
4632 return (
isSame( a.vector_, b.vector_ ) && ( a.offset_ == b.offset_ ) && ( a.size_ == b.size_ ) );
4652 template<
typename VT
4655 inline typename DerestrictTrait< DenseSubvector<VT,AF,TF> >::Type
4656 derestrict( DenseSubvector<VT,AF,TF>& dv )
4658 typedef typename DerestrictTrait< DenseSubvector<VT,AF,TF> >::Type
ReturnType;
4659 return ReturnType( derestrict( dv.vector_ ), dv.offset_, dv.size_ );
4690 inline const DenseSubvector<VT,AF1,TF>
4691 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size )
4695 if( index + size > dv.size() )
4696 throw std::invalid_argument(
"Invalid subvector specification" );
4698 return DenseSubvector<VT,AF1,TF>( dv.vector_, dv.offset_ + index,
size );
4714 template<
typename VT,
bool AF,
bool TF >
4715 struct IsRestricted< DenseSubvector<VT,AF,TF> > :
public If< IsRestricted<VT>, TrueType, FalseType >::Type
4717 enum { value = IsRestricted<VT>::value };
4734 template<
typename VT,
bool AF,
bool TF >
4735 struct DerestrictTrait< DenseSubvector<VT,AF,TF> >
4737 typedef DenseSubvector< typename RemoveReference< typename DerestrictTrait<VT>::Type >::Type, AF, TF > Type;
4753 template<
typename VT,
bool AF,
bool TF >
4754 struct HasConstDataAccess< DenseSubvector<VT,AF,TF> >
4755 :
public If< HasConstDataAccess<VT>, TrueType, FalseType >::Type
4757 enum { value = HasConstDataAccess<VT>::value };
4774 template<
typename VT,
bool AF,
bool TF >
4775 struct HasMutableDataAccess< DenseSubvector<VT,AF,TF> >
4776 :
public If< HasMutableDataAccess<VT>, TrueType, FalseType >::Type
4778 enum { value = HasMutableDataAccess<VT>::value };
4779 typedef typename If< HasMutableDataAccess<VT>,
TrueType,
FalseType >::Type Type;
4795 template<
typename VT,
bool AF,
bool TF >
4796 struct SubvectorTrait< DenseSubvector<VT,AF,TF> >
4814 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4815 struct SubvectorExprTrait< DenseSubvector<VT,AF1,TF>, AF2 >
4817 typedef DenseSubvector<VT,AF2,TF> Type;
4825 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4826 struct SubvectorExprTrait< const DenseSubvector<VT,AF1,TF>, AF2 >
4828 typedef DenseSubvector<VT,AF2,TF> Type;
4836 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4837 struct SubvectorExprTrait< volatile DenseSubvector<VT,AF1,TF>, AF2 >
4839 typedef DenseSubvector<VT,AF2,TF> Type;
4847 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4848 struct SubvectorExprTrait< const volatile DenseSubvector<VT,AF1,TF>, AF2 >
4850 typedef DenseSubvector<VT,AF2,TF> Type;
4858 template<
typename VT1,
typename VT2,
bool AF >
4859 struct SubvectorExprTrait< DVecDVecCrossExpr<VT1,VT2>, AF >
4863 typedef DenseSubvector< DVecDVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
4872 template<
typename VT1,
typename VT2,
bool AF >
4873 struct SubvectorExprTrait< DVecSVecCrossExpr<VT1,VT2>, AF >
4877 typedef DenseSubvector< DVecSVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
4886 template<
typename VT1,
typename VT2,
bool AF >
4887 struct SubvectorExprTrait< SVecDVecCrossExpr<VT1,VT2>, AF >
4891 typedef DenseSubvector< SVecDVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
4900 template<
typename VT1,
typename VT2,
bool AF >
4901 struct SubvectorExprTrait< SVecSVecCrossExpr<VT1,VT2>, AF >
4905 typedef DenseSubvector< SVecSVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
const ElementType * ConstPointer
Pointer to a constant subvector value.
Definition: DenseSubvector.h:422
Constraint on the data type.
const size_t final_
The final index for unaligned intrinsic operations.
Definition: DenseSubvector.h:982
Constraint on the data type.
BLAZE_ALWAYS_INLINE void multAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the multiplication assignment of a matrix to a matrix.
Definition: Matrix.h:879
bool canAlias(const Other *alias) const
Returns whether the dense subvector can alias with the given address alias.
Definition: DenseSubvector.h:1638
#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 subvector/submatrix alignment flag values.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
const size_t rest_
The number of remaining elements in an unaligned intrinsic operation.
Definition: DenseSubvector.h:981
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
SubvectorIterator(IteratorType iterator, IteratorType finalIterator, size_t remainingElements, bool isMemoryAligned)
Constructor of the SubvectorIterator class.
Definition: DenseSubvector.h:478
SubvectorIterator()
Default constructor of the SubvectorIterator class.
Definition: DenseSubvector.h:462
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:258
IT::Type IntrinsicType
Intrinsic type of the subvector elements.
Definition: DenseSubvector.h:411
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:946
ReferenceType reference
Reference return type.
Definition: DenseSubvector.h:455
Header file for the IsSame and IsStrictlySame type traits.
size_t nonZeros() const
Returns the number of non-zero elements in the subvector.
Definition: DenseSubvector.h:1562
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
bool isAligned_
Memory alignment flag.
Definition: DenseSubvector.h:778
Header file for the IsRowVector type trait.
const DenseSubvector & CompositeType
Data type for composite expression templates.
Definition: DenseSubvector.h:413
Header file for the DenseVector base class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
SubvectorIterator(const SubvectorIterator< IteratorType2 > &it)
Conversion constructor from different SubvectorIterator instances.
Definition: DenseSubvector.h:493
Header file for the Computation base class.
IntrinsicType loadu() const
Unaligned load of an intrinsic element of the dense subvector.
Definition: DenseSubvector.h:602
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:118
bool operator==(const SubvectorIterator &rhs) const
Equality comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:626
DenseSubvector(Operand vector, size_t index, size_t n)
The constructor for DenseSubvector.
Definition: DenseSubvector.h:1059
IntrinsicTrait< typename VT::ElementType > IT
Intrinsic trait for the vector element type.
Definition: DenseSubvector.h:391
const size_t offset_
The offset of the subvector within the dense vector.
Definition: DenseSubvector.h:979
size_t capacity() const
Returns the maximum capacity of the dense subvector.
Definition: DenseSubvector.h:1544
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Iterator begin()
Returns an iterator to the first element of the subvector.
Definition: DenseSubvector.h:1162
DenseSubvector & operator=(const ElementType &rhs)
Homogenous assignment to all subvector elements.
Definition: DenseSubvector.h:1277
const bool aligned
Alignment flag for aligned subvectors and submatrices.
Definition: AlignmentFlag.h:83
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:123
void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the subvector.
Definition: DenseSubvector.h:1904
Constraint on the data type.
void reset()
Reset to the default initial values.
Definition: DenseSubvector.h:1585
Pointer data()
Low-level data access to the subvector elements.
Definition: DenseSubvector.h:1128
DifferenceType difference_type
Difference between two iterators.
Definition: DenseSubvector.h:456
Pointer data()
Low-level data access to the array elements.
Definition: AlignedArray.h:441
SubvectorTrait< VT >::Type ResultType
Result type for expression template evaluations.
Definition: DenseSubvector.h:408
Header file for the DisableIf class template.
void store(size_t index, const IntrinsicType &value)
Aligned store of an intrinsic element of the subvector.
Definition: DenseSubvector.h:1838
Operand vector_
The dense vector containing the subvector.
Definition: DenseSubvector.h:978
const SubvectorIterator operator--(int)
Post-decrement operator.
Definition: DenseSubvector.h:562
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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:76
Header file for nested template disabiguation.
Header file for the If class template.
Header file for the Subvector base class.
Reference operator[](size_t index)
Subscript operator for the direct access to the subvector elements.
Definition: DenseSubvector.h:1092
IfTrue< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant subvector value.
Definition: DenseSubvector.h:425
SubvectorIterator & operator++()
Pre-increment operator.
Definition: DenseSubvector.h:530
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
Header file for the Or class template.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type store(T *address, const sse_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Store.h:80
friend const SubvectorIterator operator-(const SubvectorIterator &it, size_t dec)
Subtraction between a SubvectorIterator and an integral value.
Definition: DenseSubvector.h:728
std::iterator_traits< IteratorType >::difference_type DifferenceType
Difference between two iterators.
Definition: DenseSubvector.h:449
ConstIterator cbegin() const
Returns an iterator to the first element of the subvector.
Definition: DenseSubvector.h:1198
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
DifferenceType operator-(const SubvectorIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DenseSubvector.h:692
VT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseSubvector.h:412
Header file for the subvector trait.
DenseSubvector< VT, AF, TF > This
Type of this DenseSubvector instance.
Definition: DenseSubvector.h:407
friend const SubvectorIterator operator+(size_t inc, const SubvectorIterator &it)
Addition between an integral value and a SubvectorIterator.
Definition: DenseSubvector.h:716
bool operator!=(const SubvectorIterator &rhs) const
Inequality comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:637
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
SubvectorIterator & operator--()
Pre-decrement operator.
Definition: DenseSubvector.h:551
IteratorType iterator_
Iterator to the current subvector element.
Definition: DenseSubvector.h:775
Constraint on the data type.
Constraint on the data type.
#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
IteratorType base() const
Access to the current position of the subvector iterator.
Definition: DenseSubvector.h:738
Constraint on the data type.
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:195
size_t size() const
Returns the current size/dimension of the dense subvector.
Definition: DenseSubvector.h:1529
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseSubvector.h:409
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:841
Header file for the DerestrictTrait class template.
const bool unaligned
Alignment flag for unaligned subvectors and submatrices.
Definition: AlignmentFlag.h:63
std::iterator_traits< IteratorType >::iterator_category IteratorCategory
The iterator category.
Definition: DenseSubvector.h:437
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
Header file for the CrossExpr base class.
Header file for the IsNumeric type trait.
size_t rest_
The number of remaining elements beyond the final iterator.
Definition: DenseSubvector.h:777
Header file for the HasConstDataAccess type trait.
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.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2506
Header file for the IsConst type trait.
Iterator end()
Returns an iterator just past the last element of the subvector.
Definition: DenseSubvector.h:1216
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
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
Base class for all subvectors.The Subvector class serves as a tag for all subvectors (i...
Definition: Subvector.h:64
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
View on a specific subvector of a dense vector.The DenseSubvector template represents a view on a spe...
Definition: DenseSubvector.h:382
SubvectorIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DenseSubvector.h:507
bool operator>(const SubvectorIterator &rhs) const
Greater-than comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:659
bool isAligned() const
Returns whether the subvector is properly aligned in memory.
Definition: DenseSubvector.h:1726
std::iterator_traits< IteratorType >::pointer PointerType
Pointer return type.
Definition: DenseSubvector.h:443
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
SubvectorExprTrait< VT, unaligned >::Type subvector(Vector< VT, TF > &vector, size_t index, size_t size)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:140
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const sse_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:77
ValueType value_type
Type of the underlying elements.
Definition: DenseSubvector.h:453
Header file for the AlignedArray implementation.
Header file for the cache size of the target architecture.
bool canSMPAssign() const
Returns whether the subvector can be used in SMP assignments.
Definition: DenseSubvector.h:1746
bool isAligned() const
Access to the iterator's memory alignment flag.
Definition: DenseSubvector.h:768
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the isDefault shim.
ReferenceType operator*() const
Direct access to the element at the current iterator position.
Definition: DenseSubvector.h:572
IteratorType final() const
Access to the final position of the subvector iterator.
Definition: DenseSubvector.h:748
const size_t size_
The size of the subvector.
Definition: DenseSubvector.h:980
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
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
IntrinsicType load() const
Aligned load of an intrinsic element of the dense subvector.
Definition: DenseSubvector.h:587
const SubvectorIterator operator++(int)
Post-increment operator.
Definition: DenseSubvector.h:541
IteratorCategory iterator_category
The iterator category.
Definition: DenseSubvector.h:452
Header file for the RemoveReference type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
size_t rest() const
Access to the number of remaining elements beyond the final iterator.
Definition: DenseSubvector.h:758
VT::ConstReference ConstReference
Reference to a constant subvector value.
Definition: DenseSubvector.h:416
SubvectorIterator< typename VT::ConstIterator > ConstIterator
Iterator over constant elements.
Definition: DenseSubvector.h:785
Header file for all intrinsic functionality.
IntrinsicType loadu(size_t index) const
Unaligned load of an intrinsic element of the dense subvector.
Definition: DenseSubvector.h:1794
friend const SubvectorIterator operator+(const SubvectorIterator &it, size_t inc)
Addition between a SubvectorIterator and an integral value.
Definition: DenseSubvector.h:704
bool isAliased(const Other *alias) const
Returns whether the dense subvector is aliased with the given address alias.
Definition: DenseSubvector.h:1683
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBVECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is a subvector type (i.e. a dense or sparse subvector), a compilation error is created.
Definition: Subvector.h:118
PointerType pointer
Pointer return type.
Definition: DenseSubvector.h:454
const bool isAligned_
Memory alignment flag.
Definition: DenseSubvector.h:987
If< IsExpression< VT >, VT, VT & >::Type Operand
Composite data type of the dense vector expression.
Definition: DenseSubvector.h:388
IteratorType final_
The final iterator for intrinsic operations.
Definition: DenseSubvector.h:776
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:151
IntrinsicType load(size_t index) const
Aligned load of an intrinsic element of the dense subvector.
Definition: DenseSubvector.h:1770
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:260
IfTrue< useConst, ConstIterator, SubvectorIterator< typename VT::Iterator > >::Type Iterator
Iterator over non-constant elements.
Definition: DenseSubvector.h:788
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
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
bool operator>=(const SubvectorIterator &rhs) const
Greater-than comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:681
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
ConstIterator cend() const
Returns an iterator just past the last element of the subvector.
Definition: DenseSubvector.h:1252
Header file for the SubvectorExprTrait class template.
SubvectorIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DenseSubvector.h:519
Implementation of a static array with a fixed alignment.The AlignedArray class template represents a ...
Definition: AlignedArray.h:264
Iterator over the elements of the sparse subvector.
Definition: DenseSubvector.h:432
IfTrue< useConst, ConstReference, typename VT::Reference >::Type Reference
Reference to a non-constant subvector value.
Definition: DenseSubvector.h:419
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
std::iterator_traits< IteratorType >::value_type ValueType
Type of the underlying elements.
Definition: DenseSubvector.h:440
VT::ElementType ElementType
Type of the subvector elements.
Definition: DenseSubvector.h:410
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a simple dense v...
Definition: Thresholds.h:207
void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the subvector.
Definition: DenseSubvector.h:1862
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
bool operator<(const SubvectorIterator &rhs) const
Less-than comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:648
Header file for the IsRestricted type trait.
System settings for the inline keywords.
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
bool operator<=(const SubvectorIterator &rhs) const
Less-than comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:670
#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:238
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
Compile time type selection.The IfTrue class template selects one of the two given types T1 and T2 de...
Definition: If.h:59
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
std::iterator_traits< IteratorType >::reference ReferenceType
Reference return type.
Definition: DenseSubvector.h:446
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849