35 #ifndef _BLAZE_MATH_VIEWS_DENSESUBVECTOR_H_
36 #define _BLAZE_MATH_VIEWS_DENSESUBVECTOR_H_
373 template<
typename VT
375 ,
bool TF = IsRowVector<VT>::value >
425 template<
typename IteratorType >
434 typedef typename std::iterator_traits<IteratorType>::value_type
ValueType;
437 typedef typename std::iterator_traits<IteratorType>::pointer
PointerType;
440 typedef typename std::iterator_traits<IteratorType>::reference
ReferenceType;
443 typedef typename std::iterator_traits<IteratorType>::difference_type
DifferenceType;
579 for(
size_t i=0UL; i<
rest_; ++i )
581 for(
size_t i=rest_; i<IT::size; ++i )
721 enum { vectorizable = VT::vectorizable };
724 enum { smpAssignable = VT::smpAssignable };
761 template<
typename VT2 >
inline DenseSubvector& operator+=(
const Vector<VT2,TF>& rhs );
762 template<
typename VT2 >
inline DenseSubvector& operator-=(
const Vector<VT2,TF>& rhs );
763 template<
typename VT2 >
inline DenseSubvector& operator*=(
const Vector<VT2,TF>& rhs );
765 template<
typename Other >
766 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
767 operator*=( Other rhs );
769 template<
typename Other >
770 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
771 operator/=( Other rhs );
778 inline size_t size()
const;
782 template<
typename Other >
inline DenseSubvector& scale(
const Other& scalar );
789 template<
typename VT2 >
791 struct VectorizedAssign {
792 enum { value = vectorizable && VT2::vectorizable &&
793 IsSame<ElementType,typename VT2::ElementType>::value };
800 template<
typename VT2 >
802 struct VectorizedAddAssign {
803 enum { value = vectorizable && VT2::vectorizable &&
804 IsSame<ElementType,typename VT2::ElementType>::value &&
805 IntrinsicTrait<ElementType>::addition };
812 template<
typename VT2 >
814 struct VectorizedSubAssign {
815 enum { value = vectorizable && VT2::vectorizable &&
816 IsSame<ElementType,typename VT2::ElementType>::value &&
817 IntrinsicTrait<ElementType>::subtraction };
824 template<
typename VT2 >
826 struct VectorizedMultAssign {
827 enum { value = vectorizable && VT2::vectorizable &&
828 IsSame<ElementType,typename VT2::ElementType>::value &&
829 IntrinsicTrait<ElementType>::multiplication };
838 template<
typename Other >
839 inline bool canAlias(
const Other* alias )
const;
841 template<
typename VT2,
bool AF2,
bool TF2 >
842 inline bool canAlias(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
844 template<
typename Other >
845 inline bool isAliased(
const Other* alias )
const;
847 template<
typename VT2,
bool AF2,
bool TF2 >
848 inline bool isAliased(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
859 template<
typename VT2 >
860 inline typename DisableIf< VectorizedAssign<VT2> >::Type
861 assign(
const DenseVector <VT2,TF>& rhs );
863 template<
typename VT2 >
864 inline typename EnableIf< VectorizedAssign<VT2> >::Type
865 assign(
const DenseVector <VT2,TF>& rhs );
867 template<
typename VT2 >
inline void assign(
const SparseVector<VT2,TF>& rhs );
869 template<
typename VT2 >
870 inline typename DisableIf< VectorizedAddAssign<VT2> >::Type
871 addAssign(
const DenseVector <VT2,TF>& rhs );
873 template<
typename VT2 >
874 inline typename EnableIf< VectorizedAddAssign<VT2> >::Type
875 addAssign (
const DenseVector <VT2,TF>& rhs );
877 template<
typename VT2 >
inline void addAssign(
const SparseVector<VT2,TF>& rhs );
879 template<
typename VT2 >
880 inline typename DisableIf< VectorizedSubAssign<VT2> >::Type
881 subAssign (
const DenseVector <VT2,TF>& rhs );
883 template<
typename VT2 >
884 inline typename EnableIf< VectorizedSubAssign<VT2> >::Type
885 subAssign(
const DenseVector <VT2,TF>& rhs );
887 template<
typename VT2 >
inline void subAssign(
const SparseVector<VT2,TF>& rhs );
889 template<
typename VT2 >
890 inline typename DisableIf< VectorizedMultAssign<VT2> >::Type
891 multAssign(
const DenseVector <VT2,TF>& rhs );
893 template<
typename VT2 >
894 inline typename EnableIf< VectorizedMultAssign<VT2> >::Type
895 multAssign(
const DenseVector <VT2,TF>& rhs );
897 template<
typename VT2 >
inline void multAssign(
const SparseVector<VT2,TF>& rhs );
929 template<
typename VT2,
bool AF2,
bool TF2 >
friend class DenseSubvector;
931 template<
bool AF1,
typename VT2,
bool AF2,
bool TF2 >
935 template<
typename VT2,
bool AF2,
bool TF2 >
938 template<
typename VT2,
bool AF2,
bool TF2 >
941 template<
typename VT2,
bool AF2,
bool TF2 >
979 template<
typename VT
986 , rest_ ( n %
IT::size )
987 , final_ ( n - rest_ )
988 , isAligned_( ( index %
IT::size == 0UL ) &&
989 ( index + n == vector.size() || n %
IT::size == 0UL ) )
991 if( index + n > vector.size() )
992 throw std::invalid_argument(
"Invalid subvector specification" );
1011 template<
typename VT
1018 return vector_[offset_+index];
1029 template<
typename VT
1036 return const_cast<const VT&
>( vector_ )[offset_+index];
1048 template<
typename VT
1053 return vector_.data() + offset_;
1065 template<
typename VT
1070 return vector_.data() + offset_;
1082 template<
typename VT
1087 const typename VT::Iterator first( vector_.begin() + offset_ );
1088 return Iterator( first, first + final_, rest_, isAligned_ );
1100 template<
typename VT
1106 return ConstIterator( first, first + final_, rest_, isAligned_ );
1118 template<
typename VT
1124 return ConstIterator( first, first + final_, rest_, isAligned_ );
1136 template<
typename VT
1141 const typename VT::Iterator last( vector_.begin() + offset_ + size_ );
1142 return Iterator( last, last, rest_, isAligned_ );
1154 template<
typename VT
1172 template<
typename VT
1197 template<
typename VT
1202 const size_t iend( offset_ + size_ );
1204 for(
size_t i=offset_; i<iend; ++i )
1222 template<
typename VT
1230 if( &rhs ==
this || ( &vector_ == &rhs.
vector_ && offset_ == rhs.
offset_ ) )
1233 if( size() != rhs.
size() )
1234 throw std::invalid_argument(
"Subvector sizes do not match" );
1259 template<
typename VT
1262 template<
typename VT2 >
1268 if( size() != (~rhs).size() )
1269 throw std::invalid_argument(
"Vector sizes do not match" );
1271 if( (~rhs).canAlias( &vector_ ) ) {
1296 template<
typename VT
1299 template<
typename VT2 >
1305 if( size() != (~rhs).size() )
1306 throw std::invalid_argument(
"Vector sizes do not match" );
1308 if( (~rhs).canAlias( &vector_ ) ) {
1331 template<
typename VT
1334 template<
typename VT2 >
1340 if( size() != (~rhs).size() )
1341 throw std::invalid_argument(
"Vector sizes do not match" );
1343 if( (~rhs).canAlias( &vector_ ) ) {
1367 template<
typename VT
1370 template<
typename VT2 >
1376 if( size() != (~rhs).size() )
1377 throw std::invalid_argument(
"Vector sizes do not match" );
1399 template<
typename VT
1402 template<
typename Other >
1421 template<
typename VT
1424 template<
typename Other >
1449 template<
typename VT
1464 template<
typename VT
1469 return vector_.capacity() - offset_;
1482 template<
typename VT
1487 size_t nonzeros( 0 );
1489 const size_t iend( offset_ + size_ );
1490 for(
size_t i=offset_; i<iend; ++i ) {
1505 template<
typename VT
1512 const size_t iend( offset_ + size_ );
1513 for(
size_t i=offset_; i<iend; ++i )
1514 reset( vector_[i] );
1525 template<
typename VT
1528 template<
typename Other >
1531 const size_t iend( offset_ + size_ );
1532 for(
size_t i=offset_; i<iend; ++i )
1533 vector_[i] *= scalar;
1557 template<
typename VT
1560 template<
typename Other >
1563 return vector_.isAliased( alias );
1578 template<
typename VT
1581 template<
typename VT2
1586 return ( vector_.isAliased( &alias->
vector_ ) &&
1587 ( offset_ + size_ > alias->
offset_ ) && ( offset_ < alias->offset_ + alias->
size_ ) );
1602 template<
typename VT
1605 template<
typename Other >
1608 return vector_.isAliased( alias );
1623 template<
typename VT
1626 template<
typename VT2
1631 return ( vector_.isAliased( &alias->
vector_ ) &&
1632 ( offset_ + size_ > alias->
offset_ ) && ( offset_ < alias->offset_ + alias->
size_ ) );
1646 template<
typename VT
1666 template<
typename VT
1689 template<
typename VT
1695 return loadu( index );
1713 template<
typename VT
1727 return vector_.load( offset_+index );
1729 else if( index != final_ ) {
1730 return vector_.loadu( offset_+index );
1734 for(
size_t i=0UL; i<rest_; ++i )
1735 array[i] = vector_[offset_+index+i];
1736 for(
size_t i=rest_; i<IT::size; ++i )
1758 template<
typename VT
1782 template<
typename VT
1795 vector_.store( offset_+index, value );
1797 else if( index != final_ ) {
1798 vector_.storeu( offset_+index, value );
1803 for(
size_t i=0UL; i<rest_; ++i )
1804 vector_[offset_+index+i] = array[i];
1824 template<
typename VT
1845 template<
typename VT
1848 template<
typename VT2 >
1854 const size_t iend( size() &
size_t(-2) );
1855 for(
size_t i=0UL; i<iend; i+=2UL ) {
1856 vector_[i+offset_ ] = (~rhs)[i ];
1857 vector_[i+offset_+1UL] = (~rhs)[i+1UL];
1859 if( iend < size() ) {
1860 vector_[iend+offset_] = (~rhs)[iend];
1877 template<
typename VT
1880 template<
typename VT2 >
1890 !(~rhs).isAliased( &vector_ ) )
1892 for(
size_t i=0UL; i<size(); i+=IT::size ) {
1893 vector_.stream( offset_+i, (~rhs).
load(i) );
1898 const size_t iend( size_ &
size_t(-IT::size*4) );
1902 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
1903 vector_.storeu( offset_+i , it.load() ); it += IT::size;
1904 vector_.storeu( offset_+i+IT::size , it.load() ); it += IT::size;
1905 vector_.storeu( offset_+i+IT::size*2UL, it.load() ); it += IT::size;
1906 vector_.storeu( offset_+i+IT::size*3UL, it.load() ); it += IT::size;
1908 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
1927 template<
typename VT
1930 template<
typename VT2 >
1935 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
1936 vector_[element->index()+offset_] = element->value();
1952 template<
typename VT
1955 template<
typename VT2 >
1961 const size_t iend( size() &
size_t(-2) );
1962 for(
size_t i=0UL; i<iend; i+=2UL ) {
1963 vector_[i+offset_ ] += (~rhs)[i ];
1964 vector_[i+offset_+1UL] += (~rhs)[i+1UL];
1966 if( iend < size() ) {
1967 vector_[iend+offset_] += (~rhs)[iend];
1984 template<
typename VT
1987 template<
typename VT2 >
1995 const size_t iend( size_ &
size_t(-IT::size*4) );
1999 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
2000 vector_.storeu( offset_+i ,
load(i ) + it.load() ); it += IT::size;
2001 vector_.storeu( offset_+i+IT::size ,
load(i+IT::size ) + it.load() ); it += IT::size;
2002 vector_.storeu( offset_+i+IT::size*2UL,
load(i+IT::size*2UL) + it.load() ); it += IT::size;
2003 vector_.storeu( offset_+i+IT::size*3UL,
load(i+IT::size*3UL) + it.load() ); it += IT::size;
2005 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
2023 template<
typename VT
2026 template<
typename VT2 >
2031 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2032 vector_[element->index()+offset_] += element->value();
2048 template<
typename VT
2051 template<
typename VT2 >
2057 const size_t iend( size() &
size_t(-2) );
2058 for(
size_t i=0UL; i<iend; i+=2UL ) {
2059 vector_[i+offset_ ] -= (~rhs)[i ];
2060 vector_[i+offset_+1UL] -= (~rhs)[i+1UL];
2062 if( iend < size() ) {
2063 vector_[iend+offset_] -= (~rhs)[iend];
2080 template<
typename VT
2083 template<
typename VT2 >
2091 const size_t iend( size_ &
size_t(-IT::size*4) );
2095 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
2096 vector_.storeu( offset_+i ,
load(i ) - it.load() ); it += IT::size;
2097 vector_.storeu( offset_+i+IT::size ,
load(i+IT::size ) - it.load() ); it += IT::size;
2098 vector_.storeu( offset_+i+IT::size*2UL,
load(i+IT::size*2UL) - it.load() ); it += IT::size;
2099 vector_.storeu( offset_+i+IT::size*3UL,
load(i+IT::size*3UL) - it.load() ); it += IT::size;
2101 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
2119 template<
typename VT
2122 template<
typename VT2 >
2127 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2128 vector_[element->index()+offset_] -= element->value();
2144 template<
typename VT
2147 template<
typename VT2 >
2153 const size_t iend( size() &
size_t(-2) );
2154 for(
size_t i=0UL; i<iend; i+=2UL ) {
2155 vector_[i+offset_ ] *= (~rhs)[i ];
2156 vector_[i+offset_+1UL] *= (~rhs)[i+1UL];
2158 if( iend < size() ) {
2159 vector_[iend+offset_] *= (~rhs)[iend];
2176 template<
typename VT
2179 template<
typename VT2 >
2187 const size_t iend( size_ &
size_t(-IT::size*4) );
2191 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
2192 vector_.storeu( offset_+i ,
load(i ) * it.load() ); it += IT::size;
2193 vector_.storeu( offset_+i+IT::size ,
load(i+IT::size ) * it.load() ); it += IT::size;
2194 vector_.storeu( offset_+i+IT::size*2UL,
load(i+IT::size*2UL) * it.load() ); it += IT::size;
2195 vector_.storeu( offset_+i+IT::size*3UL,
load(i+IT::size*3UL) * it.load() ); it += IT::size;
2197 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
2215 template<
typename VT
2218 template<
typename VT2 >
2227 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
2228 vector_[element->index()+offset_] = tmp[element->index()] * element->value();
2253 template<
typename VT
2280 typedef DenseSubvector<VT,aligned,TF>
This;
2281 typedef typename SubvectorTrait<VT>::Type
ResultType;
2292 typedef typename SelectType< useConst, ConstReference, typename VT::Reference >::Type
Reference;
2298 typedef typename SelectType< useConst, ConstPointer, ElementType* >::Type
Pointer;
2304 typedef typename SelectType< useConst, ConstIterator, typename VT::Iterator >::Type
Iterator;
2309 enum { vectorizable = VT::vectorizable };
2312 enum { smpAssignable = VT::smpAssignable };
2349 template<
typename VT2 >
inline DenseSubvector& operator+=(
const Vector<VT2,TF>& rhs );
2350 template<
typename VT2 >
inline DenseSubvector& operator-=(
const Vector<VT2,TF>& rhs );
2351 template<
typename VT2 >
inline DenseSubvector& operator*=(
const Vector<VT2,TF>& rhs );
2353 template<
typename Other >
2354 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
2355 operator*=( Other rhs );
2357 template<
typename Other >
2358 inline typename EnableIf< IsNumeric<Other>,
DenseSubvector >::Type&
2359 operator/=( Other rhs );
2366 inline size_t size()
const;
2369 inline void reset();
2370 template<
typename Other >
inline DenseSubvector& scale(
const Other& scalar );
2377 template<
typename VT2 >
2378 struct VectorizedAssign {
2379 enum { value = vectorizable && VT2::vectorizable &&
2380 IsSame<ElementType,typename VT2::ElementType>::value };
2386 template<
typename VT2 >
2387 struct VectorizedAddAssign {
2388 enum { value = vectorizable && VT2::vectorizable &&
2389 IsSame<ElementType,typename VT2::ElementType>::value &&
2390 IntrinsicTrait<ElementType>::addition };
2396 template<
typename VT2 >
2397 struct VectorizedSubAssign {
2398 enum { value = vectorizable && VT2::vectorizable &&
2399 IsSame<ElementType,typename VT2::ElementType>::value &&
2400 IntrinsicTrait<ElementType>::subtraction };
2406 template<
typename VT2 >
2407 struct VectorizedMultAssign {
2408 enum { value = vectorizable && VT2::vectorizable &&
2409 IsSame<ElementType,typename VT2::ElementType>::value &&
2410 IntrinsicTrait<ElementType>::multiplication };
2418 template<
typename Other >
2419 inline bool canAlias(
const Other* alias )
const;
2421 template<
typename VT2,
bool AF2,
bool TF2 >
2422 inline bool canAlias(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
2424 template<
typename Other >
2425 inline bool isAliased(
const Other* alias )
const;
2427 template<
typename VT2,
bool AF2,
bool TF2 >
2428 inline bool isAliased(
const DenseSubvector<VT2,AF2,TF2>* alias )
const;
2439 template<
typename VT2 >
2440 inline typename DisableIf< VectorizedAssign<VT2> >::Type
2441 assign(
const DenseVector <VT2,TF>& rhs );
2443 template<
typename VT2 >
2444 inline typename EnableIf< VectorizedAssign<VT2> >::Type
2445 assign(
const DenseVector <VT2,TF>& rhs );
2447 template<
typename VT2 >
inline void assign(
const SparseVector<VT2,TF>& rhs );
2449 template<
typename VT2 >
2450 inline typename DisableIf< VectorizedAddAssign<VT2> >::Type
2451 addAssign(
const DenseVector <VT2,TF>& rhs );
2453 template<
typename VT2 >
2454 inline typename EnableIf< VectorizedAddAssign<VT2> >::Type
2455 addAssign (
const DenseVector <VT2,TF>& rhs );
2457 template<
typename VT2 >
inline void addAssign(
const SparseVector<VT2,TF>& rhs );
2459 template<
typename VT2 >
2460 inline typename DisableIf< VectorizedSubAssign<VT2> >::Type
2461 subAssign (
const DenseVector <VT2,TF>& rhs );
2463 template<
typename VT2 >
2464 inline typename EnableIf< VectorizedSubAssign<VT2> >::Type
2465 subAssign(
const DenseVector <VT2,TF>& rhs );
2467 template<
typename VT2 >
inline void subAssign(
const SparseVector<VT2,TF>& rhs );
2469 template<
typename VT2 >
2470 inline typename DisableIf< VectorizedMultAssign<VT2> >::Type
2471 multAssign(
const DenseVector <VT2,TF>& rhs );
2473 template<
typename VT2 >
2474 inline typename EnableIf< VectorizedMultAssign<VT2> >::Type
2475 multAssign(
const DenseVector <VT2,TF>& rhs );
2477 template<
typename VT2 >
inline void multAssign(
const SparseVector<VT2,TF>& rhs );
2492 template<
typename VT2,
bool AF2,
bool TF2 >
friend class DenseSubvector;
2494 template<
bool AF1,
typename VT2,
bool AF2,
bool TF2 >
2495 friend const DenseSubvector<VT2,AF1,TF2>
2496 subvector(
const DenseSubvector<VT2,AF2,TF2>& dv,
size_t index,
size_t size );
2498 template<
typename VT2,
bool AF2,
bool TF2 >
2499 friend bool isSame(
const DenseSubvector<VT2,AF2,TF2>& a,
const DenseVector<VT2,TF2>& b );
2501 template<
typename VT2,
bool AF2,
bool TF2 >
2502 friend bool isSame(
const DenseVector<VT2,TF2>& a,
const DenseSubvector<VT2,AF2,TF2>& b );
2504 template<
typename VT2,
bool AF2,
bool TF2 >
2505 friend bool isSame(
const DenseSubvector<VT2,AF2,TF2>& a,
const DenseSubvector<VT2,AF2,TF2>& b );
2541 template<
typename VT
2548 if( index + n > vector.size() )
2549 throw std::invalid_argument(
"Invalid subvector specification" );
2552 throw std::invalid_argument(
"Invalid subvector alignment" );
2573 template<
typename VT
2579 return vector_[offset_+index];
2592 template<
typename VT
2598 return const_cast<const VT&
>( vector_ )[offset_+index];
2612 template<
typename VT
2616 return vector_.data() + offset_;
2630 template<
typename VT
2634 return vector_.data() + offset_;
2648 template<
typename VT
2652 return ( vector_.begin() + offset_ );
2666 template<
typename VT
2671 return ( vector_.cbegin() + offset_ );
2685 template<
typename VT
2690 return ( vector_.cbegin() + offset_ );
2704 template<
typename VT
2708 return ( vector_.begin() + offset_ + size_ );
2722 template<
typename VT
2727 return ( vector_.cbegin() + offset_ + size_ );
2741 template<
typename VT
2746 return ( vector_.cbegin() + offset_ + size_ );
2767 template<
typename VT
2769 inline DenseSubvector<VT,aligned,TF>&
2772 const size_t iend( offset_ + size_ );
2774 for(
size_t i=offset_; i<iend; ++i )
2794 template<
typename VT
2796 inline DenseSubvector<VT,aligned,TF>&
2802 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && offset_ == rhs.offset_ ) )
2805 if( size() != rhs.size() )
2806 throw std::invalid_argument(
"Subvector sizes do not match" );
2808 if( rhs.canAlias( &vector_ ) ) {
2833 template<
typename VT
2835 template<
typename VT2 >
2836 inline DenseSubvector<VT,aligned,TF>&
2842 if( size() != (~rhs).size() )
2843 throw std::invalid_argument(
"Vector sizes do not match" );
2845 if( (~rhs).canAlias( &vector_ ) ) {
2850 if( IsSparseVector<VT2>::value )
2872 template<
typename VT
2874 template<
typename VT2 >
2875 inline DenseSubvector<VT,aligned,TF>&
2876 DenseSubvector<VT,aligned,TF>::operator+=(
const Vector<VT2,TF>& rhs )
2881 if( size() != (~rhs).size() )
2882 throw std::invalid_argument(
"Vector sizes do not match" );
2884 if( (~rhs).canAlias( &vector_ ) ) {
2909 template<
typename VT
2911 template<
typename VT2 >
2912 inline DenseSubvector<VT,aligned,TF>&
2913 DenseSubvector<VT,aligned,TF>::operator-=(
const Vector<VT2,TF>& rhs )
2918 if( size() != (~rhs).size() )
2919 throw std::invalid_argument(
"Vector sizes do not match" );
2921 if( (~rhs).canAlias( &vector_ ) ) {
2947 template<
typename VT
2949 template<
typename VT2 >
2950 inline DenseSubvector<VT,aligned,TF>&
2951 DenseSubvector<VT,aligned,TF>::operator*=(
const Vector<VT2,TF>& rhs )
2956 if( size() != (~rhs).size() )
2957 throw std::invalid_argument(
"Vector sizes do not match" );
2959 if( (~rhs).canAlias( &vector_ ) || IsSparseVector<VT2>::value ) {
2981 template<
typename VT
2983 template<
typename Other >
2984 inline typename EnableIf< IsNumeric<Other>, DenseSubvector<VT,aligned,TF> >::Type&
2985 DenseSubvector<VT,aligned,TF>::operator*=( Other rhs )
3004 template<
typename VT
3006 template<
typename Other >
3007 inline typename EnableIf< IsNumeric<Other>, DenseSubvector<VT,aligned,TF> >::Type&
3008 DenseSubvector<VT,aligned,TF>::operator/=( Other rhs )
3033 template<
typename VT
3049 template<
typename VT
3053 return vector_.capacity() - offset_;
3068 template<
typename VT
3072 size_t nonzeros( 0 );
3074 const size_t iend( offset_ + size_ );
3075 for(
size_t i=offset_; i<iend; ++i ) {
3092 template<
typename VT
3098 const size_t iend( offset_ + size_ );
3099 for(
size_t i=offset_; i<iend; ++i )
3100 reset( vector_[i] );
3113 template<
typename VT
3115 template<
typename Other >
3116 inline DenseSubvector<VT,aligned,TF>& DenseSubvector<VT,aligned,TF>::scale(
const Other& scalar )
3118 const size_t iend( offset_ + size_ );
3119 for(
size_t i=offset_; i<iend; ++i )
3120 vector_[i] *= scalar;
3146 template<
typename VT
3148 template<
typename Other >
3151 return vector_.isAliased( alias );
3168 template<
typename VT
3170 template<
typename VT2
3175 return ( vector_.isAliased( &alias->vector_ ) &&
3176 ( offset_ + size_ > alias->offset_ ) && ( offset_ < alias->offset_ + alias->size_ ) );
3193 template<
typename VT
3195 template<
typename Other >
3198 return vector_.isAliased( alias );
3215 template<
typename VT
3217 template<
typename VT2
3222 return ( vector_.isAliased( &alias->vector_ ) &&
3223 ( offset_ + size_ > alias->offset_ ) && ( offset_ < alias->offset_ + alias->size_ ) );
3239 template<
typename VT
3260 template<
typename VT
3284 template<
typename VT
3286 inline typename DenseSubvector<VT,aligned,TF>::IntrinsicType
3294 return vector_.load( offset_+index );
3314 template<
typename VT
3316 inline typename DenseSubvector<VT,aligned,TF>::IntrinsicType
3324 return vector_.loadu( offset_+index );
3345 template<
typename VT
3354 vector_.store( offset_+index, value );
3375 template<
typename VT
3384 vector_.storeu( offset_+index, value );
3405 template<
typename VT
3414 vector_.stream( offset_+index, value );
3432 template<
typename VT
3434 template<
typename VT2 >
3435 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAssign<VT2> >::Type
3440 const size_t iend( size() &
size_t(-2) );
3441 for(
size_t i=0UL; i<iend; i+=2UL ) {
3442 vector_[i+offset_ ] = (~rhs)[i ];
3443 vector_[i+offset_+1UL] = (~rhs)[i+1UL];
3445 if( iend < size() ) {
3446 vector_[iend+offset_] = (~rhs)[iend];
3465 template<
typename VT
3467 template<
typename VT2 >
3468 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAssign<VT2> >::Type
3477 for(
size_t i=0UL; i<size(); i+=IT::size ) {
3478 vector_.stream( offset_+i, (~rhs).
load(i) );
3483 const size_t iend( size_ &
size_t(-IT::size*4) );
3487 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
3488 store( i , it.load() ); it += IT::size;
3489 store( i+IT::size , it.load() ); it += IT::size;
3490 store( i+IT::size*2UL, it.load() ); it += IT::size;
3491 store( i+IT::size*3UL, it.load() ); it += IT::size;
3493 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
3494 store( i, it.load() );
3514 template<
typename VT
3516 template<
typename VT2 >
3521 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3522 vector_[element->index()+offset_] = element->value();
3540 template<
typename VT
3542 template<
typename VT2 >
3543 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >::Type
3548 const size_t iend( size() &
size_t(-2) );
3549 for(
size_t i=0UL; i<iend; i+=2UL ) {
3550 vector_[i+offset_ ] += (~rhs)[i ];
3551 vector_[i+offset_+1UL] += (~rhs)[i+1UL];
3553 if( iend < size() ) {
3554 vector_[iend+offset_] += (~rhs)[iend];
3573 template<
typename VT
3575 template<
typename VT2 >
3576 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >::Type
3583 const size_t iend( size_ &
size_t(-IT::size*4) );
3587 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
3588 store( i ,
load(i ) + it.load() ); it += IT::size;
3589 store( i+IT::size ,
load(i+IT::size ) + it.load() ); it += IT::size;
3590 store( i+IT::size*2UL,
load(i+IT::size*2UL) + it.load() ); it += IT::size;
3591 store( i+IT::size*3UL,
load(i+IT::size*3UL) + it.load() ); it += IT::size;
3593 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
3613 template<
typename VT
3615 template<
typename VT2 >
3620 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3621 vector_[element->index()+offset_] += element->value();
3639 template<
typename VT
3641 template<
typename VT2 >
3642 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >::Type
3647 const size_t iend( size() &
size_t(-2) );
3648 for(
size_t i=0UL; i<iend; i+=2UL ) {
3649 vector_[i+offset_ ] -= (~rhs)[i ];
3650 vector_[i+offset_+1UL] -= (~rhs)[i+1UL];
3652 if( iend < size() ) {
3653 vector_[iend+offset_] -= (~rhs)[iend];
3672 template<
typename VT
3674 template<
typename VT2 >
3675 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >::Type
3682 const size_t iend( size_ &
size_t(-IT::size*4) );
3686 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
3687 store( i ,
load(i ) - it.load() ); it += IT::size;
3688 store( i+IT::size ,
load(i+IT::size ) - it.load() ); it += IT::size;
3689 store( i+IT::size*2UL,
load(i+IT::size*2UL) - it.load() ); it += IT::size;
3690 store( i+IT::size*3UL,
load(i+IT::size*3UL) - it.load() ); it += IT::size;
3692 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
3712 template<
typename VT
3714 template<
typename VT2 >
3719 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3720 vector_[element->index()+offset_] -= element->value();
3738 template<
typename VT
3740 template<
typename VT2 >
3741 inline typename DisableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >::Type
3746 const size_t iend( size() &
size_t(-2) );
3747 for(
size_t i=0UL; i<iend; i+=2UL ) {
3748 vector_[i+offset_ ] *= (~rhs)[i ];
3749 vector_[i+offset_+1UL] *= (~rhs)[i+1UL];
3751 if( iend < size() ) {
3752 vector_[iend+offset_] *= (~rhs)[iend];
3771 template<
typename VT
3773 template<
typename VT2 >
3774 inline typename EnableIf< typename DenseSubvector<VT,aligned,TF>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >::Type
3781 const size_t iend( size_ &
size_t(-IT::size*4) );
3785 for(
size_t i=0UL; i<iend; i+=IT::size*4UL ) {
3786 store( i ,
load(i ) * it.load() ); it += IT::size;
3787 store( i+IT::size ,
load(i+IT::size ) * it.load() ); it += IT::size;
3788 store( i+IT::size*2UL,
load(i+IT::size*2UL) * it.load() ); it += IT::size;
3789 store( i+IT::size*3UL,
load(i+IT::size*3UL) * it.load() ); it += IT::size;
3791 for(
size_t i=iend; i<size_; i+=IT::size, it+=IT::size ) {
3811 template<
typename VT
3813 template<
typename VT2 >
3822 for(
typename VT2::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element )
3823 vector_[element->index()+offset_] = tmp[element->index()] * element->value();
3849 template<
typename VT1
3851 class DenseSubvector< DVecDVecCrossExpr<VT1,VT2>,
unaligned, false >
3852 :
public DenseVector< DenseSubvector< DVecDVecCrossExpr<VT1,VT2>, unaligned, false >, false >
3857 typedef DVecDVecCrossExpr<VT1,VT2> CPE;
3863 typedef DenseSubvector<CPE,unaligned,false>
This;
3864 typedef typename SubvectorTrait<RT>::Type
ResultType;
3873 enum { vectorizable = 0 };
3876 enum { smpAssignable = 0 };
3886 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
3910 inline size_t size()
const {
3921 template<
typename T >
3922 inline bool canAlias(
const T* alias )
const {
3923 return vector_.canAlias( alias );
3933 template<
typename T >
3934 inline bool isAliased(
const T* alias )
const {
3935 return vector_.isAliased( alias );
3950 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
3951 friend const DenseSubvector<VT,AF1,TF>
3952 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
3954 template<
typename VT3,
bool AF3,
bool TF3 >
3955 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
3957 template<
typename VT3,
bool AF3,
bool TF3 >
3958 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
3960 template<
typename VT3,
bool AF3,
bool TF3 >
3961 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
3988 template<
typename VT1
3990 class DenseSubvector< DVecSVecCrossExpr<VT1,VT2>,
unaligned, false >
3991 :
public DenseVector< DenseSubvector< DVecSVecCrossExpr<VT1,VT2>, unaligned, false >, false >
3996 typedef DVecSVecCrossExpr<VT1,VT2> CPE;
4002 typedef DenseSubvector<CPE,unaligned,false>
This;
4003 typedef typename SubvectorTrait<RT>::Type
ResultType;
4012 enum { vectorizable = 0 };
4015 enum { smpAssignable = 0 };
4025 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
4049 inline size_t size()
const {
4060 template<
typename T >
4061 inline bool canAlias(
const T* alias )
const {
4062 return vector_.canAlias( alias );
4072 template<
typename T >
4073 inline bool isAliased(
const T* alias )
const {
4074 return vector_.isAliased( alias );
4089 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4090 friend const DenseSubvector<VT,AF1,TF>
4091 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4093 template<
typename VT3,
bool AF3,
bool TF3 >
4094 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4096 template<
typename VT3,
bool AF3,
bool TF3 >
4097 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4099 template<
typename VT3,
bool AF3,
bool TF3 >
4100 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4127 template<
typename VT1
4129 class DenseSubvector< SVecDVecCrossExpr<VT1,VT2>,
unaligned, false >
4130 :
public DenseVector< DenseSubvector< SVecDVecCrossExpr<VT1,VT2>, unaligned, false >, false >
4135 typedef SVecDVecCrossExpr<VT1,VT2> CPE;
4141 typedef DenseSubvector<CPE,unaligned,false>
This;
4142 typedef typename SubvectorTrait<RT>::Type
ResultType;
4151 enum { vectorizable = 0 };
4154 enum { smpAssignable = 0 };
4164 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
4188 inline size_t size()
const {
4199 template<
typename T >
4200 inline bool canAlias(
const T* alias )
const {
4201 return vector_.canAlias( alias );
4211 template<
typename T >
4212 inline bool isAliased(
const T* alias )
const {
4213 return vector_.isAliased( alias );
4228 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4229 friend const DenseSubvector<VT,AF1,TF>
4230 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4232 template<
typename VT3,
bool AF3,
bool TF3 >
4233 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4235 template<
typename VT3,
bool AF3,
bool TF3 >
4236 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4238 template<
typename VT3,
bool AF3,
bool TF3 >
4239 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4266 template<
typename VT1
4268 class DenseSubvector< SVecSVecCrossExpr<VT1,VT2>,
unaligned, false >
4269 :
public DenseVector< DenseSubvector< SVecSVecCrossExpr<VT1,VT2>, unaligned, false >, false >
4274 typedef SVecSVecCrossExpr<VT1,VT2> CPE;
4280 typedef DenseSubvector<CPE,unaligned,false>
This;
4281 typedef typename SubvectorTrait<RT>::Type
ResultType;
4290 enum { vectorizable = 0 };
4293 enum { smpAssignable = 0 };
4303 explicit inline DenseSubvector(
const CPE& vector,
size_t index,
size_t n )
4327 inline size_t size()
const {
4338 template<
typename T >
4339 inline bool canAlias(
const T* alias )
const {
4340 return vector_.canAlias( alias );
4350 template<
typename T >
4351 inline bool isAliased(
const T* alias )
const {
4352 return vector_.isAliased( alias );
4367 template<
bool AF1,
typename VT,
bool AF2,
bool TF >
4368 friend const DenseSubvector<VT,AF1,TF>
4369 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size );
4371 template<
typename VT3,
bool AF3,
bool TF3 >
4372 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseVector<VT3,TF3>& b );
4374 template<
typename VT3,
bool AF3,
bool TF3 >
4375 friend bool isSame(
const DenseVector<VT3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4377 template<
typename VT3,
bool AF3,
bool TF3 >
4378 friend bool isSame(
const DenseSubvector<VT3,AF3,TF3>& a,
const DenseSubvector<VT3,AF3,TF3>& b );
4400 template<
typename VT,
bool AF,
bool TF >
4401 inline void reset( DenseSubvector<VT,AF,TF>& dv );
4403 template<
typename VT,
bool AF,
bool TF >
4404 inline void clear( DenseSubvector<VT,AF,TF>& dv );
4406 template<
typename VT,
bool AF,
bool TF >
4407 inline bool isDefault(
const DenseSubvector<VT,AF,TF>& dv );
4409 template<
typename VT,
bool AF,
bool TF >
4410 inline bool isSame(
const DenseSubvector<VT,AF,TF>& a,
const DenseVector<VT,TF>& b );
4412 template<
typename VT,
bool AF,
bool TF >
4413 inline bool isSame(
const DenseVector<VT,TF>& a,
const DenseSubvector<VT,AF,TF>& b );
4415 template<
typename VT,
bool AF,
bool TF >
4416 inline bool isSame(
const DenseSubvector<VT,AF,TF>& a,
const DenseSubvector<VT,AF,TF>& b );
4428 template<
typename VT
4445 template<
typename VT
4474 template<
typename VT
4479 for(
size_t i=0UL; i<dv.size(); ++i )
4498 template<
typename VT,
bool AF,
bool TF >
4501 return (
isSame( a.vector_, ~b ) && ( a.size() == (~b).size() ) );
4518 template<
typename VT,
bool AF,
bool TF >
4521 return (
isSame( ~a, b.vector_ ) && ( (~a).size() == b.size() ) );
4538 template<
typename VT,
bool AF,
bool TF >
4541 return (
isSame( a.vector_, b.vector_ ) && ( a.offset_ == b.offset_ ) && ( a.size_ == b.size_ ) );
4571 inline const DenseSubvector<VT,AF1,TF>
4572 subvector(
const DenseSubvector<VT,AF2,TF>& dv,
size_t index,
size_t size )
4576 if( index + size > dv.size() )
4577 throw std::invalid_argument(
"Invalid subvector specification" );
4579 return DenseSubvector<VT,AF1,TF>( dv.vector_, dv.offset_ + index, size );
4595 template<
typename VT,
bool AF,
bool TF >
4596 struct SubvectorTrait< DenseSubvector<VT,AF,TF> >
4614 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4615 struct SubvectorExprTrait< DenseSubvector<VT,AF1,TF>, AF2 >
4617 typedef DenseSubvector<VT,AF2,TF> Type;
4625 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4626 struct SubvectorExprTrait< const DenseSubvector<VT,AF1,TF>, AF2 >
4628 typedef DenseSubvector<VT,AF2,TF> Type;
4636 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4637 struct SubvectorExprTrait< volatile DenseSubvector<VT,AF1,TF>, AF2 >
4639 typedef DenseSubvector<VT,AF2,TF> Type;
4647 template<
typename VT,
bool AF1,
bool TF,
bool AF2 >
4648 struct SubvectorExprTrait< const volatile DenseSubvector<VT,AF1,TF>, AF2 >
4650 typedef DenseSubvector<VT,AF2,TF> Type;
4658 template<
typename VT1,
typename VT2,
bool AF >
4659 struct SubvectorExprTrait< DVecDVecCrossExpr<VT1,VT2>, AF >
4663 typedef DenseSubvector< DVecDVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
4672 template<
typename VT1,
typename VT2,
bool AF >
4673 struct SubvectorExprTrait< DVecSVecCrossExpr<VT1,VT2>, AF >
4677 typedef DenseSubvector< DVecSVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
4686 template<
typename VT1,
typename VT2,
bool AF >
4687 struct SubvectorExprTrait< SVecDVecCrossExpr<VT1,VT2>, AF >
4691 typedef DenseSubvector< SVecDVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
4700 template<
typename VT1,
typename VT2,
bool AF >
4701 struct SubvectorExprTrait< SVecSVecCrossExpr<VT1,VT2>, AF >
4705 typedef DenseSubvector< SVecSVecCrossExpr<VT1,VT2>,
unaligned,
false > Type;
const ElementType * ConstPointer
Pointer to a constant subvector value.
Definition: DenseSubvector.h:416
Constraint on the data type.
const size_t final_
The final index for unaligned intrinsic operations.
Definition: DenseSubvector.h:909
Constraint on the data type.
bool canAlias(const Other *alias) const
Returns whether the dense subvector can alias with the given address alias.
Definition: DenseSubvector.h:1561
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
#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
EnableIf< IsIntegral< T > >::Type store(T *address, const typename Store< T, sizeof(T)>::Type &value)
Aligned store of a vector of integral values.
Definition: Store.h:223
EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:222
Header file for the subvector/submatrix alignment flag values.
const size_t rest_
The number of remaining elements in an unaligned intrinsic operation.
Definition: DenseSubvector.h:908
void smpSubAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:152
IT::Type IntrinsicType
Intrinsic type of the subvector elements.
Definition: DenseSubvector.h:405
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4642
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
#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
void smpMultAssign(DenseVector< 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:179
ReferenceType reference
Reference return type.
Definition: DenseSubvector.h:449
EnableIf< IsIntegral< T >, Loadu< T, sizeof(T)> >::Type::Type loadu(const T *address)
Loads a vector of integral values.
Definition: Loadu.h:219
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:1485
const bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Streaming.h:50
bool isAligned_
Memory alignment flag.
Definition: DenseSubvector.h:706
Header file for the IsRowVector type trait.
const DenseSubvector & CompositeType
Data type for composite expression templates.
Definition: DenseSubvector.h:407
Header file for the DenseVector base class.
SelectType< useConst, ConstReference, typename VT::Reference >::Type Reference
Reference to a non-constant subvector value.
Definition: DenseSubvector.h:413
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
Header file for the Computation base class.
IntrinsicType loadu() const
Unaligned load of an intrinsic element of the dense subvector.
Definition: DenseSubvector.h:570
#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:594
DenseSubvector(Operand vector, size_t index, size_t n)
The constructor for DenseSubvector.
Definition: DenseSubvector.h:982
IntrinsicTrait< typename VT::ElementType > IT
Intrinsic trait for the vector element type.
Definition: DenseSubvector.h:385
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4615
const size_t offset_
The offset of the subvector within the dense vector.
Definition: DenseSubvector.h:906
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:409
size_t capacity() const
Returns the maximum capacity of the dense subvector.
Definition: DenseSubvector.h:1467
SubvectorIterator(IteratorType iterator, IteratorType final, size_t rest, bool isAligned)
Constructor for the SubvectorIterator class.
Definition: DenseSubvector.h:461
Iterator begin()
Returns an iterator to the first element of the subvector.
Definition: DenseSubvector.h:1085
DenseSubvector & operator=(const ElementType &rhs)
Homogenous assignment to all subvector elements.
Definition: DenseSubvector.h:1200
const bool aligned
Alignment flag for aligned subvectors and submatrices.
Definition: AlignmentFlag.h:83
Base template for the SubvectorTrait class.
Definition: SubvectorTrait.h:122
void stream(size_t index, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the subvector.
Definition: DenseSubvector.h:1827
Constraint on the data type.
void reset()
Reset to the default initial values.
Definition: DenseSubvector.h:1508
Pointer data()
Low-level data access to the subvector elements.
Definition: DenseSubvector.h:1051
DifferenceType difference_type
Difference between two iterators.
Definition: DenseSubvector.h:450
void smpAddAssign(DenseMatrix< 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:122
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:402
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
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:1761
Operand vector_
The dense vector containing the subvector.
Definition: DenseSubvector.h:905
const SubvectorIterator operator--(int)
Post-decrement operator.
Definition: DenseSubvector.h:530
Header file for nested template disabiguation.
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:1015
SubvectorIterator & operator++()
Pre-increment operator.
Definition: DenseSubvector.h:498
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Header file for the Or class template.
friend const SubvectorIterator operator-(const SubvectorIterator &it, size_t dec)
Subtraction between a SubvectorIterator and an integral value.
Definition: DenseSubvector.h:696
std::iterator_traits< IteratorType >::difference_type DifferenceType
Difference between two iterators.
Definition: DenseSubvector.h:443
ConstIterator cbegin() const
Returns an iterator to the first element of the subvector.
Definition: DenseSubvector.h:1121
DifferenceType operator-(const SubvectorIterator &rhs) const
Calculating the number of elements between two iterators.
Definition: DenseSubvector.h:660
VT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DenseSubvector.h:406
Header file for the subvector trait.
DenseSubvector< VT, AF, TF > This
Type of this DenseSubvector instance.
Definition: DenseSubvector.h:401
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:271
friend const SubvectorIterator operator+(size_t inc, const SubvectorIterator &it)
Addition between an integral value and a SubvectorIterator.
Definition: DenseSubvector.h:684
bool operator!=(const SubvectorIterator &rhs) const
Inequality comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:605
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:519
IteratorType iterator_
Iterator to the current subvector element.
Definition: DenseSubvector.h:703
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
Constraint on the data type.
size_t size() const
Returns the current size/dimension of the dense subvector.
Definition: DenseSubvector.h:1452
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
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:361
Constraint on the data type.
Header file for the SelectType class template.
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:2410
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: DenseSubvector.h:403
SelectType< useConst, ConstPointer, ElementType * >::Type Pointer
Pointer to a non-constant subvector value.
Definition: DenseSubvector.h:419
System settings for streaming (non-temporal stores)
Header file for the EnableIf class template.
EnableIf< IsIntegral< T > >::Type storeu(T *address, const typename Storeu< T, sizeof(T)>::Type &value)
Unaligned store of a vector of integral values.
Definition: Storeu.h:216
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:431
Header file for the CrossExpr base class.
void smpAssign(DenseMatrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:92
Header file for the IsNumeric type trait.
size_t rest_
The number of remaining elements beyond the final iterator.
Definition: DenseSubvector.h:705
SelectType< useConst, ConstIterator, SubvectorIterator< typename VT::Iterator > >::Type Iterator
Iterator over non-constant elements.
Definition: DenseSubvector.h:716
Header file for the IsSparseVector type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2407
Header file for the IsConst type trait.
Iterator end()
Returns an iterator just past the last element of the subvector.
Definition: DenseSubvector.h:1139
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
Base class for all subvectors.The Subvector class serves as a tag for all subvectors (i...
Definition: Subvector.h:64
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:301
View on a specific subvector of a dense vector.The DenseSubvector template represents a view on a spe...
Definition: DenseSubvector.h:376
SubvectorIterator & operator+=(size_t inc)
Addition assignment operator.
Definition: DenseSubvector.h:475
bool operator>(const SubvectorIterator &rhs) const
Greater-than comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:627
bool isAligned() const
Returns whether the subvector is properly aligned in memory.
Definition: DenseSubvector.h:1649
std::iterator_traits< IteratorType >::pointer PointerType
Pointer return type.
Definition: DenseSubvector.h:437
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:135
Header file for the reset shim.
ValueType value_type
Type of the underlying elements.
Definition: DenseSubvector.h:447
Header file for the AlignedArray implementation.
Header file for the cache size of the target architecture.
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:331
bool canSMPAssign() const
Returns whether the subvector can be used in SMP assignments.
Definition: DenseSubvector.h:1669
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
Header file for the isDefault shim.
ReferenceType operator*() const
Direct access to the element at the current iterator position.
Definition: DenseSubvector.h:540
const size_t size_
The size of the subvector.
Definition: DenseSubvector.h:907
#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
IntrinsicType load() const
Aligned load of an intrinsic element of the dense subvector.
Definition: DenseSubvector.h:555
const SubvectorIterator operator++(int)
Post-increment operator.
Definition: DenseSubvector.h:509
IteratorCategory iterator_category
The iterator category.
Definition: DenseSubvector.h:446
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
VT::ConstReference ConstReference
Reference to a constant subvector value.
Definition: DenseSubvector.h:410
SubvectorIterator< typename VT::ConstIterator > ConstIterator
Iterator over constant elements.
Definition: DenseSubvector.h:713
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:1717
friend const SubvectorIterator operator+(const SubvectorIterator &it, size_t inc)
Addition between a SubvectorIterator and an integral value.
Definition: DenseSubvector.h:672
bool isAliased(const Other *alias) const
Returns whether the dense subvector is aliased with the given address alias.
Definition: DenseSubvector.h:1606
#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:448
const bool isAligned_
Memory alignment flag.
Definition: DenseSubvector.h:914
IteratorType final_
The final iterator for intrinsic operations.
Definition: DenseSubvector.h:704
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:1693
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:250
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:649
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
ConstIterator cend() const
Returns an iterator just past the last element of the subvector.
Definition: DenseSubvector.h:1175
Header file for basic type definitions.
Header file for the SubvectorExprTrait class template.
SubvectorIterator & operator-=(size_t dec)
Subtraction assignment operator.
Definition: DenseSubvector.h:487
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:426
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2409
std::iterator_traits< IteratorType >::value_type ValueType
Type of the underlying elements.
Definition: DenseSubvector.h:434
VT::ElementType ElementType
Type of the subvector elements.
Definition: DenseSubvector.h:404
const size_t SMP_DVECASSIGN_THRESHOLD
SMP dense vector assignment threshold.This threshold specifies when an assignment of a plain dense ve...
Definition: Thresholds.h:207
void storeu(size_t index, const IntrinsicType &value)
Unaligned store of an intrinsic element of the subvector.
Definition: DenseSubvector.h:1785
SelectType< IsExpression< VT >::value, VT, VT & >::Type Operand
Composite data type of the dense vector expression.
Definition: DenseSubvector.h:382
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:616
bool operator<=(const SubvectorIterator &rhs) const
Less-than comparison between two SubvectorIterator objects.
Definition: DenseSubvector.h:638
#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
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:440