35 #ifndef _BLAZE_MATH_VIEWS_ROW_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_ROW_DENSE_H_ 118 template<
typename MT
120 class Row<MT,true,true,SF>
121 :
public DenseVector< Row<MT,true,true,SF>, true >
127 typedef If_< IsExpression<MT>, MT, MT& > Operand;
132 typedef Row<MT,true,true,SF>
This;
133 typedef DenseVector<This,true>
BaseType;
137 typedef SIMDTrait_<ElementType> SIMDType;
148 typedef const ElementType* ConstPointer;
151 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
162 enum :
bool { simdEnabled = MT::simdEnabled };
165 enum :
bool { smpAssignable = MT::smpAssignable };
171 explicit inline Row( Operand matrix,
size_t index );
183 inline Reference operator[](
size_t index );
184 inline ConstReference operator[](
size_t index )
const;
185 inline Reference at(
size_t index );
186 inline ConstReference at(
size_t index )
const;
187 inline Pointer data () noexcept;
188 inline ConstPointer data () const noexcept;
189 inline Iterator
begin ();
190 inline ConstIterator begin () const;
191 inline ConstIterator
cbegin() const;
192 inline Iterator
end ();
193 inline ConstIterator end () const;
194 inline ConstIterator
cend () const;
201 inline Row& operator=( const ElementType& rhs );
202 inline Row& operator=( initializer_list<ElementType> list );
203 inline Row& operator=( const Row& rhs );
205 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
206 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
207 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
208 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
209 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
210 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
212 template< typename Other >
213 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
215 template< typename Other >
216 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
223 inline
size_t size() const noexcept;
224 inline
size_t capacity() const noexcept;
233 template< typename Other > inline Row& scale( const Other& scalar );
240 template< typename VT >
241 struct VectorizedAssign {
243 simdEnabled && VT::simdEnabled &&
244 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
250 template<
typename VT >
251 struct VectorizedAddAssign {
253 simdEnabled && VT::simdEnabled &&
254 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
255 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
261 template<
typename VT >
262 struct VectorizedSubAssign {
264 simdEnabled && VT::simdEnabled &&
265 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
266 HasSIMDSub< ElementType, ElementType_<VT> >::value };
272 template<
typename VT >
273 struct VectorizedMultAssign {
275 simdEnabled && VT::simdEnabled &&
276 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
277 HasSIMDMult< ElementType, ElementType_<VT> >::value };
283 template<
typename VT >
284 struct VectorizedDivAssign {
286 simdEnabled && VT::simdEnabled &&
287 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
288 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
301 template<
typename Other >
302 inline bool canAlias(
const Other* alias )
const noexcept;
304 template<
typename MT2,
bool SO2,
bool SF2 >
305 inline bool canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
307 template<
typename Other >
308 inline bool isAliased(
const Other* alias )
const noexcept;
310 template<
typename MT2,
bool SO2,
bool SF2 >
311 inline bool isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
313 inline bool isAligned () const noexcept;
314 inline
bool canSMPAssign() const noexcept;
325 template< typename VT >
326 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
328 template< typename VT >
329 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
331 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
333 template< typename VT >
334 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
336 template< typename VT >
337 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
339 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
341 template< typename VT >
342 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
344 template< typename VT >
345 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
347 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
349 template< typename VT >
350 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
352 template< typename VT >
353 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
355 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
357 template< typename VT >
358 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
360 template< typename VT >
361 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
375 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
377 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
378 friend
bool isIntact( const Row<MT2,SO2,DF2,SF2>&
row ) noexcept;
380 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
381 friend
bool isSame( const Row<MT2,SO2,DF2,SF2>& a, const Row<MT2,SO2,DF2,SF2>& b ) noexcept;
383 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
384 friend
bool tryAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
386 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
387 friend
bool tryAddAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
389 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
390 friend
bool trySubAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
392 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
393 friend
bool tryMultAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
395 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
396 friend
bool tryDivAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
398 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
431 template< typename MT
433 inline Row<MT,true,true,SF>::Row( Operand matrix,
size_t index )
437 if( matrix_.rows() <= index ) {
463 template<
typename MT
468 return matrix_(row_,index);
484 template<
typename MT
487 Row<MT,true,true,SF>::operator[](
size_t index )
const 490 return const_cast<const MT&
>( matrix_ )(row_,index);
507 template<
typename MT
511 if( index >=
size() ) {
514 return (*
this)[index];
531 template<
typename MT
535 if( index >=
size() ) {
538 return (*
this)[index];
553 template<
typename MT
555 inline typename Row<MT,true,true,SF>::Pointer Row<MT,true,true,SF>::data() noexcept
557 return matrix_.data( row_ );
572 template<
typename MT
574 inline typename Row<MT,true,true,SF>::ConstPointer Row<MT,true,true,SF>::data() const noexcept
576 return matrix_.data( row_ );
590 template<
typename MT
594 return matrix_.begin( row_ );
608 template<
typename MT
612 return matrix_.cbegin( row_ );
626 template<
typename MT
630 return matrix_.cbegin( row_ );
644 template<
typename MT
648 return matrix_.end( row_ );
662 template<
typename MT
666 return matrix_.cend( row_ );
680 template<
typename MT
684 return matrix_.cend( row_ );
709 template<
typename MT
711 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const ElementType& rhs )
713 const size_t jbegin( ( IsUpper<MT>::value )
714 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
718 const size_t jend ( ( IsLower<MT>::value )
719 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
724 for(
size_t j=jbegin; j<jend; ++j )
725 matrix_(row_,j) = rhs;
746 template<
typename MT
748 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=( initializer_list<ElementType> list )
750 if( list.size() >
size() ) {
778 template<
typename MT
780 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const Row& rhs )
782 if( &rhs ==
this )
return *
this;
784 if(
size() != rhs.size() ) {
788 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
792 DerestrictTrait_<This> left( derestrict( *
this ) );
818 template<
typename MT
820 template<
typename VT >
821 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const Vector<VT,true>& rhs )
830 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
833 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
837 DerestrictTrait_<This> left( derestrict( *
this ) );
839 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
840 const ResultType_<VT> tmp( right );
844 if( IsSparseVector<VT>::value )
871 template<
typename MT
873 template<
typename VT >
883 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
886 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
890 DerestrictTrait_<This> left( derestrict( *
this ) );
892 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
893 const ResultType_<VT> tmp( right );
922 template<
typename MT
924 template<
typename VT >
934 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
937 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
941 DerestrictTrait_<This> left( derestrict( *
this ) );
943 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
944 const ResultType_<VT> tmp( right );
972 template<
typename MT
974 template<
typename VT >
984 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
987 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
991 DerestrictTrait_<This> left( derestrict( *
this ) );
993 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
994 const ResultType_<VT> tmp( right );
1022 template<
typename MT
1024 template<
typename VT >
1035 const ResultType right( *
this * (~rhs) );
1037 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
1041 DerestrictTrait_<This> left( derestrict( *
this ) );
1065 template<
typename MT
1067 template<
typename VT >
1077 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
1078 Right right( ~rhs );
1080 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
1084 DerestrictTrait_<This> left( derestrict( *
this ) );
1086 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1087 const ResultType_<VT> tmp( right );
1113 template<
typename MT
1115 template<
typename Other >
1116 inline EnableIf_< IsNumeric<Other>, Row<MT,true,true,SF> >&
1121 return operator=( (*
this) * rhs );
1140 template<
typename MT
1142 template<
typename Other >
1143 inline EnableIf_< IsNumeric<Other>, Row<MT,true,true,SF> >&
1150 return operator=( (*
this) / rhs );
1170 template<
typename MT
1174 return matrix_.columns();
1186 template<
typename MT
1190 return matrix_.capacity( row_ );
1205 template<
typename MT
1209 return matrix_.nonZeros( row_ );
1221 template<
typename MT
1225 matrix_.reset( row_ );
1250 template<
typename MT
1252 template<
typename Other >
1253 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::scale(
const Other& scalar )
1257 const size_t jbegin( ( IsUpper<MT>::value )
1258 ?( ( IsStrictlyUpper<MT>::value )
1262 const size_t jend ( ( IsLower<MT>::value )
1263 ?( ( IsStrictlyLower<MT>::value )
1268 for(
size_t j=jbegin; j<jend; ++j ) {
1269 matrix_(row_,j) *= scalar;
1297 template<
typename MT
1299 template<
typename Other >
1300 inline bool Row<MT,true,true,SF>::canAlias(
const Other* alias )
const noexcept
1302 return matrix_.isAliased( alias );
1319 template<
typename MT
1321 template<
typename MT2
1324 inline bool Row<MT,true,true,SF>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
1326 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1343 template<
typename MT
1345 template<
typename Other >
1346 inline bool Row<MT,true,true,SF>::isAliased(
const Other* alias )
const noexcept
1348 return matrix_.isAliased( alias );
1365 template<
typename MT
1367 template<
typename MT2
1370 inline bool Row<MT,true,true,SF>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
1372 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1388 template<
typename MT
1390 inline bool Row<MT,true,true,SF>::isAligned() const noexcept
1392 return matrix_.isAligned();
1409 template<
typename MT
1411 inline bool Row<MT,true,true,SF>::canSMPAssign() const noexcept
1413 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1432 template<
typename MT
1435 Row<MT,true,true,SF>::load(
size_t index )
const noexcept
1437 return matrix_.load( row_, index );
1456 template<
typename MT
1461 return matrix_.loada( row_, index );
1480 template<
typename MT
1485 return matrix_.loadu( row_, index );
1505 template<
typename MT
1508 Row<MT,true,true,SF>::store(
size_t index,
const SIMDType& value ) noexcept
1510 matrix_.store( row_, index, value );
1530 template<
typename MT
1535 matrix_.storea( row_, index, value );
1555 template<
typename MT
1560 matrix_.storeu( row_, index, value );
1580 template<
typename MT
1585 matrix_.stream( row_, index, value );
1603 template<
typename MT
1605 template<
typename VT >
1606 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1607 Row<MT,true,true,SF>::assign(
const DenseVector<VT,true>& rhs )
1611 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1612 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1613 matrix_(row_,j ) = (~rhs)[j ];
1614 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1616 if( jpos < (~rhs).size() )
1617 matrix_(row_,jpos) = (~rhs)[jpos];
1635 template<
typename MT
1637 template<
typename VT >
1638 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1639 Row<MT,true,true,SF>::assign(
const DenseVector<VT,true>& rhs )
1645 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1649 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1653 Iterator left(
begin() );
1654 ConstIterator_<VT> right( (~rhs).
begin() );
1658 for( ; j<jpos; j+=SIMDSIZE ) {
1659 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1661 for( ; remainder && j<
columns; ++j ) {
1662 *left = *right; ++left; ++right;
1667 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1668 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1669 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1670 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1671 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1673 for( ; j<jpos; j+=SIMDSIZE ) {
1674 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1676 for( ; remainder && j<
columns; ++j ) {
1677 *left = *right; ++left; ++right;
1697 template<
typename MT
1699 template<
typename VT >
1700 inline void Row<MT,true,true,SF>::assign(
const SparseVector<VT,true>& rhs )
1704 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1705 matrix_(row_,element->index()) = element->value();
1723 template<
typename MT
1725 template<
typename VT >
1726 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1727 Row<MT,true,true,SF>::addAssign(
const DenseVector<VT,true>& rhs )
1731 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1732 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1733 matrix_(row_,j ) += (~rhs)[j ];
1734 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1736 if( jpos < (~rhs).size() )
1737 matrix_(row_,jpos) += (~rhs)[jpos];
1755 template<
typename MT
1757 template<
typename VT >
1758 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1759 Row<MT,true,true,SF>::addAssign(
const DenseVector<VT,true>& rhs )
1765 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1769 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1773 Iterator left(
begin() );
1774 ConstIterator_<VT> right( (~rhs).
begin() );
1776 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1777 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1778 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1779 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1780 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1782 for( ; j<jpos; j+=SIMDSIZE ) {
1783 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1785 for( ; remainder && j<
columns; ++j ) {
1786 *left += *right; ++left; ++right;
1805 template<
typename MT
1807 template<
typename VT >
1808 inline void Row<MT,true,true,SF>::addAssign(
const SparseVector<VT,true>& rhs )
1812 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1813 matrix_(row_,element->index()) += element->value();
1831 template<
typename MT
1833 template<
typename VT >
1834 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1835 Row<MT,true,true,SF>::subAssign(
const DenseVector<VT,true>& rhs )
1839 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1840 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1841 matrix_(row_,j ) -= (~rhs)[j ];
1842 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
1844 if( jpos < (~rhs).size() )
1845 matrix_(row_,jpos) -= (~rhs)[jpos];
1863 template<
typename MT
1865 template<
typename VT >
1866 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1867 Row<MT,true,true,SF>::subAssign(
const DenseVector<VT,true>& rhs )
1873 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1877 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1881 Iterator left(
begin() );
1882 ConstIterator_<VT> right( (~rhs).
begin() );
1884 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1885 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1886 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1887 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1888 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1890 for( ; j<jpos; j+=SIMDSIZE ) {
1891 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1893 for( ; remainder && j<
columns; ++j ) {
1894 *left -= *right; ++left; ++right;
1913 template<
typename MT
1915 template<
typename VT >
1916 inline void Row<MT,true,true,SF>::subAssign(
const SparseVector<VT,true>& rhs )
1920 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1921 matrix_(row_,element->index()) -= element->value();
1939 template<
typename MT
1941 template<
typename VT >
1942 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
1943 Row<MT,true,true,SF>::multAssign(
const DenseVector<VT,true>& rhs )
1947 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1948 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1949 matrix_(row_,j ) *= (~rhs)[j ];
1950 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
1952 if( jpos < (~rhs).size() )
1953 matrix_(row_,jpos) *= (~rhs)[jpos];
1971 template<
typename MT
1973 template<
typename VT >
1974 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
1975 Row<MT,true,true,SF>::multAssign(
const DenseVector<VT,true>& rhs )
1981 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1985 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1989 Iterator left(
begin() );
1990 ConstIterator_<VT> right( (~rhs).
begin() );
1992 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1993 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1994 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1995 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1996 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1998 for( ; j<jpos; j+=SIMDSIZE ) {
1999 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2001 for( ; remainder && j<
columns; ++j ) {
2002 *left *= *right; ++left; ++right;
2021 template<
typename MT
2023 template<
typename VT >
2024 inline void Row<MT,true,true,SF>::multAssign(
const SparseVector<VT,true>& rhs )
2028 const ResultType tmp(
serial( *
this ) );
2032 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2033 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
2051 template<
typename MT
2053 template<
typename VT >
2054 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2055 Row<MT,true,true,SF>::divAssign(
const DenseVector<VT,true>& rhs )
2059 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2060 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2061 matrix_(row_,j ) /= (~rhs)[j ];
2062 matrix_(row_,j+1UL) /= (~rhs)[j+1UL];
2064 if( jpos < (~rhs).size() )
2065 matrix_(row_,jpos) /= (~rhs)[jpos];
2083 template<
typename MT
2085 template<
typename VT >
2086 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2087 Row<MT,true,true,SF>::divAssign(
const DenseVector<VT,true>& rhs )
2095 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
2099 Iterator left(
begin() );
2100 ConstIterator_<VT> right( (~rhs).
begin() );
2102 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2103 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2104 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2105 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2106 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2108 for( ; j<jpos; j+=SIMDSIZE ) {
2109 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2112 *left /= *right; ++left; ++right;
2139 template<
typename MT >
2140 class Row<MT,false,true,false>
2141 :
public DenseVector< Row<MT,false,true,false>, true >
2147 typedef If_< IsExpression<MT>, MT, MT& > Operand;
2152 typedef Row<MT,false,true,false>
This;
2153 typedef DenseVector<This,true>
BaseType;
2167 typedef const ElementType* ConstPointer;
2170 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
2176 template<
typename MatrixType >
2182 typedef If_< IsConst<MatrixType>, ConstReference_<MatrixType>, Reference_<MatrixType> >
Reference;
2184 typedef std::random_access_iterator_tag IteratorCategory;
2185 typedef RemoveReference_<Reference> ValueType;
2186 typedef ValueType* PointerType;
2187 typedef Reference ReferenceType;
2188 typedef ptrdiff_t DifferenceType;
2191 typedef IteratorCategory iterator_category;
2192 typedef ValueType value_type;
2193 typedef PointerType pointer;
2194 typedef ReferenceType reference;
2195 typedef DifferenceType difference_type;
2201 inline RowIterator() noexcept
2202 : matrix_(
nullptr )
2215 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2216 : matrix_( &matrix )
2227 template<
typename MatrixType2 >
2228 inline RowIterator(
const RowIterator<MatrixType2>& it ) noexcept
2229 : matrix_( it.matrix_ )
2231 , column_( it.column_ )
2241 inline RowIterator&
operator+=(
size_t inc ) noexcept {
2253 inline RowIterator&
operator-=(
size_t dec ) noexcept {
2264 inline RowIterator& operator++() noexcept {
2275 inline const RowIterator operator++(
int ) noexcept {
2276 const RowIterator tmp( *
this );
2287 inline RowIterator& operator--() noexcept {
2298 inline const RowIterator operator--(
int ) noexcept {
2299 const RowIterator tmp( *
this );
2311 inline ReferenceType operator[](
size_t index )
const {
2312 return (*matrix_)(row_,column_+index);
2321 inline ReferenceType
operator*()
const {
2322 return (*matrix_)(row_,column_);
2331 inline PointerType operator->()
const {
2332 return &(*matrix_)(row_,column_);
2342 template<
typename MatrixType2 >
2343 inline bool operator==(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2344 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2354 template<
typename MatrixType2 >
2355 inline bool operator!=(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2356 return !( *
this == rhs );
2366 template<
typename MatrixType2 >
2367 inline bool operator<( const RowIterator<MatrixType2>& rhs )
const noexcept {
2368 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ < rhs.column_ );
2378 template<
typename MatrixType2 >
2379 inline bool operator>(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2380 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ > rhs.column_ );
2390 template<
typename MatrixType2 >
2391 inline bool operator<=( const RowIterator<MatrixType2>& rhs )
const noexcept {
2392 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
2402 template<
typename MatrixType2 >
2403 inline bool operator>=(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2404 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
2414 inline DifferenceType
operator-(
const RowIterator& rhs )
const noexcept {
2415 return column_ - rhs.column_;
2426 friend inline const RowIterator
operator+(
const RowIterator& it,
size_t inc ) noexcept {
2427 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2438 friend inline const RowIterator
operator+(
size_t inc,
const RowIterator& it ) noexcept {
2439 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2450 friend inline const RowIterator
operator-(
const RowIterator& it,
size_t dec ) noexcept {
2451 return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2457 MatrixType* matrix_;
2463 template<
typename MatrixType2 >
friend class RowIterator;
2478 enum :
bool { simdEnabled =
false };
2481 enum :
bool { smpAssignable = MT::smpAssignable };
2487 explicit inline Row( Operand matrix,
size_t index );
2499 inline Reference operator[](
size_t index );
2500 inline ConstReference operator[](
size_t index )
const;
2501 inline Reference at(
size_t index );
2502 inline ConstReference at(
size_t index )
const;
2503 inline Pointer data () noexcept;
2504 inline ConstPointer data () const noexcept;
2505 inline Iterator
begin ();
2506 inline ConstIterator begin () const;
2507 inline ConstIterator
cbegin() const;
2508 inline Iterator
end ();
2509 inline ConstIterator end () const;
2510 inline ConstIterator
cend () const;
2517 inline Row& operator=( const ElementType& rhs );
2518 inline Row& operator=( initializer_list<ElementType> list );
2519 inline Row& operator=( const Row& rhs );
2521 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2522 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2523 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2524 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
2525 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
2526 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2528 template< typename Other >
2529 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
2531 template< typename Other >
2532 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
2539 inline
size_t size() const noexcept;
2540 inline
size_t capacity() const noexcept;
2542 inline
void reset();
2549 template< typename Other > inline Row& scale( const Other& scalar );
2557 template< typename Other >
2558 inline
bool canAlias( const Other* alias ) const noexcept;
2560 template< typename MT2,
bool SO2,
bool SF2 >
2561 inline
bool canAlias( const Row<MT2,SO2,true,SF2>* alias ) const noexcept;
2563 template< typename Other >
2564 inline
bool isAliased( const Other* alias ) const noexcept;
2566 template< typename MT2,
bool SO2,
bool SF2 >
2567 inline
bool isAliased( const Row<MT2,SO2,true,SF2>* alias ) const noexcept;
2569 inline
bool isAligned () const noexcept;
2570 inline
bool canSMPAssign() const noexcept;
2572 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2573 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2574 template< typename VT > inline
void addAssign ( const DenseVector <VT,true>& rhs );
2575 template< typename VT > inline
void addAssign ( const SparseVector<VT,true>& rhs );
2576 template< typename VT > inline
void subAssign ( const DenseVector <VT,true>& rhs );
2577 template< typename VT > inline
void subAssign ( const SparseVector<VT,true>& rhs );
2578 template< typename VT > inline
void multAssign( const DenseVector <VT,true>& rhs );
2579 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
2580 template< typename VT > inline
void divAssign ( const DenseVector <VT,true>& rhs );
2594 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
2596 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2597 friend
bool isIntact( const Row<MT2,SO2,DF2,SF2>& row ) noexcept;
2599 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2600 friend
bool isSame( const Row<MT2,SO2,DF2,SF2>& a, const Row<MT2,SO2,DF2,SF2>& b ) noexcept;
2602 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2603 friend
bool tryAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2605 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2606 friend
bool tryAddAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2608 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2609 friend
bool trySubAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2611 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2612 friend
bool tryMultAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2614 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2615 friend
bool tryDivAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2617 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2618 friend
DerestrictTrait_< Row<MT2,SO2,DF2,SF2> > derestrict( Row<MT2,SO2,DF2,SF2>& row );
2651 template< typename MT >
2652 inline Row<MT,false,true,false>::Row( Operand matrix,
size_t index )
2656 if( matrix_.rows() <= index ) {
2682 template<
typename MT >
2684 Row<MT,false,true,false>::operator[](
size_t index )
2687 return matrix_(row_,index);
2703 template<
typename MT >
2705 Row<MT,false,true,false>::operator[](
size_t index )
const 2708 return const_cast<const MT&
>( matrix_ )(row_,index);
2725 template<
typename MT >
2727 Row<MT,false,true,false>::at(
size_t index )
2729 if( index >=
size() ) {
2732 return (*
this)[index];
2749 template<
typename MT >
2751 Row<MT,false,true,false>::at(
size_t index )
const 2753 if( index >=
size() ) {
2756 return (*
this)[index];
2771 template<
typename MT >
2772 inline typename Row<MT,false,true,false>::Pointer Row<MT,false,true,false>::data() noexcept
2774 return matrix_.data() + row_;
2789 template<
typename MT >
2790 inline typename Row<MT,false,true,false>::ConstPointer Row<MT,false,true,false>::data() const noexcept
2792 return matrix_.data() + row_;
2806 template<
typename MT >
2809 return Iterator( matrix_, row_, 0UL );
2823 template<
typename MT >
2840 template<
typename MT >
2857 template<
typename MT >
2874 template<
typename MT >
2891 template<
typename MT >
2919 template<
typename MT >
2920 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const ElementType& rhs )
2922 const size_t jbegin( ( IsUpper<MT>::value )
2923 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2927 const size_t jend ( ( IsLower<MT>::value )
2928 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2933 for(
size_t j=jbegin; j<jend; ++j )
2934 matrix_(row_,j) = rhs;
2955 template<
typename MT >
2956 inline Row<MT,false,true,false>&
2957 Row<MT,false,true,false>::operator=( initializer_list<ElementType> list )
2959 if( list.size() >
size() ) {
2987 template<
typename MT >
2988 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const Row& rhs )
2990 if( &rhs ==
this )
return *
this;
2992 if(
size() != rhs.size() ) {
2996 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
3000 DerestrictTrait_<This> left( derestrict( *
this ) );
3026 template<
typename MT >
3027 template<
typename VT >
3028 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const Vector<VT,true>& rhs )
3038 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3039 Right right( ~rhs );
3041 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3045 DerestrictTrait_<This> left( derestrict( *
this ) );
3047 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3048 const ResultType tmp( right );
3052 if( IsSparseVector<VT>::value )
3079 template<
typename MT >
3080 template<
typename VT >
3090 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3091 Right right( ~rhs );
3093 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
3097 DerestrictTrait_<This> left( derestrict( *
this ) );
3099 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3100 const ResultType_<VT> tmp( right );
3129 template<
typename MT >
3130 template<
typename VT >
3140 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3141 Right right( ~rhs );
3143 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
3147 DerestrictTrait_<This> left( derestrict( *
this ) );
3149 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3150 const ResultType_<VT> tmp( right );
3178 template<
typename MT >
3179 template<
typename VT >
3189 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3190 Right right( ~rhs );
3192 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
3196 DerestrictTrait_<This> left( derestrict( *
this ) );
3198 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3199 const ResultType_<VT> tmp( right );
3227 template<
typename MT >
3228 template<
typename VT >
3239 const ResultType right( *
this * (~rhs) );
3241 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3245 DerestrictTrait_<This> left( derestrict( *
this ) );
3269 template<
typename MT >
3270 template<
typename VT >
3280 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3281 Right right( ~rhs );
3283 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
3287 DerestrictTrait_<This> left( derestrict( *
this ) );
3289 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3290 const ResultType_<VT> tmp( right );
3316 template<
typename MT >
3317 template<
typename Other >
3318 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,false> >&
3323 return operator=( (*
this) * rhs );
3342 template<
typename MT >
3343 template<
typename Other >
3344 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,false> >&
3351 return operator=( (*
this) / rhs );
3371 template<
typename MT >
3374 return matrix_.columns();
3386 template<
typename MT >
3389 return matrix_.columns();
3404 template<
typename MT >
3408 size_t nonzeros( 0UL );
3410 for(
size_t j=0UL; j<
columns; ++j )
3426 template<
typename MT >
3431 const size_t jbegin( ( IsUpper<MT>::value )
3432 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3436 const size_t jend ( ( IsLower<MT>::value )
3437 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3442 for(
size_t j=jbegin; j<jend; ++j )
3443 clear( matrix_(row_,j) );
3468 template<
typename MT >
3469 template<
typename Other >
3470 inline Row<MT,false,true,false>& Row<MT,false,true,false>::scale(
const Other& scalar )
3474 const size_t jbegin( ( IsUpper<MT>::value )
3475 ?( ( IsStrictlyUpper<MT>::value )
3479 const size_t jend ( ( IsLower<MT>::value )
3480 ?( ( IsStrictlyLower<MT>::value )
3485 for(
size_t j=jbegin; j<jend; ++j ) {
3486 matrix_(row_,j) *= scalar;
3514 template<
typename MT >
3515 template<
typename Other >
3516 inline bool Row<MT,false,true,false>::canAlias(
const Other* alias )
const noexcept
3518 return matrix_.isAliased( alias );
3535 template<
typename MT >
3536 template<
typename MT2
3539 inline bool Row<MT,false,true,false>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
3541 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3558 template<
typename MT >
3559 template<
typename Other >
3560 inline bool Row<MT,false,true,false>::isAliased(
const Other* alias )
const noexcept
3562 return matrix_.isAliased( alias );
3579 template<
typename MT >
3580 template<
typename MT2
3583 inline bool Row<MT,false,true,false>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
3585 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3601 template<
typename MT >
3602 inline bool Row<MT,false,true,false>::isAligned() const noexcept
3621 template<
typename MT >
3622 inline bool Row<MT,false,true,false>::canSMPAssign() const noexcept
3624 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3642 template<
typename MT >
3643 template<
typename VT >
3644 inline void Row<MT,false,true,false>::assign(
const DenseVector<VT,true>& rhs )
3648 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3649 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3650 matrix_(row_,j ) = (~rhs)[j ];
3651 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
3653 if( jpos < (~rhs).size() )
3654 matrix_(row_,jpos) = (~rhs)[jpos];
3672 template<
typename MT >
3673 template<
typename VT >
3674 inline void Row<MT,false,true,false>::assign(
const SparseVector<VT,true>& rhs )
3678 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3679 matrix_(row_,element->index()) = element->value();
3697 template<
typename MT >
3698 template<
typename VT >
3699 inline void Row<MT,false,true,false>::addAssign(
const DenseVector<VT,true>& rhs )
3703 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3704 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3705 matrix_(row_,j ) += (~rhs)[j ];
3706 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
3708 if( jpos < (~rhs).size() )
3709 matrix_(row_,jpos) += (~rhs)[jpos];
3727 template<
typename MT >
3728 template<
typename VT >
3729 inline void Row<MT,false,true,false>::addAssign(
const SparseVector<VT,true>& rhs )
3733 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3734 matrix_(row_,element->index()) += element->value();
3752 template<
typename MT >
3753 template<
typename VT >
3754 inline void Row<MT,false,true,false>::subAssign(
const DenseVector<VT,true>& rhs )
3758 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3759 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3760 matrix_(row_,j ) -= (~rhs)[j ];
3761 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
3763 if( jpos < (~rhs).size() )
3764 matrix_(row_,jpos) -= (~rhs)[jpos];
3782 template<
typename MT >
3783 template<
typename VT >
3784 inline void Row<MT,false,true,false>::subAssign(
const SparseVector<VT,true>& rhs )
3788 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3789 matrix_(row_,element->index()) -= element->value();
3807 template<
typename MT >
3808 template<
typename VT >
3809 inline void Row<MT,false,true,false>::multAssign(
const DenseVector<VT,true>& rhs )
3813 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3814 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3815 matrix_(row_,j ) *= (~rhs)[j ];
3816 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
3818 if( jpos < (~rhs).size() )
3819 matrix_(row_,jpos) *= (~rhs)[jpos];
3837 template<
typename MT >
3838 template<
typename VT >
3839 inline void Row<MT,false,true,false>::multAssign(
const SparseVector<VT,true>& rhs )
3843 const ResultType tmp(
serial( *
this ) );
3847 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3848 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
3866 template<
typename MT >
3867 template<
typename VT >
3868 inline void Row<MT,false,true,false>::divAssign(
const DenseVector<VT,true>& rhs )
3872 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3873 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3874 matrix_(row_,j ) /= (~rhs)[j ];
3875 matrix_(row_,j+1UL) /= (~rhs)[j+1UL];
3877 if( jpos < (~rhs).size() )
3878 matrix_(row_,jpos) /= (~rhs)[jpos];
3904 template<
typename MT >
3905 class Row<MT,false,true,true>
3906 :
public DenseVector< Row<MT,false,true,true>, true >
3912 typedef If_< IsExpression<MT>, MT, MT& > Operand;
3917 typedef Row<MT,false,true,true>
This;
3918 typedef DenseVector<This,true>
BaseType;
3922 typedef SIMDTrait_<ElementType> SIMDType;
3933 typedef const ElementType* ConstPointer;
3936 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
3947 enum :
bool { simdEnabled = MT::simdEnabled };
3950 enum :
bool { smpAssignable = MT::smpAssignable };
3956 explicit inline Row( Operand matrix,
size_t index );
3968 inline Reference operator[](
size_t index );
3969 inline ConstReference operator[](
size_t index )
const;
3970 inline Reference at(
size_t index );
3971 inline ConstReference at(
size_t index )
const;
3972 inline Pointer data () noexcept;
3973 inline ConstPointer data () const noexcept;
3974 inline Iterator begin ();
3975 inline ConstIterator begin () const;
3976 inline ConstIterator
cbegin() const;
3977 inline Iterator end ();
3978 inline ConstIterator end () const;
3979 inline ConstIterator
cend () const;
3986 inline Row& operator=( const ElementType& rhs );
3987 inline Row& operator=( initializer_list<ElementType> list );
3988 inline Row& operator=( const Row& rhs );
3990 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
3991 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
3992 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
3993 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
3994 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
3995 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
3997 template< typename Other >
3998 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
4000 template< typename Other >
4001 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
4008 inline
size_t size() const noexcept;
4009 inline
size_t capacity() const noexcept;
4011 inline
void reset();
4018 template< typename Other > inline Row& scale( const Other& scalar );
4025 template< typename VT >
4026 struct VectorizedAssign {
4028 simdEnabled && VT::simdEnabled &&
4029 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
4035 template<
typename VT >
4036 struct VectorizedAddAssign {
4038 simdEnabled && VT::simdEnabled &&
4039 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4040 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4046 template<
typename VT >
4047 struct VectorizedSubAssign {
4049 simdEnabled && VT::simdEnabled &&
4050 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4051 HasSIMDSub< ElementType, ElementType_<VT> >::value };
4057 template<
typename VT >
4058 struct VectorizedMultAssign {
4060 simdEnabled && VT::simdEnabled &&
4061 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4062 HasSIMDMult< ElementType, ElementType_<VT> >::value };
4068 template<
typename VT >
4069 struct VectorizedDivAssign {
4071 simdEnabled && VT::simdEnabled &&
4072 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4073 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4086 template<
typename Other >
4087 inline bool canAlias(
const Other* alias )
const noexcept;
4089 template<
typename MT2,
bool SO2,
bool SF2 >
4090 inline bool canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
4092 template<
typename Other >
4093 inline bool isAliased(
const Other* alias )
const noexcept;
4095 template<
typename MT2,
bool SO2,
bool SF2 >
4096 inline bool isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
4098 inline bool isAligned () const noexcept;
4099 inline
bool canSMPAssign() const noexcept;
4110 template< typename VT >
4111 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4113 template< typename VT >
4114 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4116 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
4118 template< typename VT >
4119 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4121 template< typename VT >
4122 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4124 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4126 template< typename VT >
4127 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4129 template< typename VT >
4130 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4132 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4134 template< typename VT >
4135 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4137 template< typename VT >
4138 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4140 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
4142 template< typename VT >
4143 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4145 template< typename VT >
4146 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4160 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
4162 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4163 friend
bool isIntact( const Row<MT2,SO2,DF2,SF2>& row ) noexcept;
4165 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4166 friend
bool isSame( const Row<MT2,SO2,DF2,SF2>& a, const Row<MT2,SO2,DF2,SF2>& b ) noexcept;
4168 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4169 friend
bool tryAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4171 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4172 friend
bool tryAddAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4174 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4175 friend
bool trySubAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4177 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4178 friend
bool tryMultAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4180 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4181 friend
bool tryDivAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4183 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4184 friend
DerestrictTrait_< Row<MT2,SO2,DF2,SF2> > derestrict( Row<MT2,SO2,DF2,SF2>& row );
4217 template< typename MT >
4218 inline Row<MT,false,true,true>::Row( Operand matrix,
size_t index )
4222 if( matrix_.rows() <= index ) {
4248 template<
typename MT >
4250 Row<MT,false,true,true>::operator[](
size_t index )
4253 return matrix_(index,row_);
4269 template<
typename MT >
4271 Row<MT,false,true,true>::operator[](
size_t index )
const 4274 return const_cast<const MT&
>( matrix_ )(row_,index);
4291 template<
typename MT >
4293 Row<MT,false,true,true>::at(
size_t index )
4295 if( index >=
size() ) {
4298 return (*
this)[index];
4315 template<
typename MT >
4317 Row<MT,false,true,true>::at(
size_t index )
const 4319 if( index >=
size() ) {
4322 return (*
this)[index];
4337 template<
typename MT >
4338 inline typename Row<MT,false,true,true>::Pointer Row<MT,false,true,true>::data() noexcept
4340 return matrix_.data( row_ );
4355 template<
typename MT >
4356 inline typename Row<MT,false,true,true>::ConstPointer Row<MT,false,true,true>::data() const noexcept
4358 return matrix_.data( row_ );
4372 template<
typename MT >
4375 return matrix_.begin( row_ );
4389 template<
typename MT >
4392 return matrix_.cbegin( row_ );
4406 template<
typename MT >
4409 return matrix_.cbegin( row_ );
4423 template<
typename MT >
4426 return matrix_.end( row_ );
4440 template<
typename MT >
4443 return matrix_.cend( row_ );
4457 template<
typename MT >
4460 return matrix_.cend( row_ );
4481 template<
typename MT >
4482 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const ElementType& rhs )
4484 const size_t ibegin( ( IsLower<MT>::value )
4485 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4489 const size_t iend ( ( IsUpper<MT>::value )
4490 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4495 for(
size_t i=ibegin; i<iend; ++i )
4496 matrix_(i,row_) = rhs;
4517 template<
typename MT >
4518 inline Row<MT,false,true,true>&
4519 Row<MT,false,true,true>::operator=( initializer_list<ElementType> list )
4521 if( list.size() >
size() ) {
4549 template<
typename MT >
4550 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const Row& rhs )
4552 if( &rhs ==
this )
return *
this;
4554 if(
size() != rhs.size() ) {
4558 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
4562 DerestrictTrait_<This> left( derestrict( *
this ) );
4588 template<
typename MT >
4589 template<
typename VT >
4590 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const Vector<VT,true>& rhs )
4599 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4600 Right right( ~rhs );
4602 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4606 DerestrictTrait_<This> left( derestrict( *
this ) );
4608 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4609 const ResultType_<VT> tmp( right );
4613 if( IsSparseVector<VT>::value )
4640 template<
typename MT >
4641 template<
typename VT >
4651 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4652 Right right( ~rhs );
4654 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
4658 DerestrictTrait_<This> left( derestrict( *
this ) );
4660 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4661 const ResultType_<VT> tmp( right );
4690 template<
typename MT >
4691 template<
typename VT >
4701 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4702 Right right( ~rhs );
4704 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
4708 DerestrictTrait_<This> left( derestrict( *
this ) );
4710 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4711 const ResultType_<VT> tmp( right );
4739 template<
typename MT >
4740 template<
typename VT >
4750 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4751 Right right( ~rhs );
4753 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
4757 DerestrictTrait_<This> left( derestrict( *
this ) );
4759 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4760 const ResultType_<VT> tmp( right );
4788 template<
typename MT >
4789 template<
typename VT >
4800 const ResultType right( *
this * (~rhs) );
4802 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4806 DerestrictTrait_<This> left( derestrict( *
this ) );
4830 template<
typename MT >
4831 template<
typename VT >
4841 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4842 Right right( ~rhs );
4844 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
4848 DerestrictTrait_<This> left( derestrict( *
this ) );
4850 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4851 const ResultType_<VT> tmp( right );
4877 template<
typename MT >
4878 template<
typename Other >
4879 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,true> >&
4884 return operator=( (*
this) * rhs );
4903 template<
typename MT >
4904 template<
typename Other >
4905 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,true> >&
4912 return operator=( (*
this) / rhs );
4932 template<
typename MT >
4935 return matrix_.columns();
4947 template<
typename MT >
4950 return matrix_.capacity( row_ );
4965 template<
typename MT >
4968 return matrix_.nonZeros( row_ );
4980 template<
typename MT >
4983 matrix_.reset( row_ );
5008 template<
typename MT >
5009 template<
typename Other >
5010 inline Row<MT,false,true,true>& Row<MT,false,true,true>::scale(
const Other& scalar )
5014 const size_t ibegin( ( IsLower<MT>::value )
5015 ?( ( IsStrictlyLower<MT>::value )
5019 const size_t iend ( ( IsUpper<MT>::value )
5020 ?( ( IsStrictlyUpper<MT>::value )
5025 for(
size_t i=ibegin; i<iend; ++i ) {
5026 matrix_(i,row_) *= scalar;
5054 template<
typename MT >
5055 template<
typename Other >
5056 inline bool Row<MT,false,true,true>::canAlias(
const Other* alias )
const noexcept
5058 return matrix_.isAliased( alias );
5075 template<
typename MT >
5076 template<
typename MT2
5079 inline bool Row<MT,false,true,true>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
5081 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5098 template<
typename MT >
5099 template<
typename Other >
5100 inline bool Row<MT,false,true,true>::isAliased(
const Other* alias )
const noexcept
5102 return matrix_.isAliased( alias );
5119 template<
typename MT >
5120 template<
typename MT2
5123 inline bool Row<MT,false,true,true>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
5125 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5141 template<
typename MT >
5142 inline bool Row<MT,false,true,true>::isAligned() const noexcept
5144 return matrix_.isAligned();
5161 template<
typename MT >
5162 inline bool Row<MT,false,true,true>::canSMPAssign() const noexcept
5164 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5183 template<
typename MT >
5185 Row<MT,false,true,true>::load(
size_t index )
const noexcept
5187 return matrix_.load( index, row_ );
5206 template<
typename MT >
5210 return matrix_.loada( index, row_ );
5229 template<
typename MT >
5233 return matrix_.loadu( index, row_ );
5253 template<
typename MT >
5255 Row<MT,false,true,true>::store(
size_t index,
const SIMDType& value ) noexcept
5257 matrix_.store( index, row_, value );
5277 template<
typename MT >
5281 matrix_.storea( index, row_, value );
5301 template<
typename MT >
5305 matrix_.storeu( index, row_, value );
5325 template<
typename MT >
5329 matrix_.stream( index, row_, value );
5347 template<
typename MT >
5348 template<
typename VT >
5349 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5350 Row<MT,false,true,true>::assign(
const DenseVector<VT,true>& rhs )
5354 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5355 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5356 matrix_(i ,row_) = (~rhs)[i ];
5357 matrix_(i+1UL,row_) = (~rhs)[i+1UL];
5359 if( ipos < (~rhs).size() )
5360 matrix_(ipos,row_) = (~rhs)[ipos];
5378 template<
typename MT >
5379 template<
typename VT >
5380 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5381 Row<MT,false,true,true>::assign(
const DenseVector<VT,true>& rhs )
5387 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5391 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5395 Iterator left(
begin() );
5396 ConstIterator_<VT> right( (~rhs).
begin() );
5400 for( ; i<ipos; i+=SIMDSIZE ) {
5401 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5403 for( ; remainder && i<
rows; ++i ) {
5404 *left = *right; ++left; ++right;
5409 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5410 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5411 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5412 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5413 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5415 for( ; i<ipos; i+=SIMDSIZE ) {
5416 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5418 for( ; remainder && i<
rows; ++i ) {
5419 *left = *right; ++left; ++right;
5439 template<
typename MT >
5440 template<
typename VT >
5441 inline void Row<MT,false,true,true>::assign(
const SparseVector<VT,true>& rhs )
5445 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5446 matrix_(element->index(),row_) = element->value();
5464 template<
typename MT >
5465 template<
typename VT >
5466 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5467 Row<MT,false,true,true>::addAssign(
const DenseVector<VT,true>& rhs )
5471 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5472 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5473 matrix_(i ,row_) += (~rhs)[i ];
5474 matrix_(i+1UL,row_) += (~rhs)[i+1UL];
5476 if( ipos < (~rhs).size() )
5477 matrix_(ipos,row_) += (~rhs)[ipos];
5495 template<
typename MT >
5496 template<
typename VT >
5497 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5498 Row<MT,false,true,true>::addAssign(
const DenseVector<VT,true>& rhs )
5504 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5508 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5512 Iterator left(
begin() );
5513 ConstIterator_<VT> right( (~rhs).
begin() );
5515 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5516 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5517 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5518 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5519 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5521 for( ; i<ipos; i+=SIMDSIZE ) {
5522 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5524 for( ; remainder && i<
rows; ++i ) {
5525 *left += *right; ++left; ++right;
5544 template<
typename MT >
5545 template<
typename VT >
5546 inline void Row<MT,false,true,true>::addAssign(
const SparseVector<VT,true>& rhs )
5550 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5551 matrix_(element->index(),row_) += element->value();
5569 template<
typename MT >
5570 template<
typename VT >
5571 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5572 Row<MT,false,true,true>::subAssign(
const DenseVector<VT,true>& rhs )
5576 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5577 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5578 matrix_(i ,row_) -= (~rhs)[i ];
5579 matrix_(i+1UL,row_) -= (~rhs)[i+1UL];
5581 if( ipos < (~rhs).size() )
5582 matrix_(ipos,row_) -= (~rhs)[ipos];
5600 template<
typename MT >
5601 template<
typename VT >
5602 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5603 Row<MT,false,true,true>::subAssign(
const DenseVector<VT,true>& rhs )
5609 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5613 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5617 Iterator left(
begin() );
5618 ConstIterator_<VT> right( (~rhs).
begin() );
5620 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5621 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5622 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5623 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5624 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5626 for( ; i<ipos; i+=SIMDSIZE ) {
5627 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5629 for( ; remainder && i<
rows; ++i ) {
5630 *left -= *right; ++left; ++right;
5649 template<
typename MT >
5650 template<
typename VT >
5651 inline void Row<MT,false,true,true>::subAssign(
const SparseVector<VT,true>& rhs )
5655 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5656 matrix_(element->index(),row_) -= element->value();
5674 template<
typename MT >
5675 template<
typename VT >
5676 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5677 Row<MT,false,true,true>::multAssign(
const DenseVector<VT,true>& rhs )
5681 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5682 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5683 matrix_(i ,row_) *= (~rhs)[i ];
5684 matrix_(i+1UL,row_) *= (~rhs)[i+1UL];
5686 if( ipos < (~rhs).size() )
5687 matrix_(ipos,row_) *= (~rhs)[ipos];
5705 template<
typename MT >
5706 template<
typename VT >
5707 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5708 Row<MT,false,true,true>::multAssign(
const DenseVector<VT,true>& rhs )
5714 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5718 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5722 Iterator left(
begin() );
5723 ConstIterator_<VT> right( (~rhs).
begin() );
5725 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5726 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5727 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5728 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5729 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5731 for( ; i<ipos; i+=SIMDSIZE ) {
5732 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5734 for( ; remainder && i<
rows; ++i ) {
5735 *left *= *right; ++left; ++right;
5754 template<
typename MT >
5755 template<
typename VT >
5756 inline void Row<MT,false,true,true>::multAssign(
const SparseVector<VT,true>& rhs )
5760 const ResultType tmp(
serial( *
this ) );
5764 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5765 matrix_(element->index(),row_) = tmp[element->index()] * element->value();
5783 template<
typename MT >
5784 template<
typename VT >
5785 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
5786 Row<MT,false,true,true>::divAssign(
const DenseVector<VT,true>& rhs )
5790 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5791 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5792 matrix_(i ,row_) /= (~rhs)[i ];
5793 matrix_(i+1UL,row_) /= (~rhs)[i+1UL];
5795 if( ipos < (~rhs).size() )
5796 matrix_(ipos,row_) /= (~rhs)[ipos];
5814 template<
typename MT >
5815 template<
typename VT >
5816 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
5817 Row<MT,false,true,true>::divAssign(
const DenseVector<VT,true>& rhs )
5825 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
5829 Iterator left(
begin() );
5830 ConstIterator_<VT> right( (~rhs).
begin() );
5832 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5833 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5834 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5835 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5836 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5838 for( ; i<ipos; i+=SIMDSIZE ) {
5839 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5841 for( ; i<
rows; ++i ) {
5842 *left /= *right; ++left; ++right;
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.
constexpr bool useOptimizedKernels
Configuration switch for optimized kernels.This configuration switch enables/disables all optimized c...
Definition: Optimizations.h:84
typename DerestrictTrait< T >::Type DerestrictTrait_
Auxiliary alias declaration for the DerestrictTrait type trait.The DerestrictTrait_ alias declaration...
Definition: DerestrictTrait.h:110
#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 IsUniUpper type trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:721
Header file for basic type definitions.
Header file for the View base class.
Header file for the row trait.
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:160
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
#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 size_t cacheSize
Cache size of the target architecture.This setting specifies the available cache size in Byte of the ...
Definition: CacheSize.h:48
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
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:194
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
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:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
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:223
Header file for the DenseVector base class.
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
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:390
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
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:731
Constraints on the storage order of matrix types.
#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
System settings for performance optimizations.
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
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
Header file for the IsUniLower type trait.
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:129
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:304
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:238
Constraint on the data type.
Header file for the std::initializer_list aliases.
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the implementation of the Row base template.
Header file for the IsStrictlyUpper type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
Header file for the If class template.
constexpr bool useStreaming
Configuration of the streaming behavior.For large vectors and matrices non-temporal stores can provid...
Definition: Optimizations.h:68
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
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:98
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 Not class template.
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 all SIMD functionality.
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:336
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.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
#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
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
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:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
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.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsPadded type trait.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
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.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the HasSIMDMult type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
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:1285
Header file for run time assertion macros.
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.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the HasSIMDSub type trait.
Constraints on the storage order of matrix types.
#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
Header file for the IsReference type trait.
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
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 size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
#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
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
Header file for the HasSIMDDiv type trait.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
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:1303
Header file for the IsUpper type trait.
Header file for the IsRestricted type trait.
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
System settings for the inline keywords.
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
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.