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 View< DenseVector< Row<MT,true,true,SF>, true > >
126 using Operand = If_< IsExpression<MT>, MT, MT& >;
131 using This = Row<MT,true,true,SF>;
132 using BaseType = DenseVector<This,true>;
136 using SIMDType = SIMDTrait_<ElementType>;
150 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer,
ElementType* >;
161 enum :
bool { simdEnabled = MT::simdEnabled };
164 enum :
bool { smpAssignable = MT::smpAssignable };
170 explicit inline Row( Operand matrix,
size_t index );
182 inline Reference operator[](
size_t index );
183 inline ConstReference operator[](
size_t index )
const;
185 inline ConstReference at(
size_t index )
const;
186 inline Pointer data () noexcept;
187 inline ConstPointer data () const noexcept;
189 inline ConstIterator begin () const;
190 inline ConstIterator
cbegin() const;
192 inline ConstIterator end () const;
193 inline ConstIterator
cend () const;
200 inline Row& operator=( const ElementType& rhs );
201 inline Row& operator=( initializer_list<ElementType> list );
202 inline Row& operator=( const Row& rhs );
204 template< typename VT > inline Row& operator= ( const Vector<VT,true>& 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 DenseVector<VT,true>& rhs );
208 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
209 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
210 template< typename VT > inline Row& operator%=( const Vector<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 Operand operand() const noexcept;
224 inline
size_t row() const noexcept;
225 inline
size_t size() const noexcept;
226 inline
size_t spacing() const noexcept;
227 inline
size_t capacity() const noexcept;
236 template< typename Other > inline Row& scale( const Other& scalar );
243 template< typename VT >
244 struct VectorizedAssign {
245 enum :
bool { value = useOptimizedKernels &&
246 simdEnabled && VT::simdEnabled &&
247 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
253 template<
typename VT >
254 struct VectorizedAddAssign {
255 enum :
bool { value = useOptimizedKernels &&
256 simdEnabled && VT::simdEnabled &&
257 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
258 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
264 template<
typename VT >
265 struct VectorizedSubAssign {
266 enum :
bool { value = useOptimizedKernels &&
267 simdEnabled && VT::simdEnabled &&
268 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
269 HasSIMDSub< ElementType, ElementType_<VT> >::value };
275 template<
typename VT >
276 struct VectorizedMultAssign {
277 enum :
bool { value = useOptimizedKernels &&
278 simdEnabled && VT::simdEnabled &&
279 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
280 HasSIMDMult< ElementType, ElementType_<VT> >::value };
286 template<
typename VT >
287 struct VectorizedDivAssign {
288 enum :
bool { value = useOptimizedKernels &&
289 simdEnabled && VT::simdEnabled &&
290 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
291 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
304 template<
typename Other >
305 inline bool canAlias(
const Other* alias )
const noexcept;
307 template<
typename MT2,
bool SO2,
bool SF2 >
308 inline bool canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
310 template<
typename Other >
311 inline bool isAliased(
const Other* alias )
const noexcept;
313 template<
typename MT2,
bool SO2,
bool SF2 >
314 inline bool isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
316 inline bool isAligned () const noexcept;
317 inline
bool canSMPAssign() const noexcept;
328 template< typename VT >
329 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
331 template< typename VT >
332 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
334 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
336 template< typename VT >
337 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
339 template< typename VT >
340 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
342 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
344 template< typename VT >
345 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
347 template< typename VT >
348 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
350 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
352 template< typename VT >
353 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
355 template< typename VT >
356 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
358 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
360 template< typename VT >
361 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
363 template< typename VT >
364 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
378 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
410 template< typename MT
412 inline Row<MT,true,true,SF>::Row( Operand matrix,
size_t index )
416 if( matrix_.rows() <= index ) {
442 template<
typename MT
447 return matrix_(row_,index);
463 template<
typename MT
466 Row<MT,true,true,SF>::operator[](
size_t index )
const 469 return const_cast<const MT&
>( matrix_ )(row_,index);
486 template<
typename MT
490 if( index >=
size() ) {
493 return (*
this)[index];
510 template<
typename MT
514 if( index >=
size() ) {
517 return (*
this)[index];
532 template<
typename MT
534 inline typename Row<MT,true,true,SF>::Pointer Row<MT,true,true,SF>::data() noexcept
536 return matrix_.data( row_ );
551 template<
typename MT
553 inline typename Row<MT,true,true,SF>::ConstPointer Row<MT,true,true,SF>::data() const noexcept
555 return matrix_.data( row_ );
569 template<
typename MT
573 return matrix_.begin( row_ );
587 template<
typename MT
591 return matrix_.cbegin( row_ );
605 template<
typename MT
609 return matrix_.cbegin( row_ );
623 template<
typename MT
627 return matrix_.end( row_ );
641 template<
typename MT
645 return matrix_.cend( row_ );
659 template<
typename MT
663 return matrix_.cend( row_ );
688 template<
typename MT
690 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const ElementType& rhs )
692 const size_t jbegin( ( IsUpper<MT>::value )
693 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
697 const size_t jend ( ( IsLower<MT>::value )
698 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
703 for(
size_t j=jbegin; j<jend; ++j )
704 matrix_(row_,j) = rhs;
725 template<
typename MT
727 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=( initializer_list<ElementType> list )
729 if( list.size() >
size() ) {
757 template<
typename MT
759 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=(
const Row& rhs )
761 if( &rhs ==
this )
return *
this;
763 if(
size() != rhs.size() ) {
767 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
771 decltype(
auto) left( derestrict( *this ) );
797 template< typename MT
799 template< typename VT >
800 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator=( const Vector<VT,true>& rhs )
809 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
812 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
816 decltype(
auto) left( derestrict( *this ) );
818 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
819 const ResultType_<VT> tmp( right );
823 if( IsSparseVector<VT>::value )
850 template<
typename MT
852 template<
typename VT >
862 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
865 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
869 decltype(
auto) left( derestrict( *this ) );
871 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
872 const ResultType_<VT> tmp( right );
901 template<
typename MT
903 template<
typename VT >
913 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
916 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
920 decltype(
auto) left( derestrict( *this ) );
922 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
923 const ResultType_<VT> tmp( right );
951 template<
typename MT
953 template<
typename VT >
963 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
966 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
970 decltype(
auto) left( derestrict( *this ) );
972 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
973 const ResultType_<VT> tmp( right );
1001 template<
typename MT
1003 template<
typename VT >
1016 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
1020 decltype(
auto) left( derestrict( *this ) );
1044 template< typename MT
1046 template< typename VT >
1047 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator/=( const DenseVector<VT,true>& rhs )
1056 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
1057 Right right( ~rhs );
1059 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
1063 decltype(
auto) left( derestrict( *this ) );
1065 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1066 const ResultType_<VT> tmp( right );
1094 template<
typename MT
1096 template<
typename VT >
1097 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::operator%=(
const Vector<VT,true>& rhs )
1099 using blaze::assign;
1104 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1110 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1114 const CrossType right( *
this % (~rhs) );
1116 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
1120 decltype(
auto) left( derestrict( *this ) );
1122 assign( left, right );
1143 template< typename MT
1145 template< typename Other >
1146 inline
EnableIf_< IsNumeric<Other>, Row<MT,true,true,SF> >&
1147 Row<MT,true,true,SF>::operator*=( Other rhs )
1151 return operator=( (*
this) * rhs );
1170 template<
typename MT
1172 template<
typename Other >
1173 inline EnableIf_< IsNumeric<Other>, Row<MT,true,true,SF> >&
1180 return operator=( (*
this) / rhs );
1200 template<
typename MT
1202 inline typename Row<MT,true,true,SF>::Operand Row<MT,true,true,SF>::operand() const noexcept
1216 template<
typename MT
1232 template<
typename MT
1236 return matrix_.columns();
1251 template<
typename MT
1255 return matrix_.spacing();
1267 template<
typename MT
1271 return matrix_.capacity( row_ );
1286 template<
typename MT
1290 return matrix_.nonZeros( row_ );
1302 template<
typename MT
1306 matrix_.reset( row_ );
1333 template<
typename MT
1335 template<
typename Other >
1336 inline Row<MT,true,true,SF>& Row<MT,true,true,SF>::scale(
const Other& scalar )
1340 const size_t jbegin( ( IsUpper<MT>::value )
1341 ?( ( IsStrictlyUpper<MT>::value )
1345 const size_t jend ( ( IsLower<MT>::value )
1346 ?( ( IsStrictlyLower<MT>::value )
1351 for(
size_t j=jbegin; j<jend; ++j ) {
1352 matrix_(row_,j) *= scalar;
1380 template<
typename MT
1382 template<
typename Other >
1383 inline bool Row<MT,true,true,SF>::canAlias(
const Other* alias )
const noexcept
1385 return matrix_.isAliased( alias );
1402 template<
typename MT
1404 template<
typename MT2
1407 inline bool Row<MT,true,true,SF>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
1409 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1426 template<
typename MT
1428 template<
typename Other >
1429 inline bool Row<MT,true,true,SF>::isAliased(
const Other* alias )
const noexcept
1431 return matrix_.isAliased( alias );
1448 template<
typename MT
1450 template<
typename MT2
1453 inline bool Row<MT,true,true,SF>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
1455 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
1471 template<
typename MT
1473 inline bool Row<MT,true,true,SF>::isAligned() const noexcept
1475 return matrix_.isAligned();
1492 template<
typename MT
1494 inline bool Row<MT,true,true,SF>::canSMPAssign() const noexcept
1496 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1515 template<
typename MT
1518 Row<MT,true,true,SF>::load(
size_t index )
const noexcept
1520 return matrix_.load( row_, index );
1539 template<
typename MT
1544 return matrix_.loada( row_, index );
1563 template<
typename MT
1568 return matrix_.loadu( row_, index );
1588 template<
typename MT
1591 Row<MT,true,true,SF>::store(
size_t index,
const SIMDType& value ) noexcept
1593 matrix_.store( row_, index, value );
1613 template<
typename MT
1618 matrix_.storea( row_, index, value );
1638 template<
typename MT
1643 matrix_.storeu( row_, index, value );
1663 template<
typename MT
1668 matrix_.stream( row_, index, value );
1686 template<
typename MT
1688 template<
typename VT >
1689 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1690 Row<MT,true,true,SF>::assign(
const DenseVector<VT,true>& rhs )
1694 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1695 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1696 matrix_(row_,j ) = (~rhs)[j ];
1697 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
1699 if( jpos < (~rhs).size() )
1700 matrix_(row_,jpos) = (~rhs)[jpos];
1718 template<
typename MT
1720 template<
typename VT >
1721 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAssign<VT> >
1722 Row<MT,true,true,SF>::assign(
const DenseVector<VT,true>& rhs )
1728 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1732 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1737 ConstIterator_<VT> right( (~rhs).
begin() );
1739 if( useStreaming &&
columns > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1741 for( ; j<jpos; j+=SIMDSIZE ) {
1742 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1744 for( ; remainder && j<
columns; ++j ) {
1745 *left = *right; ++left; ++right;
1750 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1751 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1752 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1753 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1754 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1756 for( ; j<jpos; j+=SIMDSIZE ) {
1757 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1759 for( ; remainder && j<
columns; ++j ) {
1760 *left = *right; ++left; ++right;
1780 template<
typename MT
1782 template<
typename VT >
1783 inline void Row<MT,true,true,SF>::assign(
const SparseVector<VT,true>& rhs )
1787 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1788 matrix_(row_,element->index()) = element->value();
1806 template<
typename MT
1808 template<
typename VT >
1809 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1810 Row<MT,true,true,SF>::addAssign(
const DenseVector<VT,true>& rhs )
1814 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1815 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1816 matrix_(row_,j ) += (~rhs)[j ];
1817 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
1819 if( jpos < (~rhs).size() )
1820 matrix_(row_,jpos) += (~rhs)[jpos];
1838 template<
typename MT
1840 template<
typename VT >
1841 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
1842 Row<MT,true,true,SF>::addAssign(
const DenseVector<VT,true>& rhs )
1848 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1852 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1857 ConstIterator_<VT> right( (~rhs).
begin() );
1859 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1860 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1861 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1862 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1863 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1865 for( ; j<jpos; j+=SIMDSIZE ) {
1866 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1868 for( ; remainder && j<
columns; ++j ) {
1869 *left += *right; ++left; ++right;
1888 template<
typename MT
1890 template<
typename VT >
1891 inline void Row<MT,true,true,SF>::addAssign(
const SparseVector<VT,true>& rhs )
1895 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1896 matrix_(row_,element->index()) += element->value();
1914 template<
typename MT
1916 template<
typename VT >
1917 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1918 Row<MT,true,true,SF>::subAssign(
const DenseVector<VT,true>& rhs )
1922 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1923 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1924 matrix_(row_,j ) -= (~rhs)[j ];
1925 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
1927 if( jpos < (~rhs).size() )
1928 matrix_(row_,jpos) -= (~rhs)[jpos];
1946 template<
typename MT
1948 template<
typename VT >
1949 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
1950 Row<MT,true,true,SF>::subAssign(
const DenseVector<VT,true>& rhs )
1956 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
1960 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1965 ConstIterator_<VT> right( (~rhs).
begin() );
1967 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1968 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1969 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1970 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1971 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1973 for( ; j<jpos; j+=SIMDSIZE ) {
1974 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1976 for( ; remainder && j<
columns; ++j ) {
1977 *left -= *right; ++left; ++right;
1996 template<
typename MT
1998 template<
typename VT >
1999 inline void Row<MT,true,true,SF>::subAssign(
const SparseVector<VT,true>& rhs )
2003 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2004 matrix_(row_,element->index()) -= element->value();
2022 template<
typename MT
2024 template<
typename VT >
2025 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2026 Row<MT,true,true,SF>::multAssign(
const DenseVector<VT,true>& rhs )
2030 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2031 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2032 matrix_(row_,j ) *= (~rhs)[j ];
2033 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
2035 if( jpos < (~rhs).size() )
2036 matrix_(row_,jpos) *= (~rhs)[jpos];
2054 template<
typename MT
2056 template<
typename VT >
2057 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
2058 Row<MT,true,true,SF>::multAssign(
const DenseVector<VT,true>& rhs )
2064 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
2068 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
2073 ConstIterator_<VT> right( (~rhs).
begin() );
2075 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2076 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2077 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2078 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2079 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2081 for( ; j<jpos; j+=SIMDSIZE ) {
2082 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2084 for( ; remainder && j<
columns; ++j ) {
2085 *left *= *right; ++left; ++right;
2104 template<
typename MT
2106 template<
typename VT >
2107 inline void Row<MT,true,true,SF>::multAssign(
const SparseVector<VT,true>& rhs )
2115 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2116 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
2134 template<
typename MT
2136 template<
typename VT >
2137 inline DisableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2138 Row<MT,true,true,SF>::divAssign(
const DenseVector<VT,true>& rhs )
2142 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2143 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2144 matrix_(row_,j ) /= (~rhs)[j ];
2145 matrix_(row_,j+1UL) /= (~rhs)[j+1UL];
2147 if( jpos < (~rhs).size() )
2148 matrix_(row_,jpos) /= (~rhs)[jpos];
2166 template<
typename MT
2168 template<
typename VT >
2169 inline EnableIf_< typename Row<MT,true,true,SF>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
2170 Row<MT,true,true,SF>::divAssign(
const DenseVector<VT,true>& rhs )
2178 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
2183 ConstIterator_<VT> right( (~rhs).
begin() );
2185 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2186 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2187 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2188 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2189 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2191 for( ; j<jpos; j+=SIMDSIZE ) {
2192 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2195 *left /= *right; ++left; ++right;
2222 template<
typename MT >
2223 class Row<MT,false,true,false>
2224 :
public View< DenseVector< Row<MT,false,true,false>, true > >
2229 using Operand = If_< IsExpression<MT>, MT, MT& >;
2234 using This = Row<MT,false,true,false>;
2235 using BaseType = DenseVector<This,true>;
2238 using ElementType = ElementType_<MT>;
2243 using ConstReference = ConstReference_<MT>;
2249 using ConstPointer =
const ElementType*;
2252 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* >;
2258 template<
typename MatrixType >
2264 using Reference = If_< IsConst<MatrixType>, ConstReference_<MatrixType>, Reference_<MatrixType> >;
2266 using IteratorCategory = std::random_access_iterator_tag;
2267 using ValueType = RemoveReference_<Reference>;
2268 using PointerType = ValueType*;
2270 using DifferenceType = ptrdiff_t;
2273 using iterator_category = IteratorCategory;
2274 using value_type = ValueType;
2275 using pointer = PointerType;
2276 using reference = ReferenceType;
2277 using difference_type = DifferenceType;
2283 inline RowIterator() noexcept
2284 : matrix_(
nullptr )
2297 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2298 : matrix_( &matrix )
2309 template<
typename MatrixType2 >
2310 inline RowIterator(
const RowIterator<MatrixType2>& it ) noexcept
2311 : matrix_( it.matrix_ )
2313 , column_( it.column_ )
2323 inline RowIterator&
operator+=(
size_t inc ) noexcept {
2335 inline RowIterator&
operator-=(
size_t dec ) noexcept {
2346 inline RowIterator& operator++() noexcept {
2357 inline const RowIterator operator++(
int ) noexcept {
2358 const RowIterator tmp( *
this );
2369 inline RowIterator& operator--() noexcept {
2380 inline const RowIterator operator--(
int ) noexcept {
2381 const RowIterator tmp( *
this );
2393 inline ReferenceType operator[](
size_t index )
const {
2394 return (*matrix_)(row_,column_+index);
2403 inline ReferenceType
operator*()
const {
2404 return (*matrix_)(row_,column_);
2413 inline PointerType operator->()
const {
2414 return &(*matrix_)(row_,column_);
2424 template<
typename MatrixType2 >
2425 inline bool operator==(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2426 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2436 template<
typename MatrixType2 >
2437 inline bool operator!=(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2438 return !( *
this == rhs );
2448 template<
typename MatrixType2 >
2449 inline bool operator<( const RowIterator<MatrixType2>& rhs )
const noexcept {
2450 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ < rhs.column_ );
2460 template<
typename MatrixType2 >
2461 inline bool operator>(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2462 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ > rhs.column_ );
2472 template<
typename MatrixType2 >
2473 inline bool operator<=( const RowIterator<MatrixType2>& rhs )
const noexcept {
2474 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ <= rhs.column_ );
2484 template<
typename MatrixType2 >
2485 inline bool operator>=(
const RowIterator<MatrixType2>& rhs )
const noexcept {
2486 return ( matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ >= rhs.column_ );
2496 inline DifferenceType
operator-(
const RowIterator& rhs )
const noexcept {
2497 return column_ - rhs.column_;
2508 friend inline const RowIterator
operator+(
const RowIterator& it,
size_t inc ) noexcept {
2509 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2520 friend inline const RowIterator
operator+(
size_t inc,
const RowIterator& it ) noexcept {
2521 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2532 friend inline const RowIterator
operator-(
const RowIterator& it,
size_t dec ) noexcept {
2533 return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2539 MatrixType* matrix_;
2545 template<
typename MatrixType2 >
friend class RowIterator;
2552 using ConstIterator = RowIterator<const MT>;
2560 enum :
bool { simdEnabled =
false };
2563 enum :
bool { smpAssignable = MT::smpAssignable };
2569 explicit inline Row( Operand matrix,
size_t index );
2581 inline Reference operator[](
size_t index );
2582 inline ConstReference operator[](
size_t index )
const;
2584 inline ConstReference at(
size_t index )
const;
2585 inline Pointer data () noexcept;
2586 inline ConstPointer data () const noexcept;
2588 inline ConstIterator begin () const;
2589 inline ConstIterator
cbegin() const;
2591 inline ConstIterator end () const;
2592 inline ConstIterator
cend () const;
2599 inline Row& operator=( const ElementType& rhs );
2600 inline Row& operator=( initializer_list<ElementType> list );
2601 inline Row& operator=( const Row& rhs );
2603 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2604 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2605 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2606 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
2607 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
2608 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2609 template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
2611 template< typename Other >
2612 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
2614 template< typename Other >
2615 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
2622 inline Operand operand() const noexcept;
2623 inline
size_t row() const noexcept;
2624 inline
size_t size() const noexcept;
2625 inline
size_t spacing() const noexcept;
2626 inline
size_t capacity() const noexcept;
2628 inline
void reset();
2635 template< typename Other > inline Row& scale( const Other& scalar );
2642 template< typename Other >
2643 inline
bool canAlias( const Other* alias ) const noexcept;
2645 template< typename MT2,
bool SO2,
bool SF2 >
2646 inline
bool canAlias( const Row<MT2,SO2,true,SF2>* alias ) const noexcept;
2648 template< typename Other >
2649 inline
bool isAliased( const Other* alias ) const noexcept;
2651 template< typename MT2,
bool SO2,
bool SF2 >
2652 inline
bool isAliased( const Row<MT2,SO2,true,SF2>* alias ) const noexcept;
2654 inline
bool isAligned () const noexcept;
2655 inline
bool canSMPAssign() const noexcept;
2657 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2658 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2659 template< typename VT > inline
void addAssign ( const DenseVector <VT,true>& rhs );
2660 template< typename VT > inline
void addAssign ( const SparseVector<VT,true>& rhs );
2661 template< typename VT > inline
void subAssign ( const DenseVector <VT,true>& rhs );
2662 template< typename VT > inline
void subAssign ( const SparseVector<VT,true>& rhs );
2663 template< typename VT > inline
void multAssign( const DenseVector <VT,true>& rhs );
2664 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
2665 template< typename VT > inline
void divAssign ( const DenseVector <VT,true>& rhs );
2679 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
2712 template< typename MT >
2713 inline Row<MT,false,true,false>::Row( Operand matrix,
size_t index )
2717 if( matrix_.rows() <= index ) {
2743 template<
typename MT >
2745 Row<MT,false,true,false>::operator[](
size_t index )
2748 return matrix_(row_,index);
2764 template<
typename MT >
2766 Row<MT,false,true,false>::operator[](
size_t index )
const 2769 return const_cast<const MT&
>( matrix_ )(row_,index);
2786 template<
typename MT >
2788 Row<MT,false,true,false>::at(
size_t index )
2790 if( index >=
size() ) {
2793 return (*
this)[index];
2810 template<
typename MT >
2812 Row<MT,false,true,false>::at(
size_t index )
const 2814 if( index >=
size() ) {
2817 return (*
this)[index];
2832 template<
typename MT >
2833 inline typename Row<MT,false,true,false>::Pointer Row<MT,false,true,false>::data() noexcept
2835 return matrix_.data() + row_;
2850 template<
typename MT >
2851 inline typename Row<MT,false,true,false>::ConstPointer Row<MT,false,true,false>::data() const noexcept
2853 return matrix_.data() + row_;
2867 template<
typename MT >
2870 return Iterator( matrix_, row_, 0UL );
2884 template<
typename MT >
2901 template<
typename MT >
2918 template<
typename MT >
2935 template<
typename MT >
2952 template<
typename MT >
2980 template<
typename MT >
2981 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const ElementType& rhs )
2983 const size_t jbegin( ( IsUpper<MT>::value )
2984 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
2988 const size_t jend ( ( IsLower<MT>::value )
2989 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
2994 for(
size_t j=jbegin; j<jend; ++j )
2995 matrix_(row_,j) = rhs;
3016 template<
typename MT >
3017 inline Row<MT,false,true,false>&
3018 Row<MT,false,true,false>::operator=( initializer_list<ElementType> list )
3020 if( list.size() >
size() ) {
3048 template<
typename MT >
3049 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=(
const Row& rhs )
3051 if( &rhs ==
this )
return *
this;
3053 if(
size() != rhs.size() ) {
3057 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
3061 decltype(
auto) left( derestrict( *this ) );
3087 template< typename MT >
3088 template< typename VT >
3089 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator=( const Vector<VT,true>& rhs )
3099 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3100 Right right( ~rhs );
3102 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3106 decltype(
auto) left( derestrict( *this ) );
3108 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3113 if( IsSparseVector<VT>::value )
3140 template<
typename MT >
3141 template<
typename VT >
3151 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3152 Right right( ~rhs );
3154 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
3158 decltype(
auto) left( derestrict( *this ) );
3160 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3161 const ResultType_<VT> tmp( right );
3190 template<
typename MT >
3191 template<
typename VT >
3201 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3202 Right right( ~rhs );
3204 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
3208 decltype(
auto) left( derestrict( *this ) );
3210 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3211 const ResultType_<VT> tmp( right );
3239 template<
typename MT >
3240 template<
typename VT >
3250 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3251 Right right( ~rhs );
3253 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
3257 decltype(
auto) left( derestrict( *this ) );
3259 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3260 const ResultType_<VT> tmp( right );
3288 template<
typename MT >
3289 template<
typename VT >
3302 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3306 decltype(
auto) left( derestrict( *this ) );
3330 template< typename MT >
3331 template< typename VT >
3332 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator/=( const DenseVector<VT,true>& rhs )
3341 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
3342 Right right( ~rhs );
3344 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
3348 decltype(
auto) left( derestrict( *this ) );
3350 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3351 const ResultType_<VT> tmp( right );
3379 template<
typename MT >
3380 template<
typename VT >
3381 inline Row<MT,false,true,false>& Row<MT,false,true,false>::operator%=(
const Vector<VT,true>& rhs )
3383 using blaze::assign;
3388 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3394 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3398 const CrossType right( *
this % (~rhs) );
3400 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
3404 decltype(
auto) left( derestrict( *this ) );
3406 assign( left, right );
3427 template< typename MT >
3428 template< typename Other >
3429 inline
EnableIf_< IsNumeric<Other>, Row<MT,false,true,false> >&
3430 Row<MT,false,true,false>::operator*=( Other rhs )
3434 return operator=( (*
this) * rhs );
3453 template<
typename MT >
3454 template<
typename Other >
3455 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,false> >&
3462 return operator=( (*
this) / rhs );
3482 template<
typename MT >
3483 inline typename Row<MT,false,true,false>::Operand Row<MT,false,true,false>::operand() const noexcept
3497 template<
typename MT >
3512 template<
typename MT >
3515 return matrix_.columns();
3530 template<
typename MT >
3533 return matrix_.spacing();
3545 template<
typename MT >
3548 return matrix_.columns();
3563 template<
typename MT >
3567 size_t nonzeros( 0UL );
3569 for(
size_t j=0UL; j<
columns; ++j )
3585 template<
typename MT >
3590 const size_t jbegin( ( IsUpper<MT>::value )
3591 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3595 const size_t jend ( ( IsLower<MT>::value )
3596 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3601 for(
size_t j=jbegin; j<jend; ++j )
3602 clear( matrix_(row_,j) );
3629 template<
typename MT >
3630 template<
typename Other >
3631 inline Row<MT,false,true,false>& Row<MT,false,true,false>::scale(
const Other& scalar )
3635 const size_t jbegin( ( IsUpper<MT>::value )
3636 ?( ( IsStrictlyUpper<MT>::value )
3640 const size_t jend ( ( IsLower<MT>::value )
3641 ?( ( IsStrictlyLower<MT>::value )
3646 for(
size_t j=jbegin; j<jend; ++j ) {
3647 matrix_(row_,j) *= scalar;
3675 template<
typename MT >
3676 template<
typename Other >
3677 inline bool Row<MT,false,true,false>::canAlias(
const Other* alias )
const noexcept
3679 return matrix_.isAliased( alias );
3696 template<
typename MT >
3697 template<
typename MT2
3700 inline bool Row<MT,false,true,false>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
3702 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3719 template<
typename MT >
3720 template<
typename Other >
3721 inline bool Row<MT,false,true,false>::isAliased(
const Other* alias )
const noexcept
3723 return matrix_.isAliased( alias );
3740 template<
typename MT >
3741 template<
typename MT2
3744 inline bool Row<MT,false,true,false>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
3746 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
3762 template<
typename MT >
3763 inline bool Row<MT,false,true,false>::isAligned() const noexcept
3782 template<
typename MT >
3783 inline bool Row<MT,false,true,false>::canSMPAssign() const noexcept
3785 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3803 template<
typename MT >
3804 template<
typename VT >
3805 inline void Row<MT,false,true,false>::assign(
const DenseVector<VT,true>& rhs )
3809 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3810 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3811 matrix_(row_,j ) = (~rhs)[j ];
3812 matrix_(row_,j+1UL) = (~rhs)[j+1UL];
3814 if( jpos < (~rhs).size() )
3815 matrix_(row_,jpos) = (~rhs)[jpos];
3833 template<
typename MT >
3834 template<
typename VT >
3835 inline void Row<MT,false,true,false>::assign(
const SparseVector<VT,true>& rhs )
3839 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3840 matrix_(row_,element->index()) = element->value();
3858 template<
typename MT >
3859 template<
typename VT >
3860 inline void Row<MT,false,true,false>::addAssign(
const DenseVector<VT,true>& rhs )
3864 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3865 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3866 matrix_(row_,j ) += (~rhs)[j ];
3867 matrix_(row_,j+1UL) += (~rhs)[j+1UL];
3869 if( jpos < (~rhs).size() )
3870 matrix_(row_,jpos) += (~rhs)[jpos];
3888 template<
typename MT >
3889 template<
typename VT >
3890 inline void Row<MT,false,true,false>::addAssign(
const SparseVector<VT,true>& rhs )
3894 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3895 matrix_(row_,element->index()) += element->value();
3913 template<
typename MT >
3914 template<
typename VT >
3915 inline void Row<MT,false,true,false>::subAssign(
const DenseVector<VT,true>& rhs )
3919 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3920 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3921 matrix_(row_,j ) -= (~rhs)[j ];
3922 matrix_(row_,j+1UL) -= (~rhs)[j+1UL];
3924 if( jpos < (~rhs).size() )
3925 matrix_(row_,jpos) -= (~rhs)[jpos];
3943 template<
typename MT >
3944 template<
typename VT >
3945 inline void Row<MT,false,true,false>::subAssign(
const SparseVector<VT,true>& rhs )
3949 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3950 matrix_(row_,element->index()) -= element->value();
3968 template<
typename MT >
3969 template<
typename VT >
3970 inline void Row<MT,false,true,false>::multAssign(
const DenseVector<VT,true>& rhs )
3974 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3975 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3976 matrix_(row_,j ) *= (~rhs)[j ];
3977 matrix_(row_,j+1UL) *= (~rhs)[j+1UL];
3979 if( jpos < (~rhs).size() )
3980 matrix_(row_,jpos) *= (~rhs)[jpos];
3998 template<
typename MT >
3999 template<
typename VT >
4000 inline void Row<MT,false,true,false>::multAssign(
const SparseVector<VT,true>& rhs )
4008 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4009 matrix_(row_,element->index()) = tmp[element->index()] * element->value();
4027 template<
typename MT >
4028 template<
typename VT >
4029 inline void Row<MT,false,true,false>::divAssign(
const DenseVector<VT,true>& rhs )
4033 const size_t jpos( (~rhs).
size() &
size_t(-2) );
4034 for(
size_t j=0UL; j<jpos; j+=2UL ) {
4035 matrix_(row_,j ) /= (~rhs)[j ];
4036 matrix_(row_,j+1UL) /= (~rhs)[j+1UL];
4038 if( jpos < (~rhs).size() )
4039 matrix_(row_,jpos) /= (~rhs)[jpos];
4065 template<
typename MT >
4066 class Row<MT,false,true,true>
4067 :
public View< DenseVector< Row<MT,false,true,true>, true > >
4072 using Operand = If_< IsExpression<MT>, MT, MT& >;
4077 using This = Row<MT,false,true,true>;
4078 using BaseType = DenseVector<This,true>;
4081 using ElementType = ElementType_<MT>;
4082 using SIMDType = SIMDTrait_<ElementType>;
4087 using ConstReference = ConstReference_<MT>;
4093 using ConstPointer =
const ElementType*;
4096 using Pointer = If_< Or< IsConst<MT>, Not< HasMutableDataAccess<MT> > >, ConstPointer, ElementType* >;
4099 using ConstIterator = ConstIterator_<MT>;
4107 enum :
bool { simdEnabled = MT::simdEnabled };
4110 enum :
bool { smpAssignable = MT::smpAssignable };
4116 explicit inline Row( Operand matrix,
size_t index );
4128 inline Reference operator[](
size_t index );
4129 inline ConstReference operator[](
size_t index )
const;
4131 inline ConstReference at(
size_t index )
const;
4132 inline Pointer data () noexcept;
4133 inline ConstPointer data () const noexcept;
4135 inline ConstIterator begin () const;
4136 inline ConstIterator
cbegin() const;
4138 inline ConstIterator end () const;
4139 inline ConstIterator
cend () const;
4146 inline Row& operator=( const ElementType& rhs );
4147 inline Row& operator=( initializer_list<ElementType> list );
4148 inline Row& operator=( const Row& rhs );
4150 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
4151 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
4152 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
4153 template< typename VT > inline Row& operator*=( const DenseVector<VT,true>& rhs );
4154 template< typename VT > inline Row& operator*=( const SparseVector<VT,true>& rhs );
4155 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4156 template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4158 template< typename Other >
4159 inline
EnableIf_< IsNumeric<Other>, Row >& operator*=( Other rhs );
4161 template< typename Other >
4162 inline
EnableIf_< IsNumeric<Other>, Row >& operator/=( Other rhs );
4169 inline Operand operand() const noexcept;
4170 inline
size_t row() const noexcept;
4171 inline
size_t size() const noexcept;
4172 inline
size_t spacing() const noexcept;
4173 inline
size_t capacity() const noexcept;
4175 inline
void reset();
4182 template< typename Other > inline Row& scale( const Other& scalar );
4189 template< typename VT >
4190 struct VectorizedAssign {
4191 enum :
bool { value = useOptimizedKernels &&
4192 simdEnabled && VT::simdEnabled &&
4193 IsSIMDCombinable< ElementType, ElementType_<VT> >::value };
4199 template<
typename VT >
4200 struct VectorizedAddAssign {
4201 enum :
bool { value = useOptimizedKernels &&
4202 simdEnabled && VT::simdEnabled &&
4203 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4204 HasSIMDAdd< ElementType, ElementType_<VT> >::value };
4210 template<
typename VT >
4211 struct VectorizedSubAssign {
4212 enum :
bool { value = useOptimizedKernels &&
4213 simdEnabled && VT::simdEnabled &&
4214 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4215 HasSIMDSub< ElementType, ElementType_<VT> >::value };
4221 template<
typename VT >
4222 struct VectorizedMultAssign {
4223 enum :
bool { value = useOptimizedKernels &&
4224 simdEnabled && VT::simdEnabled &&
4225 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4226 HasSIMDMult< ElementType, ElementType_<VT> >::value };
4232 template<
typename VT >
4233 struct VectorizedDivAssign {
4234 enum :
bool { value = useOptimizedKernels &&
4235 simdEnabled && VT::simdEnabled &&
4236 IsSIMDCombinable< ElementType, ElementType_<VT> >::value &&
4237 HasSIMDDiv< ElementType, ElementType_<VT> >::value };
4250 template<
typename Other >
4251 inline bool canAlias(
const Other* alias )
const noexcept;
4253 template<
typename MT2,
bool SO2,
bool SF2 >
4254 inline bool canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
4256 template<
typename Other >
4257 inline bool isAliased(
const Other* alias )
const noexcept;
4259 template<
typename MT2,
bool SO2,
bool SF2 >
4260 inline bool isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept;
4262 inline bool isAligned () const noexcept;
4263 inline
bool canSMPAssign() const noexcept;
4274 template< typename VT >
4275 inline
DisableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4277 template< typename VT >
4278 inline
EnableIf_< VectorizedAssign<VT> > assign( const DenseVector<VT,true>& rhs );
4280 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
4282 template< typename VT >
4283 inline
DisableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4285 template< typename VT >
4286 inline
EnableIf_< VectorizedAddAssign<VT> > addAssign( const DenseVector<VT,true>& rhs );
4288 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4290 template< typename VT >
4291 inline
DisableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4293 template< typename VT >
4294 inline
EnableIf_< VectorizedSubAssign<VT> > subAssign( const DenseVector<VT,true>& rhs );
4296 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4298 template< typename VT >
4299 inline
DisableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4301 template< typename VT >
4302 inline
EnableIf_< VectorizedMultAssign<VT> > multAssign( const DenseVector<VT,true>& rhs );
4304 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
4306 template< typename VT >
4307 inline
DisableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4309 template< typename VT >
4310 inline
EnableIf_< VectorizedDivAssign<VT> > divAssign( const DenseVector<VT,true>& rhs );
4324 template< typename MT2,
bool SO2,
bool DF2,
bool SF2 > friend class Row;
4357 template< typename MT >
4358 inline Row<MT,false,true,true>::Row( Operand matrix,
size_t index )
4362 if( matrix_.rows() <= index ) {
4388 template<
typename MT >
4390 Row<MT,false,true,true>::operator[](
size_t index )
4393 return matrix_(index,row_);
4409 template<
typename MT >
4411 Row<MT,false,true,true>::operator[](
size_t index )
const 4414 return const_cast<const MT&
>( matrix_ )(row_,index);
4431 template<
typename MT >
4433 Row<MT,false,true,true>::at(
size_t index )
4435 if( index >=
size() ) {
4438 return (*
this)[index];
4455 template<
typename MT >
4457 Row<MT,false,true,true>::at(
size_t index )
const 4459 if( index >=
size() ) {
4462 return (*
this)[index];
4477 template<
typename MT >
4478 inline typename Row<MT,false,true,true>::Pointer Row<MT,false,true,true>::data() noexcept
4480 return matrix_.data( row_ );
4495 template<
typename MT >
4496 inline typename Row<MT,false,true,true>::ConstPointer Row<MT,false,true,true>::data() const noexcept
4498 return matrix_.data( row_ );
4512 template<
typename MT >
4515 return matrix_.begin( row_ );
4529 template<
typename MT >
4532 return matrix_.cbegin( row_ );
4546 template<
typename MT >
4549 return matrix_.cbegin( row_ );
4563 template<
typename MT >
4566 return matrix_.end( row_ );
4580 template<
typename MT >
4583 return matrix_.cend( row_ );
4597 template<
typename MT >
4600 return matrix_.cend( row_ );
4621 template<
typename MT >
4622 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const ElementType& rhs )
4624 const size_t ibegin( ( IsLower<MT>::value )
4625 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
4629 const size_t iend ( ( IsUpper<MT>::value )
4630 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
4635 for(
size_t i=ibegin; i<iend; ++i )
4636 matrix_(i,row_) = rhs;
4657 template<
typename MT >
4658 inline Row<MT,false,true,true>&
4659 Row<MT,false,true,true>::operator=( initializer_list<ElementType> list )
4661 if( list.size() >
size() ) {
4689 template<
typename MT >
4690 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=(
const Row& rhs )
4692 if( &rhs ==
this )
return *
this;
4694 if(
size() != rhs.size() ) {
4698 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
4702 decltype(
auto) left( derestrict( *this ) );
4728 template< typename MT >
4729 template< typename VT >
4730 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator=( const Vector<VT,true>& rhs )
4739 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4740 Right right( ~rhs );
4742 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4746 decltype(
auto) left( derestrict( *this ) );
4748 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4749 const ResultType_<VT> tmp( right );
4753 if( IsSparseVector<VT>::value )
4780 template<
typename MT >
4781 template<
typename VT >
4791 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4792 Right right( ~rhs );
4794 if( !tryAddAssign( matrix_, right, row_, 0UL ) ) {
4798 decltype(
auto) left( derestrict( *this ) );
4800 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4801 const ResultType_<VT> tmp( right );
4830 template<
typename MT >
4831 template<
typename VT >
4841 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4842 Right right( ~rhs );
4844 if( !trySubAssign( matrix_, right, row_, 0UL ) ) {
4848 decltype(
auto) left( derestrict( *this ) );
4850 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4851 const ResultType_<VT> tmp( right );
4879 template<
typename MT >
4880 template<
typename VT >
4890 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4891 Right right( ~rhs );
4893 if( !tryMultAssign( matrix_, right, row_, 0UL ) ) {
4897 decltype(
auto) left( derestrict( *this ) );
4899 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4900 const ResultType_<VT> tmp( right );
4928 template<
typename MT >
4929 template<
typename VT >
4942 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4946 decltype(
auto) left( derestrict( *this ) );
4970 template< typename MT >
4971 template< typename VT >
4972 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator/=( const DenseVector<VT,true>& rhs )
4981 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4982 Right right( ~rhs );
4984 if( !tryDivAssign( matrix_, right, row_, 0UL ) ) {
4988 decltype(
auto) left( derestrict( *this ) );
4990 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4991 const ResultType_<VT> tmp( right );
5019 template<
typename MT >
5020 template<
typename VT >
5021 inline Row<MT,false,true,true>& Row<MT,false,true,true>::operator%=(
const Vector<VT,true>& rhs )
5023 using blaze::assign;
5028 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5034 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5038 const CrossType right( *
this % (~rhs) );
5040 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
5044 decltype(
auto) left( derestrict( *this ) );
5046 assign( left, right );
5067 template< typename MT >
5068 template< typename Other >
5069 inline
EnableIf_< IsNumeric<Other>, Row<MT,false,true,true> >&
5070 Row<MT,false,true,true>::operator*=( Other rhs )
5074 return operator=( (*
this) * rhs );
5093 template<
typename MT >
5094 template<
typename Other >
5095 inline EnableIf_< IsNumeric<Other>, Row<MT,false,true,true> >&
5102 return operator=( (*
this) / rhs );
5122 template<
typename MT >
5123 inline typename Row<MT,false,true,true>::Operand Row<MT,false,true,true>::operand() const noexcept
5137 template<
typename MT >
5152 template<
typename MT >
5155 return matrix_.columns();
5170 template<
typename MT >
5173 return matrix_.spacing();
5185 template<
typename MT >
5188 return matrix_.capacity( row_ );
5203 template<
typename MT >
5206 return matrix_.nonZeros( row_ );
5218 template<
typename MT >
5221 matrix_.reset( row_ );
5248 template<
typename MT >
5249 template<
typename Other >
5250 inline Row<MT,false,true,true>& Row<MT,false,true,true>::scale(
const Other& scalar )
5254 const size_t ibegin( ( IsLower<MT>::value )
5255 ?( ( IsStrictlyLower<MT>::value )
5259 const size_t iend ( ( IsUpper<MT>::value )
5260 ?( ( IsStrictlyUpper<MT>::value )
5265 for(
size_t i=ibegin; i<iend; ++i ) {
5266 matrix_(i,row_) *= scalar;
5294 template<
typename MT >
5295 template<
typename Other >
5296 inline bool Row<MT,false,true,true>::canAlias(
const Other* alias )
const noexcept
5298 return matrix_.isAliased( alias );
5315 template<
typename MT >
5316 template<
typename MT2
5319 inline bool Row<MT,false,true,true>::canAlias(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
5321 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5338 template<
typename MT >
5339 template<
typename Other >
5340 inline bool Row<MT,false,true,true>::isAliased(
const Other* alias )
const noexcept
5342 return matrix_.isAliased( alias );
5359 template<
typename MT >
5360 template<
typename MT2
5363 inline bool Row<MT,false,true,true>::isAliased(
const Row<MT2,SO2,true,SF2>* alias )
const noexcept
5365 return matrix_.isAliased( &alias->matrix_ ) && ( row_ == alias->row_ );
5381 template<
typename MT >
5382 inline bool Row<MT,false,true,true>::isAligned() const noexcept
5384 return matrix_.isAligned();
5401 template<
typename MT >
5402 inline bool Row<MT,false,true,true>::canSMPAssign() const noexcept
5404 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5423 template<
typename MT >
5425 Row<MT,false,true,true>::load(
size_t index )
const noexcept
5427 return matrix_.load( index, row_ );
5446 template<
typename MT >
5450 return matrix_.loada( index, row_ );
5469 template<
typename MT >
5473 return matrix_.loadu( index, row_ );
5493 template<
typename MT >
5495 Row<MT,false,true,true>::store(
size_t index,
const SIMDType& value ) noexcept
5497 matrix_.store( index, row_, value );
5517 template<
typename MT >
5521 matrix_.storea( index, row_, value );
5541 template<
typename MT >
5545 matrix_.storeu( index, row_, value );
5565 template<
typename MT >
5569 matrix_.stream( index, row_, value );
5587 template<
typename MT >
5588 template<
typename VT >
5589 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5590 Row<MT,false,true,true>::assign(
const DenseVector<VT,true>& rhs )
5594 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5595 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5596 matrix_(i ,row_) = (~rhs)[i ];
5597 matrix_(i+1UL,row_) = (~rhs)[i+1UL];
5599 if( ipos < (~rhs).size() )
5600 matrix_(ipos,row_) = (~rhs)[ipos];
5618 template<
typename MT >
5619 template<
typename VT >
5620 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAssign<VT> >
5621 Row<MT,false,true,true>::assign(
const DenseVector<VT,true>& rhs )
5627 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5631 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5636 ConstIterator_<VT> right( (~rhs).
begin() );
5638 if( useStreaming &&
rows > ( cacheSize/(
sizeof(ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
5640 for( ; i<ipos; i+=SIMDSIZE ) {
5641 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5643 for( ; remainder && i<
rows; ++i ) {
5644 *left = *right; ++left; ++right;
5649 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5650 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5651 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5652 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5653 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5655 for( ; i<ipos; i+=SIMDSIZE ) {
5656 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5658 for( ; remainder && i<
rows; ++i ) {
5659 *left = *right; ++left; ++right;
5679 template<
typename MT >
5680 template<
typename VT >
5681 inline void Row<MT,false,true,true>::assign(
const SparseVector<VT,true>& rhs )
5685 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5686 matrix_(element->index(),row_) = element->value();
5704 template<
typename MT >
5705 template<
typename VT >
5706 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5707 Row<MT,false,true,true>::addAssign(
const DenseVector<VT,true>& rhs )
5711 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5712 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5713 matrix_(i ,row_) += (~rhs)[i ];
5714 matrix_(i+1UL,row_) += (~rhs)[i+1UL];
5716 if( ipos < (~rhs).size() )
5717 matrix_(ipos,row_) += (~rhs)[ipos];
5735 template<
typename MT >
5736 template<
typename VT >
5737 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedAddAssign<VT> >
5738 Row<MT,false,true,true>::addAssign(
const DenseVector<VT,true>& rhs )
5744 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5748 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5753 ConstIterator_<VT> right( (~rhs).
begin() );
5755 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5756 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5757 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5758 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5759 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5761 for( ; i<ipos; i+=SIMDSIZE ) {
5762 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5764 for( ; remainder && i<
rows; ++i ) {
5765 *left += *right; ++left; ++right;
5784 template<
typename MT >
5785 template<
typename VT >
5786 inline void Row<MT,false,true,true>::addAssign(
const SparseVector<VT,true>& rhs )
5790 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5791 matrix_(element->index(),row_) += element->value();
5809 template<
typename MT >
5810 template<
typename VT >
5811 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5812 Row<MT,false,true,true>::subAssign(
const DenseVector<VT,true>& rhs )
5816 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5817 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5818 matrix_(i ,row_) -= (~rhs)[i ];
5819 matrix_(i+1UL,row_) -= (~rhs)[i+1UL];
5821 if( ipos < (~rhs).size() )
5822 matrix_(ipos,row_) -= (~rhs)[ipos];
5840 template<
typename MT >
5841 template<
typename VT >
5842 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedSubAssign<VT> >
5843 Row<MT,false,true,true>::subAssign(
const DenseVector<VT,true>& rhs )
5849 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5853 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5858 ConstIterator_<VT> right( (~rhs).
begin() );
5860 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5861 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5862 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5863 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5864 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5866 for( ; i<ipos; i+=SIMDSIZE ) {
5867 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5869 for( ; remainder && i<
rows; ++i ) {
5870 *left -= *right; ++left; ++right;
5889 template<
typename MT >
5890 template<
typename VT >
5891 inline void Row<MT,false,true,true>::subAssign(
const SparseVector<VT,true>& rhs )
5895 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5896 matrix_(element->index(),row_) -= element->value();
5914 template<
typename MT >
5915 template<
typename VT >
5916 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5917 Row<MT,false,true,true>::multAssign(
const DenseVector<VT,true>& rhs )
5921 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5922 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5923 matrix_(i ,row_) *= (~rhs)[i ];
5924 matrix_(i+1UL,row_) *= (~rhs)[i+1UL];
5926 if( ipos < (~rhs).size() )
5927 matrix_(ipos,row_) *= (~rhs)[ipos];
5945 template<
typename MT >
5946 template<
typename VT >
5947 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedMultAssign<VT> >
5948 Row<MT,false,true,true>::multAssign(
const DenseVector<VT,true>& rhs )
5954 constexpr
bool remainder( !IsPadded<MT>::value || !IsPadded<VT>::value );
5958 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5963 ConstIterator_<VT> right( (~rhs).
begin() );
5965 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5966 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5967 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5968 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5969 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5971 for( ; i<ipos; i+=SIMDSIZE ) {
5972 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5974 for( ; remainder && i<
rows; ++i ) {
5975 *left *= *right; ++left; ++right;
5994 template<
typename MT >
5995 template<
typename VT >
5996 inline void Row<MT,false,true,true>::multAssign(
const SparseVector<VT,true>& rhs )
6004 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
6005 matrix_(element->index(),row_) = tmp[element->index()] * element->value();
6023 template<
typename MT >
6024 template<
typename VT >
6025 inline DisableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6026 Row<MT,false,true,true>::divAssign(
const DenseVector<VT,true>& rhs )
6030 const size_t ipos( (~rhs).
size() &
size_t(-2) );
6031 for(
size_t i=0UL; i<ipos; i+=2UL ) {
6032 matrix_(i ,row_) /= (~rhs)[i ];
6033 matrix_(i+1UL,row_) /= (~rhs)[i+1UL];
6035 if( ipos < (~rhs).size() )
6036 matrix_(ipos,row_) /= (~rhs)[ipos];
6054 template<
typename MT >
6055 template<
typename VT >
6056 inline EnableIf_< typename Row<MT,false,true,true>::BLAZE_TEMPLATE VectorizedDivAssign<VT> >
6057 Row<MT,false,true,true>::divAssign(
const DenseVector<VT,true>& rhs )
6065 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
6070 ConstIterator_<VT> right( (~rhs).
begin() );
6072 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6073 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6074 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6075 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6076 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6078 for( ; i<ipos; i+=SIMDSIZE ) {
6079 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6081 for( ; i<
rows; ++i ) {
6082 *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.
#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:356
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:164
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
#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:1411
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
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:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
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
EnableIf_< IsDenseVector< VT1 > > smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:193
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Header file for the DenseVector base class.
#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 Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
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:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
#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
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
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:1393
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:133
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:308
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:242
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:110
Header file for the std::initializer_list aliases.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
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.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
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.
#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
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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:102
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
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.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
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:340
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:61
Constraint on the data type.
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
Header file for the IsPadded type trait.
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.
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the cross product trait.
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
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.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
#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:224
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
#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
Header file for the HasSIMDDiv type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
#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:600
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
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.