35 #ifndef _BLAZE_MATH_VIEWS_ROW_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_ROW_DENSE_H_ 122 template<
typename MT
125 class Row<MT,true,true,SF,CRAs...>
126 :
public View< DenseVector< Row<MT,true,true,SF,CRAs...>, true > >
127 ,
private RowData<CRAs...>
131 using DataType = RowData<CRAs...>;
132 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
138 using This = Row<MT,
true,
true,SF,CRAs...>;
140 using BaseType = DenseVector<This,true>;
141 using ViewedType = MT;
145 using SIMDType = SIMDTrait_t<ElementType>;
156 using ConstPointer = ConstPointer_t<MT>;
159 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
170 static constexpr
bool simdEnabled = MT::simdEnabled;
179 template<
typename... RRAs >
180 explicit inline Row( MT& matrix, RRAs... args );
182 Row(
const Row& ) =
default;
196 inline Reference operator[](
size_t index );
200 inline Pointer
data () noexcept;
201 inline ConstPointer
data () const noexcept;
215 inline Row& operator=( initializer_list<
ElementType> list );
216 inline Row& operator=( const Row& rhs );
218 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
219 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
220 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
221 template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
222 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
223 template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
232 inline MT& operand() noexcept;
233 inline const MT& operand() const noexcept;
235 inline
size_t size() const noexcept;
236 inline
size_t spacing() const noexcept;
237 inline
size_t capacity() const noexcept;
246 template< typename Other > inline Row& scale( const Other& scalar );
253 template< typename VT >
254 static constexpr
bool VectorizedAssign_v =
255 ( useOptimizedKernels &&
256 simdEnabled && VT::simdEnabled &&
262 template< typename VT >
263 static constexpr
bool VectorizedAddAssign_v =
264 ( useOptimizedKernels &&
265 simdEnabled && VT::simdEnabled &&
272 template< typename VT >
273 static constexpr
bool VectorizedSubAssign_v =
274 ( useOptimizedKernels &&
275 simdEnabled && VT::simdEnabled &&
282 template< typename VT >
283 static constexpr
bool VectorizedMultAssign_v =
284 ( useOptimizedKernels &&
285 simdEnabled && VT::simdEnabled &&
292 template< typename VT >
293 static constexpr
bool VectorizedDivAssign_v =
294 ( useOptimizedKernels &&
295 simdEnabled && VT::simdEnabled &&
309 template< typename Other >
310 inline
bool canAlias( const Other* alias ) const noexcept;
312 template< typename MT2,
bool SO2,
bool SF2,
size_t... CRAs2 >
313 inline
bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
315 template< typename Other >
316 inline
bool isAliased( const Other* alias ) const noexcept;
318 template< typename MT2,
bool SO2,
bool SF2,
size_t... CRAs2 >
319 inline
bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
321 inline
bool isAligned () const noexcept;
322 inline
bool canSMPAssign() const noexcept;
333 template< typename VT >
334 inline auto assign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedAssign_v<VT> >;
336 template< typename VT >
337 inline auto assign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedAssign_v<VT> >;
339 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
341 template< typename VT >
342 inline auto addAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<VT> >;
344 template< typename VT >
345 inline auto addAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<VT> >;
347 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
349 template< typename VT >
350 inline auto subAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<VT> >;
352 template< typename VT >
353 inline auto subAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<VT> >;
355 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
357 template< typename VT >
358 inline auto multAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedMultAssign_v<VT> >;
360 template< typename VT >
361 inline auto multAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedMultAssign_v<VT> >;
363 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
365 template< typename VT >
366 inline auto divAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedDivAssign_v<VT> >;
368 template< typename VT >
369 inline auto divAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedDivAssign_v<VT> >;
382 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CRAs2 > friend class Row;
420 template< typename MT
423 template< typename... RRAs >
424 inline Row<MT,true,true,SF,CRAs...>::Row( MT& matrix, RRAs... args )
425 : DataType( args... )
429 if( matrix_.rows() <=
row() ) {
459 template<
typename MT
462 inline typename Row<MT,
true,
true,SF,CRAs...>
::Reference 463 Row<MT,true,true,SF,CRAs...>::operator[](
size_t index )
466 return matrix_(
row(),index);
482 template<
typename MT
486 Row<MT,true,true,SF,CRAs...>::operator[](
size_t index )
const 489 return const_cast<const MT&
>( matrix_ )(
row(),index);
506 template<
typename MT
509 inline typename Row<MT,
true,
true,SF,CRAs...>
::Reference 510 Row<MT,true,true,SF,CRAs...>::at(
size_t index )
512 if( index >=
size() ) {
515 return (*
this)[index];
532 template<
typename MT
536 Row<MT,true,true,SF,CRAs...>::at(
size_t index )
const 538 if( index >=
size() ) {
541 return (*
this)[index];
556 template<
typename MT
559 inline typename Row<MT,
true,
true,SF,CRAs...>::Pointer
562 return matrix_.data(
row() );
577 template<
typename MT
580 inline typename Row<MT,
true,
true,SF,CRAs...>::ConstPointer
583 return matrix_.data(
row() );
597 template<
typename MT
600 inline typename Row<MT,
true,
true,SF,CRAs...>
::Iterator 603 return matrix_.begin(
row() );
617 template<
typename MT
623 return matrix_.cbegin(
row() );
637 template<
typename MT
643 return matrix_.cbegin(
row() );
657 template<
typename MT
660 inline typename Row<MT,
true,
true,SF,CRAs...>
::Iterator 663 return matrix_.end(
row() );
677 template<
typename MT
683 return matrix_.cend(
row() );
697 template<
typename MT
703 return matrix_.cend(
row() );
728 template<
typename MT
731 inline Row<MT,
true,
true,SF,CRAs...>&
732 Row<MT,true,true,SF,CRAs...>::operator=(
const ElementType& rhs )
734 decltype(
auto) left( derestrict( matrix_ ) );
747 for(
size_t j=jbegin; j<jend; ++j ) {
748 if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_,
row(), j, rhs ) )
773 template<
typename MT
776 inline Row<MT,
true,
true,SF,CRAs...>&
777 Row<MT,true,true,SF,CRAs...>::operator=( initializer_list<ElementType> list )
779 if( list.size() >
size() ) {
783 if( IsRestricted_v<MT> ) {
784 const InitializerVector<ElementType,true> tmp( list,
size() );
785 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
790 decltype(
auto) left( derestrict( *this ) );
816 template< typename MT
819 inline Row<MT,true,true,SF,CRAs...>&
820 Row<MT,true,true,SF,CRAs...>::operator=( const Row& rhs )
822 if( &rhs ==
this )
return *
this;
824 if(
size() != rhs.size() ) {
828 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
832 decltype(
auto) left( derestrict( *this ) );
864 template<
typename MT
867 template<
typename VT >
868 inline Row<MT,
true,
true,SF,CRAs...>&
869 Row<MT,true,true,SF,CRAs...>::operator=(
const Vector<VT,true>& rhs )
878 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
881 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
885 decltype(
auto) left( derestrict( *this ) );
888 const ResultType_t<VT> tmp( right );
892 if( IsSparseVector_v<VT> )
919 template<
typename MT
922 template<
typename VT >
923 inline Row<MT,
true,
true,SF,CRAs...>&
933 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
936 if( !tryAddAssign( matrix_, right,
row(), 0UL ) ) {
940 decltype(
auto) left( derestrict( *this ) );
943 const ResultType_t<VT> tmp( right );
972 template<
typename MT
975 template<
typename VT >
976 inline Row<MT,
true,
true,SF,CRAs...>&
986 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
989 if( !trySubAssign( matrix_, right,
row(), 0UL ) ) {
993 decltype(
auto) left( derestrict( *this ) );
996 const ResultType_t<VT> tmp( right );
1024 template<
typename MT
1027 template<
typename VT >
1028 inline Row<MT,
true,
true,SF,CRAs...>&
1038 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
1039 Right right( ~rhs );
1041 if( !tryMultAssign( matrix_, right,
row(), 0UL ) ) {
1045 decltype(
auto) left( derestrict( *this ) );
1048 const ResultType_t<VT> tmp( right );
1075 template<
typename MT
1078 template<
typename VT >
1079 inline Row<MT,
true,
true,SF,CRAs...>&
1089 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
1090 Right right( ~rhs );
1092 if( !tryDivAssign( matrix_, right,
row(), 0UL ) ) {
1096 decltype(
auto) left( derestrict( *this ) );
1099 const ResultType_t<VT> tmp( right );
1127 template<
typename MT
1130 template<
typename VT >
1131 inline Row<MT,
true,
true,SF,CRAs...>&
1132 Row<MT,true,true,SF,CRAs...>::operator%=(
const Vector<VT,true>& rhs )
1134 using blaze::assign;
1139 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1145 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1149 const CrossType right( *
this % (~rhs) );
1151 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
1155 decltype(
auto) left( derestrict( *this ) );
1157 assign( left, right );
1181 template< typename MT
1184 inline MT& Row<MT,true,true,SF,CRAs...>::operand() noexcept
1198 template<
typename MT
1201 inline const MT& Row<MT,true,true,SF,CRAs...>::operand() const noexcept
1215 template<
typename MT
1220 return matrix_.columns();
1235 template<
typename MT
1240 return matrix_.spacing();
1252 template<
typename MT
1257 return matrix_.capacity(
row() );
1272 template<
typename MT
1277 return matrix_.nonZeros(
row() );
1289 template<
typename MT
1294 matrix_.reset(
row() );
1321 template<
typename MT
1324 template<
typename Other >
1325 inline Row<MT,
true,
true,SF,CRAs...>&
1326 Row<MT,true,true,SF,CRAs...>::scale(
const Other& scalar )
1330 const size_t jbegin( ( IsUpper_v<MT> )
1331 ?( ( IsStrictlyUpper_v<MT> )
1335 const size_t jend ( ( IsLower_v<MT> )
1336 ?( ( IsStrictlyLower_v<MT> )
1341 for(
size_t j=jbegin; j<jend; ++j ) {
1342 matrix_(
row(),j) *= scalar;
1370 template<
typename MT
1373 template<
typename Other >
1374 inline bool Row<MT,true,true,SF,CRAs...>::canAlias(
const Other* alias )
const noexcept
1376 return matrix_.isAliased( alias );
1393 template<
typename MT
1396 template<
typename MT2
1401 Row<MT,true,true,SF,CRAs...>::canAlias(
const Row<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
1403 return matrix_.isAliased( &alias->matrix_ ) && (
row() == alias->row() );
1420 template<
typename MT
1423 template<
typename Other >
1424 inline bool Row<MT,true,true,SF,CRAs...>::isAliased(
const Other* alias )
const noexcept
1426 return matrix_.isAliased( alias );
1443 template<
typename MT
1446 template<
typename MT2
1451 Row<MT,true,true,SF,CRAs...>::isAliased(
const Row<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
1453 return matrix_.isAliased( &alias->matrix_ ) && (
row() == alias->row() );
1469 template<
typename MT
1472 inline bool Row<MT,true,true,SF,CRAs...>::isAligned() const noexcept
1474 return matrix_.isAligned();
1491 template<
typename MT
1494 inline bool Row<MT,true,true,SF,CRAs...>::canSMPAssign() const noexcept
1496 return (
size() > SMP_DVECASSIGN_THRESHOLD );
1515 template<
typename MT
1519 Row<MT,true,true,SF,CRAs...>::load(
size_t index )
const noexcept
1521 return matrix_.load(
row(), index );
1540 template<
typename MT
1546 return matrix_.loada(
row(), index );
1565 template<
typename MT
1571 return matrix_.loadu(
row(), index );
1591 template<
typename MT
1595 Row<MT,true,true,SF,CRAs...>::store(
size_t index,
const SIMDType& value ) noexcept
1597 matrix_.store(
row(), index, value );
1617 template<
typename MT
1623 matrix_.storea(
row(), index, value );
1643 template<
typename MT
1649 matrix_.storeu(
row(), index, value );
1669 template<
typename MT
1675 matrix_.stream(
row(), index, value );
1693 template<
typename MT
1696 template<
typename VT >
1697 inline auto Row<MT,true,true,SF,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
1698 -> DisableIf_t< VectorizedAssign_v<VT> >
1702 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1703 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1704 matrix_(
row(),j ) = (~rhs)[j ];
1705 matrix_(
row(),j+1UL) = (~rhs)[j+1UL];
1707 if( jpos < (~rhs).size() )
1708 matrix_(
row(),jpos) = (~rhs)[jpos];
1726 template<
typename MT
1729 template<
typename VT >
1730 inline auto Row<MT,true,true,SF,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
1731 -> EnableIf_t< VectorizedAssign_v<VT> >
1737 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1741 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1746 ConstIterator_t<VT> right( (~rhs).
begin() );
1748 if( useStreaming &&
columns > ( cacheSize/(
sizeof(
ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
1750 for( ; j<jpos; j+=SIMDSIZE ) {
1751 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1753 for( ; remainder && j<
columns; ++j ) {
1754 *left = *right; ++left; ++right;
1759 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1760 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1761 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1762 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1763 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1765 for( ; j<jpos; j+=SIMDSIZE ) {
1766 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1768 for( ; remainder && j<
columns; ++j ) {
1769 *left = *right; ++left; ++right;
1789 template<
typename MT
1792 template<
typename VT >
1793 inline void Row<MT,true,true,SF,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
1797 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1798 matrix_(
row(),element->index()) = element->value();
1816 template<
typename MT
1819 template<
typename VT >
1820 inline auto Row<MT,true,true,SF,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
1821 -> DisableIf_t< VectorizedAddAssign_v<VT> >
1825 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1826 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1827 matrix_(
row(),j ) += (~rhs)[j ];
1828 matrix_(
row(),j+1UL) += (~rhs)[j+1UL];
1830 if( jpos < (~rhs).size() )
1831 matrix_(
row(),jpos) += (~rhs)[jpos];
1849 template<
typename MT
1852 template<
typename VT >
1853 inline auto Row<MT,true,true,SF,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
1854 -> EnableIf_t< VectorizedAddAssign_v<VT> >
1860 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1864 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1869 ConstIterator_t<VT> right( (~rhs).
begin() );
1871 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1872 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1873 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1874 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1875 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1877 for( ; j<jpos; j+=SIMDSIZE ) {
1878 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1880 for( ; remainder && j<
columns; ++j ) {
1881 *left += *right; ++left; ++right;
1900 template<
typename MT
1903 template<
typename VT >
1904 inline void Row<MT,true,true,SF,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
1908 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
1909 matrix_(
row(),element->index()) += element->value();
1927 template<
typename MT
1930 template<
typename VT >
1931 inline auto Row<MT,true,true,SF,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
1932 -> DisableIf_t< VectorizedSubAssign_v<VT> >
1936 const size_t jpos( (~rhs).
size() &
size_t(-2) );
1937 for(
size_t j=0UL; j<jpos; j+=2UL ) {
1938 matrix_(
row(),j ) -= (~rhs)[j ];
1939 matrix_(
row(),j+1UL) -= (~rhs)[j+1UL];
1941 if( jpos < (~rhs).size() )
1942 matrix_(
row(),jpos) -= (~rhs)[jpos];
1960 template<
typename MT
1963 template<
typename VT >
1964 inline auto Row<MT,true,true,SF,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
1965 -> EnableIf_t< VectorizedSubAssign_v<VT> >
1971 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
1975 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
1980 ConstIterator_t<VT> right( (~rhs).
begin() );
1982 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
1983 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1984 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1985 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1986 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1988 for( ; j<jpos; j+=SIMDSIZE ) {
1989 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
1991 for( ; remainder && j<
columns; ++j ) {
1992 *left -= *right; ++left; ++right;
2011 template<
typename MT
2014 template<
typename VT >
2015 inline void Row<MT,true,true,SF,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
2019 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
2020 matrix_(
row(),element->index()) -= element->value();
2038 template<
typename MT
2041 template<
typename VT >
2042 inline auto Row<MT,true,true,SF,CRAs...>::multAssign(
const DenseVector<VT,true>& rhs )
2043 -> DisableIf_t< VectorizedMultAssign_v<VT> >
2047 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2048 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2049 matrix_(
row(),j ) *= (~rhs)[j ];
2050 matrix_(
row(),j+1UL) *= (~rhs)[j+1UL];
2052 if( jpos < (~rhs).size() )
2053 matrix_(
row(),jpos) *= (~rhs)[jpos];
2071 template<
typename MT
2074 template<
typename VT >
2075 inline auto Row<MT,true,true,SF,CRAs...>::multAssign(
const DenseVector<VT,true>& rhs )
2076 -> EnableIf_t< VectorizedMultAssign_v<VT> >
2082 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
2086 const size_t jpos( ( remainder )?(
columns &
size_t(-SIMDSIZE) ):(
columns ) );
2091 ConstIterator_t<VT> right( (~rhs).
begin() );
2093 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2094 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2095 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2096 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2097 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2099 for( ; j<jpos; j+=SIMDSIZE ) {
2100 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2102 for( ; remainder && j<
columns; ++j ) {
2103 *left *= *right; ++left; ++right;
2122 template<
typename MT
2125 template<
typename VT >
2126 inline void Row<MT,true,true,SF,CRAs...>::multAssign(
const SparseVector<VT,true>& rhs )
2134 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
2135 const size_t index( element->index() );
2136 for( ; j<index; ++j )
2138 matrix_(
row(),j) *= element->value();
2142 for( ; j<
size(); ++j ) {
2162 template<
typename MT
2165 template<
typename VT >
2166 inline auto Row<MT,true,true,SF,CRAs...>::divAssign(
const DenseVector<VT,true>& rhs )
2167 -> DisableIf_t< VectorizedDivAssign_v<VT> >
2171 const size_t jpos( (~rhs).
size() &
size_t(-2) );
2172 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2173 matrix_(
row(),j ) /= (~rhs)[j ];
2174 matrix_(
row(),j+1UL) /= (~rhs)[j+1UL];
2176 if( jpos < (~rhs).size() )
2177 matrix_(
row(),jpos) /= (~rhs)[jpos];
2195 template<
typename MT
2198 template<
typename VT >
2199 inline auto Row<MT,true,true,SF,CRAs...>::divAssign(
const DenseVector<VT,true>& rhs )
2200 -> EnableIf_t< VectorizedDivAssign_v<VT> >
2208 const size_t jpos(
columns &
size_t(-SIMDSIZE) );
2213 ConstIterator_t<VT> right( (~rhs).
begin() );
2215 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2216 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2217 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2218 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2219 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2221 for( ; j<jpos; j+=SIMDSIZE ) {
2222 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2225 *left /= *right; ++left; ++right;
2252 template<
typename MT
2254 class Row<MT,false,true,false,CRAs...>
2255 :
public View< DenseVector< Row<MT,false,true,false,CRAs...>, true > >
2256 ,
private RowData<CRAs...>
2260 using DataType = RowData<CRAs...>;
2261 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2267 using This = Row<MT,
false,
true,
false,CRAs...>;
2269 using BaseType = DenseVector<This,true>;
2270 using ViewedType = MT;
2284 using ConstPointer = ConstPointer_t<MT>;
2287 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
2293 template<
typename MatrixType
2294 ,
typename IteratorType >
2300 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
2303 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
2306 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
2309 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
2312 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
2315 using iterator_category = IteratorCategory;
2316 using value_type = ValueType;
2317 using pointer = PointerType;
2318 using reference = ReferenceType;
2319 using difference_type = DifferenceType;
2325 inline RowIterator() noexcept
2326 : matrix_(
nullptr )
2340 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
2341 : matrix_( &matrix )
2346 if( column_ != matrix_->columns() )
2347 pos_ = matrix_->begin( column_ ) + row_;
2356 template<
typename MatrixType2,
typename IteratorType2 >
2357 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it ) noexcept
2358 : matrix_( it.matrix_ )
2360 , column_( it.column_ )
2371 inline RowIterator&
operator+=(
size_t inc ) noexcept {
2374 if( column_ != matrix_->columns() )
2375 pos_ = matrix_->begin( column_ ) + row_;
2387 inline RowIterator&
operator-=(
size_t dec ) noexcept {
2390 if( column_ != matrix_->columns() )
2391 pos_ = matrix_->begin( column_ ) + row_;
2402 inline RowIterator& operator++() noexcept {
2405 if( column_ != matrix_->columns() )
2406 pos_ = matrix_->begin( column_ ) + row_;
2417 inline const RowIterator operator++(
int ) noexcept {
2418 const RowIterator tmp( *
this );
2429 inline RowIterator& operator--() noexcept {
2432 if( column_ != matrix_->columns() )
2433 pos_ = matrix_->begin( column_ ) + row_;
2444 inline const RowIterator operator--(
int ) noexcept {
2445 const RowIterator tmp( *
this );
2457 inline ReferenceType operator[](
size_t index )
const {
2459 const IteratorType pos( matrix_->begin( column_+index ) + row_ );
2469 inline ReferenceType
operator*()
const {
2479 inline PointerType operator->()
const {
2490 template<
typename MatrixType2,
typename IteratorType2 >
2491 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2492 return column_ == rhs.column_;
2502 template<
typename MatrixType2,
typename IteratorType2 >
2503 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2504 return !( *
this == rhs );
2514 template<
typename MatrixType2,
typename IteratorType2 >
2515 inline bool operator<( const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2516 return column_ < rhs.column_;
2526 template<
typename MatrixType2,
typename IteratorType2 >
2527 inline bool operator>(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2528 return column_ > rhs.column_;
2538 template<
typename MatrixType2,
typename IteratorType2 >
2539 inline bool operator<=( const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2540 return column_ <= rhs.column_;
2550 template<
typename MatrixType2,
typename IteratorType2 >
2551 inline bool operator>=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2552 return column_ >= rhs.column_;
2562 inline DifferenceType
operator-(
const RowIterator& rhs )
const noexcept {
2563 return column_ - rhs.column_;
2574 friend inline const RowIterator
operator+(
const RowIterator& it,
size_t inc ) noexcept {
2575 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2586 friend inline const RowIterator
operator+(
size_t inc,
const RowIterator& it ) noexcept {
2587 return RowIterator( *it.matrix_, it.row_, it.column_+inc );
2598 friend inline const RowIterator
operator-(
const RowIterator& it,
size_t dec ) noexcept {
2599 return RowIterator( *it.matrix_, it.row_, it.column_-dec );
2605 MatrixType* matrix_;
2612 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
2619 using ConstIterator = RowIterator< const MT, ConstIterator_t<MT> >;
2627 static constexpr
bool simdEnabled =
false;
2636 template<
typename... RRAs >
2637 explicit inline Row( MT& matrix, RRAs... args );
2639 Row(
const Row& ) =
default;
2653 inline Reference operator[](
size_t index );
2657 inline Pointer
data () noexcept;
2658 inline ConstPointer
data () const noexcept;
2672 inline Row& operator=( initializer_list<
ElementType> list );
2673 inline Row& operator=( const Row& rhs );
2675 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
2676 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
2677 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
2678 template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
2679 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
2680 template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
2687 using DataType::
row;
2689 inline MT& operand() noexcept;
2690 inline const MT& operand() const noexcept;
2692 inline
size_t size() const noexcept;
2693 inline
size_t spacing() const noexcept;
2694 inline
size_t capacity() const noexcept;
2696 inline
void reset();
2703 template< typename Other > inline Row& scale( const Other& scalar );
2710 template< typename Other >
2711 inline
bool canAlias( const Other* alias ) const noexcept;
2713 template< typename MT2,
bool SO2,
bool SF2,
size_t... CRAs2 >
2714 inline
bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
2716 template< typename Other >
2717 inline
bool isAliased( const Other* alias ) const noexcept;
2719 template< typename MT2,
bool SO2,
bool SF2,
size_t... CRAs2 >
2720 inline
bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
2722 inline
bool isAligned () const noexcept;
2723 inline
bool canSMPAssign() const noexcept;
2725 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2726 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2727 template< typename VT > inline
void addAssign ( const DenseVector <VT,true>& rhs );
2728 template< typename VT > inline
void addAssign ( const SparseVector<VT,true>& rhs );
2729 template< typename VT > inline
void subAssign ( const DenseVector <VT,true>& rhs );
2730 template< typename VT > inline
void subAssign ( const SparseVector<VT,true>& rhs );
2731 template< typename VT > inline
void multAssign( const DenseVector <VT,true>& rhs );
2732 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
2733 template< typename VT > inline
void divAssign ( const DenseVector <VT,true>& rhs );
2746 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CRAs2 > friend class Row;
2785 template< typename MT
2787 template< typename... RRAs >
2788 inline Row<MT,false,true,false,CRAs...>::Row( MT& matrix, RRAs... args )
2789 : DataType( args... )
2790 , matrix_ ( matrix )
2793 if( matrix_.rows() <=
row() ) {
2823 template<
typename MT
2825 inline typename Row<MT,
false,
true,
false,CRAs...>
::Reference 2826 Row<MT,false,true,false,CRAs...>::operator[](
size_t index )
2829 return matrix_(
row(),index);
2845 template<
typename MT
2848 Row<MT,false,true,false,CRAs...>::operator[](
size_t index )
const 2851 return const_cast<const MT&
>( matrix_ )(
row(),index);
2868 template<
typename MT
2870 inline typename Row<MT,
false,
true,
false,CRAs...>
::Reference 2871 Row<MT,false,true,false,CRAs...>::at(
size_t index )
2873 if( index >=
size() ) {
2876 return (*
this)[index];
2893 template<
typename MT
2896 Row<MT,false,true,false,CRAs...>::at(
size_t index )
const 2898 if( index >=
size() ) {
2901 return (*
this)[index];
2916 template<
typename MT
2918 inline typename Row<MT,
false,
true,
false,CRAs...>::Pointer
2921 return matrix_.data() +
row();
2936 template<
typename MT
2938 inline typename Row<MT,
false,
true,
false,CRAs...>::ConstPointer
2941 return matrix_.data() +
row();
2955 template<
typename MT
2957 inline typename Row<MT,
false,
true,
false,CRAs...>
::Iterator 2974 template<
typename MT
2993 template<
typename MT
3012 template<
typename MT
3014 inline typename Row<MT,
false,
true,
false,CRAs...>
::Iterator 3031 template<
typename MT
3050 template<
typename MT
3080 template<
typename MT
3082 inline Row<MT,
false,
true,
false,CRAs...>&
3083 Row<MT,false,true,false,CRAs...>::operator=(
const ElementType& rhs )
3085 decltype(
auto) left( derestrict( matrix_ ) );
3098 for(
size_t j=jbegin; j<jend; ++j ) {
3099 if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_,
row(), j, rhs ) )
3100 left(
row(),j) = rhs;
3124 template<
typename MT
3126 inline Row<MT,
false,
true,
false,CRAs...>&
3127 Row<MT,false,true,false,CRAs...>::operator=( initializer_list<ElementType> list )
3129 if( list.size() >
size() ) {
3133 if( IsRestricted_v<MT> ) {
3134 const InitializerVector<ElementType,true> tmp( list,
size() );
3135 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3140 decltype(
auto) left( derestrict( *this ) );
3166 template< typename MT
3168 inline Row<MT,false,true,false,CRAs...>&
3169 Row<MT,false,true,false,CRAs...>::operator=( const Row& rhs )
3171 if( &rhs ==
this )
return *
this;
3173 if(
size() != rhs.size() ) {
3177 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
3181 decltype(
auto) left( derestrict( *this ) );
3213 template<
typename MT
3215 template<
typename VT >
3216 inline Row<MT,
false,
true,
false,CRAs...>&
3217 Row<MT,false,true,false,CRAs...>::operator=(
const Vector<VT,true>& rhs )
3227 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3228 Right right( ~rhs );
3230 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
3234 decltype(
auto) left( derestrict( *this ) );
3241 if( IsSparseVector_v<VT> )
3268 template<
typename MT
3270 template<
typename VT >
3271 inline Row<MT,
false,
true,
false,CRAs...>&
3281 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3282 Right right( ~rhs );
3284 if( !tryAddAssign( matrix_, right,
row(), 0UL ) ) {
3288 decltype(
auto) left( derestrict( *this ) );
3291 const ResultType_t<VT> tmp( right );
3320 template<
typename MT
3322 template<
typename VT >
3323 inline Row<MT,
false,
true,
false,CRAs...>&
3333 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3334 Right right( ~rhs );
3336 if( !trySubAssign( matrix_, right,
row(), 0UL ) ) {
3340 decltype(
auto) left( derestrict( *this ) );
3343 const ResultType_t<VT> tmp( right );
3371 template<
typename MT
3373 template<
typename VT >
3374 inline Row<MT,
false,
true,
false,CRAs...>&
3384 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3385 Right right( ~rhs );
3387 if( !tryMultAssign( matrix_, right,
row(), 0UL ) ) {
3391 decltype(
auto) left( derestrict( *this ) );
3394 const ResultType_t<VT> tmp( right );
3421 template<
typename MT
3423 template<
typename VT >
3424 inline Row<MT,
false,
true,
false,CRAs...>&
3434 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
3435 Right right( ~rhs );
3437 if( !tryDivAssign( matrix_, right,
row(), 0UL ) ) {
3441 decltype(
auto) left( derestrict( *this ) );
3444 const ResultType_t<VT> tmp( right );
3472 template<
typename MT
3474 template<
typename VT >
3475 inline Row<MT,
false,
true,
false,CRAs...>&
3476 Row<MT,false,true,false,CRAs...>::operator%=(
const Vector<VT,true>& rhs )
3478 using blaze::assign;
3483 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3489 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3493 const CrossType right( *
this % (~rhs) );
3495 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
3499 decltype(
auto) left( derestrict( *this ) );
3501 assign( left, right );
3525 template< typename MT
3527 inline MT& Row<MT,false,true,false,CRAs...>::operand() noexcept
3541 template<
typename MT
3543 inline const MT& Row<MT,false,true,false,CRAs...>::operand() const noexcept
3557 template<
typename MT
3561 return matrix_.columns();
3576 template<
typename MT
3580 return matrix_.spacing();
3592 template<
typename MT
3596 return matrix_.columns();
3611 template<
typename MT
3616 size_t nonzeros( 0UL );
3618 for(
size_t j=0UL; j<
columns; ++j )
3634 template<
typename MT
3640 const size_t jbegin( ( IsUpper_v<MT> )
3641 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3645 const size_t jend ( ( IsLower_v<MT> )
3646 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3651 for(
size_t j=jbegin; j<jend; ++j )
3679 template<
typename MT
3681 template<
typename Other >
3682 inline Row<MT,
false,
true,
false,CRAs...>&
3683 Row<MT,false,true,false,CRAs...>::scale(
const Other& scalar )
3687 const size_t jbegin( ( IsUpper_v<MT> )
3688 ?( ( IsStrictlyUpper_v<MT> )
3692 const size_t jend ( ( IsLower_v<MT> )
3693 ?( ( IsStrictlyLower_v<MT> )
3698 for(
size_t j=jbegin; j<jend; ++j ) {
3699 matrix_(
row(),j) *= scalar;
3727 template<
typename MT
3729 template<
typename Other >
3730 inline bool Row<MT,false,true,false,CRAs...>::canAlias(
const Other* alias )
const noexcept
3732 return matrix_.isAliased( alias );
3749 template<
typename MT
3751 template<
typename MT2
3756 Row<MT,false,true,false,CRAs...>::canAlias(
const Row<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
3758 return matrix_.isAliased( &alias->matrix_ ) && (
row() == alias->row() );
3775 template<
typename MT
3777 template<
typename Other >
3778 inline bool Row<MT,false,true,false,CRAs...>::isAliased(
const Other* alias )
const noexcept
3780 return matrix_.isAliased( alias );
3797 template<
typename MT
3799 template<
typename MT2
3804 Row<MT,false,true,false,CRAs...>::isAliased(
const Row<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
3806 return matrix_.isAliased( &alias->matrix_ ) && (
row() == alias->row() );
3822 template<
typename MT
3824 inline bool Row<MT,false,true,false,CRAs...>::isAligned() const noexcept
3843 template<
typename MT
3845 inline bool Row<MT,false,true,false,CRAs...>::canSMPAssign() const noexcept
3847 return (
size() > SMP_DVECASSIGN_THRESHOLD );
3865 template<
typename MT
3867 template<
typename VT >
3868 inline void Row<MT,false,true,false,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
3872 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3873 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3874 matrix_(
row(),j ) = (~rhs)[j ];
3875 matrix_(
row(),j+1UL) = (~rhs)[j+1UL];
3877 if( jpos < (~rhs).size() )
3878 matrix_(
row(),jpos) = (~rhs)[jpos];
3896 template<
typename MT
3898 template<
typename VT >
3899 inline void Row<MT,false,true,false,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
3903 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3904 matrix_(
row(),element->index()) = element->value();
3922 template<
typename MT
3924 template<
typename VT >
3925 inline void Row<MT,false,true,false,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
3929 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3930 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3931 matrix_(
row(),j ) += (~rhs)[j ];
3932 matrix_(
row(),j+1UL) += (~rhs)[j+1UL];
3934 if( jpos < (~rhs).size() )
3935 matrix_(
row(),jpos) += (~rhs)[jpos];
3953 template<
typename MT
3955 template<
typename VT >
3956 inline void Row<MT,false,true,false,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
3960 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
3961 matrix_(
row(),element->index()) += element->value();
3979 template<
typename MT
3981 template<
typename VT >
3982 inline void Row<MT,false,true,false,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
3986 const size_t jpos( (~rhs).
size() &
size_t(-2) );
3987 for(
size_t j=0UL; j<jpos; j+=2UL ) {
3988 matrix_(
row(),j ) -= (~rhs)[j ];
3989 matrix_(
row(),j+1UL) -= (~rhs)[j+1UL];
3991 if( jpos < (~rhs).size() )
3992 matrix_(
row(),jpos) -= (~rhs)[jpos];
4010 template<
typename MT
4012 template<
typename VT >
4013 inline void Row<MT,false,true,false,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
4017 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
4018 matrix_(
row(),element->index()) -= element->value();
4036 template<
typename MT
4038 template<
typename VT >
4039 inline void Row<MT,false,true,false,CRAs...>::multAssign(
const DenseVector<VT,true>& rhs )
4043 const size_t jpos( (~rhs).
size() &
size_t(-2) );
4044 for(
size_t j=0UL; j<jpos; j+=2UL ) {
4045 matrix_(
row(),j ) *= (~rhs)[j ];
4046 matrix_(
row(),j+1UL) *= (~rhs)[j+1UL];
4048 if( jpos < (~rhs).size() )
4049 matrix_(
row(),jpos) *= (~rhs)[jpos];
4067 template<
typename MT
4069 template<
typename VT >
4070 inline void Row<MT,false,true,false,CRAs...>::multAssign(
const SparseVector<VT,true>& rhs )
4078 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
4079 const size_t index( element->index() );
4080 for( ; j<index; ++j )
4082 matrix_(
row(),j) *= element->value();
4086 for( ; j<
size(); ++j ) {
4106 template<
typename MT
4108 template<
typename VT >
4109 inline void Row<MT,false,true,false,CRAs...>::divAssign(
const DenseVector<VT,true>& rhs )
4113 const size_t jpos( (~rhs).
size() &
size_t(-2) );
4114 for(
size_t j=0UL; j<jpos; j+=2UL ) {
4115 matrix_(
row(),j ) /= (~rhs)[j ];
4116 matrix_(
row(),j+1UL) /= (~rhs)[j+1UL];
4118 if( jpos < (~rhs).size() )
4119 matrix_(
row(),jpos) /= (~rhs)[jpos];
4145 template<
typename MT
4147 class Row<MT,false,true,true,CRAs...>
4148 :
public View< DenseVector< Row<MT,false,true,true,CRAs...>, true > >
4149 ,
private RowData<CRAs...>
4153 using DataType = RowData<CRAs...>;
4154 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4160 using This = Row<MT,
false,
true,
true,CRAs...>;
4162 using BaseType = DenseVector<This,true>;
4163 using ViewedType = MT;
4167 using SIMDType = SIMDTrait_t<ElementType>;
4178 using ConstPointer = ConstPointer_t<MT>;
4181 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
4192 static constexpr
bool simdEnabled = MT::simdEnabled;
4201 template<
typename... RRAs >
4202 explicit inline Row( MT& matrix, RRAs... args );
4204 Row(
const Row& ) =
default;
4218 inline Reference operator[](
size_t index );
4222 inline Pointer
data () noexcept;
4223 inline ConstPointer
data () const noexcept;
4237 inline Row& operator=( initializer_list<
ElementType> list );
4238 inline Row& operator=( const Row& rhs );
4240 template< typename VT > inline Row& operator= ( const Vector<VT,true>& rhs );
4241 template< typename VT > inline Row& operator+=( const Vector<VT,true>& rhs );
4242 template< typename VT > inline Row& operator-=( const Vector<VT,true>& rhs );
4243 template< typename VT > inline Row& operator*=( const Vector<VT,true>& rhs );
4244 template< typename VT > inline Row& operator/=( const DenseVector<VT,true>& rhs );
4245 template< typename VT > inline Row& operator%=( const Vector<VT,true>& rhs );
4252 using DataType::
row;
4254 inline MT& operand() noexcept;
4255 inline const MT& operand() const noexcept;
4257 inline
size_t size() const noexcept;
4258 inline
size_t spacing() const noexcept;
4259 inline
size_t capacity() const noexcept;
4261 inline
void reset();
4268 template< typename Other > inline Row& scale( const Other& scalar );
4275 template< typename VT >
4276 static constexpr
bool VectorizedAssign_v =
4277 ( useOptimizedKernels &&
4278 simdEnabled && VT::simdEnabled &&
4284 template< typename VT >
4285 static constexpr
bool VectorizedAddAssign_v =
4286 ( useOptimizedKernels &&
4287 simdEnabled && VT::simdEnabled &&
4294 template< typename VT >
4295 static constexpr
bool VectorizedSubAssign_v =
4296 ( useOptimizedKernels &&
4297 simdEnabled && VT::simdEnabled &&
4304 template< typename VT >
4305 static constexpr
bool VectorizedMultAssign_v =
4306 ( useOptimizedKernels &&
4307 simdEnabled && VT::simdEnabled &&
4314 template< typename VT >
4315 static constexpr
bool VectorizedDivAssign_v =
4316 ( useOptimizedKernels &&
4317 simdEnabled && VT::simdEnabled &&
4331 template< typename Other >
4332 inline
bool canAlias( const Other* alias ) const noexcept;
4334 template< typename MT2,
bool SO2,
bool SF2,
size_t... CRAs2 >
4335 inline
bool canAlias( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
4337 template< typename Other >
4338 inline
bool isAliased( const Other* alias ) const noexcept;
4340 template< typename MT2,
bool SO2,
bool SF2,
size_t... CRAs2 >
4341 inline
bool isAliased( const Row<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
4343 inline
bool isAligned () const noexcept;
4344 inline
bool canSMPAssign() const noexcept;
4355 template< typename VT >
4356 inline auto assign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedAssign_v<VT> >;
4358 template< typename VT >
4359 inline auto assign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedAssign_v<VT> >;
4361 template< typename VT > inline
void assign( const SparseVector<VT,true>& rhs );
4363 template< typename VT >
4364 inline auto addAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<VT> >;
4366 template< typename VT >
4367 inline auto addAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<VT> >;
4369 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4371 template< typename VT >
4372 inline auto subAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<VT> >;
4374 template< typename VT >
4375 inline auto subAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<VT> >;
4377 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4379 template< typename VT >
4380 inline auto multAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedMultAssign_v<VT> >;
4382 template< typename VT >
4383 inline auto multAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedMultAssign_v<VT> >;
4385 template< typename VT > inline
void multAssign( const SparseVector<VT,true>& rhs );
4387 template< typename VT >
4388 inline auto divAssign( const DenseVector<VT,true>& rhs ) ->
DisableIf_t< VectorizedDivAssign_v<VT> >;
4390 template< typename VT >
4391 inline auto divAssign( const DenseVector<VT,true>& rhs ) ->
EnableIf_t< VectorizedDivAssign_v<VT> >;
4404 template< typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CRAs2 > friend class Row;
4443 template< typename MT
4445 template< typename... RRAs >
4446 inline Row<MT,false,true,true,CRAs...>::Row( MT& matrix, RRAs... args )
4447 : DataType( args... )
4448 , matrix_ ( matrix )
4451 if( matrix_.rows() <=
row() ) {
4481 template<
typename MT
4483 inline typename Row<MT,
false,
true,
true,CRAs...>
::Reference 4484 Row<MT,false,true,true,CRAs...>::operator[](
size_t index )
4487 return matrix_(index,
row());
4503 template<
typename MT
4506 Row<MT,false,true,true,CRAs...>::operator[](
size_t index )
const 4509 return const_cast<const MT&
>( matrix_ )(index,
row());
4526 template<
typename MT
4528 inline typename Row<MT,
false,
true,
true,CRAs...>
::Reference 4529 Row<MT,false,true,true,CRAs...>::at(
size_t index )
4531 if( index >=
size() ) {
4534 return (*
this)[index];
4551 template<
typename MT
4554 Row<MT,false,true,true,CRAs...>::at(
size_t index )
const 4556 if( index >=
size() ) {
4559 return (*
this)[index];
4574 template<
typename MT
4576 inline typename Row<MT,
false,
true,
true,CRAs...>::Pointer
4579 return matrix_.data(
row() );
4594 template<
typename MT
4596 inline typename Row<MT,
false,
true,
true,CRAs...>::ConstPointer
4599 return matrix_.data(
row() );
4613 template<
typename MT
4615 inline typename Row<MT,
false,
true,
true,CRAs...>
::Iterator 4618 return matrix_.begin(
row() );
4632 template<
typename MT
4637 return matrix_.cbegin(
row() );
4651 template<
typename MT
4656 return matrix_.cbegin(
row() );
4670 template<
typename MT
4672 inline typename Row<MT,
false,
true,
true,CRAs...>
::Iterator 4675 return matrix_.end(
row() );
4689 template<
typename MT
4694 return matrix_.cend(
row() );
4708 template<
typename MT
4713 return matrix_.cend(
row() );
4734 template<
typename MT
4736 inline Row<MT,
false,
true,
true,CRAs...>&
4737 Row<MT,false,true,true,CRAs...>::operator=(
const ElementType& rhs )
4739 decltype(
auto) left( derestrict( matrix_ ) );
4752 for(
size_t i=ibegin; i<iend; ++i ) {
4753 if( !IsRestricted_v<MT> || IsTriangular_v<MT> || trySet( matrix_, i,
row(), rhs ) )
4754 left(i,
row()) = rhs;
4778 template<
typename MT
4780 inline Row<MT,
false,
true,
true,CRAs...>&
4781 Row<MT,false,true,true,CRAs...>::operator=( initializer_list<ElementType> list )
4783 if( list.size() >
size() ) {
4787 if( IsRestricted_v<MT> ) {
4788 const InitializerVector<ElementType,true> tmp( list,
size() );
4789 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4794 decltype(
auto) left( derestrict( *this ) );
4820 template< typename MT
4822 inline Row<MT,false,true,true,CRAs...>&
4823 Row<MT,false,true,true,CRAs...>::operator=( const Row& rhs )
4825 if( &rhs ==
this )
return *
this;
4827 if(
size() != rhs.size() ) {
4831 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
4835 decltype(
auto) left( derestrict( *this ) );
4867 template<
typename MT
4869 template<
typename VT >
4870 inline Row<MT,
false,
true,
true,CRAs...>&
4871 Row<MT,false,true,true,CRAs...>::operator=(
const Vector<VT,true>& rhs )
4880 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4881 Right right( ~rhs );
4883 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4887 decltype(
auto) left( derestrict( *this ) );
4890 const ResultType_t<VT> tmp( right );
4894 if( IsSparseVector_v<VT> )
4921 template<
typename MT
4923 template<
typename VT >
4924 inline Row<MT,
false,
true,
true,CRAs...>&
4934 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4935 Right right( ~rhs );
4937 if( !tryAddAssign( matrix_, right,
row(), 0UL ) ) {
4941 decltype(
auto) left( derestrict( *this ) );
4944 const ResultType_t<VT> tmp( right );
4973 template<
typename MT
4975 template<
typename VT >
4976 inline Row<MT,
false,
true,
true,CRAs...>&
4986 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4987 Right right( ~rhs );
4989 if( !trySubAssign( matrix_, right,
row(), 0UL ) ) {
4993 decltype(
auto) left( derestrict( *this ) );
4996 const ResultType_t<VT> tmp( right );
5024 template<
typename MT
5026 template<
typename VT >
5027 inline Row<MT,
false,
true,
true,CRAs...>&
5037 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
5038 Right right( ~rhs );
5040 if( !tryMultAssign( matrix_, right,
row(), 0UL ) ) {
5044 decltype(
auto) left( derestrict( *this ) );
5047 const ResultType_t<VT> tmp( right );
5074 template<
typename MT
5076 template<
typename VT >
5077 inline Row<MT,
false,
true,
true,CRAs...>&
5087 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
5088 Right right( ~rhs );
5090 if( !tryDivAssign( matrix_, right,
row(), 0UL ) ) {
5094 decltype(
auto) left( derestrict( *this ) );
5097 const ResultType_t<VT> tmp( right );
5125 template<
typename MT
5127 template<
typename VT >
5128 inline Row<MT,
false,
true,
true,CRAs...>&
5129 Row<MT,false,true,true,CRAs...>::operator%=(
const Vector<VT,true>& rhs )
5131 using blaze::assign;
5136 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5142 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5146 const CrossType right( *
this % (~rhs) );
5148 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
5152 decltype(
auto) left( derestrict( *this ) );
5154 assign( left, right );
5178 template< typename MT
5180 inline MT& Row<MT,false,true,true,CRAs...>::operand() noexcept
5194 template<
typename MT
5196 inline const MT& Row<MT,false,true,true,CRAs...>::operand() const noexcept
5210 template<
typename MT
5214 return matrix_.columns();
5229 template<
typename MT
5233 return matrix_.spacing();
5245 template<
typename MT
5249 return matrix_.capacity(
row() );
5264 template<
typename MT
5268 return matrix_.nonZeros(
row() );
5280 template<
typename MT
5284 matrix_.reset(
row() );
5311 template<
typename MT
5313 template<
typename Other >
5314 inline Row<MT,
false,
true,
true,CRAs...>&
5315 Row<MT,false,true,true,CRAs...>::scale(
const Other& scalar )
5319 const size_t ibegin( ( IsLower_v<MT> )
5320 ?( ( IsStrictlyLower_v<MT> )
5324 const size_t iend ( ( IsUpper_v<MT> )
5325 ?( ( IsStrictlyUpper_v<MT> )
5330 for(
size_t i=ibegin; i<iend; ++i ) {
5331 matrix_(i,
row()) *= scalar;
5359 template<
typename MT
5361 template<
typename Other >
5362 inline bool Row<MT,false,true,true,CRAs...>::canAlias(
const Other* alias )
const noexcept
5364 return matrix_.isAliased( alias );
5381 template<
typename MT
5383 template<
typename MT2
5388 Row<MT,false,true,true,CRAs...>::canAlias(
const Row<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
5390 return matrix_.isAliased( &alias->matrix_ ) && (
row() == alias->row() );
5407 template<
typename MT
5409 template<
typename Other >
5410 inline bool Row<MT,false,true,true,CRAs...>::isAliased(
const Other* alias )
const noexcept
5412 return matrix_.isAliased( alias );
5429 template<
typename MT
5431 template<
typename MT2
5436 Row<MT,false,true,true,CRAs...>::isAliased(
const Row<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
5438 return matrix_.isAliased( &alias->matrix_ ) && (
row() == alias->row() );
5454 template<
typename MT
5456 inline bool Row<MT,false,true,true,CRAs...>::isAligned() const noexcept
5458 return matrix_.isAligned();
5475 template<
typename MT
5477 inline bool Row<MT,false,true,true,CRAs...>::canSMPAssign() const noexcept
5479 return (
size() > SMP_DVECASSIGN_THRESHOLD );
5498 template<
typename MT
5501 Row<MT,false,true,true,CRAs...>::load(
size_t index )
const noexcept
5503 return matrix_.load( index,
row() );
5522 template<
typename MT
5527 return matrix_.loada( index,
row() );
5546 template<
typename MT
5551 return matrix_.loadu( index,
row() );
5571 template<
typename MT
5574 Row<MT,false,true,true,CRAs...>::store(
size_t index,
const SIMDType& value ) noexcept
5576 matrix_.store( index,
row(), value );
5596 template<
typename MT
5601 matrix_.storea( index,
row(), value );
5621 template<
typename MT
5626 matrix_.storeu( index,
row(), value );
5646 template<
typename MT
5651 matrix_.stream( index,
row(), value );
5669 template<
typename MT
5671 template<
typename VT >
5672 inline auto Row<MT,false,true,true,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
5673 -> DisableIf_t< VectorizedAssign_v<VT> >
5677 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5678 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5679 matrix_(i ,
row()) = (~rhs)[i ];
5680 matrix_(i+1UL,
row()) = (~rhs)[i+1UL];
5682 if( ipos < (~rhs).size() )
5683 matrix_(ipos,
row()) = (~rhs)[ipos];
5701 template<
typename MT
5703 template<
typename VT >
5704 inline auto Row<MT,false,true,true,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
5705 -> EnableIf_t< VectorizedAssign_v<VT> >
5711 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5715 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5720 ConstIterator_t<VT> right( (~rhs).
begin() );
5722 if( useStreaming &&
rows > ( cacheSize/(
sizeof(
ElementType) * 3UL ) ) && !(~rhs).isAliased( &matrix_ ) )
5724 for( ; i<ipos; i+=SIMDSIZE ) {
5725 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5727 for( ; remainder && i<
rows; ++i ) {
5728 *left = *right; ++left; ++right;
5733 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5734 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5735 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5736 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5737 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5739 for( ; i<ipos; i+=SIMDSIZE ) {
5740 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5742 for( ; remainder && i<
rows; ++i ) {
5743 *left = *right; ++left; ++right;
5763 template<
typename MT
5765 template<
typename VT >
5766 inline void Row<MT,false,true,true,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
5770 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5771 matrix_(element->index(),
row()) = element->value();
5789 template<
typename MT
5791 template<
typename VT >
5792 inline auto Row<MT,false,true,true,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
5793 -> DisableIf_t< VectorizedAddAssign_v<VT> >
5797 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5798 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5799 matrix_(i ,
row()) += (~rhs)[i ];
5800 matrix_(i+1UL,
row()) += (~rhs)[i+1UL];
5802 if( ipos < (~rhs).size() )
5803 matrix_(ipos,
row()) += (~rhs)[ipos];
5821 template<
typename MT
5823 template<
typename VT >
5824 inline auto Row<MT,false,true,true,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
5825 -> EnableIf_t< VectorizedAddAssign_v<VT> >
5831 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5835 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5840 ConstIterator_t<VT> right( (~rhs).
begin() );
5842 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5843 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5844 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5845 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5846 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5848 for( ; i<ipos; i+=SIMDSIZE ) {
5849 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5851 for( ; remainder && i<
rows; ++i ) {
5852 *left += *right; ++left; ++right;
5871 template<
typename MT
5873 template<
typename VT >
5874 inline void Row<MT,false,true,true,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
5878 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5879 matrix_(element->index(),
row()) += element->value();
5897 template<
typename MT
5899 template<
typename VT >
5900 inline auto Row<MT,false,true,true,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
5901 -> DisableIf_t< VectorizedSubAssign_v<VT> >
5905 const size_t ipos( (~rhs).
size() &
size_t(-2) );
5906 for(
size_t i=0UL; i<ipos; i+=2UL ) {
5907 matrix_(i ,
row()) -= (~rhs)[i ];
5908 matrix_(i+1UL,
row()) -= (~rhs)[i+1UL];
5910 if( ipos < (~rhs).size() )
5911 matrix_(ipos,
row()) -= (~rhs)[ipos];
5929 template<
typename MT
5931 template<
typename VT >
5932 inline auto Row<MT,false,true,true,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
5933 -> EnableIf_t< VectorizedSubAssign_v<VT> >
5939 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
5943 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
5948 ConstIterator_t<VT> right( (~rhs).
begin() );
5950 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
5951 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5952 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5953 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5954 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5956 for( ; i<ipos; i+=SIMDSIZE ) {
5957 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
5959 for( ; remainder && i<
rows; ++i ) {
5960 *left -= *right; ++left; ++right;
5979 template<
typename MT
5981 template<
typename VT >
5982 inline void Row<MT,false,true,true,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
5986 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element )
5987 matrix_(element->index(),
row()) -= element->value();
6005 template<
typename MT
6007 template<
typename VT >
6008 inline auto Row<MT,false,true,true,CRAs...>::multAssign(
const DenseVector<VT,true>& rhs )
6009 -> DisableIf_t< VectorizedMultAssign_v<VT> >
6013 const size_t ipos( (~rhs).
size() &
size_t(-2) );
6014 for(
size_t i=0UL; i<ipos; i+=2UL ) {
6015 matrix_(i ,
row()) *= (~rhs)[i ];
6016 matrix_(i+1UL,
row()) *= (~rhs)[i+1UL];
6018 if( ipos < (~rhs).size() )
6019 matrix_(ipos,
row()) *= (~rhs)[ipos];
6037 template<
typename MT
6039 template<
typename VT >
6040 inline auto Row<MT,false,true,true,CRAs...>::multAssign(
const DenseVector<VT,true>& rhs )
6041 -> EnableIf_t< VectorizedMultAssign_v<VT> >
6047 constexpr
bool remainder( !IsPadded_v<MT> || !IsPadded_v<VT> );
6051 const size_t ipos( ( remainder )?(
rows &
size_t(-SIMDSIZE) ):(
rows ) );
6056 ConstIterator_t<VT> right( (~rhs).
begin() );
6058 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6059 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6060 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6061 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6062 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6064 for( ; i<ipos; i+=SIMDSIZE ) {
6065 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6067 for( ; remainder && i<
rows; ++i ) {
6068 *left *= *right; ++left; ++right;
6087 template<
typename MT
6089 template<
typename VT >
6090 inline void Row<MT,false,true,true,CRAs...>::multAssign(
const SparseVector<VT,true>& rhs )
6098 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
6099 const size_t index( element->index() );
6100 for( ; i<index; ++i )
6102 matrix_(i,
row()) *= element->value();
6106 for( ; i<
size(); ++i ) {
6126 template<
typename MT
6128 template<
typename VT >
6129 inline auto Row<MT,false,true,true,CRAs...>::divAssign(
const DenseVector<VT,true>& rhs )
6130 -> DisableIf_t< VectorizedDivAssign_v<VT> >
6134 const size_t ipos( (~rhs).
size() &
size_t(-2) );
6135 for(
size_t i=0UL; i<ipos; i+=2UL ) {
6136 matrix_(i ,
row()) /= (~rhs)[i ];
6137 matrix_(i+1UL,
row()) /= (~rhs)[i+1UL];
6139 if( ipos < (~rhs).size() )
6140 matrix_(ipos,
row()) /= (~rhs)[ipos];
6158 template<
typename MT
6160 template<
typename VT >
6161 inline auto Row<MT,false,true,true,CRAs...>::divAssign(
const DenseVector<VT,true>& rhs )
6162 -> EnableIf_t< VectorizedDivAssign_v<VT> >
6170 const size_t ipos(
rows &
size_t(-SIMDSIZE) );
6175 ConstIterator_t<VT> right( (~rhs).
begin() );
6177 for( ; (i+SIMDSIZE*3UL) < ipos; i+=SIMDSIZE*4UL ) {
6178 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6179 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6180 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6181 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6183 for( ; i<ipos; i+=SIMDSIZE ) {
6184 left.store( left.load() / right.load() ); left += SIMDSIZE; right += SIMDSIZE;
6186 for( ; i<
rows; ++i ) {
6187 *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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the RowData class template.
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.The IsUniUpper_v variable template provides...
Definition: IsUniUpper.h:172
#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
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the IsUniUpper type trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
Header file for the View base class.
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:188
Header file for the row trait.
#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 const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
Header file for the DenseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#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:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#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
Header file for the reset shim.
constexpr bool IsUpper_v
Auxiliary variable template for the IsUpper type trait.The IsUpper_v variable template provides a con...
Definition: IsUpper.h:174
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
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
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
Header file for the IsUniLower type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
auto smpDivAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP division assignment of a vector to a dense vector.
Definition: DenseVector.h:220
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the DisableIf class template.
Header file for the implementation of the Row base template.
Header file for the IsStrictlyUpper type trait.
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#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
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:189
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#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
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
#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 HasSIMDDiv_v
Auxiliary variable template for the HasSIMDDiv type trait.The HasSIMDDiv_v variable template provides...
Definition: HasSIMDDiv.h:172
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:446
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
Header file for all SIMD functionality.
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
Constraint on the data type.
Header file for the IsTriangular type trait.
#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.
constexpr bool IsStrictlyLower_v
Auxiliary variable template for the IsStrictlyLower type trait.The IsStrictlyLower_v variable templat...
Definition: IsStrictlyLower.h:172
Header file for the exception macros of the math module.
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:438
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:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
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:611
Header file for the IsPadded type trait.
Constraint on the data type.
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.
constexpr bool IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.The IsUniLower_v variable template provides...
Definition: IsUniLower.h:172
Header file for the cross product trait.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
Header file for the Unique class template.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.The IsStrictlyUpper_v variable templat...
Definition: IsStrictlyUpper.h:172
constexpr bool IsLower_v
Auxiliary variable template for the IsLower type trait.The IsLower_v variable template provides a con...
Definition: IsLower.h:174
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
typename RowTrait< MT, CRAs... >::Type RowTrait_t
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_t alias declaration provides a c...
Definition: RowTrait.h:170
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
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.
Header file for the HasMutableDataAccess type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the IsReference type trait.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
Header file for the RemoveReference type trait.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#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
constexpr bool IsExpression_v
Auxiliary variable template for the IsExpression type trait.The IsExpression_v variable template prov...
Definition: IsExpression.h:131
Header file for the HasSIMDDiv type trait.
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
constexpr bool HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:188
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
#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:631
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.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the clear shim.
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Constraint on the data type.