35 #ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_SUBVECTOR_DENSE_H_ 111 template<
typename VT
114 class Subvector<VT,
unaligned,TF,true,CSAs...>
115 :
public View< DenseVector< Subvector<VT,unaligned,TF,true,CSAs...>, TF > >
116 ,
private SubvectorData<CSAs...>
120 using DataType = SubvectorData<CSAs...>;
121 using Operand = If_< IsExpression<VT>, VT, VT& >;
129 using BaseType = DenseVector<This,TF>;
130 using ViewedType = VT;
134 using SIMDType = SIMDTrait_<ElementType>;
145 using ConstPointer = ConstPointer_<VT>;
148 using Pointer = If_< Or< IsConst<VT>, Not< HasMutableDataAccess<VT> > >, ConstPointer, Pointer_<VT> >;
154 template<
typename IteratorType >
155 class SubvectorIterator
160 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
163 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
166 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
169 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
172 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
175 using iterator_category = IteratorCategory;
176 using value_type = ValueType;
177 using pointer = PointerType;
178 using reference = ReferenceType;
179 using difference_type = DifferenceType;
185 inline SubvectorIterator()
187 , isAligned_( false )
197 inline SubvectorIterator( IteratorType iterator,
bool isMemoryAligned )
198 : iterator_ ( iterator )
199 , isAligned_( isMemoryAligned )
208 template<
typename IteratorType2 >
209 inline SubvectorIterator(
const SubvectorIterator<IteratorType2>& it )
210 : iterator_ ( it.base() )
211 , isAligned_( it.isAligned() )
221 inline SubvectorIterator&
operator+=(
size_t inc ) {
233 inline SubvectorIterator&
operator-=(
size_t dec ) {
244 inline SubvectorIterator& operator++() {
255 inline const SubvectorIterator operator++(
int ) {
256 return SubvectorIterator( iterator_++, isAligned_ );
265 inline SubvectorIterator& operator--() {
276 inline const SubvectorIterator operator--(
int ) {
277 return SubvectorIterator( iterator_--, isAligned_ );
296 inline IteratorType operator->()
const {
311 inline SIMDType load()
const {
326 inline SIMDType
loada()
const {
327 return iterator_.loada();
341 inline SIMDType
loadu()
const {
343 return iterator_.loada();
346 return iterator_.loadu();
362 inline void store(
const SIMDType& value )
const {
378 inline void storea(
const SIMDType& value )
const {
379 iterator_.storea( value );
394 inline void storeu(
const SIMDType& value )
const {
396 iterator_.storea( value );
399 iterator_.storeu( value );
415 inline void stream(
const SIMDType& value )
const {
416 iterator_.stream( value );
426 inline bool operator==(
const SubvectorIterator& rhs )
const {
427 return iterator_ == rhs.iterator_;
437 inline bool operator!=(
const SubvectorIterator& rhs )
const {
438 return iterator_ != rhs.iterator_;
448 inline bool operator<(
const SubvectorIterator& rhs )
const {
449 return iterator_ < rhs.iterator_;
459 inline bool operator>(
const SubvectorIterator& rhs )
const {
460 return iterator_ > rhs.iterator_;
470 inline bool operator<=(
const SubvectorIterator& rhs )
const {
471 return iterator_ <= rhs.iterator_;
481 inline bool operator>=(
const SubvectorIterator& rhs )
const {
482 return iterator_ >= rhs.iterator_;
492 inline DifferenceType
operator-(
const SubvectorIterator& rhs )
const {
493 return iterator_ - rhs.iterator_;
504 friend inline const SubvectorIterator
operator+(
const SubvectorIterator& it,
size_t inc ) {
505 return SubvectorIterator( it.iterator_ + inc, it.isAligned_ );
516 friend inline const SubvectorIterator
operator+(
size_t inc,
const SubvectorIterator& it ) {
517 return SubvectorIterator( it.iterator_ + inc, it.isAligned_ );
528 friend inline const SubvectorIterator
operator-(
const SubvectorIterator& it,
size_t dec ) {
529 return SubvectorIterator( it.iterator_ - dec, it.isAligned_ );
538 inline IteratorType base()
const {
548 inline bool isAligned()
const {
555 IteratorType iterator_;
563 using ConstIterator = SubvectorIterator< ConstIterator_<VT> >;
571 enum :
bool { simdEnabled = VT::simdEnabled };
574 enum :
bool { smpAssignable = VT::smpAssignable };
580 template<
typename... RSAs >
581 explicit inline Subvector( VT& vector, RSAs... args );
593 inline Reference operator[](
size_t index );
594 inline ConstReference operator[](
size_t index )
const;
596 inline ConstReference at(
size_t index )
const;
597 inline Pointer
data () noexcept;
598 inline ConstPointer
data () const noexcept;
600 inline ConstIterator begin () const;
601 inline ConstIterator
cbegin() const;
603 inline ConstIterator end () const;
604 inline ConstIterator
cend () const;
611 inline Subvector& operator= ( const
ElementType& rhs );
612 inline Subvector& operator= ( initializer_list<
ElementType> list );
613 inline Subvector& operator= ( const Subvector& rhs );
614 template< typename VT2 > inline Subvector& operator= ( const Vector<VT2,TF>& rhs );
615 template< typename VT2 > inline Subvector& operator+=( const Vector<VT2,TF>& rhs );
616 template< typename VT2 > inline Subvector& operator-=( const Vector<VT2,TF>& rhs );
617 template< typename VT2 > inline Subvector& operator*=( const Vector<VT2,TF>& rhs );
618 template< typename VT2 > inline Subvector& operator/=( const DenseVector<VT2,TF>& rhs );
619 template< typename VT2 > inline Subvector& operator%=( const Vector<VT2,TF>& rhs );
626 using DataType::offset;
627 using DataType::
size;
629 inline VT& operand() noexcept;
630 inline const VT& operand() const noexcept;
632 inline
size_t spacing() const noexcept;
633 inline
size_t capacity() const noexcept;
642 template< typename Other > inline Subvector& scale( const Other& scalar );
649 template< typename VT2 >
650 struct VectorizedAssign {
651 enum :
bool { value = useOptimizedKernels &&
652 simdEnabled && VT2::simdEnabled &&
653 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value };
659 template<
typename VT2 >
660 struct VectorizedAddAssign {
661 enum :
bool { value = useOptimizedKernels &&
662 simdEnabled && VT2::simdEnabled &&
663 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
664 HasSIMDAdd< ElementType, ElementType_<VT2> >::value };
670 template<
typename VT2 >
671 struct VectorizedSubAssign {
672 enum :
bool { value = useOptimizedKernels &&
673 simdEnabled && VT2::simdEnabled &&
674 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
675 HasSIMDSub< ElementType, ElementType_<VT2> >::value };
681 template<
typename VT2 >
682 struct VectorizedMultAssign {
683 enum :
bool { value = useOptimizedKernels &&
684 simdEnabled && VT2::simdEnabled &&
685 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
686 HasSIMDMult< ElementType, ElementType_<VT2> >::value };
692 template<
typename VT2 >
693 struct VectorizedDivAssign {
694 enum :
bool { value = useOptimizedKernels &&
695 simdEnabled && VT2::simdEnabled &&
696 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
697 HasSIMDDiv< ElementType, ElementType_<VT2> >::value };
710 template<
typename Other >
711 inline bool canAlias(
const Other* alias )
const noexcept;
713 template<
typename VT2,
AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
714 inline bool canAlias(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept;
716 template<
typename Other >
717 inline bool isAliased(
const Other* alias )
const noexcept;
719 template<
typename VT2,
AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
720 inline bool isAliased(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept;
722 inline bool isAligned () const noexcept;
723 inline
bool canSMPAssign() const noexcept;
734 template< typename VT2 >
735 inline
DisableIf_< VectorizedAssign<VT2> > assign( const DenseVector <VT2,TF>& rhs );
737 template< typename VT2 >
738 inline
EnableIf_< VectorizedAssign<VT2> > assign( const DenseVector <VT2,TF>& rhs );
740 template< typename VT2 > inline
void assign( const SparseVector<VT2,TF>& rhs );
742 template< typename VT2 >
743 inline
DisableIf_< VectorizedAddAssign<VT2> > addAssign( const DenseVector <VT2,TF>& rhs );
745 template< typename VT2 >
746 inline
EnableIf_< VectorizedAddAssign<VT2> > addAssign ( const DenseVector <VT2,TF>& rhs );
748 template< typename VT2 > inline
void addAssign( const SparseVector<VT2,TF>& rhs );
750 template< typename VT2 >
751 inline
DisableIf_< VectorizedSubAssign<VT2> > subAssign( const DenseVector <VT2,TF>& rhs );
753 template< typename VT2 >
754 inline
EnableIf_< VectorizedSubAssign<VT2> > subAssign( const DenseVector <VT2,TF>& rhs );
756 template< typename VT2 > inline
void subAssign( const SparseVector<VT2,TF>& rhs );
758 template< typename VT2 >
759 inline
DisableIf_< VectorizedMultAssign<VT2> > multAssign( const DenseVector <VT2,TF>& rhs );
761 template< typename VT2 >
762 inline
EnableIf_< VectorizedMultAssign<VT2> > multAssign( const DenseVector <VT2,TF>& rhs );
764 template< typename VT2 > inline
void multAssign( const SparseVector<VT2,TF>& rhs );
766 template< typename VT2 >
767 inline
DisableIf_< VectorizedDivAssign<VT2> > divAssign( const DenseVector <VT2,TF>& rhs );
769 template< typename VT2 >
770 inline
EnableIf_< VectorizedDivAssign<VT2> > divAssign( const DenseVector <VT2,TF>& rhs );
779 const
bool isAligned_;
790 template< typename VT2,
AlignmentFlag AF2,
bool TF2,
bool DF2,
size_t... CSAs2 > friend class Subvector;
827 template< typename VT
830 template< typename... RSAs >
831 inline Subvector<VT,unaligned,TF,true,CSAs...>::Subvector( VT& vector, RSAs... args )
832 : DataType ( args... )
836 if( !Contains< TypeList<RSAs...>,
Unchecked >::value ) {
837 if( offset() +
size() > vector.size() ) {
867 template<
typename VT
871 Subvector<VT,unaligned,TF,true,CSAs...>::operator[](
size_t index )
874 return vector_[offset()+index];
890 template<
typename VT
894 Subvector<VT,unaligned,TF,true,CSAs...>::operator[](
size_t index )
const 897 return const_cast<const VT&
>( vector_ )[offset()+index];
914 template<
typename VT
918 Subvector<VT,unaligned,TF,true,CSAs...>::at(
size_t index )
920 if( index >=
size() ) {
923 return (*
this)[index];
940 template<
typename VT
944 Subvector<VT,unaligned,TF,true,CSAs...>::at(
size_t index )
const 946 if( index >=
size() ) {
949 return (*
this)[index];
963 template<
typename VT
966 inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::Pointer
969 return vector_.data() + offset();
983 template<
typename VT
986 inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstPointer
989 return vector_.data() + offset();
1003 template<
typename VT
1009 return Iterator( vector_.begin() + offset(), isAligned_ );
1023 template<
typename VT
1029 return ConstIterator( vector_.cbegin() + offset(), isAligned_ );
1043 template<
typename VT
1049 return ConstIterator( vector_.cbegin() + offset(), isAligned_ );
1063 template<
typename VT
1069 return Iterator( vector_.begin() + offset() +
size(), isAligned_ );
1083 template<
typename VT
1103 template<
typename VT
1130 template<
typename VT
1133 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1134 Subvector<VT,unaligned,TF,true,CSAs...>::operator=(
const ElementType& rhs )
1136 const size_t iend( offset() +
size() );
1137 decltype(
auto) left( derestrict( vector_ ) );
1139 for(
size_t i=offset(); i<iend; ++i ) {
1140 if( !IsRestricted<VT>::value || trySet( vector_, i, rhs ) )
1166 template<
typename VT
1169 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1170 Subvector<VT,unaligned,TF,true,CSAs...>::operator=( initializer_list<ElementType> list )
1172 if( list.size() >
size() ) {
1176 if( IsRestricted<VT>::value ) {
1177 const InitializerVector<ElementType,TF> tmp( list,
size() );
1178 if( !tryAssign( vector_, tmp, offset() ) ) {
1183 decltype(
auto) left( derestrict( *this ) );
1207 template< typename VT
1210 inline Subvector<VT,unaligned,TF,true,CSAs...>&
1211 Subvector<VT,unaligned,TF,true,CSAs...>::operator=( const Subvector& rhs )
1216 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && offset() == rhs.offset() ) )
1219 if(
size() != rhs.size() ) {
1223 if( !tryAssign( vector_, rhs, offset() ) ) {
1227 decltype(
auto) left( derestrict( *this ) );
1229 if( rhs.canAlias( &vector_ ) ) {
1257 template<
typename VT
1260 template<
typename VT2 >
1261 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1262 Subvector<VT,unaligned,TF,true,CSAs...>::operator=(
const Vector<VT2,TF>& rhs )
1271 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1272 Right right( ~rhs );
1274 if( !tryAssign( vector_, right, offset() ) ) {
1278 decltype(
auto) left( derestrict( *this ) );
1280 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1281 const ResultType_<VT2> tmp( right );
1285 if( IsSparseVector<VT2>::value )
1310 template<
typename VT
1313 template<
typename VT2 >
1314 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1324 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1325 Right right( ~rhs );
1327 if( !tryAddAssign( vector_, right, offset() ) ) {
1331 decltype(
auto) left( derestrict( *this ) );
1333 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1334 const ResultType_<VT2> tmp( right );
1361 template<
typename VT
1364 template<
typename VT2 >
1365 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1375 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1376 Right right( ~rhs );
1378 if( !trySubAssign( vector_, right, offset() ) ) {
1382 decltype(
auto) left( derestrict( *this ) );
1384 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1385 const ResultType_<VT2> tmp( right );
1413 template<
typename VT
1416 template<
typename VT2 >
1417 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1427 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1428 Right right( ~rhs );
1430 if( !tryMultAssign( vector_, right, offset() ) ) {
1434 decltype(
auto) left( derestrict( *this ) );
1436 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1437 const ResultType_<VT2> tmp( right );
1464 template<
typename VT
1467 template<
typename VT2 >
1468 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1478 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
1479 Right right( ~rhs );
1481 if( !tryDivAssign( vector_, right, offset() ) ) {
1485 decltype(
auto) left( derestrict( *this ) );
1487 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
1488 const ResultType_<VT2> tmp( right );
1516 template<
typename VT
1519 template<
typename VT2 >
1520 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1521 Subvector<VT,unaligned,TF,true,CSAs...>::operator%=(
const Vector<VT2,TF>& rhs )
1523 using blaze::assign;
1528 using CrossType = CrossTrait_< ResultType, ResultType_<VT2> >;
1534 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1538 const CrossType tmp( *
this % (~rhs) );
1540 if( !tryAssign( vector_, tmp, offset() ) ) {
1544 decltype(
auto) left( derestrict( *this ) );
1546 assign( left, tmp );
1570 template< typename VT
1573 inline VT& Subvector<VT,unaligned,TF,true,CSAs...>::operand() noexcept
1587 template<
typename VT
1590 inline const VT& Subvector<VT,unaligned,TF,true,CSAs...>::operand() const noexcept
1607 template<
typename VT
1612 return vector_.spacing() - offset();
1624 template<
typename VT
1629 return vector_.capacity() - offset();
1644 template<
typename VT
1649 size_t nonzeros( 0 );
1651 const size_t iend( offset() +
size() );
1652 for(
size_t i=offset(); i<iend; ++i ) {
1669 template<
typename VT
1676 const size_t iend( offset() +
size() );
1677 for(
size_t i=offset(); i<iend; ++i )
1678 clear( vector_[i] );
1703 template<
typename VT
1706 template<
typename Other >
1707 inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1708 Subvector<VT,unaligned,TF,true,CSAs...>::scale(
const Other& scalar )
1710 const size_t iend( offset() +
size() );
1711 for(
size_t i=offset(); i<iend; ++i )
1712 vector_[i] *= scalar;
1738 template<
typename VT
1741 template<
typename Other >
1742 inline bool Subvector<VT,unaligned,TF,true,CSAs...>::canAlias(
const Other* alias )
const noexcept
1744 return vector_.isAliased( alias );
1761 template<
typename VT
1764 template<
typename VT2
1769 Subvector<VT,unaligned,TF,true,CSAs...>::canAlias(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
1771 return ( vector_.isAliased( &alias->vector_ ) &&
1772 ( offset() +
size() > alias->offset() ) &&
1773 ( offset() < alias->offset() + alias->size() ) );
1790 template<
typename VT
1793 template<
typename Other >
1794 inline bool Subvector<VT,unaligned,TF,true,CSAs...>::isAliased(
const Other* alias )
const noexcept
1796 return vector_.isAliased( alias );
1813 template<
typename VT
1816 template<
typename VT2
1821 Subvector<VT,unaligned,TF,true,CSAs...>::isAliased(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
1823 return ( vector_.isAliased( &alias->vector_ ) &&
1824 ( offset() +
size() > alias->offset() ) &&
1825 ( offset() < alias->offset() + alias->size() ) );
1841 template<
typename VT
1844 inline bool Subvector<VT,unaligned,TF,true,CSAs...>::isAligned() const noexcept
1863 template<
typename VT
1866 inline bool Subvector<VT,unaligned,TF,true,CSAs...>::canSMPAssign() const noexcept
1868 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1888 template<
typename VT
1892 Subvector<VT,unaligned,TF,true,CSAs...>::load(
size_t index )
const noexcept
1895 return loada( index );
1897 return loadu( index );
1917 template<
typename VT
1929 return vector_.loada( offset()+index );
1949 template<
typename VT
1961 return vector_.loadu( offset()+index );
1982 template<
typename VT
1986 Subvector<VT,unaligned,TF,true,CSAs...>::store(
size_t index,
const SIMDType& value ) noexcept
2012 template<
typename VT
2024 vector_.storea( offset()+index, value );
2045 template<
typename VT
2057 vector_.storeu( offset()+index, value );
2078 template<
typename VT
2091 vector_.stream( offset()+index, value );
2093 vector_.storeu( offset()+index, value );
2111 template<
typename VT
2114 template<
typename VT2 >
2115 inline DisableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAssign<VT2> >
2116 Subvector<VT,unaligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
2120 const size_t ipos(
size() &
size_t(-2) );
2121 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2122 vector_[offset()+i ] = (~rhs)[i ];
2123 vector_[offset()+i+1UL] = (~rhs)[i+1UL];
2125 if( ipos <
size() ) {
2126 vector_[offset()+ipos] = (~rhs)[ipos];
2145 template<
typename VT
2148 template<
typename VT2 >
2149 inline EnableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAssign<VT2> >
2150 Subvector<VT,unaligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
2156 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
2161 ConstIterator_<VT2> right( (~rhs).
begin() );
2163 if( useStreaming && isAligned_ &&
2164 (
size() > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) ) &&
2165 !(~rhs).isAliased( &vector_ ) )
2167 for( ; i<ipos; i+=SIMDSIZE ) {
2168 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2170 for( ; i<
size(); ++i ) {
2176 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2177 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2178 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2179 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2180 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2182 for( ; i<ipos; i+=SIMDSIZE ) {
2183 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2185 for( ; i<
size(); ++i ) {
2186 *left = *right; ++left; ++right;
2206 template<
typename VT
2209 template<
typename VT2 >
2210 inline void Subvector<VT,unaligned,TF,true,CSAs...>::assign(
const SparseVector<VT2,TF>& rhs )
2214 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2215 vector_[offset()+element->index()] = element->value();
2233 template<
typename VT
2236 template<
typename VT2 >
2237 inline DisableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >
2238 Subvector<VT,unaligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
2242 const size_t ipos(
size() &
size_t(-2) );
2243 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2244 vector_[offset()+i ] += (~rhs)[i ];
2245 vector_[offset()+i+1UL] += (~rhs)[i+1UL];
2247 if( ipos <
size() ) {
2248 vector_[offset()+ipos] += (~rhs)[ipos];
2267 template<
typename VT
2270 template<
typename VT2 >
2271 inline EnableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >
2272 Subvector<VT,unaligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
2278 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
2283 ConstIterator_<VT2> right( (~rhs).
begin() );
2285 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2286 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2287 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2288 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2289 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2291 for( ; i<ipos; i+=SIMDSIZE ) {
2292 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2294 for( ; i<
size(); ++i ) {
2295 *left += *right; ++left; ++right;
2314 template<
typename VT
2317 template<
typename VT2 >
2318 inline void Subvector<VT,unaligned,TF,true,CSAs...>::addAssign(
const SparseVector<VT2,TF>& rhs )
2322 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2323 vector_[offset()+element->index()] += element->value();
2341 template<
typename VT
2344 template<
typename VT2 >
2345 inline DisableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >
2346 Subvector<VT,unaligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
2350 const size_t ipos(
size() &
size_t(-2) );
2351 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2352 vector_[offset()+i ] -= (~rhs)[i ];
2353 vector_[offset()+i+1UL] -= (~rhs)[i+1UL];
2355 if( ipos <
size() ) {
2356 vector_[offset()+ipos] -= (~rhs)[ipos];
2375 template<
typename VT
2378 template<
typename VT2 >
2379 inline EnableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >
2380 Subvector<VT,unaligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
2386 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
2391 ConstIterator_<VT2> right( (~rhs).
begin() );
2393 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2394 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2395 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2396 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2397 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2399 for( ; i<ipos; i+=SIMDSIZE ) {
2400 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2402 for( ; i<
size(); ++i ) {
2403 *left -= *right; ++left; ++right;
2422 template<
typename VT
2425 template<
typename VT2 >
2426 inline void Subvector<VT,unaligned,TF,true,CSAs...>::subAssign(
const SparseVector<VT2,TF>& rhs )
2430 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2431 vector_[offset()+element->index()] -= element->value();
2449 template<
typename VT
2452 template<
typename VT2 >
2453 inline DisableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >
2454 Subvector<VT,unaligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
2458 const size_t ipos(
size() &
size_t(-2) );
2459 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2460 vector_[offset()+i ] *= (~rhs)[i ];
2461 vector_[offset()+i+1UL] *= (~rhs)[i+1UL];
2463 if( ipos <
size() ) {
2464 vector_[offset()+ipos] *= (~rhs)[ipos];
2483 template<
typename VT
2486 template<
typename VT2 >
2487 inline EnableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >
2488 Subvector<VT,unaligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
2494 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
2499 ConstIterator_<VT2> right( (~rhs).
begin() );
2501 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2502 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2503 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2504 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2505 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2507 for( ; i<ipos; i+=SIMDSIZE ) {
2508 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2510 for( ; i<
size(); ++i ) {
2511 *left *= *right; ++left; ++right;
2530 template<
typename VT
2533 template<
typename VT2 >
2534 inline void Subvector<VT,unaligned,TF,true,CSAs...>::multAssign(
const SparseVector<VT2,TF>& rhs )
2542 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
2543 const size_t index( element->index() );
2544 for( ; i<index; ++i )
2545 reset( vector_[offset()+i] );
2546 vector_[offset()+i] *= element->value();
2550 for( ; i<
size(); ++i ) {
2551 reset( vector_[offset()+i] );
2570 template<
typename VT
2573 template<
typename VT2 >
2574 inline DisableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT2> >
2575 Subvector<VT,unaligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
2579 const size_t ipos(
size() &
size_t(-2) );
2580 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2581 vector_[offset()+i ] /= (~rhs)[i ];
2582 vector_[offset()+i+1UL] /= (~rhs)[i+1UL];
2584 if( ipos <
size() ) {
2585 vector_[offset()+ipos] /= (~rhs)[ipos];
2604 template<
typename VT
2607 template<
typename VT2 >
2608 inline EnableIf_<
typename Subvector<VT,
unaligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT2> >
2609 Subvector<VT,unaligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
2615 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
2620 ConstIterator_<VT2> right( (~rhs).
begin() );
2622 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2623 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2624 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2625 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2626 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2628 for( ; i<ipos; i+=SIMDSIZE ) {
2629 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2631 for( ; i<
size(); ++i ) {
2632 *left /= *right; ++left; ++right;
2659 template<
typename VT
2662 class Subvector<VT,
aligned,TF,true,CSAs...>
2663 :
public View< DenseVector< Subvector<VT,aligned,TF,true,CSAs...>, TF > >
2664 ,
private SubvectorData<CSAs...>
2668 using DataType = SubvectorData<CSAs...>;
2669 using Operand = If_< IsExpression<VT>, VT, VT& >;
2675 using This = Subvector<VT,
aligned,TF,
true,CSAs...>;
2677 using BaseType = DenseVector<This,TF>;
2678 using ViewedType = VT;
2681 using ElementType = ElementType_<VT>;
2682 using SIMDType = SIMDTrait_<ElementType>;
2687 using ConstReference = ConstReference_<VT>;
2693 using ConstPointer = ConstPointer_<VT>;
2696 using Pointer = If_< Or< IsConst<VT>, Not< HasMutableDataAccess<VT> > >, ConstPointer, Pointer_<VT> >;
2699 using ConstIterator = ConstIterator_<VT>;
2707 enum :
bool { simdEnabled = VT::simdEnabled };
2710 enum :
bool { smpAssignable = VT::smpAssignable };
2716 template<
typename... RSAs >
2717 explicit inline Subvector( VT& vector, RSAs... args );
2729 inline Reference operator[](
size_t index );
2730 inline ConstReference operator[](
size_t index )
const;
2732 inline ConstReference at(
size_t index )
const;
2733 inline Pointer
data () noexcept;
2734 inline ConstPointer data () const noexcept;
2736 inline ConstIterator begin () const;
2737 inline ConstIterator
cbegin() const;
2739 inline ConstIterator end () const;
2740 inline ConstIterator
cend () const;
2747 inline Subvector& operator= ( const ElementType& rhs );
2748 inline Subvector& operator= ( initializer_list<ElementType> list );
2749 inline Subvector& operator= ( const Subvector& rhs );
2750 template< typename VT2 > inline Subvector& operator= ( const Vector<VT2,TF>& rhs );
2751 template< typename VT2 > inline Subvector& operator+=( const Vector<VT2,TF>& rhs );
2752 template< typename VT2 > inline Subvector& operator-=( const Vector<VT2,TF>& rhs );
2753 template< typename VT2 > inline Subvector& operator*=( const Vector<VT2,TF>& rhs );
2754 template< typename VT2 > inline Subvector& operator/=( const DenseVector<VT2,TF>& rhs );
2755 template< typename VT2 > inline Subvector& operator%=( const Vector<VT2,TF>& rhs );
2762 using DataType::offset;
2763 using DataType::
size;
2765 inline VT& operand() noexcept;
2766 inline const VT& operand() const noexcept;
2768 inline
size_t spacing() const noexcept;
2769 inline
size_t capacity() const noexcept;
2771 inline
void reset();
2778 template< typename Other > inline Subvector& scale( const Other& scalar );
2785 template< typename VT2 >
2786 struct VectorizedAssign {
2787 enum :
bool { value = useOptimizedKernels &&
2788 simdEnabled && VT2::simdEnabled &&
2789 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value };
2795 template<
typename VT2 >
2796 struct VectorizedAddAssign {
2797 enum :
bool { value = useOptimizedKernels &&
2798 simdEnabled && VT2::simdEnabled &&
2799 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
2800 HasSIMDAdd< ElementType, ElementType_<VT2> >::value };
2806 template<
typename VT2 >
2807 struct VectorizedSubAssign {
2808 enum :
bool { value = useOptimizedKernels &&
2809 simdEnabled && VT2::simdEnabled &&
2810 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
2811 HasSIMDSub< ElementType, ElementType_<VT2> >::value };
2817 template<
typename VT2 >
2818 struct VectorizedMultAssign {
2819 enum :
bool { value = useOptimizedKernels &&
2820 simdEnabled && VT2::simdEnabled &&
2821 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
2822 HasSIMDMult< ElementType, ElementType_<VT2> >::value };
2828 template<
typename VT2 >
2829 struct VectorizedDivAssign {
2830 enum :
bool { value = useOptimizedKernels &&
2831 simdEnabled && VT2::simdEnabled &&
2832 IsSIMDCombinable< ElementType, ElementType_<VT2> >::value &&
2833 HasSIMDDiv< ElementType, ElementType_<VT2> >::value };
2846 template<
typename Other >
2847 inline bool canAlias(
const Other* alias )
const noexcept;
2849 template<
typename VT2,
AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
2850 inline bool canAlias(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept;
2852 template<
typename Other >
2853 inline bool isAliased(
const Other* alias )
const noexcept;
2855 template<
typename VT2,
AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
2856 inline bool isAliased(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept;
2858 inline bool isAligned () const noexcept;
2859 inline
bool canSMPAssign() const noexcept;
2870 template< typename VT2 >
2871 inline
DisableIf_< VectorizedAssign<VT2> > assign( const DenseVector <VT2,TF>& rhs );
2873 template< typename VT2 >
2874 inline
EnableIf_< VectorizedAssign<VT2> > assign( const DenseVector <VT2,TF>& rhs );
2876 template< typename VT2 > inline
void assign( const SparseVector<VT2,TF>& rhs );
2878 template< typename VT2 >
2879 inline
DisableIf_< VectorizedAddAssign<VT2> > addAssign( const DenseVector <VT2,TF>& rhs );
2881 template< typename VT2 >
2882 inline
EnableIf_< VectorizedAddAssign<VT2> > addAssign ( const DenseVector <VT2,TF>& rhs );
2884 template< typename VT2 > inline
void addAssign( const SparseVector<VT2,TF>& rhs );
2886 template< typename VT2 >
2887 inline
DisableIf_< VectorizedSubAssign<VT2> > subAssign ( const DenseVector <VT2,TF>& rhs );
2889 template< typename VT2 >
2890 inline
EnableIf_< VectorizedSubAssign<VT2> > subAssign( const DenseVector <VT2,TF>& rhs );
2892 template< typename VT2 > inline
void subAssign( const SparseVector<VT2,TF>& rhs );
2894 template< typename VT2 >
2895 inline
DisableIf_< VectorizedMultAssign<VT2> > multAssign( const DenseVector <VT2,TF>& rhs );
2897 template< typename VT2 >
2898 inline
EnableIf_< VectorizedMultAssign<VT2> > multAssign( const DenseVector <VT2,TF>& rhs );
2900 template< typename VT2 > inline
void multAssign( const SparseVector<VT2,TF>& rhs );
2902 template< typename VT2 >
2903 inline
DisableIf_< VectorizedDivAssign<VT2> > divAssign( const DenseVector <VT2,TF>& rhs );
2905 template< typename VT2 >
2906 inline
EnableIf_< VectorizedDivAssign<VT2> > divAssign( const DenseVector <VT2,TF>& rhs );
2919 template< typename VT2,
AlignmentFlag AF2,
bool TF2,
bool DF2,
size_t... CSAs2 > friend class Subvector;
2956 template< typename VT
2959 template< typename... RSAs >
2960 inline Subvector<VT,aligned,TF,true,CSAs...>::Subvector( VT& vector, RSAs... args )
2961 : DataType( args... )
2962 , vector_ ( vector )
2964 if( !Contains< TypeList<RSAs...>,
Unchecked >::value )
2966 if( offset() +
size() > vector.size() ) {
2998 template<
typename VT
3002 Subvector<VT,aligned,TF,true,CSAs...>::operator[](
size_t index )
3005 return vector_[offset()+index];
3018 template<
typename VT
3022 Subvector<VT,aligned,TF,true,CSAs...>::operator[](
size_t index )
const 3025 return const_cast<const VT&
>( vector_ )[offset()+index];
3042 template<
typename VT
3046 Subvector<VT,aligned,TF,true,CSAs...>::at(
size_t index )
3048 if( index >=
size() ) {
3051 return (*
this)[index];
3068 template<
typename VT
3072 Subvector<VT,aligned,TF,true,CSAs...>::at(
size_t index )
const 3074 if( index >=
size() ) {
3077 return (*
this)[index];
3091 template<
typename VT
3094 inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::Pointer
3097 return vector_.data() + offset();
3111 template<
typename VT
3114 inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstPointer
3117 return vector_.data() + offset();
3131 template<
typename VT
3137 return ( vector_.begin() + offset() );
3151 template<
typename VT
3157 return ( vector_.cbegin() + offset() );
3171 template<
typename VT
3177 return ( vector_.cbegin() + offset() );
3191 template<
typename VT
3197 return ( vector_.begin() + offset() +
size() );
3211 template<
typename VT
3217 return ( vector_.cbegin() + offset() +
size() );
3231 template<
typename VT
3237 return ( vector_.cbegin() + offset() +
size() );
3258 template<
typename VT
3261 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3262 Subvector<VT,aligned,TF,true,CSAs...>::operator=(
const ElementType& rhs )
3264 const size_t iend( offset() +
size() );
3265 decltype(
auto) left( derestrict( vector_ ) );
3267 for(
size_t i=offset(); i<iend; ++i ) {
3268 if( !IsRestricted<VT>::value || trySet( vector_, i, rhs ) )
3291 template<
typename VT
3294 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3295 Subvector<VT,aligned,TF,true,CSAs...>::operator=( initializer_list<ElementType> list )
3297 if( list.size() >
size() ) {
3301 if( IsRestricted<VT>::value ) {
3302 const InitializerVector<ElementType,TF> tmp( list,
size() );
3303 if( !tryAssign( vector_, tmp, offset() ) ) {
3308 decltype(
auto) left( derestrict( *this ) );
3310 std::fill(
std::copy( list.begin(), list.end(), begin() ), end(), ElementType() );
3332 template< typename VT
3335 inline Subvector<VT,aligned,TF,true,CSAs...>&
3336 Subvector<VT,aligned,TF,true,CSAs...>::operator=( const Subvector& rhs )
3341 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && offset() == rhs.offset() ) )
3344 if(
size() != rhs.size() ) {
3348 if( !tryAssign( vector_, rhs, offset() ) ) {
3352 decltype(
auto) left( derestrict( *this ) );
3354 if( rhs.canAlias( &vector_ ) ) {
3382 template<
typename VT
3385 template<
typename VT2 >
3386 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3387 Subvector<VT,aligned,TF,true,CSAs...>::operator=(
const Vector<VT2,TF>& rhs )
3396 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
3397 Right right( ~rhs );
3399 if( !tryAssign( vector_, right, offset() ) ) {
3403 decltype(
auto) left( derestrict( *this ) );
3405 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
3406 const ResultType_<VT2> tmp( right );
3410 if( IsSparseVector<VT2>::value )
3435 template<
typename VT
3438 template<
typename VT2 >
3439 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3449 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
3450 Right right( ~rhs );
3452 if( !tryAddAssign( vector_, right, offset() ) ) {
3456 decltype(
auto) left( derestrict( *this ) );
3458 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
3459 const ResultType_<VT2> tmp( right );
3486 template<
typename VT
3489 template<
typename VT2 >
3490 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3500 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
3501 Right right( ~rhs );
3503 if( !trySubAssign( vector_, right, offset() ) ) {
3507 decltype(
auto) left( derestrict( *this ) );
3509 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
3510 const ResultType_<VT2> tmp( right );
3538 template<
typename VT
3541 template<
typename VT2 >
3542 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3552 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
3553 Right right( ~rhs );
3555 if( !tryMultAssign( vector_, right, offset() ) ) {
3559 decltype(
auto) left( derestrict( *this ) );
3561 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
3562 const ResultType_<VT2> tmp( right );
3589 template<
typename VT
3592 template<
typename VT2 >
3593 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3603 using Right = If_< IsRestricted<VT>, CompositeType_<VT2>,
const VT2& >;
3604 Right right( ~rhs );
3606 if( !tryDivAssign( vector_, right, offset() ) ) {
3610 decltype(
auto) left( derestrict( *this ) );
3612 if( IsReference<Right>::value && right.canAlias( &vector_ ) ) {
3613 const ResultType_<VT2> tmp( right );
3641 template<
typename VT
3644 template<
typename VT2 >
3645 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3646 Subvector<VT,aligned,TF,true,CSAs...>::operator%=(
const Vector<VT2,TF>& rhs )
3648 using blaze::assign;
3653 using CrossType = CrossTrait_< ResultType, ResultType_<VT2> >;
3659 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3663 const CrossType tmp( *
this % (~rhs) );
3665 if( !tryAssign( vector_, tmp, offset() ) ) {
3669 decltype(
auto) left( derestrict( *this ) );
3671 assign( left, tmp );
3695 template< typename VT
3698 inline VT& Subvector<VT,aligned,TF,true,CSAs...>::operand() noexcept
3712 template<
typename VT
3715 inline const VT& Subvector<VT,aligned,TF,true,CSAs...>::operand() const noexcept
3732 template<
typename VT
3737 return vector_.spacing() - offset();
3749 template<
typename VT
3754 return vector_.capacity() - offset();
3769 template<
typename VT
3774 size_t nonzeros( 0 );
3776 const size_t iend( offset() +
size() );
3777 for(
size_t i=offset(); i<iend; ++i ) {
3794 template<
typename VT
3801 const size_t iend( offset() +
size() );
3802 for(
size_t i=offset(); i<iend; ++i )
3803 clear( vector_[i] );
3828 template<
typename VT
3831 template<
typename Other >
3832 inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3833 Subvector<VT,aligned,TF,true,CSAs...>::scale(
const Other& scalar )
3835 const size_t iend( offset() +
size() );
3836 for(
size_t i=offset(); i<iend; ++i )
3837 vector_[i] *= scalar;
3863 template<
typename VT
3866 template<
typename Other >
3867 inline bool Subvector<VT,aligned,TF,true,CSAs...>::canAlias(
const Other* alias )
const noexcept
3869 return vector_.isAliased( alias );
3886 template<
typename VT
3889 template<
typename VT2
3894 Subvector<VT,aligned,TF,true,CSAs...>::canAlias(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
3896 return ( vector_.isAliased( &alias->vector_ ) &&
3897 ( offset() +
size() > alias->offset() ) &&
3898 ( offset() < alias->offset() + alias->size() ) );
3915 template<
typename VT
3918 template<
typename Other >
3919 inline bool Subvector<VT,aligned,TF,true,CSAs...>::isAliased(
const Other* alias )
const noexcept
3921 return vector_.isAliased( alias );
3938 template<
typename VT
3941 template<
typename VT2
3946 Subvector<VT,aligned,TF,true,CSAs...>::isAliased(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
3948 return ( vector_.isAliased( &alias->vector_ ) &&
3949 ( offset() +
size() > alias->offset() ) &&
3950 ( offset() < alias->offset() + alias->size() ) );
3966 template<
typename VT
3969 inline bool Subvector<VT,aligned,TF,true,CSAs...>::isAligned() const noexcept
3988 template<
typename VT
3991 inline bool Subvector<VT,aligned,TF,true,CSAs...>::canSMPAssign() const noexcept
3993 return (
size() > SMP_DVECASSIGN_THRESHOLD );
4013 template<
typename VT
4017 Subvector<VT,aligned,TF,true,CSAs...>::load(
size_t index )
const noexcept
4019 return loada( index );
4039 template<
typename VT
4051 return vector_.loada( offset()+index );
4071 template<
typename VT
4083 return vector_.loadu( offset()+index );
4104 template<
typename VT
4108 Subvector<VT,aligned,TF,true,CSAs...>::store(
size_t index,
const SIMDType& value ) noexcept
4131 template<
typename VT
4143 vector_.storea( offset()+index, value );
4164 template<
typename VT
4176 vector_.storeu( offset()+index, value );
4197 template<
typename VT
4209 vector_.stream( offset()+index, value );
4227 template<
typename VT
4230 template<
typename VT2 >
4231 inline DisableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAssign<VT2> >
4232 Subvector<VT,aligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
4236 const size_t ipos(
size() &
size_t(-2) );
4237 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4238 vector_[offset()+i ] = (~rhs)[i ];
4239 vector_[offset()+i+1UL] = (~rhs)[i+1UL];
4241 if( ipos <
size() ) {
4242 vector_[offset()+ipos] = (~rhs)[ipos];
4261 template<
typename VT
4264 template<
typename VT2 >
4265 inline EnableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAssign<VT2> >
4266 Subvector<VT,aligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
4272 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
4277 ConstIterator_<VT2> right( (~rhs).
begin() );
4279 if( useStreaming &&
size() > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &vector_ ) )
4281 for( ; i<ipos; i+=SIMDSIZE ) {
4282 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4284 for( ; i<
size(); ++i ) {
4285 *left = *right; ++left; ++right;
4290 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4291 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4292 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4293 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4294 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4296 for( ; i<ipos; i+=SIMDSIZE ) {
4297 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4299 for( ; i<
size(); ++i ) {
4300 *left = *right; ++left; ++right;
4320 template<
typename VT
4323 template<
typename VT2 >
4324 inline void Subvector<VT,aligned,TF,true,CSAs...>::assign(
const SparseVector<VT2,TF>& rhs )
4328 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4329 vector_[offset()+element->index()] = element->value();
4347 template<
typename VT
4350 template<
typename VT2 >
4351 inline DisableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >
4352 Subvector<VT,aligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
4356 const size_t ipos(
size() &
size_t(-2) );
4357 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4358 vector_[offset()+i ] += (~rhs)[i ];
4359 vector_[offset()+i+1UL] += (~rhs)[i+1UL];
4361 if( ipos <
size() ) {
4362 vector_[offset()+ipos] += (~rhs)[ipos];
4381 template<
typename VT
4384 template<
typename VT2 >
4385 inline EnableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedAddAssign<VT2> >
4386 Subvector<VT,aligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
4392 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
4397 ConstIterator_<VT2> right( (~rhs).
begin() );
4399 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4400 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4401 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4402 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4403 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4405 for( ; i<ipos; i+=SIMDSIZE ) {
4406 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4408 for( ; i<
size(); ++i ) {
4409 *left += *right; ++left; ++right;
4428 template<
typename VT
4431 template<
typename VT2 >
4432 inline void Subvector<VT,aligned,TF,true,CSAs...>::addAssign(
const SparseVector<VT2,TF>& rhs )
4436 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4437 vector_[offset()+element->index()] += element->value();
4455 template<
typename VT
4458 template<
typename VT2 >
4459 inline DisableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >
4460 Subvector<VT,aligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
4464 const size_t ipos(
size() &
size_t(-2) );
4465 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4466 vector_[offset()+i ] -= (~rhs)[i ];
4467 vector_[offset()+i+1UL] -= (~rhs)[i+1UL];
4469 if( ipos <
size() ) {
4470 vector_[offset()+ipos] -= (~rhs)[ipos];
4489 template<
typename VT
4492 template<
typename VT2 >
4493 inline EnableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedSubAssign<VT2> >
4494 Subvector<VT,aligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
4500 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
4505 ConstIterator_<VT2> right( (~rhs).
begin() );
4507 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4508 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4509 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4510 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4511 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4513 for( ; i<ipos; i+=SIMDSIZE ) {
4514 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4516 for( ; i<
size(); ++i ) {
4517 *left -= *right; ++left; ++right;
4536 template<
typename VT
4539 template<
typename VT2 >
4540 inline void Subvector<VT,aligned,TF,true,CSAs...>::subAssign(
const SparseVector<VT2,TF>& rhs )
4544 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4545 vector_[offset()+element->index()] -= element->value();
4563 template<
typename VT
4566 template<
typename VT2 >
4567 inline DisableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >
4568 Subvector<VT,aligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
4572 const size_t ipos(
size() &
size_t(-2) );
4573 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4574 vector_[offset()+i ] *= (~rhs)[i ];
4575 vector_[offset()+i+1UL] *= (~rhs)[i+1UL];
4577 if( ipos <
size() ) {
4578 vector_[offset()+ipos] *= (~rhs)[ipos];
4597 template<
typename VT
4600 template<
typename VT2 >
4601 inline EnableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedMultAssign<VT2> >
4602 Subvector<VT,aligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
4608 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
4613 ConstIterator_<VT2> right( (~rhs).
begin() );
4615 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4616 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4617 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4618 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4619 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4621 for( ; i<ipos; i+=SIMDSIZE ) {
4622 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4624 for( ; i<
size(); ++i ) {
4625 *left *= *right; ++left; ++right;
4644 template<
typename VT
4647 template<
typename VT2 >
4648 inline void Subvector<VT,aligned,TF,true,CSAs...>::multAssign(
const SparseVector<VT2,TF>& rhs )
4656 for( ConstIterator_<VT2> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
4657 const size_t index( element->index() );
4658 for( ; i<index; ++i )
4659 reset( vector_[offset()+i] );
4660 vector_[offset()+i] *= element->value();
4664 for( ; i<
size(); ++i ) {
4665 reset( vector_[offset()+i] );
4684 template<
typename VT
4687 template<
typename VT2 >
4688 inline DisableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT2> >
4689 Subvector<VT,aligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
4693 const size_t ipos(
size() &
size_t(-2) );
4694 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4695 vector_[offset()+i ] /= (~rhs)[i ];
4696 vector_[offset()+i+1UL] /= (~rhs)[i+1UL];
4698 if( ipos <
size() ) {
4699 vector_[offset()+ipos] /= (~rhs)[ipos];
4718 template<
typename VT
4721 template<
typename VT2 >
4722 inline EnableIf_<
typename Subvector<VT,
aligned,TF,
true,CSAs...>::BLAZE_TEMPLATE VectorizedDivAssign<VT2> >
4723 Subvector<VT,aligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
4729 const size_t ipos(
size() &
size_t(-SIMDSIZE) );
4734 ConstIterator_<VT2> right( (~rhs).
begin() );
4736 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4737 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4738 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4739 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4740 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4742 for( ; i<ipos; i+=SIMDSIZE ) {
4743 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4745 for( ; i<
size(); ++i ) {
4746 *left /= *right; ++left; ++right;
4773 template<
typename VT1
4777 class Subvector< DVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >
4778 :
public View< DenseVector< Subvector< DVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
4779 ,
private SubvectorData<CSAs...>
4783 using CPE = DVecDVecCrossExpr<VT1,VT2,TF>;
4784 using RT = ResultType_<CPE>;
4785 using DataType = SubvectorData<CSAs...>;
4793 using BaseType = DenseVector<This,TF>;
4794 using ViewedType = CPE;
4797 using ElementType = ElementType_<CPE>;
4804 enum :
bool { simdEnabled =
false };
4807 enum :
bool { smpAssignable =
false };
4817 template<
typename... RSAs >
4818 explicit inline Subvector(
const CPE& vector, RSAs... args )
4819 : DataType( args... )
4820 , vector_ ( vector )
4822 if( Contains< TypeList<RSAs...>,
Unchecked >::value ) {
4823 if( offset() +
size() > vector.size() ) {
4839 inline ReturnType operator[](
size_t index )
const {
4841 return vector_[offset()+index];
4853 if( index >=
size() ) {
4856 return (*
this)[index];
4861 using DataType::offset;
4870 inline CPE operand() const noexcept {
4881 template<
typename T >
4882 inline bool canAlias(
const T* alias )
const noexcept {
4883 return vector_.canAlias( alias );
4893 template<
typename T >
4894 inline bool isAliased(
const T* alias )
const noexcept {
4895 return vector_.isAliased( alias );
4928 template<
typename VT1
4932 class Subvector< DVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >
4933 :
public View< DenseVector< Subvector< DVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
4934 ,
private SubvectorData<CSAs...>
4938 using CPE = DVecSVecCrossExpr<VT1,VT2,TF>;
4939 using RT = ResultType_<CPE>;
4940 using DataType = SubvectorData<CSAs...>;
4948 using BaseType = DenseVector<This,TF>;
4949 using ViewedType = CPE;
4952 using ElementType = ElementType_<CPE>;
4959 enum :
bool { simdEnabled =
false };
4962 enum :
bool { smpAssignable =
false };
4972 template<
typename... RSAs >
4973 explicit inline Subvector(
const CPE& vector, RSAs... args )
4974 : DataType( args... )
4975 , vector_ ( vector )
4977 if( Contains< TypeList<RSAs...>,
Unchecked >::value ) {
4978 if( offset() +
size() > vector.size() ) {
4994 inline ReturnType operator[](
size_t index )
const {
4996 return vector_[offset()+index];
5008 if( index >=
size() ) {
5011 return (*
this)[index];
5016 using DataType::offset;
5025 inline CPE operand() const noexcept {
5036 template<
typename T >
5037 inline bool canAlias(
const T* alias )
const noexcept {
5038 return vector_.canAlias( alias );
5048 template<
typename T >
5049 inline bool isAliased(
const T* alias )
const noexcept {
5050 return vector_.isAliased( alias );
5083 template<
typename VT1
5087 class Subvector< SVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >
5088 :
public View< DenseVector< Subvector< SVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
5089 ,
private SubvectorData<CSAs...>
5093 using CPE = SVecDVecCrossExpr<VT1,VT2,TF>;
5094 using RT = ResultType_<CPE>;
5095 using DataType = SubvectorData<CSAs...>;
5103 using BaseType = DenseVector<This,TF>;
5104 using ViewedType = CPE;
5107 using ElementType = ElementType_<CPE>;
5114 enum :
bool { simdEnabled =
false };
5117 enum :
bool { smpAssignable =
false };
5127 template<
typename... RSAs >
5128 explicit inline Subvector(
const CPE& vector, RSAs... args )
5129 : DataType( args... )
5130 , vector_ ( vector )
5132 if( Contains< TypeList<RSAs...>,
Unchecked >::value ) {
5133 if( offset() +
size() > vector.size() ) {
5149 inline ReturnType operator[](
size_t index )
const {
5151 return vector_[offset()+index];
5163 if( index >=
size() ) {
5166 return (*
this)[index];
5171 using DataType::offset;
5180 inline CPE operand() const noexcept {
5191 template<
typename T >
5192 inline bool canAlias(
const T* alias )
const noexcept {
5193 return vector_.canAlias( alias );
5203 template<
typename T >
5204 inline bool isAliased(
const T* alias )
const noexcept {
5205 return vector_.isAliased( alias );
5238 template<
typename VT1
5242 class Subvector< SVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >
5243 :
public View< DenseVector< Subvector< SVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
5244 ,
private SubvectorData<CSAs...>
5248 using CPE = SVecSVecCrossExpr<VT1,VT2,TF>;
5249 using RT = ResultType_<CPE>;
5250 using DataType = SubvectorData<CSAs...>;
5258 using BaseType = DenseVector<This,TF>;
5259 using ViewedType = CPE;
5262 using ElementType = ElementType_<CPE>;
5269 enum :
bool { simdEnabled =
false };
5272 enum :
bool { smpAssignable =
false };
5282 template<
typename... RSAs >
5283 explicit inline Subvector(
const CPE& vector, RSAs... args )
5284 : DataType( args... )
5285 , vector_ ( vector )
5287 if( Contains< TypeList<RSAs...>,
Unchecked >::value ) {
5288 if( offset() +
size() > vector.size() ) {
5304 inline ReturnType operator[](
size_t index )
const {
5306 return vector_[offset()+index];
5318 if( index >=
size() ) {
5321 return (*
this)[index];
5326 using DataType::offset;
5335 inline CPE operand() const noexcept {
5346 template<
typename T >
5347 inline bool canAlias(
const T* alias )
const noexcept {
5348 return vector_.canAlias( alias );
5358 template<
typename T >
5359 inline bool isAliased(
const T* alias )
const {
5360 return vector_.isAliased( alias );
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
Constraint on the data type.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
Header file for the blaze::checked and blaze::unchecked instances.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
Header file for the View base class.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
EnableIf_< IsDenseMatrix< MT1 > > smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:164
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#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:81
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
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:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:701
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
Header file for the DenseVector base class.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
Header file for the Computation base class.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
#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:81
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
EnableIf_< IsDenseMatrix< MT1 > > smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:133
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Constraint on the data type.
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
EnableIf_< IsDenseMatrix< MT1 > > smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
Header file for the Or class template.
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
Header file for the implementation of the Subvector base template.
Header file for the Not class template.
Header file for the implementation of the SubvectorData class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for the subvector trait.
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
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:61
Constraint on the data type.
Header file for the exception macros of the math module.
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:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
typename SubvectorTrait< VT, CSAs... >::Type SubvectorTrait_
Auxiliary alias declaration for the SubvectorTrait type trait.The SubvectorTrait_ alias declaration p...
Definition: SubvectorTrait.h:145
Header file for the CrossExpr base class.
Flag for aligned vectors and matrices.
Definition: AlignmentFlag.h:65
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
Header file for the IsSIMDCombinable type trait.
Header file for the IsSparseVector type trait.
Header file for the HasSIMDMult type trait.
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the cross product trait.
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
EnableIf_< IsDenseVector< VT1 > > smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:222
Header file for the cache size of the target architecture.
Header file for the isDefault shim.
Header file for the HasSIMDSub type trait.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:405
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:81
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
#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:81
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
Header file for the HasSIMDDiv type trait.
Flag for unaligned vectors and matrices.
Definition: AlignmentFlag.h:64
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
Header file for the alignment check function.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsRestricted type trait.
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.In case the given data type T is not a dense or sparse vector type and in...
Definition: TransposeFlag.h:63
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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.