35 #ifndef _BLAZE_MATH_VIEWS_ROWS_DENSE_H_ 36 #define _BLAZE_MATH_VIEWS_ROWS_DENSE_H_ 119 template<
typename MT
122 class Rows<MT,true,true,SF,CRAs...>
123 :
public View< DenseMatrix< Rows<MT,true,true,SF,CRAs...>, false > >
124 ,
private RowsData<CRAs...>
128 using DataType = RowsData<CRAs...>;
129 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
138 template<
typename MT1,
typename MT2 >
139 static constexpr
bool EnforceEvaluation_v =
140 ( IsRestricted_v<MT1> && RequiresEvaluation_v<MT2> );
146 using This = Rows<MT,
true,
true,SF,CRAs...>;
148 using BaseType = DenseMatrix<This,false>;
149 using ViewedType = MT;
150 using ResultType = RowsTrait_t<MT,N>;
151 using OppositeType = OppositeType_t<ResultType>;
152 using TransposeType = TransposeType_t<ResultType>;
153 using ElementType = ElementType_t<MT>;
154 using SIMDType = SIMDTrait_t<ElementType>;
155 using ReturnType = ReturnType_t<MT>;
156 using CompositeType =
const Rows&;
159 using ConstReference = ConstReference_t<MT>;
162 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
165 using ConstPointer = ConstPointer_t<MT>;
168 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
171 using ConstIterator = ConstIterator_t<MT>;
174 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
179 static constexpr
bool simdEnabled = MT::simdEnabled;
182 static constexpr
bool smpAssignable = MT::smpAssignable;
185 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
191 template<
typename... RRAs >
192 explicit inline Rows( MT& matrix, RRAs... args );
194 Rows(
const Rows& ) =
default;
195 Rows( Rows&& ) =
default;
209 inline Reference operator()(
size_t i,
size_t j );
210 inline ConstReference operator()(
size_t i,
size_t j )
const;
211 inline Reference at(
size_t i,
size_t j );
212 inline ConstReference at(
size_t i,
size_t j )
const;
213 inline Pointer
data () noexcept;
214 inline ConstPointer
data () const noexcept;
215 inline Pointer
data (
size_t i ) noexcept;
216 inline ConstPointer
data (
size_t i ) const noexcept;
217 inline Iterator
begin (
size_t i );
218 inline ConstIterator
begin (
size_t i ) const;
219 inline ConstIterator
cbegin(
size_t i ) const;
220 inline Iterator
end (
size_t i );
221 inline ConstIterator
end (
size_t i ) const;
222 inline ConstIterator
cend (
size_t i ) const;
229 inline Rows& operator=( const ElementType& rhs );
230 inline Rows& operator=( initializer_list< initializer_list<ElementType> > list );
231 inline Rows& operator=( const Rows& rhs );
233 template< typename MT2,
bool SO2 >
234 inline Rows& operator=( const Matrix<MT2,SO2>& rhs );
236 template< typename MT2,
bool SO2 >
237 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
238 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
240 template< typename MT2,
bool SO2 >
241 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
242 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
244 template< typename MT2,
bool SO2 >
245 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
246 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
248 template< typename MT2,
bool SO2 >
249 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
250 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
252 template< typename MT2,
bool SO2 >
253 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
254 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
256 template< typename MT2,
bool SO2 >
257 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
258 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
266 using DataType::idces;
267 using DataType::
rows;
269 inline MT& operand() noexcept;
270 inline const MT& operand() const noexcept;
272 inline
size_t columns() const noexcept;
273 inline
size_t spacing() const noexcept;
274 inline
size_t capacity() const noexcept;
275 inline
size_t capacity(
size_t i ) const noexcept;
277 inline
size_t nonZeros(
size_t i ) const;
279 inline
void reset(
size_t i );
289 template< typename Other > inline Rows& scale( const Other& scalar );
296 template< typename MT2 >
297 static constexpr
bool VectorizedAssign_v =
298 ( useOptimizedKernels &&
299 simdEnabled && MT2::simdEnabled &&
305 template< typename MT2 >
306 static constexpr
bool VectorizedAddAssign_v =
307 ( useOptimizedKernels &&
308 simdEnabled && MT2::simdEnabled &&
316 template< typename MT2 >
317 static constexpr
bool VectorizedSubAssign_v =
318 ( useOptimizedKernels &&
319 simdEnabled && MT2::simdEnabled &&
327 template< typename MT2 >
328 static constexpr
bool VectorizedSchurAssign_v =
329 ( useOptimizedKernels &&
330 simdEnabled && MT2::simdEnabled &&
337 static constexpr
size_t SIMDSIZE = SIMDTrait<ElementType>::
size;
344 template< typename Other >
345 inline
bool canAlias( const Other* alias ) const noexcept;
347 template< typename MT2,
bool SO2,
bool SF2, typename... CRAs2 >
348 inline
bool canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
350 template< typename Other >
351 inline
bool isAliased( const Other* alias ) const noexcept;
353 template< typename MT2,
bool SO2,
bool SF2, typename... CRAs2 >
354 inline
bool isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
356 inline
bool isAligned () const noexcept;
357 inline
bool canSMPAssign() const noexcept;
368 template< typename MT2 >
369 inline auto assign( const DenseMatrix<MT2,false>& rhs ) ->
DisableIf_t< VectorizedAssign_v<MT2> >;
371 template< typename MT2 >
372 inline auto assign( const DenseMatrix<MT2,false>& rhs ) ->
EnableIf_t< VectorizedAssign_v<MT2> >;
374 template< typename MT2 > inline
void assign( const DenseMatrix<MT2,true>& rhs );
376 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,false>& rhs );
377 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,true>& rhs );
379 template< typename MT2 >
380 inline auto addAssign( const DenseMatrix<MT2,false>& rhs ) ->
DisableIf_t< VectorizedAddAssign_v<MT2> >;
382 template< typename MT2 >
383 inline auto addAssign( const DenseMatrix<MT2,false>& rhs ) ->
EnableIf_t< VectorizedAddAssign_v<MT2> >;
385 template< typename MT2 > inline
void addAssign( const DenseMatrix<MT2,true>& rhs );
386 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,false>& rhs );
387 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,true>& rhs );
389 template< typename MT2 >
390 inline auto subAssign( const DenseMatrix<MT2,false>& rhs ) ->
DisableIf_t< VectorizedSubAssign_v<MT2> >;
392 template< typename MT2 >
393 inline auto subAssign( const DenseMatrix<MT2,false>& rhs ) ->
EnableIf_t< VectorizedSubAssign_v<MT2> >;
395 template< typename MT2 > inline
void subAssign( const DenseMatrix<MT2,true>& rhs );
396 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,false>& rhs );
397 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,true>& rhs );
399 template< typename MT2 >
400 inline auto schurAssign( const DenseMatrix<MT2,false>& rhs ) ->
DisableIf_t< VectorizedSchurAssign_v<MT2> >;
402 template< typename MT2 >
403 inline auto schurAssign( const DenseMatrix<MT2,false>& rhs ) ->
EnableIf_t< VectorizedSchurAssign_v<MT2> >;
405 template< typename MT2 > inline
void schurAssign( const DenseMatrix<MT2,true>& rhs );
406 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,false>& rhs );
407 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,true>& rhs );
420 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename... CRAs2 > friend class Rows;
459 template< typename MT
462 template< typename... RRAs >
463 inline Rows<MT,true,true,SF,CRAs...>::Rows( MT& matrix, RRAs... args )
464 : DataType( args... )
468 for(
size_t i=0UL; i<
rows(); ++i ) {
469 if( matrix_.rows() <= idx(i) ) {
498 template<
typename MT
501 inline typename Rows<MT,
true,
true,SF,CRAs...>::Reference
502 Rows<MT,true,true,SF,CRAs...>::operator()(
size_t i,
size_t j )
507 return matrix_(idx(i),j);
524 template<
typename MT
527 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstReference
528 Rows<MT,true,true,SF,CRAs...>::operator()(
size_t i,
size_t j )
const 533 return const_cast<const MT&>( matrix_ )(idx(i),j);
551 template<
typename MT
554 inline typename Rows<MT,
true,
true,SF,CRAs...>::Reference
555 Rows<MT,true,true,SF,CRAs...>::at(
size_t i,
size_t j )
581 template<
typename MT
584 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstReference
585 Rows<MT,true,true,SF,CRAs...>::at(
size_t i,
size_t j )
const 609 template<
typename MT
612 inline typename Rows<MT,
true,
true,SF,CRAs...>::Pointer
615 return matrix_.data( idx(0UL) );
631 template<
typename MT
634 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstPointer
637 return matrix_.data( idx(0UL) );
652 template<
typename MT
655 inline typename Rows<MT,
true,
true,SF,CRAs...>::Pointer
658 return matrix_.data( idx(i) );
673 template<
typename MT
676 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstPointer
679 return matrix_.data( idx(i) );
694 template<
typename MT
697 inline typename Rows<MT,
true,
true,SF,CRAs...>::Iterator
701 return matrix_.begin( idx(i) );
716 template<
typename MT
719 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstIterator
723 return matrix_.cbegin( idx(i) );
738 template<
typename MT
741 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstIterator
745 return matrix_.cbegin( idx(i) );
760 template<
typename MT
763 inline typename Rows<MT,
true,
true,SF,CRAs...>::Iterator
767 return matrix_.end( idx(i) );
782 template<
typename MT
785 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstIterator
789 return matrix_.cend( idx(i) );
804 template<
typename MT
807 inline typename Rows<MT,
true,
true,SF,CRAs...>::ConstIterator
811 return matrix_.cend( idx(i) );
836 template<
typename MT
839 inline Rows<MT,
true,
true,SF,CRAs...>&
840 Rows<MT,true,true,SF,CRAs...>::operator=(
const ElementType& rhs )
842 for(
size_t i=0UL; i<
rows(); ++i ) {
868 template<
typename MT
871 inline Rows<MT,
true,
true,SF,CRAs...>&
872 Rows<MT,true,true,SF,CRAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
877 if( list.size() !=
rows() ) {
881 if( IsRestricted_v<MT> ) {
883 for(
const auto& rowList : list ) {
884 const InitializerVector<ElementType> tmp( rowList,
columns() );
885 if( !tryAssign(
row( matrix_, idx(i),
unchecked ), tmp, 0UL ) ){
892 decltype(
auto) left( derestrict( *this ) );
895 for( const auto& rowList : list ) {
896 std::fill( std::copy( rowList.begin(), rowList.end(), left.begin(i) ), left.end(i), ElementType() );
921 template<
typename MT
924 inline Rows<MT,
true,
true,SF,CRAs...>&
925 Rows<MT,true,true,SF,CRAs...>::operator=(
const Rows& rhs )
933 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
936 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
940 if( IsRestricted_v<MT> ) {
941 for(
size_t i=0UL; i<
rows(); ++i ) {
948 decltype(
auto) left( derestrict( *this ) );
950 if( rhs.canAlias( &matrix_ ) ) {
951 const ResultType tmp( rhs );
981 template<
typename MT
984 template<
typename MT2
986 inline Rows<MT,
true,
true,SF,CRAs...>&
987 Rows<MT,true,true,SF,CRAs...>::operator=(
const Matrix<MT2,SO2>& rhs )
998 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<MT2>,
const MT2& >;
1001 if( IsRestricted_v<MT> ) {
1002 for(
size_t i=0UL; i<
rows(); ++i ) {
1009 decltype(
auto) left( derestrict( *this ) );
1015 if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
1016 const ResultType_t<MT2> tmp( right );
1045 template<
typename MT
1047 ,
typename... CRAs >
1048 template<
typename MT2
1051 -> DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
1060 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
1069 if( IsRestricted_v<MT> ) {
1070 for(
size_t i=0UL; i<
rows(); ++i ) {
1077 decltype(
auto) left( derestrict( *this ) );
1079 if( (~rhs).canAlias( &matrix_ ) ) {
1080 const AddType tmp( *
this + (~rhs) );
1109 template<
typename MT
1111 ,
typename... CRAs >
1112 template<
typename MT2
1115 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
1124 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
1133 const AddType tmp( *
this + (~rhs) );
1135 if( IsRestricted_v<MT> ) {
1136 for(
size_t i=0UL; i<
rows(); ++i ) {
1143 decltype(
auto) left( derestrict( *this ) );
1169 template< typename MT
1171 , typename... CRAs >
1172 template< typename MT2
1174 inline auto Rows<MT,true,true,SF,CRAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
1175 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
1184 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
1193 if( IsRestricted_v<MT> ) {
1194 for(
size_t i=0UL; i<
rows(); ++i ) {
1201 decltype(
auto) left( derestrict( *this ) );
1203 if( (~rhs).canAlias( &matrix_ ) ) {
1204 const SubType tmp( *
this - (~rhs ) );
1233 template<
typename MT
1235 ,
typename... CRAs >
1236 template<
typename MT2
1239 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
1248 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
1257 const SubType tmp( *
this - (~rhs) );
1259 if( IsRestricted_v<MT> ) {
1260 for(
size_t i=0UL; i<
rows(); ++i ) {
1267 decltype(
auto) left( derestrict( *this ) );
1293 template< typename MT
1295 , typename... CRAs >
1296 template< typename MT2
1298 inline auto Rows<MT,true,true,SF,CRAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
1299 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
1308 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
1316 if( IsRestricted_v<MT> ) {
1317 for(
size_t i=0UL; i<
rows(); ++i ) {
1324 decltype(
auto) left( derestrict( *this ) );
1326 if( (~rhs).canAlias( &matrix_ ) ) {
1327 const SchurType tmp( *
this % (~rhs) );
1328 if( IsSparseMatrix_v<SchurType> )
1358 template<
typename MT
1360 ,
typename... CRAs >
1361 template<
typename MT2
1363 inline auto Rows<MT,true,true,SF,CRAs...>::operator%=(
const Matrix<MT2,SO2>& rhs )
1364 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
1373 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
1381 const SchurType tmp( *
this % (~rhs) );
1383 if( IsRestricted_v<MT> ) {
1384 for(
size_t i=0UL; i<
rows(); ++i ) {
1391 decltype(
auto) left( derestrict( *this ) );
1421 template<
typename MT
1423 ,
typename... CRAs >
1424 inline MT& Rows<MT,true,true,SF,CRAs...>::operand() noexcept
1438 template<
typename MT
1440 ,
typename... CRAs >
1441 inline const MT& Rows<MT,true,true,SF,CRAs...>::operand() const noexcept
1455 template<
typename MT
1457 ,
typename... CRAs >
1460 return matrix_.columns();
1475 template<
typename MT
1477 ,
typename... CRAs >
1480 return matrix_.spacing();
1492 template<
typename MT
1494 ,
typename... CRAs >
1512 template<
typename MT
1514 ,
typename... CRAs >
1533 template<
typename MT
1535 ,
typename... CRAs >
1538 size_t nonzeros( 0UL );
1540 for(
size_t i=0UL; i<
rows(); ++i ) {
1541 nonzeros += matrix_.nonZeros( idx(i) );
1559 template<
typename MT
1561 ,
typename... CRAs >
1566 return matrix_.nonZeros( idx(i) );
1578 template<
typename MT
1580 ,
typename... CRAs >
1583 for(
size_t i=0UL; i<
rows(); ++i ) {
1584 matrix_.reset( idx(i) );
1600 template<
typename MT
1602 ,
typename... CRAs >
1605 matrix_.reset( idx(i) );
1632 template<
typename MT
1634 ,
typename... CRAs >
1635 inline Rows<MT,
true,
true,SF,CRAs...>&
1645 const ResultType tmp(
trans( *
this ) );
1647 if( IsRestricted_v<MT> ) {
1648 for(
size_t i=0UL; i<
rows(); ++i ) {
1649 if( !tryAssign( matrix_,
row( tmp, i ), idx(i), 0UL ) ) {
1655 decltype(
auto) left( derestrict( *this ) );
1678 template< typename MT
1680 , typename... CRAs >
1681 inline Rows<MT,true,true,SF,CRAs...>&
1691 const ResultType tmp(
ctrans( *
this ) );
1693 if( IsRestricted_v<MT> ) {
1694 for(
size_t i=0UL; i<
rows(); ++i ) {
1695 if( !tryAssign( matrix_,
row( tmp, i ), idx(i), 0UL ) ) {
1701 decltype(
auto) left( derestrict( *this ) );
1724 template< typename MT
1726 , typename... CRAs >
1727 template< typename Other >
1728 inline Rows<MT,true,true,SF,CRAs...>&
1729 Rows<MT,true,true,SF,CRAs...>::scale( const Other& scalar )
1735 for(
size_t i=0UL; i<
rows(); ++i )
1737 const size_t index ( idx(i) );
1738 const size_t jbegin( IsUpper<MT>::value ? ( IsStrictlyUpper_v<MT> ? index+1UL : index ) : 0UL );
1739 const size_t jend ( IsLower<MT>::value ? ( IsStrictlyLower_v<MT> ? index : index+1UL ) :
columns() );
1741 for(
size_t j=jbegin; j<jend; ++j ) {
1742 matrix_(index,j) *= scalar;
1771 template<
typename MT
1773 ,
typename... CRAs >
1774 template<
typename Other >
1775 inline bool Rows<MT,true,true,SF,CRAs...>::canAlias(
const Other* alias )
const noexcept
1777 return matrix_.isAliased( alias );
1795 template<
typename MT
1797 ,
typename... CRAs >
1798 template<
typename MT2
1801 ,
typename... CRAs2 >
1803 Rows<MT,true,true,SF,CRAs...>::canAlias(
const Rows<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
1805 return matrix_.isAliased( &alias->matrix_ );
1822 template<
typename MT
1824 ,
typename... CRAs >
1825 template<
typename Other >
1826 inline bool Rows<MT,true,true,SF,CRAs...>::isAliased(
const Other* alias )
const noexcept
1828 return matrix_.isAliased( alias );
1846 template<
typename MT
1848 ,
typename... CRAs >
1849 template<
typename MT2
1852 ,
typename... CRAs2 >
1854 Rows<MT,true,true,SF,CRAs...>::isAliased(
const Rows<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
1856 return matrix_.isAliased( &alias->matrix_ );
1872 template<
typename MT
1874 ,
typename... CRAs >
1875 inline bool Rows<MT,true,true,SF,CRAs...>::isAligned() const noexcept
1877 return matrix_.isAligned();
1894 template<
typename MT
1896 ,
typename... CRAs >
1897 inline bool Rows<MT,true,true,SF,CRAs...>::canSMPAssign() const noexcept
1899 return (
rows() *
columns() > SMP_DMATASSIGN_THRESHOLD );
1920 template<
typename MT
1922 ,
typename... CRAs >
1924 Rows<MT,true,true,SF,CRAs...>::load(
size_t i,
size_t j )
const noexcept
1926 return matrix_.load( idx(i), j );
1947 template<
typename MT
1949 ,
typename... CRAs >
1953 return matrix_.loada( idx(i), j );
1974 template<
typename MT
1976 ,
typename... CRAs >
1980 return matrix_.loadu( idx(i), j );
2002 template<
typename MT
2004 ,
typename... CRAs >
2006 Rows<MT,true,true,SF,CRAs...>::store(
size_t i,
size_t j,
const SIMDType& value ) noexcept
2008 matrix_.store( idx(i), j, value );
2030 template<
typename MT
2032 ,
typename... CRAs >
2036 matrix_.storea( idx(i), j, value );
2058 template<
typename MT
2060 ,
typename... CRAs >
2064 matrix_.storeu( idx(i), j, value );
2086 template<
typename MT
2088 ,
typename... CRAs >
2092 matrix_.stream( idx(i), j, value );
2110 template<
typename MT
2112 ,
typename... CRAs >
2113 template<
typename MT2 >
2114 inline auto Rows<MT,true,true,SF,CRAs...>::assign(
const DenseMatrix<MT2,false>& rhs )
2115 -> DisableIf_t< VectorizedAssign_v<MT2> >
2123 const size_t jpos(
columns() &
size_t(-2) );
2126 for(
size_t i=0UL; i<
rows(); ++i ) {
2127 const size_t index( idx(i) );
2128 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2129 matrix_(index,j ) = (~rhs)(i,j );
2130 matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
2133 matrix_(index,jpos) = (~rhs)(i,jpos);
2153 template<
typename MT
2155 ,
typename... CRAs >
2156 template<
typename MT2 >
2157 inline auto Rows<MT,true,true,SF,CRAs...>::assign(
const DenseMatrix<MT2,false>& rhs )
2158 -> EnableIf_t< VectorizedAssign_v<MT2> >
2168 const size_t jpos(
columns() &
size_t(-SIMDSIZE) );
2172 rows()*
columns() > ( cacheSize / (
sizeof(ElementType) * 3UL ) ) &&
2173 !(~rhs).isAliased( &matrix_ ) )
2175 for(
size_t i=0UL; i<
rows(); ++i )
2178 Iterator left(
begin(i) );
2179 ConstIterator_t<MT2> right( (~rhs).
begin(i) );
2181 for( ; j<jpos; j+=SIMDSIZE ) {
2182 left.stream( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2191 for(
size_t i=0UL; i<
rows(); ++i )
2194 Iterator left(
begin(i) );
2195 ConstIterator_t<MT2> right( (~rhs).
begin(i) );
2197 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2198 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2199 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2200 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2201 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2203 for( ; j<jpos; j+=SIMDSIZE ) {
2204 left.store( right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2207 *left = *right; ++left; ++right;
2228 template<
typename MT
2230 ,
typename... CRAs >
2231 template<
typename MT2 >
2232 inline void Rows<MT,true,true,SF,CRAs...>::assign(
const DenseMatrix<MT2,true>& rhs )
2242 constexpr
size_t block( BLOCK_SIZE );
2246 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
2247 for(
size_t i=0UL; i<
rows(); ++i ) {
2248 const size_t index( idx(i) );
2249 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2250 matrix_(index,j ) = (~rhs)(i,j );
2251 matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
2253 if( jpos < (~rhs).columns() ) {
2254 matrix_(index,jpos) = (~rhs)(i,jpos);
2260 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2261 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2262 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2263 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2264 for(
size_t i=ii; i<iend; ++i ) {
2265 const size_t index( idx(i) );
2266 for(
size_t j=jj; j<jend; ++j ) {
2267 matrix_(index,j) = (~rhs)(i,j);
2290 template<
typename MT
2292 ,
typename... CRAs >
2293 template<
typename MT2 >
2294 inline void Rows<MT,true,true,SF,CRAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2302 for(
size_t i=0UL; i<
rows(); ++i ) {
2303 const size_t index( idx(i) );
2304 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2305 matrix_(index,element->index()) = element->value();
2324 template<
typename MT
2326 ,
typename... CRAs >
2327 template<
typename MT2 >
2328 inline void Rows<MT,true,true,SF,CRAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2338 for(
size_t j=0UL; j<
columns(); ++j ) {
2339 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2340 matrix_(idx(element->index()),j) = element->value();
2359 template<
typename MT
2361 ,
typename... CRAs >
2362 template<
typename MT2 >
2363 inline auto Rows<MT,true,true,SF,CRAs...>::addAssign(
const DenseMatrix<MT2,false>& rhs )
2364 -> DisableIf_t< VectorizedAddAssign_v<MT2> >
2372 const size_t jpos(
columns() &
size_t(-2) );
2375 for(
size_t i=0UL; i<
rows(); ++i )
2377 const size_t index( idx(i) );
2378 if( IsDiagonal_v<MT2> ) {
2379 matrix_(index,i) += (~rhs)(i,i);
2382 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2383 matrix_(index,j ) += (~rhs)(i,j );
2384 matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
2387 matrix_(index,jpos) += (~rhs)(i,jpos);
2408 template<
typename MT
2410 ,
typename... CRAs >
2411 template<
typename MT2 >
2412 inline auto Rows<MT,true,true,SF,CRAs...>::addAssign(
const DenseMatrix<MT2,false>& rhs )
2413 -> EnableIf_t< VectorizedAddAssign_v<MT2> >
2423 for(
size_t i=0UL; i<
rows(); ++i )
2425 const size_t jbegin( ( IsUpper_v<MT2> )
2426 ?( ( IsStrictlyUpper_v<MT2> ? i+1UL : i ) &
size_t(-SIMDSIZE) )
2428 const size_t jend ( ( IsLower_v<MT2> )
2429 ?( IsStrictlyLower_v<MT2> ? i : i+1UL )
2433 const size_t jpos( jend &
size_t(-SIMDSIZE) );
2437 Iterator left(
begin(i) + jbegin );
2438 ConstIterator_t<MT2> right( (~rhs).
begin(i) + jbegin );
2440 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2441 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2442 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2443 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2444 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2446 for( ; j<jpos; j+=SIMDSIZE ) {
2447 left.store( left.load() + right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2449 for( ; j<jend; ++j ) {
2450 *left += *right; ++left; ++right;
2470 template<
typename MT
2472 ,
typename... CRAs >
2473 template<
typename MT2 >
2474 inline void Rows<MT,true,true,SF,CRAs...>::addAssign(
const DenseMatrix<MT2,true>& rhs )
2484 constexpr
size_t block( BLOCK_SIZE );
2488 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
2489 for(
size_t i=0UL; i<
rows(); ++i ) {
2490 const size_t index( idx(i) );
2491 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2492 matrix_(index,j ) += (~rhs)(i,j );
2493 matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
2495 if( jpos < (~rhs).columns() ) {
2496 matrix_(index,jpos) += (~rhs)(i,jpos);
2502 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2503 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2504 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2505 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2506 for(
size_t i=ii; i<iend; ++i ) {
2507 const size_t index( idx(i) );
2508 for(
size_t j=jj; j<jend; ++j ) {
2509 matrix_(index,j) += (~rhs)(i,j);
2532 template<
typename MT
2534 ,
typename... CRAs >
2535 template<
typename MT2 >
2536 inline void Rows<MT,true,true,SF,CRAs...>::addAssign(
const SparseMatrix<MT2,false>& rhs )
2544 for(
size_t i=0UL; i<
rows(); ++i ) {
2545 const size_t index( idx(i) );
2546 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2547 matrix_(index,element->index()) += element->value();
2566 template<
typename MT
2568 ,
typename... CRAs >
2569 template<
typename MT2 >
2570 inline void Rows<MT,true,true,SF,CRAs...>::addAssign(
const SparseMatrix<MT2,true>& rhs )
2580 for(
size_t j=0UL; j<
columns(); ++j ) {
2581 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2582 matrix_(idx(element->index()),j) += element->value();
2601 template<
typename MT
2603 ,
typename... CRAs >
2604 template<
typename MT2 >
2605 inline auto Rows<MT,true,true,SF,CRAs...>::subAssign(
const DenseMatrix<MT2,false>& rhs )
2606 -> DisableIf_t< VectorizedSubAssign_v<MT2> >
2614 const size_t jpos(
columns() &
size_t(-2) );
2617 for(
size_t i=0UL; i<
rows(); ++i )
2619 const size_t index( idx(i) );
2621 if( IsDiagonal_v<MT2> ) {
2622 matrix_(index,i) -= (~rhs)(i,i);
2625 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2626 matrix_(index,j ) -= (~rhs)(i,j );
2627 matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
2630 matrix_(index,jpos) -= (~rhs)(i,jpos);
2651 template<
typename MT
2653 ,
typename... CRAs >
2654 template<
typename MT2 >
2655 inline auto Rows<MT,true,true,SF,CRAs...>::subAssign(
const DenseMatrix<MT2,false>& rhs )
2656 -> EnableIf_t< VectorizedSubAssign_v<MT2> >
2666 for(
size_t i=0UL; i<
rows(); ++i )
2668 const size_t jbegin( ( IsUpper_v<MT2> )
2669 ?( ( IsStrictlyUpper_v<MT2> ? i+1UL : i ) &
size_t(-SIMDSIZE) )
2671 const size_t jend ( ( IsLower_v<MT2> )
2672 ?( IsStrictlyLower_v<MT2> ? i : i+1UL )
2676 const size_t jpos( jend &
size_t(-SIMDSIZE) );
2680 Iterator left(
begin(i) + jbegin );
2681 ConstIterator_t<MT2> right( (~rhs).
begin(i) + jbegin );
2683 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2684 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2685 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2686 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2687 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2689 for( ; j<jpos; j+=SIMDSIZE ) {
2690 left.store( left.load() - right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2692 for( ; j<jend; ++j ) {
2693 *left -= *right; ++left; ++right;
2713 template<
typename MT
2715 ,
typename... CRAs >
2716 template<
typename MT2 >
2717 inline void Rows<MT,true,true,SF,CRAs...>::subAssign(
const DenseMatrix<MT2,true>& rhs )
2727 constexpr
size_t block( BLOCK_SIZE );
2731 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
2732 for(
size_t i=0UL; i<
rows(); ++i ) {
2733 const size_t index( idx(i) );
2734 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2735 matrix_(index,j ) -= (~rhs)(i,j );
2736 matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
2738 if( jpos < (~rhs).columns() ) {
2739 matrix_(index,jpos) -= (~rhs)(i,jpos);
2745 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2746 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2747 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2748 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2749 for(
size_t i=ii; i<iend; ++i ) {
2750 const size_t index( idx(i) );
2751 for(
size_t j=jj; j<jend; ++j ) {
2752 matrix_(index,j) -= (~rhs)(i,j);
2775 template<
typename MT
2777 ,
typename... CRAs >
2778 template<
typename MT2 >
2779 inline void Rows<MT,true,true,SF,CRAs...>::subAssign(
const SparseMatrix<MT2,false>& rhs )
2787 for(
size_t i=0UL; i<
rows(); ++i ) {
2788 const size_t index( idx(i) );
2789 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2790 matrix_(index,element->index()) -= element->value();
2809 template<
typename MT
2811 ,
typename... CRAs >
2812 template<
typename MT2 >
2813 inline void Rows<MT,true,true,SF,CRAs...>::subAssign(
const SparseMatrix<MT2,true>& rhs )
2823 for(
size_t j=0UL; j<
columns(); ++j ) {
2824 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2825 matrix_(idx(element->index()),j) -= element->value();
2844 template<
typename MT
2846 ,
typename... CRAs >
2847 template<
typename MT2 >
2848 inline auto Rows<MT,true,true,SF,CRAs...>::schurAssign(
const DenseMatrix<MT2,false>& rhs )
2849 -> DisableIf_t< VectorizedSchurAssign_v<MT2> >
2857 const size_t jpos(
columns() &
size_t(-2) );
2860 for(
size_t i=0UL; i<
rows(); ++i ) {
2861 const size_t index( idx(i) );
2862 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2863 matrix_(index,j ) *= (~rhs)(i,j );
2864 matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
2867 matrix_(index,jpos) *= (~rhs)(i,jpos);
2887 template<
typename MT
2889 ,
typename... CRAs >
2890 template<
typename MT2 >
2891 inline auto Rows<MT,true,true,SF,CRAs...>::schurAssign(
const DenseMatrix<MT2,false>& rhs )
2892 -> EnableIf_t< VectorizedSchurAssign_v<MT2> >
2902 for(
size_t i=0UL; i<
rows(); ++i )
2904 const size_t jpos(
columns() &
size_t(-SIMDSIZE) );
2908 Iterator left(
begin(i) );
2909 ConstIterator_t<MT2> right( (~rhs).
begin(i) );
2911 for( ; (j+SIMDSIZE*3UL) < jpos; j+=SIMDSIZE*4UL ) {
2912 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2913 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2914 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2915 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2917 for( ; j<jpos; j+=SIMDSIZE ) {
2918 left.store( left.load() * right.load() ); left += SIMDSIZE; right += SIMDSIZE;
2921 *left *= *right; ++left; ++right;
2941 template<
typename MT
2943 ,
typename... CRAs >
2944 template<
typename MT2 >
2945 inline void Rows<MT,true,true,SF,CRAs...>::schurAssign(
const DenseMatrix<MT2,true>& rhs )
2955 constexpr
size_t block( BLOCK_SIZE );
2959 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
2960 for(
size_t i=0UL; i<
rows(); ++i ) {
2961 const size_t index( idx(i) );
2962 for(
size_t j=0UL; j<jpos; j+=2UL ) {
2963 matrix_(index,j ) *= (~rhs)(i,j );
2964 matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
2966 if( jpos < (~rhs).columns() ) {
2967 matrix_(index,jpos) *= (~rhs)(i,jpos);
2973 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
2974 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
2975 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
2976 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
2977 for(
size_t i=ii; i<iend; ++i ) {
2978 const size_t index( idx(i) );
2979 for(
size_t j=jj; j<jend; ++j ) {
2980 matrix_(index,j) *= (~rhs)(i,j);
3003 template<
typename MT
3005 ,
typename... CRAs >
3006 template<
typename MT2 >
3007 inline void Rows<MT,true,true,SF,CRAs...>::schurAssign(
const SparseMatrix<MT2,false>& rhs )
3017 for(
size_t i=0UL; i<
rows(); ++i )
3019 const size_t index( idx(i) );
3022 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
3023 for( ; j<element->index(); ++j )
3024 reset( matrix_(index,j) );
3025 matrix_(index,j) *= element->value();
3030 reset( matrix_(index,j) );
3050 template<
typename MT
3052 ,
typename... CRAs >
3053 template<
typename MT2 >
3054 inline void Rows<MT,true,true,SF,CRAs...>::schurAssign(
const SparseMatrix<MT2,true>& rhs )
3066 for(
size_t j=0UL; j<
columns(); ++j )
3070 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
3071 for( ; i<element->index(); ++i )
3072 reset( matrix_(idx(i),j) );
3073 matrix_(idx(i),j) *= element->value();
3077 for( ; i<
rows(); ++i ) {
3078 reset( matrix_(idx(i),j) );
3106 template<
typename MT
3107 ,
typename... CRAs >
3108 class Rows<MT,false,true,false,CRAs...>
3109 :
public View< DenseMatrix< Rows<MT,false,true,false,CRAs...>, false > >
3110 ,
private RowsData<CRAs...>
3114 using DataType = RowsData<CRAs...>;
3115 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
3124 template<
typename MT1,
typename MT2 >
3125 static constexpr
bool EnforceEvaluation_v =
3126 ( IsRestricted_v<MT1> && RequiresEvaluation_v<MT2> );
3132 using This = Rows<MT,
false,
true,
false,CRAs...>;
3134 using BaseType = DenseMatrix<This,false>;
3135 using ViewedType = MT;
3136 using ResultType = RowsTrait_t<MT,N>;
3137 using OppositeType = OppositeType_t<ResultType>;
3138 using TransposeType = TransposeType_t<ResultType>;
3139 using ElementType = ElementType_t<MT>;
3140 using ReturnType = ReturnType_t<MT>;
3141 using CompositeType =
const Rows&;
3144 using ConstReference = ConstReference_t<MT>;
3147 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
3150 using ConstPointer = ConstPointer_t<MT>;
3153 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
3159 template<
typename MatrixType
3160 ,
typename IteratorType >
3166 using IteratorCategory =
typename std::iterator_traits<IteratorType>::iterator_category;
3169 using ValueType =
typename std::iterator_traits<IteratorType>::value_type;
3172 using PointerType =
typename std::iterator_traits<IteratorType>::pointer;
3175 using ReferenceType =
typename std::iterator_traits<IteratorType>::reference;
3178 using DifferenceType =
typename std::iterator_traits<IteratorType>::difference_type;
3181 using iterator_category = IteratorCategory;
3182 using value_type = ValueType;
3183 using pointer = PointerType;
3184 using reference = ReferenceType;
3185 using difference_type = DifferenceType;
3191 inline RowsIterator() noexcept
3192 : matrix_(
nullptr )
3206 inline RowsIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
3207 : matrix_( &matrix )
3212 if( column_ != matrix_->columns() )
3213 pos_ = matrix_->begin( column_ ) + row_;
3222 template<
typename MatrixType2,
typename IteratorType2 >
3223 inline RowsIterator(
const RowsIterator<MatrixType2,IteratorType2>& it ) noexcept
3224 : matrix_( it.matrix_ )
3226 , column_( it.column_ )
3237 inline RowsIterator&
operator+=(
size_t inc ) noexcept {
3240 if( column_ != matrix_->columns() )
3241 pos_ = matrix_->begin( column_ ) + row_;
3253 inline RowsIterator&
operator-=(
size_t dec ) noexcept {
3256 if( column_ != matrix_->columns() )
3257 pos_ = matrix_->begin( column_ ) + row_;
3268 inline RowsIterator& operator++() noexcept {
3271 if( column_ != matrix_->columns() )
3272 pos_ = matrix_->begin( column_ ) + row_;
3283 inline const RowsIterator operator++(
int ) noexcept {
3284 const RowsIterator tmp( *
this );
3295 inline RowsIterator& operator--() noexcept {
3298 if( column_ != matrix_->columns() )
3299 pos_ = matrix_->begin( column_ ) + row_;
3310 inline const RowsIterator operator--(
int ) noexcept {
3311 const RowsIterator tmp( *
this );
3323 inline ReferenceType operator[](
size_t index )
const {
3325 const IteratorType pos( matrix_->begin( column_+index ) + row_ );
3335 inline ReferenceType
operator*()
const {
3345 inline PointerType operator->()
const {
3356 template<
typename MatrixType2,
typename IteratorType2 >
3357 inline bool operator==(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3358 return column_ == rhs.column_;
3368 template<
typename MatrixType2,
typename IteratorType2 >
3369 inline bool operator!=(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3370 return !( *
this == rhs );
3380 template<
typename MatrixType2,
typename IteratorType2 >
3381 inline bool operator<(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3382 return column_ < rhs.column_;
3392 template<
typename MatrixType2,
typename IteratorType2 >
3393 inline bool operator>(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3394 return column_ > rhs.column_;
3404 template<
typename MatrixType2,
typename IteratorType2 >
3405 inline bool operator<=(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3406 return column_ <= rhs.column_;
3416 template<
typename MatrixType2,
typename IteratorType2 >
3417 inline bool operator>=(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
3418 return column_ >= rhs.column_;
3428 inline DifferenceType
operator-(
const RowsIterator& rhs )
const noexcept {
3429 return column_ - rhs.column_;
3440 friend inline const RowsIterator
operator+(
const RowsIterator& it,
size_t inc ) noexcept {
3441 return RowsIterator( *it.matrix_, it.row_, it.column_+inc );
3452 friend inline const RowsIterator
operator+(
size_t inc,
const RowsIterator& it ) noexcept {
3453 return RowsIterator( *it.matrix_, it.row_, it.column_+inc );
3464 friend inline const RowsIterator
operator-(
const RowsIterator& it,
size_t dec ) noexcept {
3465 return RowsIterator( *it.matrix_, it.row_, it.column_-dec );
3471 MatrixType* matrix_;
3478 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowsIterator;
3485 using ConstIterator = RowsIterator< const MT, ConstIterator_t<MT> >;
3488 using Iterator = If_t< IsConst_v<MT>, ConstIterator, RowsIterator< MT, Iterator_t<MT> > >;
3493 static constexpr
bool simdEnabled =
false;
3496 static constexpr
bool smpAssignable = MT::smpAssignable;
3499 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
3505 template<
typename... RRAs >
3506 explicit inline Rows( MT& matrix, RRAs... args );
3508 Rows(
const Rows& ) =
default;
3509 Rows( Rows&& ) =
default;
3523 inline Reference operator()(
size_t i,
size_t j );
3524 inline ConstReference operator()(
size_t i,
size_t j )
const;
3525 inline Reference at(
size_t i,
size_t j );
3526 inline ConstReference at(
size_t i,
size_t j )
const;
3527 inline Pointer
data () noexcept;
3528 inline ConstPointer
data () const noexcept;
3529 inline Pointer
data (
size_t i ) noexcept;
3530 inline ConstPointer
data (
size_t i ) const noexcept;
3531 inline Iterator
begin (
size_t i );
3532 inline ConstIterator
begin (
size_t i ) const;
3533 inline ConstIterator
cbegin(
size_t i ) const;
3534 inline Iterator
end (
size_t i );
3535 inline ConstIterator
end (
size_t i ) const;
3536 inline ConstIterator
cend (
size_t i ) const;
3543 inline Rows& operator=( const ElementType& rhs );
3544 inline Rows& operator=( initializer_list< initializer_list<ElementType> > list );
3545 inline Rows& operator=( const Rows& rhs );
3547 template< typename MT2,
bool SO2 >
3548 inline Rows& operator=( const Matrix<MT2,SO2>& rhs );
3550 template< typename MT2,
bool SO2 >
3551 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
3552 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
3554 template< typename MT2,
bool SO2 >
3555 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
3556 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
3558 template< typename MT2,
bool SO2 >
3559 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
3560 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
3562 template< typename MT2,
bool SO2 >
3563 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
3564 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
3566 template< typename MT2,
bool SO2 >
3567 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
3568 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
3570 template< typename MT2,
bool SO2 >
3571 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
3572 ->
EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >;
3579 using DataType::idx;
3580 using DataType::idces;
3581 using DataType::
rows;
3583 inline MT& operand() noexcept;
3584 inline const MT& operand() const noexcept;
3586 inline
size_t columns() const noexcept;
3587 inline
size_t spacing() const noexcept;
3588 inline
size_t capacity() const noexcept;
3589 inline
size_t capacity(
size_t i ) const noexcept;
3591 inline
size_t nonZeros(
size_t i ) const;
3592 inline
void reset();
3593 inline
void reset(
size_t i );
3603 template< typename Other > inline Rows& scale( const Other& scalar );
3610 template< typename Other >
3611 inline
bool canAlias( const Other* alias ) const noexcept;
3613 template< typename MT2,
bool SO2,
bool SF2, typename... CRAs2 >
3614 inline
bool canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
3616 template< typename Other >
3617 inline
bool isAliased( const Other* alias ) const noexcept;
3619 template< typename MT2,
bool SO2,
bool SF2, typename... CRAs2 >
3620 inline
bool isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
3622 inline
bool isAligned () const noexcept;
3623 inline
bool canSMPAssign() const noexcept;
3625 template< typename MT2 > inline
void assign( const DenseMatrix<MT2,false>& rhs );
3626 template< typename MT2 > inline
void assign( const DenseMatrix<MT2,true>& rhs );
3627 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,false>& rhs );
3628 template< typename MT2 > inline
void assign( const SparseMatrix<MT2,true>& rhs );
3630 template< typename MT2 > inline
void addAssign( const DenseMatrix<MT2,false>& rhs );
3631 template< typename MT2 > inline
void addAssign( const DenseMatrix<MT2,true>& rhs );
3632 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,false>& rhs );
3633 template< typename MT2 > inline
void addAssign( const SparseMatrix<MT2,true>& rhs );
3635 template< typename MT2 > inline
void subAssign( const DenseMatrix<MT2,false>& rhs );
3636 template< typename MT2 > inline
void subAssign( const DenseMatrix<MT2,true>& rhs );
3637 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,false>& rhs );
3638 template< typename MT2 > inline
void subAssign( const SparseMatrix<MT2,true>& rhs );
3640 template< typename MT2 > inline
void schurAssign( const DenseMatrix<MT2,false>& rhs );
3641 template< typename MT2 > inline
void schurAssign( const DenseMatrix<MT2,true>& rhs );
3642 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,false>& rhs );
3643 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,true>& rhs );
3656 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename... CRAs2 > friend class Rows;
3696 template< typename MT
3697 , typename... CRAs >
3698 template< typename... RRAs >
3699 inline Rows<MT,false,true,false,CRAs...>::Rows( MT& matrix, RRAs... args )
3700 : DataType( args... )
3701 , matrix_ ( matrix )
3704 for(
size_t i=0UL; i<
rows(); ++i ) {
3705 if( matrix_.rows() <= idx(i) ) {
3734 template<
typename MT
3735 ,
typename... CRAs >
3736 inline typename Rows<MT,
false,
true,
false,CRAs...>::Reference
3737 Rows<MT,false,true,false,CRAs...>::operator()(
size_t i,
size_t j )
3742 return matrix_(idx(i),j);
3759 template<
typename MT
3760 ,
typename... CRAs >
3761 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstReference
3762 Rows<MT,false,true,false,CRAs...>::operator()(
size_t i,
size_t j )
const 3767 return const_cast<const MT&>( matrix_ )(idx(i),j);
3785 template<
typename MT
3786 ,
typename... CRAs >
3787 inline typename Rows<MT,
false,
true,
false,CRAs...>::Reference
3788 Rows<MT,false,true,false,CRAs...>::at(
size_t i,
size_t j )
3796 return (*
this)(i,j);
3814 template<
typename MT
3815 ,
typename... CRAs >
3816 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstReference
3817 Rows<MT,false,true,false,CRAs...>::at(
size_t i,
size_t j )
const 3825 return (*
this)(i,j);
3841 template<
typename MT
3842 ,
typename... CRAs >
3843 inline typename Rows<MT,
false,
true,
false,CRAs...>::Pointer
3846 return matrix_.data() + idx(0UL);
3862 template<
typename MT
3863 ,
typename... CRAs >
3864 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstPointer
3867 return matrix_.data() + idx(0UL);
3882 template<
typename MT
3883 ,
typename... CRAs >
3884 inline typename Rows<MT,
false,
true,
false,CRAs...>::Pointer
3887 return matrix_.data() + idx(i);
3902 template<
typename MT
3903 ,
typename... CRAs >
3904 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstPointer
3907 return matrix_.data() + idx(i);
3922 template<
typename MT
3923 ,
typename... CRAs >
3924 inline typename Rows<MT,
false,
true,
false,CRAs...>::Iterator
3928 return Iterator( matrix_, idx(i), 0UL );
3943 template<
typename MT
3944 ,
typename... CRAs >
3945 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstIterator
3949 return ConstIterator( matrix_, idx(i), 0UL );
3964 template<
typename MT
3965 ,
typename... CRAs >
3966 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstIterator
3970 return ConstIterator( matrix_, idx(i), 0UL );
3985 template<
typename MT
3986 ,
typename... CRAs >
3987 inline typename Rows<MT,
false,
true,
false,CRAs...>::Iterator
3991 return Iterator( matrix_, idx(i),
columns() );
4006 template<
typename MT
4007 ,
typename... CRAs >
4008 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstIterator
4012 return ConstIterator( matrix_, idx(i),
columns() );
4027 template<
typename MT
4028 ,
typename... CRAs >
4029 inline typename Rows<MT,
false,
true,
false,CRAs...>::ConstIterator
4033 return ConstIterator( matrix_, idx(i),
columns() );
4058 template<
typename MT
4059 ,
typename... CRAs >
4060 inline Rows<MT,
false,
true,
false,CRAs...>&
4061 Rows<MT,false,true,false,CRAs...>::operator=(
const ElementType& rhs )
4063 for(
size_t i=0UL; i<
rows(); ++i ) {
4089 template<
typename MT
4090 ,
typename... CRAs >
4091 inline Rows<MT,
false,
true,
false,CRAs...>&
4092 Rows<MT,false,true,false,CRAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
4097 if( list.size() !=
rows() ) {
4101 if( IsRestricted_v<MT> ) {
4103 for(
const auto& rowList : list ) {
4104 const InitializerVector<ElementType> tmp( rowList,
columns() );
4105 if( !tryAssign(
row( matrix_, idx(i),
unchecked ), tmp, 0UL ) ){
4112 decltype(
auto) left( derestrict( *this ) );
4115 for( const auto& rowList : list ) {
4116 std::fill( std::copy( rowList.begin(), rowList.end(), left.begin(i) ), left.end(i), ElementType() );
4141 template<
typename MT
4142 ,
typename... CRAs >
4143 inline Rows<MT,
false,
true,
false,CRAs...>&
4144 Rows<MT,false,true,false,CRAs...>::operator=(
const Rows& rhs )
4152 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
4155 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
4159 if( IsRestricted_v<MT> ) {
4160 for(
size_t i=0UL; i<
rows(); ++i ) {
4167 decltype(
auto) left( derestrict( *this ) );
4169 if( rhs.canAlias( &matrix_ ) ) {
4170 const ResultType tmp( rhs );
4200 template<
typename MT
4201 ,
typename... CRAs >
4202 template<
typename MT2
4204 inline Rows<MT,
false,
true,
false,CRAs...>&
4205 Rows<MT,false,true,false,CRAs...>::operator=(
const Matrix<MT2,SO2>& rhs )
4216 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<MT2>,
const MT2& >;
4217 Right right( ~rhs );
4219 if( IsRestricted_v<MT> ) {
4220 for(
size_t i=0UL; i<
rows(); ++i ) {
4227 decltype(
auto) left( derestrict( *this ) );
4233 if( IsReference_v<Right> && right.canAlias( &matrix_ ) ) {
4234 const ResultType_t<MT2> tmp( right );
4263 template<
typename MT
4264 ,
typename... CRAs >
4265 template<
typename MT2
4268 -> DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
4277 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4286 if( IsRestricted_v<MT> ) {
4287 for(
size_t i=0UL; i<
rows(); ++i ) {
4294 decltype(
auto) left( derestrict( *this ) );
4296 if( (~rhs).canAlias( &matrix_ ) ) {
4297 const AddType tmp( *
this + (~rhs) );
4326 template<
typename MT
4327 ,
typename... CRAs >
4328 template<
typename MT2
4331 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
4340 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4349 const AddType tmp( *
this + (~rhs) );
4351 if( IsRestricted_v<MT> ) {
4352 for(
size_t i=0UL; i<
rows(); ++i ) {
4359 decltype(
auto) left( derestrict( *this ) );
4385 template< typename MT
4386 , typename... CRAs >
4387 template< typename MT2
4389 inline auto Rows<MT,false,true,false,CRAs...>::operator-=( const Matrix<MT2,SO2>& rhs )
4390 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
4399 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4408 if( IsRestricted_v<MT> ) {
4409 for(
size_t i=0UL; i<
rows(); ++i ) {
4416 decltype(
auto) left( derestrict( *this ) );
4418 if( (~rhs).canAlias( &matrix_ ) ) {
4419 const SubType tmp( *
this - (~rhs ) );
4448 template<
typename MT
4449 ,
typename... CRAs >
4450 template<
typename MT2
4453 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
4462 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4471 const SubType tmp( *
this - (~rhs) );
4473 if( IsRestricted_v<MT> ) {
4474 for(
size_t i=0UL; i<
rows(); ++i ) {
4481 decltype(
auto) left( derestrict( *this ) );
4507 template< typename MT
4508 , typename... CRAs >
4509 template< typename MT2
4511 inline auto Rows<MT,false,true,false,CRAs...>::operator%=( const Matrix<MT2,SO2>& rhs )
4512 ->
DisableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
4521 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4529 if( IsRestricted_v<MT> ) {
4530 for(
size_t i=0UL; i<
rows(); ++i ) {
4537 decltype(
auto) left( derestrict( *this ) );
4539 if( (~rhs).canAlias( &matrix_ ) ) {
4540 const SchurType tmp( *
this % (~rhs) );
4541 if( IsSparseMatrix_v<SchurType> )
4571 template<
typename MT
4572 ,
typename... CRAs >
4573 template<
typename MT2
4575 inline auto Rows<MT,false,true,false,CRAs...>::operator%=(
const Matrix<MT2,SO2>& rhs )
4576 -> EnableIf_t< EnforceEvaluation_v<MT,MT2>, Rows& >
4585 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4593 const SchurType tmp( *
this % (~rhs) );
4595 if( IsRestricted_v<MT> ) {
4596 for(
size_t i=0UL; i<
rows(); ++i ) {
4603 decltype(
auto) left( derestrict( *this ) );
4633 template<
typename MT
4634 ,
typename... CRAs >
4635 inline MT& Rows<MT,false,true,false,CRAs...>::operand() noexcept
4649 template<
typename MT
4650 ,
typename... CRAs >
4651 inline const MT& Rows<MT,false,true,false,CRAs...>::operand() const noexcept
4665 template<
typename MT
4666 ,
typename... CRAs >
4669 return matrix_.columns();
4684 template<
typename MT
4685 ,
typename... CRAs >
4688 return matrix_.columns();
4700 template<
typename MT
4701 ,
typename... CRAs >
4719 template<
typename MT
4720 ,
typename... CRAs >
4739 template<
typename MT
4740 ,
typename... CRAs >
4743 size_t nonzeros( 0UL );
4745 for(
size_t i=0UL; i<
rows(); ++i ) {
4764 template<
typename MT
4765 ,
typename... CRAs >
4770 size_t nonzeros( 0UL );
4772 const size_t index( idx(i) );
4773 for(
size_t j=0UL; j<
columns(); ++j ) {
4790 template<
typename MT
4791 ,
typename... CRAs >
4794 for(
size_t i=0UL; i<
rows(); ++i ) {
4811 template<
typename MT
4812 ,
typename... CRAs >
4817 const size_t index( idx(i) );
4818 for(
size_t j=0UL; j<
columns(); ++j ) {
4819 reset( matrix_( index, j ) );
4847 template<
typename MT
4848 ,
typename... CRAs >
4849 inline Rows<MT,
false,
true,
false,CRAs...>&
4859 const ResultType tmp(
trans( *
this ) );
4861 if( IsRestricted_v<MT> ) {
4862 for(
size_t i=0UL; i<
rows(); ++i ) {
4863 if( !tryAssign( matrix_,
row( tmp, i ), idx(i), 0UL ) ) {
4869 decltype(
auto) left( derestrict( *this ) );
4892 template< typename MT
4893 , typename... CRAs >
4894 inline Rows<MT,false,true,false,CRAs...>&
4895 Rows<MT,false,true,false,CRAs...>::
ctranspose()
4904 const ResultType tmp(
ctrans( *
this ) );
4906 if( IsRestricted_v<MT> ) {
4907 for(
size_t i=0UL; i<
rows(); ++i ) {
4908 if( !tryAssign( matrix_,
row( tmp, i ), idx(i), 0UL ) ) {
4914 decltype(
auto) left( derestrict( *this ) );
4937 template< typename MT
4938 , typename... CRAs >
4939 template< typename Other >
4940 inline Rows<MT,false,true,false,CRAs...>&
4941 Rows<MT,false,true,false,CRAs...>::scale( const Other& scalar )
4947 for(
size_t i=0UL; i<
rows(); ++i )
4949 const size_t index ( idx(i) );
4950 const size_t jbegin( IsUpper<MT>::value ? ( IsStrictlyUpper_v<MT> ? index+1UL : index ) : 0UL );
4951 const size_t jend ( IsLower<MT>::value ? ( IsStrictlyLower_v<MT> ? index : index+1UL ) :
columns() );
4953 for(
size_t j=jbegin; j<jend; ++j ) {
4954 matrix_(index,j) *= scalar;
4983 template<
typename MT
4984 ,
typename... CRAs >
4985 template<
typename Other >
4986 inline bool Rows<MT,false,true,false,CRAs...>::canAlias(
const Other* alias )
const noexcept
4988 return matrix_.isAliased( alias );
5006 template<
typename MT
5007 ,
typename... CRAs >
5008 template<
typename MT2
5011 ,
typename... CRAs2 >
5013 Rows<MT,false,true,false,CRAs...>::canAlias(
const Rows<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
5015 return matrix_.isAliased( &alias->matrix_ );
5032 template<
typename MT
5033 ,
typename... CRAs >
5034 template<
typename Other >
5035 inline bool Rows<MT,false,true,false,CRAs...>::isAliased(
const Other* alias )
const noexcept
5037 return matrix_.isAliased( alias );
5055 template<
typename MT
5056 ,
typename... CRAs >
5057 template<
typename MT2
5060 ,
typename... CRAs2 >
5062 Rows<MT,false,true,false,CRAs...>::isAliased(
const Rows<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
5064 return matrix_.isAliased( &alias->matrix_ );
5080 template<
typename MT
5081 ,
typename... CRAs >
5082 inline bool Rows<MT,false,true,false,CRAs...>::isAligned() const noexcept
5101 template<
typename MT
5102 ,
typename... CRAs >
5103 inline bool Rows<MT,false,true,false,CRAs...>::canSMPAssign() const noexcept
5105 return (
rows() *
columns() > SMP_DMATASSIGN_THRESHOLD );
5123 template<
typename MT
5124 ,
typename... CRAs >
5125 template<
typename MT2 >
5126 inline void Rows<MT,false,true,false,CRAs...>::assign(
const DenseMatrix<MT2,false>& rhs )
5134 const size_t jpos(
columns() &
size_t(-2) );
5137 for(
size_t i=0UL; i<
rows(); ++i ) {
5138 const size_t index( idx(i) );
5139 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5140 matrix_(index,j ) = (~rhs)(i,j );
5141 matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
5144 matrix_(index,jpos) = (~rhs)(i,jpos);
5164 template<
typename MT
5165 ,
typename... CRAs >
5166 template<
typename MT2 >
5167 inline void Rows<MT,false,true,false,CRAs...>::assign(
const DenseMatrix<MT2,true>& rhs )
5177 constexpr
size_t block( BLOCK_SIZE );
5181 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
5182 for(
size_t i=0UL; i<
rows(); ++i ) {
5183 const size_t index( idx(i) );
5184 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5185 matrix_(index,j ) = (~rhs)(i,j );
5186 matrix_(index,j+1UL) = (~rhs)(i,j+1UL);
5188 if( jpos < (~rhs).columns() )
5189 matrix_(index,jpos) = (~rhs)(i,jpos);
5194 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5195 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5196 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5197 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5198 for(
size_t i=ii; i<iend; ++i ) {
5199 const size_t index( idx(i) );
5200 for(
size_t j=jj; j<jend; ++j ) {
5201 matrix_(index,j) = (~rhs)(i,j);
5224 template<
typename MT
5225 ,
typename... CRAs >
5226 template<
typename MT2 >
5227 inline void Rows<MT,false,true,false,CRAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
5235 for(
size_t i=0UL; i<
rows(); ++i ) {
5236 const size_t index( idx(i) );
5237 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5238 matrix_(index,element->index()) = element->value();
5257 template<
typename MT
5258 ,
typename... CRAs >
5259 template<
typename MT2 >
5260 inline void Rows<MT,false,true,false,CRAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
5270 for(
size_t j=0UL; j<
columns(); ++j ) {
5271 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5272 matrix_(idx(element->index()),j) = element->value();
5291 template<
typename MT
5292 ,
typename... CRAs >
5293 template<
typename MT2 >
5294 inline void Rows<MT,false,true,false,CRAs...>::addAssign(
const DenseMatrix<MT2,false>& rhs )
5302 const size_t jpos(
columns() &
size_t(-2) );
5305 for(
size_t i=0UL; i<
rows(); ++i )
5307 const size_t index( idx(i) );
5308 if( IsDiagonal_v<MT2> ) {
5309 matrix_(index,i) += (~rhs)(i,i);
5312 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5313 matrix_(index,j ) += (~rhs)(i,j );
5314 matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
5317 matrix_(index,jpos) += (~rhs)(i,jpos);
5338 template<
typename MT
5339 ,
typename... CRAs >
5340 template<
typename MT2 >
5341 inline void Rows<MT,false,true,false,CRAs...>::addAssign(
const DenseMatrix<MT2,true>& rhs )
5351 constexpr
size_t block( BLOCK_SIZE );
5355 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
5356 for(
size_t i=0UL; i<
rows(); ++i ) {
5357 const size_t index( idx(i) );
5358 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5359 matrix_(index,j ) += (~rhs)(i,j );
5360 matrix_(index,j+1UL) += (~rhs)(i,j+1UL);
5362 if( jpos < (~rhs).columns() )
5363 matrix_(index,jpos) += (~rhs)(i,jpos);
5368 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5369 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5370 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5371 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5372 for(
size_t i=ii; i<iend; ++i ) {
5373 const size_t index( idx(i) );
5374 for(
size_t j=jj; j<jend; ++j ) {
5375 matrix_(index,j) += (~rhs)(i,j);
5398 template<
typename MT
5399 ,
typename... CRAs >
5400 template<
typename MT2 >
5401 inline void Rows<MT,false,true,false,CRAs...>::addAssign(
const SparseMatrix<MT2,false>& rhs )
5409 for(
size_t i=0UL; i<
rows(); ++i ) {
5410 const size_t index( idx(i) );
5411 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5412 matrix_(index,element->index()) += element->value();
5431 template<
typename MT
5432 ,
typename... CRAs >
5433 template<
typename MT2 >
5434 inline void Rows<MT,false,true,false,CRAs...>::addAssign(
const SparseMatrix<MT2,true>& rhs )
5444 for(
size_t j=0UL; j<
columns(); ++j ) {
5445 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5446 matrix_(idx(element->index()),j) += element->value();
5465 template<
typename MT
5466 ,
typename... CRAs >
5467 template<
typename MT2 >
5468 inline void Rows<MT,false,true,false,CRAs...>::subAssign(
const DenseMatrix<MT2,false>& rhs )
5476 const size_t jpos(
columns() &
size_t(-2) );
5479 for(
size_t i=0UL; i<
rows(); ++i )
5481 const size_t index( idx(i) );
5483 if( IsDiagonal_v<MT2> ) {
5484 matrix_(index,i) -= (~rhs)(i,i);
5487 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5488 matrix_(index,j ) -= (~rhs)(i,j );
5489 matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
5492 matrix_(index,jpos) -= (~rhs)(i,jpos);
5513 template<
typename MT
5514 ,
typename... CRAs >
5515 template<
typename MT2 >
5516 inline void Rows<MT,false,true,false,CRAs...>::subAssign(
const DenseMatrix<MT2,true>& rhs )
5526 constexpr
size_t block( BLOCK_SIZE );
5530 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
5531 for(
size_t i=0UL; i<
rows(); ++i ) {
5532 const size_t index( idx(i) );
5533 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5534 matrix_(index,j ) -= (~rhs)(i,j );
5535 matrix_(index,j+1UL) -= (~rhs)(i,j+1UL);
5537 if( jpos < (~rhs).columns() )
5538 matrix_(index,jpos) -= (~rhs)(i,jpos);
5543 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5544 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5545 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5546 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5547 for(
size_t i=ii; i<iend; ++i ) {
5548 const size_t index( idx(i) );
5549 for(
size_t j=jj; j<jend; ++j ) {
5550 matrix_(index,j) -= (~rhs)(i,j);
5573 template<
typename MT
5574 ,
typename... CRAs >
5575 template<
typename MT2 >
5576 inline void Rows<MT,false,true,false,CRAs...>::subAssign(
const SparseMatrix<MT2,false>& rhs )
5584 for(
size_t i=0UL; i<
rows(); ++i ) {
5585 const size_t index( idx(i) );
5586 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5587 matrix_(index,element->index()) -= element->value();
5606 template<
typename MT
5607 ,
typename... CRAs >
5608 template<
typename MT2 >
5609 inline void Rows<MT,false,true,false,CRAs...>::subAssign(
const SparseMatrix<MT2,true>& rhs )
5619 for(
size_t j=0UL; j<
columns(); ++j ) {
5620 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
5621 matrix_(idx(element->index()),j) -= element->value();
5640 template<
typename MT
5641 ,
typename... CRAs >
5642 template<
typename MT2 >
5643 inline void Rows<MT,false,true,false,CRAs...>::schurAssign(
const DenseMatrix<MT2,false>& rhs )
5651 const size_t jpos(
columns() &
size_t(-2) );
5654 for(
size_t i=0UL; i<
rows(); ++i ) {
5655 const size_t index( idx(i) );
5656 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5657 matrix_(index,j ) *= (~rhs)(i,j );
5658 matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
5661 matrix_(index,jpos) *= (~rhs)(i,jpos);
5681 template<
typename MT
5682 ,
typename... CRAs >
5683 template<
typename MT2 >
5684 inline void Rows<MT,false,true,false,CRAs...>::schurAssign(
const DenseMatrix<MT2,true>& rhs )
5694 constexpr
size_t block( BLOCK_SIZE );
5698 const size_t jpos( (~rhs).
columns() &
size_t(-2) );
5699 for(
size_t i=0UL; i<
rows(); ++i ) {
5700 const size_t index( idx(i) );
5701 for(
size_t j=0UL; j<jpos; j+=2UL ) {
5702 matrix_(index,j ) *= (~rhs)(i,j );
5703 matrix_(index,j+1UL) *= (~rhs)(i,j+1UL);
5705 if( jpos < (~rhs).columns() )
5706 matrix_(index,jpos) *= (~rhs)(i,jpos);
5711 for(
size_t ii=0UL; ii<
rows(); ii+=block ) {
5712 const size_t iend( (
rows()<(ii+block) )?(
rows() ):( ii+block ) );
5713 for(
size_t jj=0UL; jj<
columns(); jj+=block ) {
5714 const size_t jend( (
columns()<(jj+block) )?(
columns() ):( jj+block ) );
5715 for(
size_t i=ii; i<iend; ++i ) {
5716 const size_t index( idx(i) );
5717 for(
size_t j=jj; j<jend; ++j ) {
5718 matrix_(index,j) *= (~rhs)(i,j);
5741 template<
typename MT
5742 ,
typename... CRAs >
5743 template<
typename MT2 >
5744 inline void Rows<MT,false,true,false,CRAs...>::schurAssign(
const SparseMatrix<MT2,false>& rhs )
5754 for(
size_t i=0UL; i<
rows(); ++i )
5756 const size_t index( idx(i) );
5759 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
5760 for( ; j<element->index(); ++j )
5761 reset( matrix_(index,j) );
5762 matrix_(index,j) *= element->value();
5767 reset( matrix_(index,j) );
5787 template<
typename MT
5788 ,
typename... CRAs >
5789 template<
typename MT2 >
5790 inline void Rows<MT,false,true,false,CRAs...>::schurAssign(
const SparseMatrix<MT2,true>& rhs )
5802 for(
size_t j=0UL; j<
columns(); ++j )
5806 for( ConstIterator_t<MT2> element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element ) {
5807 for( ; i<element->index(); ++i )
5808 reset( matrix_(idx(i),j) );
5809 matrix_(idx(i),j) *= element->value();
5813 for( ; i<
rows(); ++i ) {
5814 reset( matrix_(idx(i),j) );
5842 template<
typename MT
5843 ,
typename... CRAs >
5844 class Rows<MT,false,true,true,CRAs...>
5845 :
public View< DenseMatrix< Rows<MT,false,true,true,CRAs...>, false > >
5846 ,
private RowsData<CRAs...>
5850 using DataType = RowsData<CRAs...>;
5851 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
5861 using This = Rows<MT,
false,
true,
true,CRAs...>;
5863 using BaseType = DenseMatrix<This,false>;
5864 using ViewedType = MT;
5865 using ResultType = RowsTrait_t<MT,N>;
5866 using OppositeType = OppositeType_t<ResultType>;
5867 using TransposeType = TransposeType_t<ResultType>;
5868 using ElementType = ElementType_t<MT>;
5869 using SIMDType = SIMDTrait_t<ElementType>;
5870 using ReturnType = ReturnType_t<MT>;
5871 using CompositeType =
const Rows&;
5874 using ConstReference = ConstReference_t<MT>;
5877 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
5880 using ConstPointer = ConstPointer_t<MT>;
5883 using Pointer = If_t< IsConst_v<MT> || !HasMutableDataAccess_v<MT>, ConstPointer, Pointer_t<MT> >;
5886 using ConstIterator = ConstIterator_t<MT>;
5889 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
5894 static constexpr
bool simdEnabled = MT::simdEnabled;
5897 static constexpr
bool smpAssignable = MT::smpAssignable;
5900 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
5906 template<
typename... RRAs >
5907 explicit inline Rows( MT& matrix, RRAs... args );
5909 Rows(
const Rows& ) =
default;
5910 Rows( Rows&& ) =
default;
5924 inline Reference operator()(
size_t i,
size_t j );
5925 inline ConstReference operator()(
size_t i,
size_t j )
const;
5926 inline Reference at(
size_t i,
size_t j );
5927 inline ConstReference at(
size_t i,
size_t j )
const;
5928 inline Pointer
data () noexcept;
5929 inline ConstPointer
data () const noexcept;
5930 inline Pointer
data (
size_t i ) noexcept;
5931 inline ConstPointer
data (
size_t i ) const noexcept;
5932 inline Iterator
begin (
size_t i );
5933 inline ConstIterator
begin (
size_t i ) const;
5934 inline ConstIterator
cbegin(
size_t i ) const;
5935 inline Iterator
end (
size_t i );
5936 inline ConstIterator
end (
size_t i ) const;
5937 inline ConstIterator
cend (
size_t i ) const;
5944 inline Rows& operator=( const ElementType& rhs );
5946 Rows& operator=( const Rows& ) = delete;
5953 using DataType::idx;
5954 using DataType::idces;
5955 using DataType::
rows;
5957 inline MT& operand() noexcept;
5958 inline const MT& operand() const noexcept;
5960 inline
size_t columns() const noexcept;
5961 inline
size_t spacing() const noexcept;
5962 inline
size_t capacity() const noexcept;
5963 inline
size_t capacity(
size_t i ) const noexcept;
5965 inline
size_t nonZeros(
size_t i ) const;
5966 inline
void reset();
5967 inline
void reset(
size_t i );
5974 template< typename Other >
5975 inline
bool canAlias( const Other* alias ) const noexcept;
5977 template< typename MT2,
bool SO2,
bool SF2, typename... CRAs2 >
5978 inline
bool canAlias( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
5980 template< typename Other >
5981 inline
bool isAliased( const Other* alias ) const noexcept;
5983 template< typename MT2,
bool SO2,
bool SF2, typename... CRAs2 >
5984 inline
bool isAliased( const Rows<MT2,SO2,true,SF2,CRAs2...>* alias ) const noexcept;
5986 inline
bool isAligned () const noexcept;
5987 inline
bool canSMPAssign() const noexcept;
6004 template< typename MT2,
bool SO2,
bool DF2,
bool SF2, typename... CRAs2 > friend class Rows;
6044 template< typename MT
6045 , typename... CRAs >
6046 template< typename... RRAs >
6047 inline Rows<MT,false,true,true,CRAs...>::Rows( MT& matrix, RRAs... args )
6048 : DataType( args... )
6049 , matrix_ ( matrix )
6052 for(
size_t i=0UL; i<
rows(); ++i ) {
6053 if( matrix_.rows() <= idx(i) ) {
6082 template<
typename MT
6083 ,
typename... CRAs >
6084 inline typename Rows<MT,
false,
true,
true,CRAs...>::Reference
6085 Rows<MT,false,true,true,CRAs...>::operator()(
size_t i,
size_t j )
6090 return matrix_(j,idx(i));
6107 template<
typename MT
6108 ,
typename... CRAs >
6109 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstReference
6110 Rows<MT,false,true,true,CRAs...>::operator()(
size_t i,
size_t j )
const 6115 return const_cast<const MT&>( matrix_ )(j,idx(i));
6133 template<
typename MT
6134 ,
typename... CRAs >
6135 inline typename Rows<MT,
false,
true,
true,CRAs...>::Reference
6136 Rows<MT,false,true,true,CRAs...>::at(
size_t i,
size_t j )
6144 return (*
this)(i,j);
6162 template<
typename MT
6163 ,
typename... CRAs >
6164 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstReference
6165 Rows<MT,false,true,true,CRAs...>::at(
size_t i,
size_t j )
const 6173 return (*
this)(i,j);
6189 template<
typename MT
6190 ,
typename... CRAs >
6191 inline typename Rows<MT,
false,
true,
true,CRAs...>::Pointer
6194 return matrix_.data( idx(0UL) );
6210 template<
typename MT
6211 ,
typename... CRAs >
6212 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstPointer
6215 return matrix_.data( idx(0UL) );
6230 template<
typename MT
6231 ,
typename... CRAs >
6232 inline typename Rows<MT,
false,
true,
true,CRAs...>::Pointer
6235 return matrix_.data( idx(i) );
6250 template<
typename MT
6251 ,
typename... CRAs >
6252 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstPointer
6255 return matrix_.data( idx(i) );
6270 template<
typename MT
6271 ,
typename... CRAs >
6272 inline typename Rows<MT,
false,
true,
true,CRAs...>::Iterator
6276 return matrix_.begin( idx(i) );
6291 template<
typename MT
6292 ,
typename... CRAs >
6293 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstIterator
6297 return matrix_.cbegin( idx(i) );
6312 template<
typename MT
6313 ,
typename... CRAs >
6314 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstIterator
6318 return matrix_.cbegin( idx(i) );
6333 template<
typename MT
6334 ,
typename... CRAs >
6335 inline typename Rows<MT,
false,
true,
true,CRAs...>::Iterator
6339 return matrix_.end( idx(i) );
6354 template<
typename MT
6355 ,
typename... CRAs >
6356 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstIterator
6360 return matrix_.cend( idx(i) );
6375 template<
typename MT
6376 ,
typename... CRAs >
6377 inline typename Rows<MT,
false,
true,
true,CRAs...>::ConstIterator
6381 return matrix_.cend( idx(i) );
6406 template<
typename MT
6407 ,
typename... CRAs >
6408 inline Rows<MT,
false,
true,
true,CRAs...>&
6409 Rows<MT,false,true,true,CRAs...>::operator=(
const ElementType& rhs )
6411 for(
size_t i=0UL; i<
rows(); ++i ) {
6435 template<
typename MT
6436 ,
typename... CRAs >
6437 inline MT& Rows<MT,false,true,true,CRAs...>::operand() noexcept
6451 template<
typename MT
6452 ,
typename... CRAs >
6453 inline const MT& Rows<MT,false,true,true,CRAs...>::operand() const noexcept
6467 template<
typename MT
6468 ,
typename... CRAs >
6471 return matrix_.columns();
6486 template<
typename MT
6487 ,
typename... CRAs >
6490 return matrix_.spacing();
6502 template<
typename MT
6503 ,
typename... CRAs >
6521 template<
typename MT
6522 ,
typename... CRAs >
6541 template<
typename MT
6542 ,
typename... CRAs >
6545 size_t nonzeros( 0UL );
6547 for(
size_t i=0UL; i<
rows(); ++i ) {
6548 nonzeros += matrix_.nonZeros( idx(i) );
6566 template<
typename MT
6567 ,
typename... CRAs >
6572 return matrix_.nonZeros( idx(i) );
6584 template<
typename MT
6585 ,
typename... CRAs >
6588 for(
size_t i=0UL; i<
rows(); ++i ) {
6589 matrix_.reset( idx(i) );
6605 template<
typename MT
6606 ,
typename... CRAs >
6609 matrix_.reset( idx(i) );
6634 template<
typename MT
6635 ,
typename... CRAs >
6636 template<
typename Other >
6637 inline bool Rows<MT,false,true,true,CRAs...>::canAlias(
const Other* alias )
const noexcept
6639 return matrix_.isAliased( alias );
6657 template<
typename MT
6658 ,
typename... CRAs >
6659 template<
typename MT2
6662 ,
typename... CRAs2 >
6664 Rows<MT,false,true,true,CRAs...>::canAlias(
const Rows<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
6666 return matrix_.isAliased( &alias->matrix_ );
6683 template<
typename MT
6684 ,
typename... CRAs >
6685 template<
typename Other >
6686 inline bool Rows<MT,false,true,true,CRAs...>::isAliased(
const Other* alias )
const noexcept
6688 return matrix_.isAliased( alias );
6706 template<
typename MT
6707 ,
typename... CRAs >
6708 template<
typename MT2
6711 ,
typename... CRAs2 >
6713 Rows<MT,false,true,true,CRAs...>::isAliased(
const Rows<MT2,SO2,true,SF2,CRAs2...>* alias )
const noexcept
6715 return matrix_.isAliased( &alias->matrix_ );
6731 template<
typename MT
6732 ,
typename... CRAs >
6733 inline bool Rows<MT,false,true,true,CRAs...>::isAligned() const noexcept
6735 return matrix_.isAligned();
6752 template<
typename MT
6753 ,
typename... CRAs >
6754 inline bool Rows<MT,false,true,true,CRAs...>::canSMPAssign() const noexcept
6756 return (
rows() *
columns() > SMP_DMATASSIGN_THRESHOLD );
6777 template<
typename MT
6778 ,
typename... CRAs >
6780 Rows<MT,false,true,true,CRAs...>::load(
size_t i,
size_t j )
const noexcept
6782 return matrix_.load( j, idx(i) );
6803 template<
typename MT
6804 ,
typename... CRAs >
6808 return matrix_.loada( j, idx(i) );
6829 template<
typename MT
6830 ,
typename... CRAs >
6834 return matrix_.loadu( j, idx(i) );
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.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
Header file for kernel specific block sizes.
Header file for the Schur product trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ROWS_TYPE(T)
Constraint on the data type.In case the given data type T is a row selection type (i....
Definition: Rows.h:81
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
Header file for the subtraction 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:170
Header file for the View base class.
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.The IsSIMDCombinable_v variable templ...
Definition: IsSIMDCombinable.h:137
Header file for the IsSparseMatrix type trait.
Header file for the IsDiagonal type 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
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
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
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
#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....
Definition: Submatrix.h:81
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
#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
Header file for the MAYBE_UNUSED function template.
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 HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.The HasSIMDAdd_v variable template provides...
Definition: HasSIMDAdd.h:187
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 RequiresEvaluation type trait.
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
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
Constraint on the data type.
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:253
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 IsStrictlyUpper type trait.
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
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1361
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
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:9091
#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
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.The HasSIMDSub_v variable template provides...
Definition: HasSIMDSub.h:187
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
Header file for the DenseMatrix base class.
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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
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:138
Header file for the IsLower type trait.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
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.
#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
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
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.
Constraint on the data type.
Header file for the IsSIMDCombinable 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,...
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.
Header file for run time assertion macros.
Header file for the addition 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
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,...
Definition: Reference.h:79
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.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
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.
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
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
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
Header file for the rows trait.
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
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Constraint on the data type.
Header file for the implementation of the RowsData class template.
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
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.The HasSIMDMult_v variable template provid...
Definition: HasSIMDMult.h:188
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type,...
Definition: Hermitian.h:79
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)
Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Bla...
Definition: Exception.h:187
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
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.The IsDiagonal_v variable template provides...
Definition: IsDiagonal.h:148
Header file for the implementation of the Rows base template.
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,...
Definition: Assert.h:101
constexpr bool IsSparseMatrix_v
Auxiliary variable template for the IsSparseMatrix type trait.The IsSparseMatrix_v variable template ...
Definition: IsSparseMatrix.h:138
Header file for the IsExpression type trait class.
Constraint on the data type.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825