35#ifndef _BLAZE_MATH_VIEWS_SUBVECTOR_DENSE_H_
36#define _BLAZE_MATH_VIEWS_SUBVECTOR_DENSE_H_
114class Subvector<VT,
unaligned,TF,true,CSAs...>
115 :
public View< DenseVector< Subvector<VT,unaligned,TF,true,CSAs...>, TF > >
120 using DataType = SubvectorData<CSAs...>;
121 using Operand = If_t< IsExpression_v<VT>, VT, VT& >;
127 using This = Subvector<VT,
unaligned,TF,
true,CSAs...>;
129 using BaseType = View< DenseVector<This,TF> >;
130 using ViewedType = VT;
132 using TransposeType = TransposeType_t<ResultType>;
133 using ElementType = ElementType_t<VT>;
134 using SIMDType = SIMDTrait_t<ElementType>;
135 using ReturnType = ReturnType_t<VT>;
136 using CompositeType =
const Subvector&;
139 using ConstReference = ConstReference_t<VT>;
142 using Reference = If_t< IsConst_v<VT>, ConstReference, Reference_t<VT> >;
145 using ConstPointer = ConstPointer_t<VT>;
148 using Pointer = If_t< IsConst_v<VT> || !HasMutableDataAccess_v<VT>, ConstPointer, Pointer_t<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;
187 , isAligned_( false )
198 : iterator_ ( iterator )
199 , isAligned_( isMemoryAligned )
208 template<
typename IteratorType2 >
210 : iterator_ ( it.base() )
211 , isAligned_( it.isAligned() )
256 return SubvectorIterator( iterator_++, isAligned_ );
277 return SubvectorIterator( iterator_--, isAligned_ );
311 inline SIMDType load()
const {
331 inline SIMDType
loada()
const {
332 return iterator_.loada();
346 inline SIMDType
loadu()
const {
347 return iterator_.loadu();
362 inline void store(
const SIMDType& value )
const {
383 inline void storea(
const SIMDType& value )
const {
384 iterator_.storea( value );
399 inline void storeu(
const SIMDType& value )
const {
400 iterator_.storeu( value );
415 inline void stream(
const SIMDType& value )
const {
416 iterator_.stream( value );
427 return iterator_ == rhs.iterator_;
438 return iterator_ != rhs.iterator_;
449 return iterator_ < rhs.iterator_;
460 return iterator_ > rhs.iterator_;
471 return iterator_ <= rhs.iterator_;
482 return iterator_ >= rhs.iterator_;
493 return iterator_ - rhs.iterator_;
505 return SubvectorIterator( it.iterator_ + inc, it.isAligned_ );
517 return SubvectorIterator( it.iterator_ + inc, it.isAligned_ );
529 return SubvectorIterator( it.iterator_ - dec, it.isAligned_ );
548 inline bool isAligned()
const {
555 IteratorType iterator_;
563 using ConstIterator = SubvectorIterator< ConstIterator_t<VT> >;
566 using Iterator = If_t< IsConst_v<VT>, ConstIterator, SubvectorIterator< Iterator_t<VT> > >;
571 static constexpr bool simdEnabled = VT::simdEnabled;
574 static constexpr bool smpAssignable = VT::smpAssignable;
577 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
583 template<
typename... RSAs >
584 explicit inline Subvector( VT& vector, RSAs... args );
586 Subvector(
const Subvector& ) =
default;
593 ~Subvector() =
default;
600 inline Reference operator[](
size_t index );
601 inline ConstReference operator[](
size_t index )
const;
602 inline Reference at(
size_t index );
603 inline ConstReference at(
size_t index )
const;
604 inline Pointer
data () noexcept;
605 inline ConstPointer data () const noexcept;
606 inline Iterator begin ();
607 inline ConstIterator begin () const;
608 inline ConstIterator cbegin() const;
609 inline Iterator end ();
610 inline ConstIterator end () const;
611 inline ConstIterator cend () const;
618 inline Subvector& operator= ( const ElementType& rhs );
619 inline Subvector& operator= ( initializer_list<ElementType> list );
620 inline Subvector& operator= ( const Subvector& rhs );
621 template< typename VT2 > inline Subvector& operator= ( const Vector<VT2,TF>& rhs );
622 template< typename VT2 > inline Subvector& operator+=( const Vector<VT2,TF>& rhs );
623 template< typename VT2 > inline Subvector& operator-=( const Vector<VT2,TF>& rhs );
624 template< typename VT2 > inline Subvector& operator*=( const Vector<VT2,TF>& rhs );
625 template< typename VT2 > inline Subvector& operator/=( const DenseVector<VT2,TF>& rhs );
626 template< typename VT2 > inline Subvector& operator%=( const Vector<VT2,TF>& rhs );
633 using DataType::offset;
634 using DataType::size;
636 inline VT& operand() noexcept;
637 inline const VT& operand() const noexcept;
639 inline
size_t spacing() const noexcept;
640 inline
size_t capacity() const noexcept;
641 inline
size_t nonZeros() const;
649 template< typename Other > inline Subvector& scale( const Other& scalar );
656 template< typename VT2 >
657 static constexpr
bool VectorizedAssign_v =
658 ( useOptimizedKernels &&
659 simdEnabled && VT2::simdEnabled &&
660 IsSIMDCombinable_v< ElementType, ElementType_t<VT2> > );
665 template< typename VT2 >
666 static constexpr
bool VectorizedAddAssign_v =
667 ( VectorizedAssign_v<VT2> &&
668 HasSIMDAdd_v< ElementType, ElementType_t<VT2> > );
673 template< typename VT2 >
674 static constexpr
bool VectorizedSubAssign_v =
675 ( VectorizedAssign_v<VT2> &&
676 HasSIMDSub_v< ElementType, ElementType_t<VT2> > );
681 template< typename VT2 >
682 static constexpr
bool VectorizedMultAssign_v =
683 ( VectorizedAssign_v<VT2> &&
684 HasSIMDMult_v< ElementType, ElementType_t<VT2> > );
689 template< typename VT2 >
690 static constexpr
bool VectorizedDivAssign_v =
691 ( VectorizedAssign_v<VT2> &&
692 HasSIMDDiv_v< ElementType, ElementType_t<VT2> > );
697 static constexpr
size_t SIMDSIZE = SIMDTrait<ElementType>::size;
704 template< typename Other >
705 inline
bool canAlias( const Other* alias ) const noexcept;
707 template< typename VT2, AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
708 inline
bool canAlias( const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias ) const noexcept;
710 template< typename Other >
711 inline
bool isAliased( const Other* alias ) const noexcept;
713 template< typename VT2, AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
714 inline
bool isAliased( const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias ) const noexcept;
716 inline
bool isAligned () const noexcept;
717 inline
bool canSMPAssign() const noexcept;
728 template< typename VT2 >
729 inline auto assign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT2> >;
731 template< typename VT2 >
732 inline auto assign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT2> >;
734 template< typename VT2 > inline
void assign( const SparseVector<VT2,TF>& rhs );
736 template< typename VT2 >
737 inline auto addAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT2> >;
739 template< typename VT2 >
740 inline auto addAssign ( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT2> >;
742 template< typename VT2 > inline
void addAssign( const SparseVector<VT2,TF>& rhs );
744 template< typename VT2 >
745 inline auto subAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT2> >;
747 template< typename VT2 >
748 inline auto subAssign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT2> >;
750 template< typename VT2 > inline
void subAssign( const SparseVector<VT2,TF>& rhs );
752 template< typename VT2 >
753 inline auto multAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT2> >;
755 template< typename VT2 >
756 inline auto multAssign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT2> >;
758 template< typename VT2 > inline
void multAssign( const SparseVector<VT2,TF>& rhs );
760 template< typename VT2 >
761 inline auto divAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT2> >;
763 template< typename VT2 >
764 inline auto divAssign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT2> >;
773 const
bool isAligned_;
784 template< typename VT2, AlignmentFlag AF2,
bool TF2,
bool DF2,
size_t... CSAs2 > friend class Subvector;
824template< typename... RSAs >
825inline Subvector<VT,unaligned,TF,true,CSAs...>::Subvector( VT& vector, RSAs... args )
826 : DataType ( args... )
828 , isAligned_( simdEnabled && IsContiguous_v<VT> &&
829 vector.data() !=
nullptr && checkAlignment( data() ) )
832 if( offset() + size() > vector.size() ) {
833 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid subvector specification" );
865inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::Reference
866 Subvector<VT,unaligned,TF,true,CSAs...>::operator[](
size_t index )
869 return vector_[offset()+index];
888inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstReference
889 Subvector<VT,unaligned,TF,true,CSAs...>::operator[](
size_t index )
const
892 return const_cast<const VT&
>( vector_ )[offset()+index];
912inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::Reference
913 Subvector<VT,unaligned,TF,true,CSAs...>::at(
size_t index )
915 if( index >=
size() ) {
918 return (*
this)[index];
938inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstReference
939 Subvector<VT,unaligned,TF,true,CSAs...>::at(
size_t index )
const
941 if( index >=
size() ) {
944 return (*
this)[index];
961inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::Pointer
962 Subvector<VT,unaligned,TF,true,CSAs...>::data() noexcept
964 return vector_.data() + offset();
981inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstPointer
982 Subvector<VT,unaligned,TF,true,CSAs...>::data() const noexcept
984 return vector_.data() + offset();
1001inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::Iterator
1002 Subvector<VT,unaligned,TF,true,CSAs...>::begin()
1004 return Iterator( vector_.begin() + offset(), isAligned_ );
1018template<
typename VT
1021inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstIterator
1022 Subvector<VT,unaligned,TF,true,CSAs...>::begin()
const
1024 return ConstIterator( vector_.cbegin() + offset(), isAligned_ );
1038template<
typename VT
1041inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstIterator
1042 Subvector<VT,unaligned,TF,true,CSAs...>::cbegin()
const
1044 return ConstIterator( vector_.cbegin() + offset(), isAligned_ );
1058template<
typename VT
1061inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::Iterator
1062 Subvector<VT,unaligned,TF,true,CSAs...>::end()
1064 return Iterator( vector_.begin() + offset() +
size(), isAligned_ );
1078template<
typename VT
1081inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstIterator
1082 Subvector<VT,unaligned,TF,true,CSAs...>::end()
const
1084 return ConstIterator( vector_.cbegin() + offset() +
size(), isAligned_ );
1098template<
typename VT
1101inline typename Subvector<VT,
unaligned,TF,
true,CSAs...>::ConstIterator
1102 Subvector<VT,unaligned,TF,true,CSAs...>::cend()
const
1104 return ConstIterator( vector_.cbegin() + offset() +
size(), isAligned_ );
1125template<
typename VT
1128inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1129 Subvector<VT,unaligned,TF,true,CSAs...>::operator=(
const ElementType& rhs )
1131 const size_t iend( offset() +
size() );
1132 decltype(
auto) left( derestrict( vector_ ) );
1134 for(
size_t i=offset(); i<iend; ++i ) {
1161template<
typename VT
1164inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1165 Subvector<VT,unaligned,TF,true,CSAs...>::operator=( initializer_list<ElementType> list )
1167 if( list.size() >
size() ) {
1173 if( !tryAssign( vector_, tmp, offset() ) ) {
1178 decltype(
auto) left( derestrict( *
this ) );
1180 std::fill( std::copy( list.begin(), list.end(), left.begin() ), left.end(), ElementType() );
1202template<
typename VT
1205inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1206 Subvector<VT,unaligned,TF,true,CSAs...>::operator=(
const Subvector& rhs )
1211 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && offset() == rhs.offset() ) )
1214 if(
size() != rhs.size() ) {
1218 if( !tryAssign( vector_, rhs, offset() ) ) {
1222 decltype(
auto) left( derestrict( *
this ) );
1224 if( rhs.canAlias(
this ) ) {
1225 const ResultType tmp( rhs );
1252template<
typename VT
1255template<
typename VT2 >
1256inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1257 Subvector<VT,unaligned,TF,true,CSAs...>::operator=(
const Vector<VT2,TF>& rhs )
1262 if(
size() != (*rhs).size() ) {
1267 Right right( *rhs );
1269 if( !tryAssign( vector_, right, offset() ) ) {
1273 decltype(
auto) left( derestrict( *
this ) );
1305template<
typename VT
1308template<
typename VT2 >
1309inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1310 Subvector<VT,unaligned,TF,true,CSAs...>::operator+=(
const Vector<VT2,TF>& rhs )
1315 if(
size() != (*rhs).size() ) {
1320 Right right( *rhs );
1322 if( !tryAddAssign( vector_, right, offset() ) ) {
1326 decltype(
auto) left( derestrict( *
this ) );
1356template<
typename VT
1359template<
typename VT2 >
1360inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1361 Subvector<VT,unaligned,TF,true,CSAs...>::operator-=(
const Vector<VT2,TF>& rhs )
1366 if(
size() != (*rhs).size() ) {
1371 Right right( *rhs );
1373 if( !trySubAssign( vector_, right, offset() ) ) {
1377 decltype(
auto) left( derestrict( *
this ) );
1408template<
typename VT
1411template<
typename VT2 >
1412inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1413 Subvector<VT,unaligned,TF,true,CSAs...>::operator*=(
const Vector<VT2,TF>& rhs )
1418 if(
size() != (*rhs).size() ) {
1423 Right right( *rhs );
1425 if( !tryMultAssign( vector_, right, offset() ) ) {
1429 decltype(
auto) left( derestrict( *
this ) );
1459template<
typename VT
1462template<
typename VT2 >
1463inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1469 if(
size() != (*rhs).size() ) {
1474 Right right( *rhs );
1476 if( !tryDivAssign( vector_, right, offset() ) ) {
1480 decltype(
auto) left( derestrict( *
this ) );
1511template<
typename VT
1514template<
typename VT2 >
1515inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1516 Subvector<VT,unaligned,TF,true,CSAs...>::operator%=(
const Vector<VT2,TF>& rhs )
1518 using blaze::assign;
1529 if(
size() != 3UL || (*rhs).size() != 3UL ) {
1533 const CrossType tmp( *
this % (*rhs) );
1535 if( !tryAssign( vector_, tmp, offset() ) ) {
1539 decltype(
auto) left( derestrict( *
this ) );
1541 assign( left, tmp );
1565template<
typename VT
1568inline VT& Subvector<VT,unaligned,TF,true,CSAs...>::operand() noexcept
1582template<
typename VT
1585inline const VT& Subvector<VT,unaligned,TF,true,CSAs...>::operand() const noexcept
1602template<
typename VT
1605inline size_t Subvector<VT,unaligned,TF,true,CSAs...>::spacing() const noexcept
1607 return vector_.spacing() - offset();
1619template<
typename VT
1622inline size_t Subvector<VT,unaligned,TF,true,CSAs...>::capacity() const noexcept
1624 return vector_.capacity() - offset();
1639template<
typename VT
1642inline size_t Subvector<VT,unaligned,TF,true,CSAs...>::nonZeros()
const
1644 size_t nonzeros( 0 );
1646 const size_t iend( offset() +
size() );
1647 for(
size_t i=offset(); i<iend; ++i ) {
1664template<
typename VT
1667inline void Subvector<VT,unaligned,TF,true,CSAs...>::reset()
1671 const size_t iend( offset() +
size() );
1672 for(
size_t i=offset(); i<iend; ++i )
1673 clear( vector_[i] );
1698template<
typename VT
1701template<
typename Other >
1702inline Subvector<VT,
unaligned,TF,
true,CSAs...>&
1703 Subvector<VT,unaligned,TF,true,CSAs...>::scale(
const Other& scalar )
1705 const size_t iend( offset() +
size() );
1706 for(
size_t i=offset(); i<iend; ++i )
1707 vector_[i] *= scalar;
1733template<
typename VT
1736template<
typename Other >
1737inline bool Subvector<VT,unaligned,TF,true,CSAs...>::canAlias(
const Other* alias )
const noexcept
1739 return vector_.isAliased( &unview( *alias ) );
1756template<
typename VT
1759template<
typename VT2
1764 Subvector<VT,unaligned,TF,true,CSAs...>::canAlias(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
1766 return ( vector_.isAliased( &alias->vector_ ) &&
1767 ( offset() +
size() > alias->offset() ) &&
1768 ( offset() < alias->offset() + alias->size() ) );
1785template<
typename VT
1788template<
typename Other >
1789inline bool Subvector<VT,unaligned,TF,true,CSAs...>::isAliased(
const Other* alias )
const noexcept
1791 return vector_.isAliased( &unview( *alias ) );
1808template<
typename VT
1811template<
typename VT2
1816 Subvector<VT,unaligned,TF,true,CSAs...>::isAliased(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
1818 return ( vector_.isAliased( &alias->vector_ ) &&
1819 ( offset() +
size() > alias->offset() ) &&
1820 ( offset() < alias->offset() + alias->size() ) );
1836template<
typename VT
1839inline bool Subvector<VT,unaligned,TF,true,CSAs...>::isAligned() const noexcept
1858template<
typename VT
1861inline bool Subvector<VT,unaligned,TF,true,CSAs...>::canSMPAssign() const noexcept
1863 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1883template<
typename VT
1887 Subvector<VT,unaligned,TF,true,CSAs...>::load(
size_t index )
const noexcept
1890 return loada( index );
1892 return loadu( index );
1912template<
typename VT
1916 Subvector<VT,unaligned,TF,true,CSAs...>::loada(
size_t index )
const noexcept
1924 return vector_.loada( offset()+index );
1944template<
typename VT
1948 Subvector<VT,unaligned,TF,true,CSAs...>::loadu(
size_t index )
const noexcept
1955 return vector_.loadu( offset()+index );
1976template<
typename VT
1980 Subvector<VT,unaligned,TF,true,CSAs...>::store(
size_t index,
const SIMDType& value )
noexcept
2006template<
typename VT
2010 Subvector<VT,unaligned,TF,true,CSAs...>::storea(
size_t index,
const SIMDType& value )
noexcept
2018 vector_.storea( offset()+index, value );
2039template<
typename VT
2043 Subvector<VT,unaligned,TF,true,CSAs...>::storeu(
size_t index,
const SIMDType& value )
noexcept
2050 vector_.storeu( offset()+index, value );
2071template<
typename VT
2075 Subvector<VT,unaligned,TF,true,CSAs...>::stream(
size_t index,
const SIMDType& value )
noexcept
2084 vector_.stream( offset()+index, value );
2086 vector_.storeu( offset()+index, value );
2104template<
typename VT
2107template<
typename VT2 >
2108inline auto Subvector<VT,unaligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
2116 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2117 vector_[offset()+i ] = (*rhs)[i ];
2118 vector_[offset()+i+1UL] = (*rhs)[i+1UL];
2120 if( ipos <
size() ) {
2121 vector_[offset()+ipos] = (*rhs)[ipos];
2140template<
typename VT
2143template<
typename VT2 >
2144inline auto Subvector<VT,unaligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
2155 Iterator left(
begin() );
2158 if( useStreaming && isAligned_ &&
2159 (
size() > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) ) &&
2160 !(*rhs).isAliased(
this ) )
2162 for( ; i<ipos; i+=SIMDSIZE ) {
2163 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2165 for( ; i<
size(); ++i ) {
2171 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2172 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2173 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2174 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2175 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2177 for( ; i<ipos; i+=SIMDSIZE ) {
2178 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2180 for( ; i<
size(); ++i ) {
2181 *left = *right; ++left; ++right;
2201template<
typename VT
2204template<
typename VT2 >
2210 vector_[offset()+element->index()] = element->value();
2228template<
typename VT
2231template<
typename VT2 >
2232inline auto Subvector<VT,unaligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
2240 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2241 vector_[offset()+i ] += (*rhs)[i ];
2242 vector_[offset()+i+1UL] += (*rhs)[i+1UL];
2244 if( ipos <
size() ) {
2245 vector_[offset()+ipos] += (*rhs)[ipos];
2264template<
typename VT
2267template<
typename VT2 >
2268inline auto Subvector<VT,unaligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
2279 Iterator left(
begin() );
2282 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2283 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2284 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2285 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2286 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2288 for( ; i<ipos; i+=SIMDSIZE ) {
2289 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2291 for( ; i<
size(); ++i ) {
2292 *left += *right; ++left; ++right;
2311template<
typename VT
2314template<
typename VT2 >
2315inline void Subvector<VT,unaligned,TF,true,CSAs...>::addAssign(
const SparseVector<VT2,TF>& rhs )
2320 vector_[offset()+element->index()] += element->value();
2338template<
typename VT
2341template<
typename VT2 >
2342inline auto Subvector<VT,unaligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
2350 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2351 vector_[offset()+i ] -= (*rhs)[i ];
2352 vector_[offset()+i+1UL] -= (*rhs)[i+1UL];
2354 if( ipos <
size() ) {
2355 vector_[offset()+ipos] -= (*rhs)[ipos];
2374template<
typename VT
2377template<
typename VT2 >
2378inline auto Subvector<VT,unaligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
2389 Iterator left(
begin() );
2392 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2393 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
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;
2398 for( ; i<ipos; i+=SIMDSIZE ) {
2399 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2401 for( ; i<
size(); ++i ) {
2402 *left -= *right; ++left; ++right;
2421template<
typename VT
2424template<
typename VT2 >
2425inline void Subvector<VT,unaligned,TF,true,CSAs...>::subAssign(
const SparseVector<VT2,TF>& rhs )
2430 vector_[offset()+element->index()] -= element->value();
2448template<
typename VT
2451template<
typename VT2 >
2452inline auto Subvector<VT,unaligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
2460 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2461 vector_[offset()+i ] *= (*rhs)[i ];
2462 vector_[offset()+i+1UL] *= (*rhs)[i+1UL];
2464 if( ipos <
size() ) {
2465 vector_[offset()+ipos] *= (*rhs)[ipos];
2484template<
typename VT
2487template<
typename VT2 >
2488inline auto Subvector<VT,unaligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
2499 Iterator left(
begin() );
2502 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
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;
2506 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2508 for( ; i<ipos; i+=SIMDSIZE ) {
2509 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2511 for( ; i<
size(); ++i ) {
2512 *left *= *right; ++left; ++right;
2531template<
typename VT
2534template<
typename VT2 >
2535inline void Subvector<VT,unaligned,TF,true,CSAs...>::multAssign(
const SparseVector<VT2,TF>& rhs )
2544 const size_t index( element->index() );
2545 for( ; i<index; ++i )
2546 reset( vector_[offset()+i] );
2547 vector_[offset()+i] *= element->value();
2551 for( ; i<
size(); ++i ) {
2552 reset( vector_[offset()+i] );
2571template<
typename VT
2574template<
typename VT2 >
2575inline auto Subvector<VT,unaligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
2583 for(
size_t i=0UL; i<ipos; i+=2UL ) {
2584 vector_[offset()+i ] /= (*rhs)[i ];
2585 vector_[offset()+i+1UL] /= (*rhs)[i+1UL];
2587 if( ipos <
size() ) {
2588 vector_[offset()+ipos] /= (*rhs)[ipos];
2607template<
typename VT
2610template<
typename VT2 >
2611inline auto Subvector<VT,unaligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
2622 Iterator left(
begin() );
2625 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
2626 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2627 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2628 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2629 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2631 for( ; i<ipos; i+=SIMDSIZE ) {
2632 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2634 for( ; i<
size(); ++i ) {
2635 *left /= *right; ++left; ++right;
2662template<
typename VT
2665class Subvector<VT,
aligned,TF,true,CSAs...>
2666 :
public View< DenseVector< Subvector<VT,aligned,TF,true,CSAs...>, TF > >
2671 using DataType = SubvectorData<CSAs...>;
2672 using Operand = If_t< IsExpression_v<VT>, VT, VT& >;
2678 using This = Subvector<VT,
aligned,TF,
true,CSAs...>;
2680 using BaseType = View< DenseVector<This,TF> >;
2681 using ViewedType = VT;
2683 using TransposeType = TransposeType_t<ResultType>;
2684 using ElementType = ElementType_t<VT>;
2685 using SIMDType = SIMDTrait_t<ElementType>;
2686 using ReturnType = ReturnType_t<VT>;
2687 using CompositeType =
const Subvector&;
2690 using ConstReference = ConstReference_t<VT>;
2693 using Reference = If_t< IsConst_v<VT>, ConstReference, Reference_t<VT> >;
2696 using ConstPointer = ConstPointer_t<VT>;
2699 using Pointer = If_t< IsConst_v<VT> || !HasMutableDataAccess_v<VT>, ConstPointer, Pointer_t<VT> >;
2702 using ConstIterator = ConstIterator_t<VT>;
2705 using Iterator = If_t< IsConst_v<VT>, ConstIterator, Iterator_t<VT> >;
2710 static constexpr bool simdEnabled = VT::simdEnabled;
2713 static constexpr bool smpAssignable = VT::smpAssignable;
2716 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2722 template<
typename... RSAs >
2723 explicit inline Subvector( VT& vector, RSAs... args );
2725 Subvector(
const Subvector& ) =
default;
2732 ~Subvector() =
default;
2739 inline Reference operator[](
size_t index );
2740 inline ConstReference operator[](
size_t index )
const;
2741 inline Reference at(
size_t index );
2742 inline ConstReference at(
size_t index )
const;
2743 inline Pointer
data () noexcept;
2744 inline ConstPointer data () const noexcept;
2745 inline Iterator begin ();
2746 inline ConstIterator begin () const;
2747 inline ConstIterator cbegin() const;
2748 inline Iterator end ();
2749 inline ConstIterator end () const;
2750 inline ConstIterator cend () const;
2757 inline Subvector& operator= ( const ElementType& rhs );
2758 inline Subvector& operator= ( initializer_list<ElementType> list );
2759 inline Subvector& operator= ( const Subvector& rhs );
2760 template< typename VT2 > inline Subvector& operator= ( const Vector<VT2,TF>& rhs );
2761 template< typename VT2 > inline Subvector& operator+=( const Vector<VT2,TF>& rhs );
2762 template< typename VT2 > inline Subvector& operator-=( const Vector<VT2,TF>& rhs );
2763 template< typename VT2 > inline Subvector& operator*=( const Vector<VT2,TF>& rhs );
2764 template< typename VT2 > inline Subvector& operator/=( const DenseVector<VT2,TF>& rhs );
2765 template< typename VT2 > inline Subvector& operator%=( const Vector<VT2,TF>& rhs );
2772 using DataType::offset;
2773 using DataType::size;
2775 inline VT& operand() noexcept;
2776 inline const VT& operand() const noexcept;
2778 inline
size_t spacing() const noexcept;
2779 inline
size_t capacity() const noexcept;
2780 inline
size_t nonZeros() const;
2781 inline
void reset();
2788 template< typename Other > inline Subvector& scale( const Other& scalar );
2795 template< typename VT2 >
2796 static constexpr
bool VectorizedAssign_v =
2797 ( useOptimizedKernels &&
2798 simdEnabled && VT2::simdEnabled &&
2799 IsSIMDCombinable_v< ElementType, ElementType_t<VT2> > );
2804 template< typename VT2 >
2805 static constexpr
bool VectorizedAddAssign_v =
2806 ( VectorizedAssign_v<VT2> &&
2807 HasSIMDAdd_v< ElementType, ElementType_t<VT2> > );
2812 template< typename VT2 >
2813 static constexpr
bool VectorizedSubAssign_v =
2814 ( VectorizedAssign_v<VT2> &&
2815 HasSIMDSub_v< ElementType, ElementType_t<VT2> > );
2820 template< typename VT2 >
2821 static constexpr
bool VectorizedMultAssign_v =
2822 ( VectorizedAssign_v<VT2> &&
2823 HasSIMDMult_v< ElementType, ElementType_t<VT2> > );
2828 template< typename VT2 >
2829 static constexpr
bool VectorizedDivAssign_v =
2830 ( VectorizedAssign_v<VT2> &&
2831 HasSIMDDiv_v< ElementType, ElementType_t<VT2> > );
2836 static constexpr
size_t SIMDSIZE = SIMDTrait<ElementType>::size;
2843 template< typename Other >
2844 inline
bool canAlias( const Other* alias ) const noexcept;
2846 template< typename VT2, AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
2847 inline
bool canAlias( const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias ) const noexcept;
2849 template< typename Other >
2850 inline
bool isAliased( const Other* alias ) const noexcept;
2852 template< typename VT2, AlignmentFlag AF2,
bool TF2,
size_t... CSAs2 >
2853 inline
bool isAliased( const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias ) const noexcept;
2855 inline
bool isAligned () const noexcept;
2856 inline
bool canSMPAssign() const noexcept;
2867 template< typename VT2 >
2868 inline auto assign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedAssign_v<VT2> >;
2870 template< typename VT2 >
2871 inline auto assign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedAssign_v<VT2> >;
2873 template< typename VT2 > inline
void assign( const SparseVector<VT2,TF>& rhs );
2875 template< typename VT2 >
2876 inline auto addAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<VT2> >;
2878 template< typename VT2 >
2879 inline auto addAssign ( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<VT2> >;
2881 template< typename VT2 > inline
void addAssign( const SparseVector<VT2,TF>& rhs );
2883 template< typename VT2 >
2884 inline auto subAssign ( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<VT2> >;
2886 template< typename VT2 >
2887 inline auto subAssign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<VT2> >;
2889 template< typename VT2 > inline
void subAssign( const SparseVector<VT2,TF>& rhs );
2891 template< typename VT2 >
2892 inline auto multAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedMultAssign_v<VT2> >;
2894 template< typename VT2 >
2895 inline auto multAssign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedMultAssign_v<VT2> >;
2897 template< typename VT2 > inline
void multAssign( const SparseVector<VT2,TF>& rhs );
2899 template< typename VT2 >
2900 inline auto divAssign( const DenseVector <VT2,TF>& rhs ) -> DisableIf_t< VectorizedDivAssign_v<VT2> >;
2902 template< typename VT2 >
2903 inline auto divAssign( const DenseVector <VT2,TF>& rhs ) -> EnableIf_t< VectorizedDivAssign_v<VT2> >;
2916 template< typename VT2, AlignmentFlag AF2,
bool TF2,
bool DF2,
size_t... CSAs2 > friend class Subvector;
2953template< typename VT
2956template< typename... RSAs >
2957inline Subvector<VT,aligned,TF,true,CSAs...>::Subvector( VT& vector, RSAs... args )
2958 : DataType( args... )
2959 , vector_ ( vector )
2963 if( offset() + size() > vector.size() ) {
2964 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid subvector specification" );
2996template<
typename VT
2999inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::Reference
3000 Subvector<VT,aligned,TF,true,CSAs...>::operator[](
size_t index )
3003 return vector_[offset()+index];
3016template<
typename VT
3019inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstReference
3020 Subvector<VT,aligned,TF,true,CSAs...>::operator[](
size_t index )
const
3023 return const_cast<const VT&
>( vector_ )[offset()+index];
3040template<
typename VT
3043inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::Reference
3044 Subvector<VT,aligned,TF,true,CSAs...>::at(
size_t index )
3046 if( index >=
size() ) {
3049 return (*
this)[index];
3066template<
typename VT
3069inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstReference
3070 Subvector<VT,aligned,TF,true,CSAs...>::at(
size_t index )
const
3072 if( index >=
size() ) {
3075 return (*
this)[index];
3089template<
typename VT
3092inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::Pointer
3093 Subvector<VT,aligned,TF,true,CSAs...>::data() noexcept
3095 return vector_.data() + offset();
3109template<
typename VT
3112inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstPointer
3113 Subvector<VT,aligned,TF,true,CSAs...>::data() const noexcept
3115 return vector_.data() + offset();
3129template<
typename VT
3132inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::Iterator
3133 Subvector<VT,aligned,TF,true,CSAs...>::begin()
3135 return ( vector_.begin() + offset() );
3149template<
typename VT
3152inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstIterator
3153 Subvector<VT,aligned,TF,true,CSAs...>::begin()
const
3155 return ( vector_.cbegin() + offset() );
3169template<
typename VT
3172inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstIterator
3173 Subvector<VT,aligned,TF,true,CSAs...>::cbegin()
const
3175 return ( vector_.cbegin() + offset() );
3189template<
typename VT
3192inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::Iterator
3193 Subvector<VT,aligned,TF,true,CSAs...>::end()
3195 return ( vector_.begin() + offset() +
size() );
3209template<
typename VT
3212inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstIterator
3213 Subvector<VT,aligned,TF,true,CSAs...>::end()
const
3215 return ( vector_.cbegin() + offset() +
size() );
3229template<
typename VT
3232inline typename Subvector<VT,
aligned,TF,
true,CSAs...>::ConstIterator
3233 Subvector<VT,aligned,TF,true,CSAs...>::cend()
const
3235 return ( vector_.cbegin() + offset() +
size() );
3256template<
typename VT
3259inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3260 Subvector<VT,aligned,TF,true,CSAs...>::operator=(
const ElementType& rhs )
3262 const size_t iend( offset() +
size() );
3263 decltype(
auto) left( derestrict( vector_ ) );
3265 for(
size_t i=offset(); i<iend; ++i ) {
3289template<
typename VT
3292inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3293 Subvector<VT,aligned,TF,true,CSAs...>::operator=( initializer_list<ElementType> list )
3295 if( list.size() >
size() ) {
3301 if( !tryAssign( vector_, tmp, offset() ) ) {
3306 decltype(
auto) left( derestrict( *
this ) );
3308 std::fill( std::copy( list.begin(), list.end(),
begin() ),
end(), ElementType() );
3330template<
typename VT
3333inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3334 Subvector<VT,aligned,TF,true,CSAs...>::operator=(
const Subvector& rhs )
3339 if( &rhs ==
this || ( &vector_ == &rhs.vector_ && offset() == rhs.offset() ) )
3342 if(
size() != rhs.size() ) {
3346 if( !tryAssign( vector_, rhs, offset() ) ) {
3350 decltype(
auto) left( derestrict( *
this ) );
3352 if( rhs.canAlias(
this ) ) {
3353 const ResultType tmp( *rhs );
3380template<
typename VT
3383template<
typename VT2 >
3384inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3385 Subvector<VT,aligned,TF,true,CSAs...>::operator=(
const Vector<VT2,TF>& rhs )
3390 if(
size() != (*rhs).size() ) {
3395 Right right( *rhs );
3397 if( !tryAssign( vector_, right, offset() ) ) {
3401 decltype(
auto) left( derestrict( *
this ) );
3433template<
typename VT
3436template<
typename VT2 >
3437inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3438 Subvector<VT,aligned,TF,true,CSAs...>::operator+=(
const Vector<VT2,TF>& rhs )
3443 if(
size() != (*rhs).size() ) {
3448 Right right( *rhs );
3450 if( !tryAddAssign( vector_, right, offset() ) ) {
3454 decltype(
auto) left( derestrict( *
this ) );
3484template<
typename VT
3487template<
typename VT2 >
3488inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3489 Subvector<VT,aligned,TF,true,CSAs...>::operator-=(
const Vector<VT2,TF>& rhs )
3494 if(
size() != (*rhs).size() ) {
3499 Right right( *rhs );
3501 if( !trySubAssign( vector_, right, offset() ) ) {
3505 decltype(
auto) left( derestrict( *
this ) );
3536template<
typename VT
3539template<
typename VT2 >
3540inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3541 Subvector<VT,aligned,TF,true,CSAs...>::operator*=(
const Vector<VT2,TF>& rhs )
3546 if(
size() != (*rhs).size() ) {
3551 Right right( *rhs );
3553 if( !tryMultAssign( vector_, right, offset() ) ) {
3557 decltype(
auto) left( derestrict( *
this ) );
3587template<
typename VT
3590template<
typename VT2 >
3591inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3597 if(
size() != (*rhs).size() ) {
3602 Right right( *rhs );
3604 if( !tryDivAssign( vector_, right, offset() ) ) {
3608 decltype(
auto) left( derestrict( *
this ) );
3639template<
typename VT
3642template<
typename VT2 >
3643inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3644 Subvector<VT,aligned,TF,true,CSAs...>::operator%=(
const Vector<VT2,TF>& rhs )
3646 using blaze::assign;
3657 if(
size() != 3UL || (*rhs).size() != 3UL ) {
3661 const CrossType tmp( *
this % (*rhs) );
3663 if( !tryAssign( vector_, tmp, offset() ) ) {
3667 decltype(
auto) left( derestrict( *
this ) );
3669 assign( left, tmp );
3693template<
typename VT
3696inline VT& Subvector<VT,aligned,TF,true,CSAs...>::operand() noexcept
3710template<
typename VT
3713inline const VT& Subvector<VT,aligned,TF,true,CSAs...>::operand() const noexcept
3730template<
typename VT
3733inline size_t Subvector<VT,aligned,TF,true,CSAs...>::spacing() const noexcept
3735 return vector_.spacing() - offset();
3747template<
typename VT
3750inline size_t Subvector<VT,aligned,TF,true,CSAs...>::capacity() const noexcept
3752 return vector_.capacity() - offset();
3767template<
typename VT
3770inline size_t Subvector<VT,aligned,TF,true,CSAs...>::nonZeros()
const
3772 size_t nonzeros( 0 );
3774 const size_t iend( offset() +
size() );
3775 for(
size_t i=offset(); i<iend; ++i ) {
3792template<
typename VT
3795inline void Subvector<VT,aligned,TF,true,CSAs...>::reset()
3799 const size_t iend( offset() +
size() );
3800 for(
size_t i=offset(); i<iend; ++i )
3801 clear( vector_[i] );
3826template<
typename VT
3829template<
typename Other >
3830inline Subvector<VT,
aligned,TF,
true,CSAs...>&
3831 Subvector<VT,aligned,TF,true,CSAs...>::scale(
const Other& scalar )
3833 const size_t iend( offset() +
size() );
3834 for(
size_t i=offset(); i<iend; ++i )
3835 vector_[i] *= scalar;
3861template<
typename VT
3864template<
typename Other >
3865inline bool Subvector<VT,aligned,TF,true,CSAs...>::canAlias(
const Other* alias )
const noexcept
3867 return vector_.isAliased( &unview( *alias ) );
3884template<
typename VT
3887template<
typename VT2
3892 Subvector<VT,aligned,TF,true,CSAs...>::canAlias(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
3894 return ( vector_.isAliased( &alias->vector_ ) &&
3895 ( offset() +
size() > alias->offset() ) &&
3896 ( offset() < alias->offset() + alias->size() ) );
3913template<
typename VT
3916template<
typename Other >
3917inline bool Subvector<VT,aligned,TF,true,CSAs...>::isAliased(
const Other* alias )
const noexcept
3919 return vector_.isAliased( &unview( *alias ) );
3936template<
typename VT
3939template<
typename VT2
3944 Subvector<VT,aligned,TF,true,CSAs...>::isAliased(
const Subvector<VT2,AF2,TF2,true,CSAs2...>* alias )
const noexcept
3946 return ( vector_.isAliased( &alias->vector_ ) &&
3947 ( offset() +
size() > alias->offset() ) &&
3948 ( offset() < alias->offset() + alias->size() ) );
3964template<
typename VT
3967inline bool Subvector<VT,aligned,TF,true,CSAs...>::isAligned() const noexcept
3986template<
typename VT
3989inline bool Subvector<VT,aligned,TF,true,CSAs...>::canSMPAssign() const noexcept
3991 return (
size() > SMP_DVECASSIGN_THRESHOLD );
4011template<
typename VT
4015 Subvector<VT,aligned,TF,true,CSAs...>::load(
size_t index )
const noexcept
4017 return loada( index );
4037template<
typename VT
4041 Subvector<VT,aligned,TF,true,CSAs...>::loada(
size_t index )
const noexcept
4049 return vector_.loada( offset()+index );
4069template<
typename VT
4073 Subvector<VT,aligned,TF,true,CSAs...>::loadu(
size_t index )
const noexcept
4080 return vector_.loadu( offset()+index );
4101template<
typename VT
4105 Subvector<VT,aligned,TF,true,CSAs...>::store(
size_t index,
const SIMDType& value )
noexcept
4128template<
typename VT
4132 Subvector<VT,aligned,TF,true,CSAs...>::storea(
size_t index,
const SIMDType& value )
noexcept
4140 vector_.storea( offset()+index, value );
4161template<
typename VT
4165 Subvector<VT,aligned,TF,true,CSAs...>::storeu(
size_t index,
const SIMDType& value )
noexcept
4172 vector_.storeu( offset()+index, value );
4193template<
typename VT
4197 Subvector<VT,aligned,TF,true,CSAs...>::stream(
size_t index,
const SIMDType& value )
noexcept
4205 vector_.stream( offset()+index, value );
4223template<
typename VT
4226template<
typename VT2 >
4227inline auto Subvector<VT,aligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
4235 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4236 vector_[offset()+i ] = (*rhs)[i ];
4237 vector_[offset()+i+1UL] = (*rhs)[i+1UL];
4239 if( ipos <
size() ) {
4240 vector_[offset()+ipos] = (*rhs)[ipos];
4259template<
typename VT
4262template<
typename VT2 >
4263inline auto Subvector<VT,aligned,TF,true,CSAs...>::assign(
const DenseVector<VT2,TF>& rhs )
4274 Iterator left(
begin() );
4277 if( useStreaming &&
size() > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(*rhs).isAliased(
this ) )
4279 for( ; i<ipos; i+=SIMDSIZE ) {
4280 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4282 for( ; i<
size(); ++i ) {
4283 *left = *right; ++left; ++right;
4288 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4289 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4290 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4291 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4292 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4294 for( ; i<ipos; i+=SIMDSIZE ) {
4295 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4297 for( ; i<
size(); ++i ) {
4298 *left = *right; ++left; ++right;
4318template<
typename VT
4321template<
typename VT2 >
4327 vector_[offset()+element->index()] = element->value();
4345template<
typename VT
4348template<
typename VT2 >
4349inline auto Subvector<VT,aligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
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];
4381template<
typename VT
4384template<
typename VT2 >
4385inline auto Subvector<VT,aligned,TF,true,CSAs...>::addAssign(
const DenseVector<VT2,TF>& rhs )
4396 Iterator left(
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;
4428template<
typename VT
4431template<
typename VT2 >
4437 vector_[offset()+element->index()] += element->value();
4455template<
typename VT
4458template<
typename VT2 >
4459inline auto Subvector<VT,aligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
4467 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4468 vector_[offset()+i ] -= (*rhs)[i ];
4469 vector_[offset()+i+1UL] -= (*rhs)[i+1UL];
4471 if( ipos <
size() ) {
4472 vector_[offset()+ipos] -= (*rhs)[ipos];
4491template<
typename VT
4494template<
typename VT2 >
4495inline auto Subvector<VT,aligned,TF,true,CSAs...>::subAssign(
const DenseVector<VT2,TF>& rhs )
4506 Iterator left(
begin() );
4509 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4510 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4511 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4512 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4513 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4515 for( ; i<ipos; i+=SIMDSIZE ) {
4516 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4518 for( ; i<
size(); ++i ) {
4519 *left -= *right; ++left; ++right;
4538template<
typename VT
4541template<
typename VT2 >
4547 vector_[offset()+element->index()] -= element->value();
4565template<
typename VT
4568template<
typename VT2 >
4569inline auto Subvector<VT,aligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
4577 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4578 vector_[offset()+i ] *= (*rhs)[i ];
4579 vector_[offset()+i+1UL] *= (*rhs)[i+1UL];
4581 if( ipos <
size() ) {
4582 vector_[offset()+ipos] *= (*rhs)[ipos];
4601template<
typename VT
4604template<
typename VT2 >
4605inline auto Subvector<VT,aligned,TF,true,CSAs...>::multAssign(
const DenseVector<VT2,TF>& rhs )
4616 Iterator left(
begin() );
4619 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4620 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4621 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4622 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4623 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4625 for( ; i<ipos; i+=SIMDSIZE ) {
4626 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4628 for( ; i<
size(); ++i ) {
4629 *left *= *right; ++left; ++right;
4648template<
typename VT
4651template<
typename VT2 >
4652inline void Subvector<VT,aligned,TF,true,CSAs...>::multAssign(
const SparseVector<VT2,TF>& rhs )
4661 const size_t index( element->index() );
4662 for( ; i<index; ++i )
4663 reset( vector_[offset()+i] );
4664 vector_[offset()+i] *= element->value();
4668 for( ; i<
size(); ++i ) {
4669 reset( vector_[offset()+i] );
4688template<
typename VT
4691template<
typename VT2 >
4692inline auto Subvector<VT,aligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
4700 for(
size_t i=0UL; i<ipos; i+=2UL ) {
4701 vector_[offset()+i ] /= (*rhs)[i ];
4702 vector_[offset()+i+1UL] /= (*rhs)[i+1UL];
4704 if( ipos <
size() ) {
4705 vector_[offset()+ipos] /= (*rhs)[ipos];
4724template<
typename VT
4727template<
typename VT2 >
4728inline auto Subvector<VT,aligned,TF,true,CSAs...>::divAssign(
const DenseVector<VT2,TF>& rhs )
4739 Iterator left(
begin() );
4742 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
4743 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4744 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4745 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4746 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4748 for( ; i<ipos; i+=SIMDSIZE ) {
4749 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
4751 for( ; i<
size(); ++i ) {
4752 *left /= *right; ++left; ++right;
4779template<
typename VT1
4784 :
public View< DenseVector< Subvector< DVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
4789 using CPE = DVecDVecCrossExpr<VT1,VT2,TF>;
4790 using RT = ResultType_t<CPE>;
4791 using DataType = SubvectorData<CSAs...>;
4797 using This = Subvector<CPE,
unaligned,TF,
true,CSAs...>;
4799 using BaseType = View< DenseVector<This,TF> >;
4800 using ViewedType = CPE;
4802 using TransposeType = TransposeType_t<ResultType>;
4803 using ElementType = ElementType_t<CPE>;
4804 using ReturnType = ReturnType_t<CPE>;
4805 using CompositeType =
const ResultType;
4810 static constexpr bool simdEnabled =
false;
4813 static constexpr bool smpAssignable =
false;
4816 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4826 template<
typename... RSAs >
4827 explicit inline Subvector(
const CPE& vector, RSAs... args )
4828 : DataType( args... )
4829 , vector_ ( vector )
4832 if( offset() + size() > vector.size() ) {
4833 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid subvector specification" );
4848 inline ReturnType operator[](
size_t index )
const {
4850 return vector_[offset()+index];
4861 inline ReturnType at(
size_t index )
const {
4862 if( index >=
size() ) {
4865 return (*
this)[index];
4870 using DataType::offset;
4871 using DataType::size;
4879 inline CPE operand() const noexcept {
4890 template<
typename T >
4891 inline bool canAlias(
const T* alias )
const noexcept {
4892 return vector_.canAlias( &unview( *alias ) );
4902 template<
typename T >
4903 inline bool isAliased(
const T* alias )
const noexcept {
4904 return vector_.isAliased( &unview( *alias ) );
4937template<
typename VT1
4941class Subvector< DVecSVecCrossExpr<VT1,VT2,TF>,
unaligned, TF, true, CSAs... >
4942 :
public View< DenseVector< Subvector< DVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
4943 ,
private SubvectorData<CSAs...>
4947 using CPE = DVecSVecCrossExpr<VT1,VT2,TF>;
4948 using RT = ResultType_t<CPE>;
4949 using DataType = SubvectorData<CSAs...>;
4955 using This = Subvector<CPE,
unaligned,TF,
true,CSAs...>;
4957 using BaseType = View< DenseVector<This,TF> >;
4958 using ViewedType = CPE;
4960 using TransposeType = TransposeType_t<ResultType>;
4961 using ElementType = ElementType_t<CPE>;
4962 using ReturnType = ReturnType_t<CPE>;
4963 using CompositeType =
const ResultType;
4968 static constexpr bool simdEnabled =
false;
4971 static constexpr bool smpAssignable =
false;
4974 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4984 template<
typename... RSAs >
4985 explicit inline Subvector(
const CPE& vector, RSAs... args )
4986 : DataType( args... )
4987 , vector_ ( vector )
4990 if( offset() + size() > vector.size() ) {
4991 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid subvector specification" );
5006 inline ReturnType operator[](
size_t index )
const {
5008 return vector_[offset()+index];
5019 inline ReturnType at(
size_t index )
const {
5020 if( index >=
size() ) {
5023 return (*
this)[index];
5028 using DataType::offset;
5029 using DataType::size;
5037 inline CPE operand() const noexcept {
5048 template<
typename T >
5049 inline bool canAlias(
const T* alias )
const noexcept {
5050 return vector_.canAlias( &unview( *alias ) );
5060 template<
typename T >
5061 inline bool isAliased(
const T* alias )
const noexcept {
5062 return vector_.isAliased( &unview( *alias ) );
5095template<
typename VT1
5099class Subvector< SVecDVecCrossExpr<VT1,VT2,TF>,
unaligned, TF, true, CSAs... >
5100 :
public View< DenseVector< Subvector< SVecDVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
5101 ,
private SubvectorData<CSAs...>
5105 using CPE = SVecDVecCrossExpr<VT1,VT2,TF>;
5106 using RT = ResultType_t<CPE>;
5107 using DataType = SubvectorData<CSAs...>;
5113 using This = Subvector<CPE,
unaligned,TF,
true,CSAs...>;
5115 using BaseType = View< DenseVector<This,TF> >;
5116 using ViewedType = CPE;
5118 using TransposeType = TransposeType_t<ResultType>;
5119 using ElementType = ElementType_t<CPE>;
5120 using ReturnType = ReturnType_t<CPE>;
5121 using CompositeType =
const ResultType;
5126 static constexpr bool simdEnabled =
false;
5129 static constexpr bool smpAssignable =
false;
5132 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
5142 template<
typename... RSAs >
5143 explicit inline Subvector(
const CPE& vector, RSAs... args )
5144 : DataType( args... )
5145 , vector_ ( vector )
5148 if( offset() + size() > vector.size() ) {
5149 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid subvector specification" );
5164 inline ReturnType operator[](
size_t index )
const {
5166 return vector_[offset()+index];
5177 inline ReturnType at(
size_t index )
const {
5178 if( index >=
size() ) {
5181 return (*
this)[index];
5186 using DataType::offset;
5187 using DataType::size;
5195 inline CPE operand() const noexcept {
5206 template<
typename T >
5207 inline bool canAlias(
const T* alias )
const noexcept {
5208 return vector_.canAlias( &unview( *alias ) );
5218 template<
typename T >
5219 inline bool isAliased(
const T* alias )
const noexcept {
5220 return vector_.isAliased( &unview( *alias ) );
5253template<
typename VT1
5257class Subvector< SVecSVecCrossExpr<VT1,VT2,TF>,
unaligned, TF, true, CSAs... >
5258 :
public View< DenseVector< Subvector< SVecSVecCrossExpr<VT1,VT2,TF>, unaligned, TF, true, CSAs... >, TF > >
5259 ,
private SubvectorData<CSAs...>
5263 using CPE = SVecSVecCrossExpr<VT1,VT2,TF>;
5264 using RT = ResultType_t<CPE>;
5265 using DataType = SubvectorData<CSAs...>;
5271 using This = Subvector<CPE,
unaligned,TF,
true,CSAs...>;
5273 using BaseType = View< DenseVector<This,TF> >;
5274 using ViewedType = CPE;
5276 using TransposeType = TransposeType_t<ResultType>;
5277 using ElementType = ElementType_t<CPE>;
5278 using ReturnType = ReturnType_t<CPE>;
5279 using CompositeType =
const ResultType;
5284 static constexpr bool simdEnabled =
false;
5287 static constexpr bool smpAssignable =
false;
5290 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
5300 template<
typename... RSAs >
5301 explicit inline Subvector(
const CPE& vector, RSAs... args )
5302 : DataType( args... )
5303 , vector_ ( vector )
5306 if( offset() + size() > vector.size() ) {
5307 BLAZE_THROW_INVALID_ARGUMENT(
"Invalid subvector specification" );
5322 inline ReturnType operator[](
size_t index )
const {
5324 return vector_[offset()+index];
5335 inline ReturnType at(
size_t index )
const {
5336 if( index >=
size() ) {
5339 return (*
this)[index];
5344 using DataType::offset;
5345 using DataType::size;
5353 inline CPE operand() const noexcept {
5364 template<
typename T >
5365 inline bool canAlias(
const T* alias )
const noexcept {
5366 return vector_.canAlias( &unview( *alias ) );
5376 template<
typename T >
5377 inline bool isAliased(
const T* alias )
const {
5378 return vector_.isAliased( &unview( *alias ) );
Header file for auxiliary alias declarations.
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.
Definition Aliases.h:130
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition Aliases.h:110
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition Aliases.h:450
Header file for the alignment check function.
Header file for the alignment flag enumeration.
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the cross product trait.
constexpr 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:751
constexpr 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:719
Header file for the EnableIf class template.
Header file for the HasMutableDataAccess type trait.
Header file for the HasSIMDAdd type trait.
Header file for the HasSIMDDiv type trait.
Header file for the HasSIMDMult type trait.
Header file for the HasSIMDSub type trait.
Macro for CUDA compatibility.
Header file for the If class template.
Header file for the IsConst type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsRestricted type trait.
Header file for the IsSIMDCombinable type trait.
Header file for the IsSparseVector type trait.
Deactivation of problematic macros.
Header file for the prevMultiple shim.
Header file for all SIMD functionality.
Header file for the implementation of the SubvectorData class template.
Header file for the subvector trait.
Constraint on the data type.
Expression object for dense vector-dense vector cross products.
Definition DVecDVecCrossExpr.h:90
Base class for N-dimensional dense vectors.
Definition DenseVector.h:77
Dense vector representation of an initializer list.
Definition InitializerVector.h:182
Base class for sparse vectors.
Definition SparseVector.h:72
Auxiliary class template for the data members of the Subvector class.
Definition SubvectorData.h:65
Base class for N-dimensional vectors.
Definition Vector.h:82
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of a vector representation of an initializer list.
Header file for the Computation base class.
Header file for the CrossExpr base class.
Header file for the DenseVector base class.
Header file for the View base class.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.
Definition Vectorizable.h:61
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition DenseMatrix.h:182
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition DenseMatrix.h:386
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:9640
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition DenseMatrix.h:448
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.
Definition TransExpr.h:81
#define BLAZE_CONSTRAINT_MUST_BE_VECTOR_WITH_TRANSPOSE_FLAG(T, TF)
Constraint on the data type.
Definition TransposeFlag.h:63
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBVECTOR_TYPE(T)
Constraint on the data type.
Definition Subvector.h:81
typename CrossTrait< T1, T2 >::Type CrossTrait_t
Auxiliary alias declaration for the CrossTrait class template.
Definition CrossTrait.h:138
typename SubvectorTrait< VT, CSAs... >::Type SubvectorTrait_t
Auxiliary alias declaration for the SubvectorTrait type trait.
Definition SubvectorTrait.h:145
constexpr bool IsSparseVector_v
Auxiliary variable template for the IsSparseVector type trait.
Definition IsSparseVector.h:124
constexpr bool IsRestricted_v
Auxiliary variable template for the IsRestricted type trait.
Definition IsRestricted.h:140
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition PrevMultiple.h:68
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:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition Accuracy.h:253
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition AlignmentFlag.h:63
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:332
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:446
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition Accuracy.h:293
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:408
@ unaligned
Flag for unaligned vectors and matrices.
Definition AlignmentFlag.h:64
@ aligned
Flag for aligned vectors and matrices.
Definition AlignmentFlag.h:65
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition Matrix.h:960
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition Matrix.h:806
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:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition Matrix.h:518
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition Matrix.h:676
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition Assert.h:117
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition Storea.h:78
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition Storeu.h:75
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< 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:74
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition Loadu.h:76
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition Loada.h:79
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition DenseVector.h:221
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition DenseMatrix.h:162
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition DenseMatrix.h:100
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector.
Definition DenseVector.h:192
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition DenseMatrix.h:131
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition HostDevice.h:94
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.
Definition IsReference.h:95
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition AlignmentCheck.h:68
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition If.h:108
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:175
constexpr bool isChecked(const Ts &... args)
Extracting blaze::Check arguments from a given list of arguments.
Definition Check.h:225
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Constraint on the data type.
Header file for all forward declarations for expression class templates.
Header file for the clear shim.
Header file for the reset shim.
Base class for all views.
Definition View.h:67
Header file for the cache size of the target architecture.
System settings for the inline keywords.
System settings for performance optimizations.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for basic type definitions.
Header file for the implementation of the Subvector base template.