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;
227 template< typename Other > inline Row& scale( const Other& scalar );
234 template< typename VT >
235 struct VectorizedAssign {
237 simdEnabled && VT::simdEnabled &&
238 AreSIMDCombinable< ElementType, ElementType_<VT> >::value };
244 template<
typename VT >
245 struct VectorizedAddAssign {
247 simdEnabled && VT::simdEnabled &&
248 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
249 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
255 template<
typename VT >
256 struct VectorizedSubAssign {
258 simdEnabled && VT::simdEnabled &&
259 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
260 HasSIMDSub< ElementType, ElementType_<VT> >::value };
266 template<
typename VT >
267 struct VectorizedMultAssign {
269 simdEnabled && VT::simdEnabled &&
270 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
271 HasSIMDMult< ElementType, ElementType_<VT> >::value };
277 template<
typename VT >
278 struct VectorizedDivAssign {
280 simdEnabled && VT::simdEnabled &&
281 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
282 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
295 template<
typename Other >
296 inline bool canAlias(
const Other* alias )
const noexcept;
298 template<
typename MT2,
bool SO2,
bool SF2 >
299 inline bool canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
301 template<
typename Other >
302 inline bool isAliased(
const Other* alias )
const noexcept;
304 template<
typename MT2,
bool SO2,
bool SF2 >
305 inline bool isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
307 inline bool isAligned () const noexcept;
308 inline
bool canSMPAssign() const noexcept;
319 template< typename VT >
320 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
322 template< typename VT >
323 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
325 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
327 template< typename VT >
328 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
330 template< typename VT >
331 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
333 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
335 template< typename VT >
336 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
338 template< typename VT >
339 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
341 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
343 template< typename VT >
344 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
346 template< typename VT >
347 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
349 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
351 template< typename VT >
352 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
354 template< typename VT >
355 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
369 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
371 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
372 friend
bool isIntact( const Row<MT2,SO2,DF2,SF2>&
row ) noexcept;
374 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
375 friend
bool isSame( const Row<MT2,SO2,DF2,SF2>& a, const Row<MT2,SO2,DF2,SF2>& b ) noexcept;
377 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
378 friend
bool tryAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
380 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
381 friend
bool tryAddAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
383 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
384 friend
bool trySubAssign( 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 tryMultAssign( 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 tryDivAssign( 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 >
425 template< typename MT
427 inline Row<MT,true,true,SF>::Row( Operand matrix,
size_t index )
431 if( matrix_.rows() <= index ) {
457 template<
typename MT
462 return matrix_(row_,index);
478 template<
typename MT
481 Row<MT,true,true,SF>::operator[](
size_t index )
const
484 return const_cast<const MT&
>( matrix_ )(row_,index);
501 template<
typename MT
505 if( index >=
size() ) {
508 return (*
this)[index];
525 template<
typename MT
529 if( index >=
size() ) {
532 return (*
this)[index];
547 template<
typename MT
549 inline typename Row<MT,true,true,SF>::Pointer Row<MT,true,true,SF>::data() noexcept
551 return matrix_.data( row_ );
566 template<
typename MT
568 inline typename Row<MT,true,true,SF>::ConstPointer Row<MT,true,true,SF>::data() const noexcept
570 return matrix_.data( row_ );
584 template<
typename MT
588 return matrix_.begin( row_ );
602 template<
typename MT
606 return matrix_.cbegin( row_ );
620 template<
typename MT
624 return matrix_.cbegin( row_ );
638 template<
typename MT
642 return matrix_.end( row_ );
656 template<
typename MT
660 return matrix_.cend( row_ );
674 template<
typename MT
678 return matrix_.cend( row_ );
703 template<
typename MT
705 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const ElementType& rhs )
707 const size_t jbegin( ( IsUpper<MT>::value )
708 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
712 const size_t jend ( ( IsLower<MT>::value )
713 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
718 for(
size_t j=jbegin; j<jend; ++j )
719 matrix_(row_,j) = rhs;
740 template<
typename MT
742 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=( initializer_list<ElementType> list )
744 if( list.size() >
size() ) {
772 template<
typename MT
774 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const Row& rhs )
776 if( &rhs ==
this )
return *
this;
778 if(
size() != rhs.size() ) {
782 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
786 DerestrictTrait_<This> left( derestrict( *
this ) );
812 template<
typename MT
814 template<
typename VT >
815 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const Vector<VT,true>& rhs )
824 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
827 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
831 DerestrictTrait_<This> left( derestrict( *
this ) );
833 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
834 const ResultType_<VT> tmp( right );
838 if( IsSparseVector<VT>::value )
865 template<
typename MT
867 template<
typename VT >
877 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
880 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
884 DerestrictTrait_<This> left( derestrict( *
this ) );
886 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
887 const ResultType_<VT> tmp( right );
916 template<
typename MT
918 template<
typename VT >
928 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
931 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
935 DerestrictTrait_<This> left( derestrict( *
this ) );
937 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
938 const ResultType_<VT> tmp( right );
966 template<
typename MT
968 template<
typename VT >
978 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
981 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
985 DerestrictTrait_<This> left( derestrict( *
this ) );
987 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
988 const ResultType_<VT> tmp( right );
1016 template<
typename MT
1018 template<
typename VT >
1029 const ResultType right( *
this * (~rhs) );
1031 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
1035 DerestrictTrait_<This> left( derestrict( *
this ) );
1059 template<
typename MT
1061 template<
typename VT >
1071 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
1072 Right right( ~rhs );
1074 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
1078 DerestrictTrait_<This> left( derestrict( *
this ) );
1080 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1081 const ResultType_<VT> tmp( right );
1107 template<
typename MT
1109 template<
typename Other >
1110 inline EnableIf_< IsNumeric<Other>, Row<MT,true,true,SF> >&
1115 return operator=( (*
this) * rhs );
1134 template<
typename MT
1136 template<
typename Other >
1137 inline EnableIf_< IsNumeric<Other>, Row<MT,true,true,SF> >&
1144 return operator=( (*
this) / rhs );
1164 template<
typename MT
1168 return matrix_.columns();
1180 template<
typename MT
1184 return matrix_.capacity( row_ );
1199 template<
typename MT
1203 return matrix_.nonZeros( row_ );
1215 template<
typename MT
1219 matrix_.reset( row_ );
1236 template<
typename MT
1238 template<
typename Other >
1239 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::scale(
const Other& scalar )
1243 const size_t jbegin( ( IsUpper<MT>::value )
1244 ?( ( IsStrictlyUpper<MT>::value )
1248 const size_t jend ( ( IsLower<MT>::value )
1249 ?( ( IsStrictlyLower<MT>::value )
1254 for(
size_t j=jbegin; j<jend; ++j ) {
1255 matrix_(row_,j) *= scalar;
1283 template<
typename MT
1285 template<
typename Other >
1286 inline bool Row<MT,true,true,SF>::canAlias(
const Other* alias )
const noexcept
1288 return matrix_.isAliased( alias );
1305 template<
typename MT
1307 template<
typename MT2
1310 inline bool Row<MT,true,true,SF>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
1312 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1329 template<
typename MT
1331 template<
typename Other >
1332 inline bool Row<MT,true,true,SF>::isAliased(
const Other* alias )
const noexcept
1334 return matrix_.isAliased( alias );
1351 template<
typename MT
1353 template<
typename MT2
1356 inline bool Row<MT,true,true,SF>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
1358 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1374 template<
typename MT
1376 inline bool Row<MT,true,true,SF>::isAligned() const noexcept
1378 return matrix_.isAligned();
1395 template<
typename MT
1397 inline bool Row<MT,true,true,SF>::canSMPAssign() const noexcept
1399 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1418 template<
typename MT
1421 Row<MT,true,true,SF>::load(
size_t index )
const noexcept
1423 return matrix_.load( row_, index );
1442 template<
typename MT
1447 return matrix_.loada( row_, index );
1466 template<
typename MT
1471 return matrix_.loadu( row_, index );
1491 template<
typename MT
1494 Row<MT,true,true,SF>::store(
size_t index,
const SIMDType& value ) noexcept
1496 matrix_.store( row_, index, value );
1516 template<
typename MT
1521 matrix_.storea( row_, index, value );
1541 template<
typename MT
1546 matrix_.storeu( row_, index, value );
1566 template<
typename MT
1571 matrix_.stream( row_, index, value );
1589 template<
typename MT
1591 template<
typename VT >
1592 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1593 Row<MT,true,true,SF>::assign(
const DenseVector<VT,true>& rhs )
1597 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1598 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1599 matrix_(row_,j ) = (~rhs)[j ];
1600 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1602 if( jpos < (~rhs).size() )
1603 matrix_(row_,jpos) = (~rhs)[jpos];
1621 template<
typename MT
1623 template<
typename VT >
1624 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1625 Row<MT,true,true,SF>::assign(
const DenseVector<VT,true>& rhs )
1631 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1634 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1638 Iterator left(
begin() );
1639 ConstIterator_<VT> right( (~rhs).
begin() );
1643 for( ; j<jpos; j+=SIMDSIZE ) {
1644 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1646 for( ; remainder && j<
columns; ++j ) {
1647 *left = *right; ++left; ++right;
1652 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1653 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1654 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1655 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1656 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1658 for( ; j<jpos; j+=SIMDSIZE ) {
1659 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1661 for( ; remainder && j<
columns; ++j ) {
1662 *left = *right; ++left; ++right;
1682 template<
typename MT
1684 template<
typename VT >
1685 inline void Row<MT,true,true,SF>::assign(
const SparseVector<VT,true>& rhs )
1689 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1690 matrix_(row_,element->index()) = element->value();
1708 template<
typename MT
1710 template<
typename VT >
1711 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1712 Row<MT,true,true,SF>::addAssign(
const DenseVector<VT,true>& rhs )
1716 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1717 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1718 matrix_(row_,j ) += (~rhs)[j ];
1719 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1721 if( jpos < (~rhs).size() )
1722 matrix_(row_,jpos) += (~rhs)[jpos];
1740 template<
typename MT
1742 template<
typename VT >
1743 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1744 Row<MT,true,true,SF>::addAssign(
const DenseVector<VT,true>& rhs )
1750 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1753 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1757 Iterator left(
begin() );
1758 ConstIterator_<VT> right( (~rhs).
begin() );
1760 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1761 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1762 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1763 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1764 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1766 for( ; j<jpos; j+=SIMDSIZE ) {
1767 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1769 for( ; remainder && j<
columns; ++j ) {
1770 *left += *right; ++left; ++right;
1789 template<
typename MT
1791 template<
typename VT >
1792 inline void Row<MT,true,true,SF>::addAssign(
const SparseVector<VT,true>& rhs )
1796 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1797 matrix_(row_,element->index()) += element->value();
1815 template<
typename MT
1817 template<
typename VT >
1818 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1819 Row<MT,true,true,SF>::subAssign(
const DenseVector<VT,true>& rhs )
1823 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1824 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1825 matrix_(row_,j ) -= (~rhs)[j ];
1826 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
1828 if( jpos < (~rhs).size() )
1829 matrix_(row_,jpos) -= (~rhs)[jpos];
1847 template<
typename MT
1849 template<
typename VT >
1850 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1851 Row<MT,true,true,SF>::subAssign(
const DenseVector<VT,true>& rhs )
1857 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1860 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1864 Iterator left(
begin() );
1865 ConstIterator_<VT> right( (~rhs).
begin() );
1867 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1868 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1869 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1870 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1871 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1873 for( ; j<jpos; j+=SIMDSIZE ) {
1874 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1876 for( ; remainder && j<
columns; ++j ) {
1877 *left -= *right; ++left; ++right;
1896 template<
typename MT
1898 template<
typename VT >
1899 inline void Row<MT,true,true,SF>::subAssign(
const SparseVector<VT,true>& rhs )
1903 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1904 matrix_(row_,element->index()) -= element->value();
1922 template<
typename MT
1924 template<
typename VT >
1925 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
1926 Row<MT,true,true,SF>::multAssign(
const DenseVector<VT,true>& rhs )
1930 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1931 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1932 matrix_(row_,j ) *= (~rhs)[j ];
1933 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
1935 if( jpos < (~rhs).size() )
1936 matrix_(row_,jpos) *= (~rhs)[jpos];
1954 template<
typename MT
1956 template<
typename VT >
1957 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
1958 Row<MT,true,true,SF>::multAssign(
const DenseVector<VT,true>& rhs )
1964 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1967 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1971 Iterator left(
begin() );
1972 ConstIterator_<VT> right( (~rhs).
begin() );
1974 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1975 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1976 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1977 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1978 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1980 for( ; j<jpos; j+=SIMDSIZE ) {
1981 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1983 for( ; remainder && j<
columns; ++j ) {
1984 *left *= *right; ++left; ++right;
2003 template<
typename MT
2005 template<
typename VT >
2006 inline void Row<MT,true,true,SF>::multAssign(
const SparseVector<VT,true>& rhs )
2010 const ResultType tmp(
serial( *
this ) );
2014 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2015 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
2033 template<
typename MT
2035 template<
typename VT >
2036 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2037 Row<MT,true,true,SF>::divAssign(
const DenseVector<VT,true>& rhs )
2041 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2042 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2043 matrix_(row_,j ) /= (~rhs)[j ];
2044 matrix_(row_,j+1UL) /= (~rhs)[j+1UL];
2046 if( jpos < (~rhs).size() )
2047 matrix_(row_,jpos) /= (~rhs)[jpos];
2065 template<
typename MT
2067 template<
typename VT >
2068 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2069 Row<MT,true,true,SF>::divAssign(
const DenseVector<VT,true>& rhs )
2077 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
2081 Iterator left(
begin() );
2082 ConstIterator_<VT> right( (~rhs).
begin() );
2084 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2085 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2086 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2087 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2088 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2090 for( ; j<jpos; j+=SIMDSIZE ) {
2091 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2094 *left /= *right; ++left; ++right;
2121 template<
typename MT >
2122 class Row<MT,false,true,false>
2123 :
public DenseVector< Row<MT,false,true,false>, true >
2129 typedef If_< IsExpression<MT>, MT, MT& > Operand;
2134 typedef Row<MT,false,true,false>
This;
2135 typedef DenseVector<This,true>
BaseType;
2149 typedef const ElementType* ConstPointer;
2152 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
2158 template<
typename MatrixType >
2164 typedef If_< IsConst<MatrixType>, ConstReference_<MatrixType>, Reference_<MatrixType> >
Reference;
2166 typedef std::random_access_iterator_tag IteratorCategory;
2167 typedef RemoveReference_<Reference> ValueType;
2168 typedef ValueType* PointerType;
2169 typedef Reference ReferenceType;
2170 typedef ptrdiff_t DifferenceType;
2173 typedef IteratorCategory iterator_category;
2174 typedef ValueType value_type;
2175 typedef PointerType pointer;
2176 typedef ReferenceType reference;
2177 typedef DifferenceType difference_type;
2183 inline RowIterator() noexcept
2184 : matrix_(
nullptr )
2197 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2198 : matrix_( &matrix )
2209 template<
typename MatrixType2 >
2210 inline RowIterator(
const RowIterator<MatrixType2>& it ) noexcept
2211 : matrix_( it.matrix_ )
2213 , column_( it.column_ )
2223 inline RowIterator&
operator+=(
size_t inc ) noexcept {
2235 inline RowIterator&
operator-=(
size_t dec ) noexcept {
2246 inline RowIterator& operator++() noexcept {
2257 inline const RowIterator operator++(
int ) noexcept {
2258 const RowIterator tmp( *
this );
2269 inline RowIterator& operator--() noexcept {
2280 inline const RowIterator operator--(
int ) noexcept {
2281 const RowIterator tmp( *
this );
2293 inline ReferenceType operator[](
size_t index )
const {
2294 return (*matrix_)(row_,column_+index);
2303 inline ReferenceType
operator*()
const {
2304 return (*matrix_)(row_,column_);
2313 inline PointerType operator->()
const {
2314 return &(*matrix_)(row_,column_);
2324 template<
typename MatrixType2 >
2325 inline bool operator==(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2326 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2336 template<
typename MatrixType2 >
2337 inline bool operator!=(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2338 return !( *
this == rhs );
2348 template<
typename MatrixType2 >
2349 inline bool operator<( const RowIterator<MatrixType2>& rhs )
const noexcept {
2350 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ < rhs.column_ );
2360 template<
typename MatrixType2 >
2361 inline bool operator>(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2362 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ > rhs.column_ );
2372 template<
typename MatrixType2 >
2373 inline bool operator<=( const RowIterator<MatrixType2>& rhs )
const noexcept {
2374 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
2384 template<
typename MatrixType2 >
2385 inline bool operator>=(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2386 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
2396 inline DifferenceType
operator-(
const RowIterator& rhs )
const noexcept {
2397 return column_ - rhs.column_;
2408 friend inline const RowIterator
operator+(
const RowIterator& it,
size_t inc ) noexcept {
2409 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2420 friend inline const RowIterator
operator+(
size_t inc,
const RowIterator& it ) noexcept {
2421 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2432 friend inline const RowIterator
operator-(
const RowIterator& it,
size_t dec ) noexcept {
2433 return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2439 MatrixType* matrix_;
2445 template<
typename MatrixType2 >
friend class RowIterator;
2460 enum :
bool { simdEnabled =
false };
2463 enum :
bool { smpAssignable = MT::smpAssignable };
2469 explicit inline Row( Operand matrix,
size_t index );
2481 inline Reference operator[](
size_t index );
2482 inline ConstReference operator[](
size_t index )
const;
2483 inline Reference at(
size_t index );
2484 inline ConstReference at(
size_t index )
const;
2485 inline Pointer data () noexcept;
2486 inline ConstPointer data () const noexcept;
2487 inline Iterator
begin ();
2488 inline ConstIterator begin () const;
2489 inline ConstIterator
cbegin() const;
2490 inline Iterator
end ();
2491 inline ConstIterator end () const;
2492 inline ConstIterator
cend () const;
2499 inline Row& operator=( const ElementType& rhs );
2500 inline Row& operator=( initializer_list<ElementType> list );
2501 inline Row& operator=( const Row& rhs );
2503 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2504 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2505 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2506 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
2507 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
2508 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2510 template< typename Other >
2511 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
2513 template< typename Other >
2514 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
2521 inline
size_t size() const noexcept;
2522 inline
size_t capacity() const noexcept;
2524 inline
void reset();
2525 template< typename Other > inline Row& scale( const Other& scalar );
2533 template< typename Other >
2534 inline
bool canAlias( const Other* alias ) const noexcept;
2536 template< typename MT2,
bool SO2,
bool SF2 >
2537 inline
bool canAlias( const Row<MT2,SO2,true,SF2>* alias ) const noexcept;
2539 template< typename Other >
2540 inline
bool isAliased( const Other* alias ) const noexcept;
2542 template< typename MT2,
bool SO2,
bool SF2 >
2543 inline
bool isAliased( const Row<MT2,SO2,true,SF2>* alias ) const noexcept;
2545 inline
bool isAligned () const noexcept;
2546 inline
bool canSMPAssign() const noexcept;
2548 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2549 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2550 template< typename VT > inline
void addAssign ( const DenseVector <VT,true>& rhs );
2551 template< typename VT > inline
void addAssign ( const SparseVector<VT,true>& rhs );
2552 template< typename VT > inline
void subAssign ( const DenseVector <VT,true>& rhs );
2553 template< typename VT > inline
void subAssign ( const SparseVector<VT,true>& rhs );
2554 template< typename VT > inline
void multAssign( const DenseVector <VT,true>& rhs );
2555 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
2556 template< typename VT > inline
void divAssign ( const DenseVector <VT,true>& rhs );
2570 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
2572 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2573 friend
bool isIntact( const Row<MT2,SO2,DF2,SF2>& row ) noexcept;
2575 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2576 friend
bool isSame( const Row<MT2,SO2,DF2,SF2>& a, const Row<MT2,SO2,DF2,SF2>& b ) noexcept;
2578 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2579 friend
bool tryAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2581 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2582 friend
bool tryAddAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2584 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2585 friend
bool trySubAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2587 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2588 friend
bool tryMultAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2590 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
2591 friend
bool tryDivAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
2593 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
2594 friend
DerestrictTrait_< Row<MT2,SO2,DF2,SF2> > derestrict( Row<MT2,SO2,DF2,SF2>& row );
2627 template< typename MT >
2628 inline Row<MT,false,true,false>::Row( Operand matrix,
size_t index )
2632 if( matrix_.rows() <= index ) {
2658 template<
typename MT >
2660 Row<MT,false,true,false>::operator[](
size_t index )
2663 return matrix_(row_,index);
2679 template<
typename MT >
2681 Row<MT,false,true,false>::operator[](
size_t index )
const
2684 return const_cast<const MT&
>( matrix_ )(row_,index);
2701 template<
typename MT >
2703 Row<MT,false,true,false>::at(
size_t index )
2705 if( index >=
size() ) {
2708 return (*
this)[index];
2725 template<
typename MT >
2727 Row<MT,false,true,false>::at(
size_t index )
const
2729 if( index >=
size() ) {
2732 return (*
this)[index];
2747 template<
typename MT >
2748 inline typename Row<MT,false,true,false>::Pointer Row<MT,false,true,false>::data() noexcept
2750 return matrix_.data() + row_;
2765 template<
typename MT >
2766 inline typename Row<MT,false,true,false>::ConstPointer Row<MT,false,true,false>::data() const noexcept
2768 return matrix_.data() + row_;
2782 template<
typename MT >
2785 return Iterator( matrix_, row_, 0UL );
2799 template<
typename MT >
2816 template<
typename MT >
2833 template<
typename MT >
2850 template<
typename MT >
2867 template<
typename MT >
2895 template<
typename MT >
2896 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const ElementType& rhs )
2898 const size_t jbegin( ( IsUpper<MT>::value )
2899 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2903 const size_t jend ( ( IsLower<MT>::value )
2904 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2909 for(
size_t j=jbegin; j<jend; ++j )
2910 matrix_(row_,j) = rhs;
2931 template<
typename MT >
2932 inline Row<MT,false,true,false>&
2933 Row<MT,false,true,false>::operator=( initializer_list<ElementType> list )
2935 if( list.size() >
size() ) {
2963 template<
typename MT >
2964 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const Row& rhs )
2966 if( &rhs ==
this )
return *
this;
2968 if(
size() != rhs.size() ) {
2972 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
2976 DerestrictTrait_<This> left( derestrict( *
this ) );
3002 template<
typename MT >
3003 template<
typename VT >
3004 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const Vector<VT,true>& rhs )
3014 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3015 Right right( ~rhs );
3017 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3021 DerestrictTrait_<This> left( derestrict( *
this ) );
3023 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3024 const ResultType tmp( right );
3028 if( IsSparseVector<VT>::value )
3055 template<
typename MT >
3056 template<
typename VT >
3066 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3067 Right right( ~rhs );
3069 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
3073 DerestrictTrait_<This> left( derestrict( *
this ) );
3075 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3076 const ResultType_<VT> tmp( right );
3105 template<
typename MT >
3106 template<
typename VT >
3116 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3117 Right right( ~rhs );
3119 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
3123 DerestrictTrait_<This> left( derestrict( *
this ) );
3125 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3126 const ResultType_<VT> tmp( right );
3154 template<
typename MT >
3155 template<
typename VT >
3165 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3166 Right right( ~rhs );
3168 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
3172 DerestrictTrait_<This> left( derestrict( *
this ) );
3174 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3175 const ResultType_<VT> tmp( right );
3203 template<
typename MT >
3204 template<
typename VT >
3215 const ResultType right( *
this * (~rhs) );
3217 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3221 DerestrictTrait_<This> left( derestrict( *
this ) );
3245 template<
typename MT >
3246 template<
typename VT >
3256 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
3257 Right right( ~rhs );
3259 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
3263 DerestrictTrait_<This> left( derestrict( *
this ) );
3265 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3266 const ResultType_<VT> tmp( right );
3292 template<
typename MT >
3293 template<
typename Other >
3294 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,false> >&
3299 return operator=( (*
this) * rhs );
3318 template<
typename MT >
3319 template<
typename Other >
3320 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,false> >&
3327 return operator=( (*
this) / rhs );
3347 template<
typename MT >
3350 return matrix_.columns();
3362 template<
typename MT >
3365 return matrix_.columns();
3380 template<
typename MT >
3384 size_t nonzeros( 0UL );
3386 for(
size_t j=0UL; j<
columns; ++j )
3402 template<
typename MT >
3407 const size_t jbegin( ( IsUpper<MT>::value )
3408 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3412 const size_t jend ( ( IsLower<MT>::value )
3413 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3418 for(
size_t j=jbegin; j<jend; ++j )
3419 clear( matrix_(row_,j) );
3436 template<
typename MT >
3437 template<
typename Other >
3438 inline Row<MT,false,true,false>& Row<MT,false,true,false>::scale(
const Other& scalar )
3442 const size_t jbegin( ( IsUpper<MT>::value )
3443 ?( ( IsStrictlyUpper<MT>::value )
3447 const size_t jend ( ( IsLower<MT>::value )
3448 ?( ( IsStrictlyLower<MT>::value )
3453 for(
size_t j=jbegin; j<jend; ++j ) {
3454 matrix_(row_,j) *= scalar;
3482 template<
typename MT >
3483 template<
typename Other >
3484 inline bool Row<MT,false,true,false>::canAlias(
const Other* alias )
const noexcept
3486 return matrix_.isAliased( alias );
3503 template<
typename MT >
3504 template<
typename MT2
3507 inline bool Row<MT,false,true,false>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
3509 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3526 template<
typename MT >
3527 template<
typename Other >
3528 inline bool Row<MT,false,true,false>::isAliased(
const Other* alias )
const noexcept
3530 return matrix_.isAliased( alias );
3547 template<
typename MT >
3548 template<
typename MT2
3551 inline bool Row<MT,false,true,false>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
3553 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3569 template<
typename MT >
3570 inline bool Row<MT,false,true,false>::isAligned() const noexcept
3589 template<
typename MT >
3590 inline bool Row<MT,false,true,false>::canSMPAssign() const noexcept
3592 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3610 template<
typename MT >
3611 template<
typename VT >
3612 inline void Row<MT,false,true,false>::assign(
const DenseVector<VT,true>& rhs )
3616 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3617 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3618 matrix_(row_,j ) = (~rhs)[j ];
3619 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
3621 if( jpos < (~rhs).size() )
3622 matrix_(row_,jpos) = (~rhs)[jpos];
3640 template<
typename MT >
3641 template<
typename VT >
3642 inline void Row<MT,false,true,false>::assign(
const SparseVector<VT,true>& rhs )
3646 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3647 matrix_(row_,element->index()) = element->value();
3665 template<
typename MT >
3666 template<
typename VT >
3667 inline void Row<MT,false,true,false>::addAssign(
const DenseVector<VT,true>& rhs )
3671 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3672 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3673 matrix_(row_,j ) += (~rhs)[j ];
3674 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
3676 if( jpos < (~rhs).size() )
3677 matrix_(row_,jpos) += (~rhs)[jpos];
3695 template<
typename MT >
3696 template<
typename VT >
3697 inline void Row<MT,false,true,false>::addAssign(
const SparseVector<VT,true>& rhs )
3701 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3702 matrix_(row_,element->index()) += element->value();
3720 template<
typename MT >
3721 template<
typename VT >
3722 inline void Row<MT,false,true,false>::subAssign(
const DenseVector<VT,true>& rhs )
3726 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3727 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3728 matrix_(row_,j ) -= (~rhs)[j ];
3729 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
3731 if( jpos < (~rhs).size() )
3732 matrix_(row_,jpos) -= (~rhs)[jpos];
3750 template<
typename MT >
3751 template<
typename VT >
3752 inline void Row<MT,false,true,false>::subAssign(
const SparseVector<VT,true>& rhs )
3756 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3757 matrix_(row_,element->index()) -= element->value();
3775 template<
typename MT >
3776 template<
typename VT >
3777 inline void Row<MT,false,true,false>::multAssign(
const DenseVector<VT,true>& rhs )
3781 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3782 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3783 matrix_(row_,j ) *= (~rhs)[j ];
3784 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
3786 if( jpos < (~rhs).size() )
3787 matrix_(row_,jpos) *= (~rhs)[jpos];
3805 template<
typename MT >
3806 template<
typename VT >
3807 inline void Row<MT,false,true,false>::multAssign(
const SparseVector<VT,true>& rhs )
3811 const ResultType tmp(
serial( *
this ) );
3815 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3816 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
3834 template<
typename MT >
3835 template<
typename VT >
3836 inline void Row<MT,false,true,false>::divAssign(
const DenseVector<VT,true>& rhs )
3840 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3841 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3842 matrix_(row_,j ) /= (~rhs)[j ];
3843 matrix_(row_,j+1UL) /= (~rhs)[j+1UL];
3845 if( jpos < (~rhs).size() )
3846 matrix_(row_,jpos) /= (~rhs)[jpos];
3872 template<
typename MT >
3873 class Row<MT,false,true,true>
3874 :
public DenseVector< Row<MT,false,true,true>, true >
3880 typedef If_< IsExpression<MT>, MT, MT& > Operand;
3885 typedef Row<MT,false,true,true>
This;
3886 typedef DenseVector<This,true>
BaseType;
3890 typedef SIMDTrait_<ElementType> SIMDType;
3901 typedef const ElementType* ConstPointer;
3904 typedef If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* > Pointer;
3915 enum :
bool { simdEnabled = MT::simdEnabled };
3918 enum :
bool { smpAssignable = MT::smpAssignable };
3924 explicit inline Row( Operand matrix,
size_t index );
3936 inline Reference operator[](
size_t index );
3937 inline ConstReference operator[](
size_t index )
const;
3938 inline Reference at(
size_t index );
3939 inline ConstReference at(
size_t index )
const;
3940 inline Pointer data () noexcept;
3941 inline ConstPointer data () const noexcept;
3942 inline Iterator begin ();
3943 inline ConstIterator begin () const;
3944 inline ConstIterator
cbegin() const;
3945 inline Iterator end ();
3946 inline ConstIterator end () const;
3947 inline ConstIterator
cend () const;
3954 inline Row& operator=( const ElementType& rhs );
3955 inline Row& operator=( initializer_list<ElementType> list );
3956 inline Row& operator=( const Row& rhs );
3958 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
3959 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
3960 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
3961 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
3962 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
3963 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
3965 template< typename Other >
3966 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
3968 template< typename Other >
3969 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
3976 inline
size_t size() const noexcept;
3977 inline
size_t capacity() const noexcept;
3979 inline
void reset();
3980 template< typename Other > inline Row& scale( const Other& scalar );
3987 template< typename VT >
3988 struct VectorizedAssign {
3990 simdEnabled && VT::simdEnabled &&
3991 AreSIMDCombinable< ElementType, ElementType_<VT> >::value };
3997 template<
typename VT >
3998 struct VectorizedAddAssign {
4000 simdEnabled && VT::simdEnabled &&
4001 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4002 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4008 template<
typename VT >
4009 struct VectorizedSubAssign {
4011 simdEnabled && VT::simdEnabled &&
4012 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4013 HasSIMDSub< ElementType, ElementType_<VT> >::value };
4019 template<
typename VT >
4020 struct VectorizedMultAssign {
4022 simdEnabled && VT::simdEnabled &&
4023 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4024 HasSIMDMult< ElementType, ElementType_<VT> >::value };
4030 template<
typename VT >
4031 struct VectorizedDivAssign {
4033 simdEnabled && VT::simdEnabled &&
4034 AreSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4035 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4048 template<
typename Other >
4049 inline bool canAlias(
const Other* alias )
const noexcept;
4051 template<
typename MT2,
bool SO2,
bool SF2 >
4052 inline bool canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
4054 template<
typename Other >
4055 inline bool isAliased(
const Other* alias )
const noexcept;
4057 template<
typename MT2,
bool SO2,
bool SF2 >
4058 inline bool isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
4060 inline bool isAligned () const noexcept;
4061 inline
bool canSMPAssign() const noexcept;
4072 template< typename VT >
4073 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4075 template< typename VT >
4076 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4078 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
4080 template< typename VT >
4081 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4083 template< typename VT >
4084 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4086 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4088 template< typename VT >
4089 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4091 template< typename VT >
4092 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4094 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4096 template< typename VT >
4097 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4099 template< typename VT >
4100 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4102 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
4104 template< typename VT >
4105 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4107 template< typename VT >
4108 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4122 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
4124 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4125 friend
bool isIntact( const Row<MT2,SO2,DF2,SF2>& row ) noexcept;
4127 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4128 friend
bool isSame( const Row<MT2,SO2,DF2,SF2>& a, const Row<MT2,SO2,DF2,SF2>& b ) noexcept;
4130 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4131 friend
bool tryAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4133 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4134 friend
bool tryAddAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4136 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4137 friend
bool trySubAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4139 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4140 friend
bool tryMultAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4142 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename VT >
4143 friend
bool tryDivAssign( const Row<MT2,SO2,DF2,SF2>& lhs, const Vector<VT,true>& rhs,
size_t index );
4145 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 >
4146 friend
DerestrictTrait_< Row<MT2,SO2,DF2,SF2> > derestrict( Row<MT2,SO2,DF2,SF2>& row );
4179 template< typename MT >
4180 inline Row<MT,false,true,true>::Row( Operand matrix,
size_t index )
4184 if( matrix_.rows() <= index ) {
4210 template<
typename MT >
4212 Row<MT,false,true,true>::operator[](
size_t index )
4215 return matrix_(index,row_);
4231 template<
typename MT >
4233 Row<MT,false,true,true>::operator[](
size_t index )
const
4236 return const_cast<const MT&
>( matrix_ )(row_,index);
4253 template<
typename MT >
4255 Row<MT,false,true,true>::at(
size_t index )
4257 if( index >=
size() ) {
4260 return (*
this)[index];
4277 template<
typename MT >
4279 Row<MT,false,true,true>::at(
size_t index )
const
4281 if( index >=
size() ) {
4284 return (*
this)[index];
4299 template<
typename MT >
4300 inline typename Row<MT,false,true,true>::Pointer Row<MT,false,true,true>::data() noexcept
4302 return matrix_.data( row_ );
4317 template<
typename MT >
4318 inline typename Row<MT,false,true,true>::ConstPointer Row<MT,false,true,true>::data() const noexcept
4320 return matrix_.data( row_ );
4334 template<
typename MT >
4337 return matrix_.begin( row_ );
4351 template<
typename MT >
4354 return matrix_.cbegin( row_ );
4368 template<
typename MT >
4371 return matrix_.cbegin( row_ );
4385 template<
typename MT >
4388 return matrix_.end( row_ );
4402 template<
typename MT >
4405 return matrix_.cend( row_ );
4419 template<
typename MT >
4422 return matrix_.cend( row_ );
4443 template<
typename MT >
4444 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const ElementType& rhs )
4446 const size_t ibegin( ( IsLower<MT>::value )
4447 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4451 const size_t iend ( ( IsUpper<MT>::value )
4452 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4457 for(
size_t i=ibegin; i<iend; ++i )
4458 matrix_(i,row_) = rhs;
4479 template<
typename MT >
4480 inline Row<MT,false,true,true>&
4481 Row<MT,false,true,true>::operator=( initializer_list<ElementType> list )
4483 if( list.size() >
size() ) {
4511 template<
typename MT >
4512 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const Row& rhs )
4514 if( &rhs ==
this )
return *
this;
4516 if(
size() != rhs.size() ) {
4520 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
4524 DerestrictTrait_<This> left( derestrict( *
this ) );
4550 template<
typename MT >
4551 template<
typename VT >
4552 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const Vector<VT,true>& rhs )
4561 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4562 Right right( ~rhs );
4564 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4568 DerestrictTrait_<This> left( derestrict( *
this ) );
4570 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4571 const ResultType_<VT> tmp( right );
4575 if( IsSparseVector<VT>::value )
4602 template<
typename MT >
4603 template<
typename VT >
4613 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4614 Right right( ~rhs );
4616 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
4620 DerestrictTrait_<This> left( derestrict( *
this ) );
4622 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4623 const ResultType_<VT> tmp( right );
4652 template<
typename MT >
4653 template<
typename VT >
4663 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4664 Right right( ~rhs );
4666 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
4670 DerestrictTrait_<This> left( derestrict( *
this ) );
4672 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4673 const ResultType_<VT> tmp( right );
4701 template<
typename MT >
4702 template<
typename VT >
4712 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4713 Right right( ~rhs );
4715 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
4719 DerestrictTrait_<This> left( derestrict( *
this ) );
4721 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4722 const ResultType_<VT> tmp( right );
4750 template<
typename MT >
4751 template<
typename VT >
4762 const ResultType right( *
this * (~rhs) );
4764 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4768 DerestrictTrait_<This> left( derestrict( *
this ) );
4792 template<
typename MT >
4793 template<
typename VT >
4803 typedef If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& > Right;
4804 Right right( ~rhs );
4806 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
4810 DerestrictTrait_<This> left( derestrict( *
this ) );
4812 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4813 const ResultType_<VT> tmp( right );
4839 template<
typename MT >
4840 template<
typename Other >
4841 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,true> >&
4846 return operator=( (*
this) * rhs );
4865 template<
typename MT >
4866 template<
typename Other >
4867 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,true> >&
4874 return operator=( (*
this) / rhs );
4894 template<
typename MT >
4897 return matrix_.columns();
4909 template<
typename MT >
4912 return matrix_.capacity( row_ );
4927 template<
typename MT >
4930 return matrix_.nonZeros( row_ );
4942 template<
typename MT >
4945 matrix_.reset( row_ );
4962 template<
typename MT >
4963 template<
typename Other >
4964 inline Row<MT,false,true,true>& Row<MT,false,true,true>::scale(
const Other& scalar )
4968 const size_t ibegin( ( IsLower<MT>::value )
4969 ?( ( IsStrictlyLower<MT>::value )
4973 const size_t iend ( ( IsUpper<MT>::value )
4974 ?( ( IsStrictlyUpper<MT>::value )
4979 for(
size_t i=ibegin; i<iend; ++i ) {
4980 matrix_(i,row_) *= scalar;
5008 template<
typename MT >
5009 template<
typename Other >
5010 inline bool Row<MT,false,true,true>::canAlias(
const Other* alias )
const noexcept
5012 return matrix_.isAliased( alias );
5029 template<
typename MT >
5030 template<
typename MT2
5033 inline bool Row<MT,false,true,true>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
5035 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5052 template<
typename MT >
5053 template<
typename Other >
5054 inline bool Row<MT,false,true,true>::isAliased(
const Other* alias )
const noexcept
5056 return matrix_.isAliased( alias );
5073 template<
typename MT >
5074 template<
typename MT2
5077 inline bool Row<MT,false,true,true>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
5079 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5095 template<
typename MT >
5096 inline bool Row<MT,false,true,true>::isAligned() const noexcept
5098 return matrix_.isAligned();
5115 template<
typename MT >
5116 inline bool Row<MT,false,true,true>::canSMPAssign() const noexcept
5118 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5137 template<
typename MT >
5139 Row<MT,false,true,true>::load(
size_t index )
const noexcept
5141 return matrix_.load( index, row_ );
5160 template<
typename MT >
5164 return matrix_.loada( index, row_ );
5183 template<
typename MT >
5187 return matrix_.loadu( index, row_ );
5207 template<
typename MT >
5209 Row<MT,false,true,true>::store(
size_t index,
const SIMDType& value ) noexcept
5211 matrix_.store( index, row_, value );
5231 template<
typename MT >
5235 matrix_.storea( index, row_, value );
5255 template<
typename MT >
5259 matrix_.storeu( index, row_, value );
5279 template<
typename MT >
5283 matrix_.stream( index, row_, value );
5301 template<
typename MT >
5302 template<
typename VT >
5303 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5304 Row<MT,false,true,true>::assign(
const DenseVector<VT,true>& rhs )
5308 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5309 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5310 matrix_(i ,row_) = (~rhs)[i ];
5311 matrix_(i+1UL,row_) = (~rhs)[i+1UL];
5313 if( ipos < (~rhs).size() )
5314 matrix_(ipos,row_) = (~rhs)[ipos];
5332 template<
typename MT >
5333 template<
typename VT >
5334 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5335 Row<MT,false,true,true>::assign(
const DenseVector<VT,true>& rhs )
5341 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5344 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5348 Iterator left(
begin() );
5349 ConstIterator_<VT> right( (~rhs).
begin() );
5353 for( ; i<ipos; i+=SIMDSIZE ) {
5354 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5356 for( ; remainder && i<
rows; ++i ) {
5357 *left = *right; ++left; ++right;
5362 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5363 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5364 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5365 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5366 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5368 for( ; i<ipos; i+=SIMDSIZE ) {
5369 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5371 for( ; remainder && i<
rows; ++i ) {
5372 *left = *right; ++left; ++right;
5392 template<
typename MT >
5393 template<
typename VT >
5394 inline void Row<MT,false,true,true>::assign(
const SparseVector<VT,true>& rhs )
5398 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5399 matrix_(element->index(),row_) = element->value();
5417 template<
typename MT >
5418 template<
typename VT >
5419 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5420 Row<MT,false,true,true>::addAssign(
const DenseVector<VT,true>& rhs )
5424 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5425 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5426 matrix_(i ,row_) += (~rhs)[i ];
5427 matrix_(i+1UL,row_) += (~rhs)[i+1UL];
5429 if( ipos < (~rhs).size() )
5430 matrix_(ipos,row_) += (~rhs)[ipos];
5448 template<
typename MT >
5449 template<
typename VT >
5450 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5451 Row<MT,false,true,true>::addAssign(
const DenseVector<VT,true>& rhs )
5457 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5460 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5464 Iterator left(
begin() );
5465 ConstIterator_<VT> right( (~rhs).
begin() );
5467 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5468 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5469 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5470 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5471 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5473 for( ; i<ipos; i+=SIMDSIZE ) {
5474 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5476 for( ; remainder && i<
rows; ++i ) {
5477 *left += *right; ++left; ++right;
5496 template<
typename MT >
5497 template<
typename VT >
5498 inline void Row<MT,false,true,true>::addAssign(
const SparseVector<VT,true>& rhs )
5502 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5503 matrix_(element->index(),row_) += element->value();
5521 template<
typename MT >
5522 template<
typename VT >
5523 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5524 Row<MT,false,true,true>::subAssign(
const DenseVector<VT,true>& rhs )
5528 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5529 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5530 matrix_(i ,row_) -= (~rhs)[i ];
5531 matrix_(i+1UL,row_) -= (~rhs)[i+1UL];
5533 if( ipos < (~rhs).size() )
5534 matrix_(ipos,row_) -= (~rhs)[ipos];
5552 template<
typename MT >
5553 template<
typename VT >
5554 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5555 Row<MT,false,true,true>::subAssign(
const DenseVector<VT,true>& rhs )
5561 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5564 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5568 Iterator left(
begin() );
5569 ConstIterator_<VT> right( (~rhs).
begin() );
5571 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5572 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5573 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5574 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5575 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5577 for( ; i<ipos; i+=SIMDSIZE ) {
5578 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5580 for( ; remainder && i<
rows; ++i ) {
5581 *left -= *right; ++left; ++right;
5600 template<
typename MT >
5601 template<
typename VT >
5602 inline void Row<MT,false,true,true>::subAssign(
const SparseVector<VT,true>& rhs )
5606 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5607 matrix_(element->index(),row_) -= element->value();
5625 template<
typename MT >
5626 template<
typename VT >
5627 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5628 Row<MT,false,true,true>::multAssign(
const DenseVector<VT,true>& rhs )
5632 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5633 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5634 matrix_(i ,row_) *= (~rhs)[i ];
5635 matrix_(i+1UL,row_) *= (~rhs)[i+1UL];
5637 if( ipos < (~rhs).size() )
5638 matrix_(ipos,row_) *= (~rhs)[ipos];
5656 template<
typename MT >
5657 template<
typename VT >
5658 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5659 Row<MT,false,true,true>::multAssign(
const DenseVector<VT,true>& rhs )
5665 const bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5668 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5672 Iterator left(
begin() );
5673 ConstIterator_<VT> right( (~rhs).
begin() );
5675 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5676 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5677 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5678 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5679 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5681 for( ; i<ipos; i+=SIMDSIZE ) {
5682 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5684 for( ; remainder && i<
rows; ++i ) {
5685 *left *= *right; ++left; ++right;
5704 template<
typename MT >
5705 template<
typename VT >
5706 inline void Row<MT,false,true,true>::multAssign(
const SparseVector<VT,true>& rhs )
5710 const ResultType tmp(
serial( *
this ) );
5714 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5715 matrix_(element->index(),row_) = tmp[element->index()] * element->value();
5733 template<
typename MT >
5734 template<
typename VT >
5735 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
5736 Row<MT,false,true,true>::divAssign(
const DenseVector<VT,true>& rhs )
5740 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5741 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5742 matrix_(i ,row_) /= (~rhs)[i ];
5743 matrix_(i+1UL,row_) /= (~rhs)[i+1UL];
5745 if( ipos < (~rhs).size() )
5746 matrix_(ipos,row_) /= (~rhs)[ipos];
5764 template<
typename MT >
5765 template<
typename VT >
5766 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
5767 Row<MT,false,true,true>::divAssign(
const DenseVector<VT,true>& rhs )
5775 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
5779 Iterator left(
begin() );
5780 ConstIterator_<VT> right( (~rhs).
begin() );
5782 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5783 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5784 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5785 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5786 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5788 for( ; i<ipos; i+=SIMDSIZE ) {
5789 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5791 for( ; i<
rows; ++i ) {
5792 *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.
const DMatDMatMultExpr< T1, T2 > 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:7800
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
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:653
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:258
#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:188
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:2643
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
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
Header file for the DenseVector base class.
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
#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
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:442
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:723
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:384
#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
DisableIf_< Or< IsComputation< MT >, IsTransExpr< 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:126
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:298
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:232
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
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:2647
#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.
Header file for the Not class template.
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:330
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:61
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
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:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
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.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< 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:126
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 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:2642
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:2646
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:314
#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:2637
Header file for the AreSIMDCombinable type trait.
Header file for the HasSIMDDiv type trait.
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
#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
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
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.
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.