35 #ifndef _BLAZE_MATH_VIEWS_ROWS_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_ROWS_SPARSE_H_ 110 template<
typename MT
113 class Rows<MT,true,false,SF,CRAs...>
114 :
public View< SparseMatrix< Rows<MT,true,false,SF,CRAs...>, false > >
115 ,
private RowsData<CRAs...>
119 using DataType = RowsData<CRAs...>;
120 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
130 using This = Rows<MT,
true,
false,SF,CRAs...>;
132 using BaseType = SparseMatrix<This,false>;
133 using ViewedType = MT;
134 using ResultType = RowsTrait_t<MT,N>;
135 using OppositeType = OppositeType_t<ResultType>;
136 using TransposeType = TransposeType_t<ResultType>;
137 using ElementType = ElementType_t<MT>;
138 using ReturnType = ReturnType_t<MT>;
139 using CompositeType =
const Rows&;
142 using ConstReference = ConstReference_t<MT>;
145 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
148 using ConstIterator = ConstIterator_t<MT>;
151 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
156 static constexpr
bool smpAssignable = MT::smpAssignable;
159 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
165 template<
typename... RRAs >
166 explicit inline Rows( MT& matrix, RRAs... args );
168 Rows(
const Rows& ) =
default;
169 Rows( Rows&& ) =
default;
183 inline Reference operator()(
size_t i,
size_t j );
184 inline ConstReference operator()(
size_t i,
size_t j )
const;
185 inline Reference at(
size_t i,
size_t j );
186 inline ConstReference at(
size_t i,
size_t j )
const;
187 inline Iterator
begin (
size_t i );
188 inline ConstIterator
begin (
size_t i )
const;
189 inline ConstIterator
cbegin(
size_t i )
const;
190 inline Iterator
end (
size_t i );
191 inline ConstIterator
end (
size_t i )
const;
192 inline ConstIterator
cend (
size_t i )
const;
199 inline Rows& operator=( initializer_list< initializer_list<ElementType> > list );
200 inline Rows& operator=(
const Rows& rhs );
202 template<
typename MT2,
bool SO >
inline Rows& operator= (
const Matrix<MT2,SO>& rhs );
203 template<
typename MT2,
bool SO >
inline Rows&
operator+=(
const Matrix<MT2,SO>& rhs );
204 template<
typename MT2,
bool SO >
inline Rows&
operator-=(
const Matrix<MT2,SO>& rhs );
205 template<
typename MT2,
bool SO >
inline Rows& operator%=(
const Matrix<MT2,SO>& rhs );
213 using DataType::idces;
216 inline MT& operand() noexcept;
217 inline const MT& operand() const noexcept;
219 inline
size_t columns() const noexcept;
220 inline
size_t capacity() const noexcept;
221 inline
size_t capacity(
size_t i ) const noexcept;
223 inline
size_t nonZeros(
size_t i ) const;
225 inline
void reset(
size_t i );
226 inline
void reserve(
size_t nonzeros );
227 void reserve(
size_t i,
size_t nonzeros );
229 inline
void trim(
size_t i );
236 inline Iterator
set (
size_t i,
size_t j, const ElementType& value );
237 inline Iterator insert (
size_t i,
size_t j, const ElementType& value );
238 inline
void append (
size_t i,
size_t j, const ElementType& value,
bool check=false );
239 inline
void finalize(
size_t i );
246 inline
void erase(
size_t i,
size_t j );
247 inline Iterator erase(
size_t i, Iterator pos );
248 inline Iterator erase(
size_t i, Iterator first, Iterator last );
250 template< typename Pred >
251 inline
void erase( Pred predicate );
253 template< typename Pred >
254 inline
void erase(
size_t i, Iterator first, Iterator last, Pred predicate );
261 inline Iterator find (
size_t i,
size_t j );
262 inline ConstIterator find (
size_t i,
size_t j ) const;
263 inline Iterator lowerBound(
size_t i,
size_t j );
264 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
265 inline Iterator upperBound(
size_t i,
size_t j );
266 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
276 template< typename Other > inline Rows& scale( const Other& scalar );
283 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
284 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
286 inline
bool canSMPAssign() const noexcept;
288 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
289 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
290 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
291 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
292 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
293 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
301 inline
size_t extendCapacity(
size_t i ) const noexcept;
348 template< typename MT
351 template< typename... RRAs >
352 inline Rows<MT,true,false,SF,CRAs...>::Rows( MT& matrix, RRAs... args )
353 : DataType( args... )
357 for(
size_t i=0UL; i<
rows(); ++i ) {
358 if( matrix_.rows() <= idx(i) ) {
387 template<
typename MT
390 inline typename Rows<MT,
true,
false,SF,CRAs...>::Reference
391 Rows<MT,true,false,SF,CRAs...>::operator()(
size_t i,
size_t j )
396 return matrix_(idx(i),j);
413 template<
typename MT
416 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstReference
417 Rows<MT,true,false,SF,CRAs...>::operator()(
size_t i,
size_t j )
const 422 return const_cast<const MT&>( matrix_ )(idx(i),j);
440 template<
typename MT
443 inline typename Rows<MT,
true,
false,SF,CRAs...>::Reference
444 Rows<MT,true,false,SF,CRAs...>::at(
size_t i,
size_t j )
470 template<
typename MT
473 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstReference
474 Rows<MT,true,false,SF,CRAs...>::at(
size_t i,
size_t j )
const 497 template<
typename MT
500 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
505 return matrix_.begin( idx(i) );
520 template<
typename MT
523 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
528 return matrix_.cbegin( idx(i) );
543 template<
typename MT
546 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
551 return matrix_.cbegin( idx(i) );
566 template<
typename MT
569 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
574 return matrix_.end( idx(i) );
589 template<
typename MT
592 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
597 return matrix_.cend( idx(i) );
612 template<
typename MT
615 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
620 return matrix_.cend( idx(i) );
650 template<
typename MT
653 inline Rows<MT,
true,
false,SF,CRAs...>&
654 Rows<MT,true,false,SF,CRAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
659 if( list.size() !=
rows() ) {
663 const InitializerMatrix<ElementType> tmp( list,
columns() );
665 if( IsRestricted_v<MT> ) {
666 for(
size_t i=0UL; i<
rows(); ++i ) {
667 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), i, 0UL ) ) {
673 decltype(
auto) left( derestrict( *this ) );
699 template< typename MT
702 inline Rows<MT,true,false,SF,CRAs...>&
703 Rows<MT,true,false,SF,CRAs...>::operator=( const Rows& rhs )
711 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
714 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
718 if( IsRestricted_v<MT> ) {
719 for(
size_t i=0UL; i<
rows(); ++i ) {
720 if( !tryAssign( matrix_,
row( rhs, i,
unchecked ), idx(i), 0UL ) ) {
726 decltype(
auto) left( derestrict( *this ) );
728 if( rhs.canAlias( &matrix_ ) ) {
729 const ResultType tmp( rhs );
761 template<
typename MT
764 template<
typename MT2
766 inline Rows<MT,
true,
false,SF,CRAs...>&
767 Rows<MT,true,false,SF,CRAs...>::operator=(
const Matrix<MT2,SO>& rhs )
778 using Right = CompositeType_t<MT2>;
781 if( IsRestricted_v<MT> ) {
782 for(
size_t i=0UL; i<
rows(); ++i ) {
783 if( !tryAssign( matrix_,
row( right, i,
unchecked ), idx(i), 0UL ) ) {
789 decltype(
auto) left( derestrict( *this ) );
792 const ResultType_t<MT2> tmp( right );
823 template<
typename MT
826 template<
typename MT2
828 inline Rows<MT,
true,
false,SF,CRAs...>&
838 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
846 const AddType tmp( *
this + (~rhs) );
848 if( IsRestricted_v<MT> ) {
849 for(
size_t i=0UL; i<
rows(); ++i ) {
850 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
856 decltype(
auto) left( derestrict( *this ) );
883 template< typename MT
886 template< typename MT2
888 inline Rows<MT,true,false,SF,CRAs...>&
889 Rows<MT,true,false,SF,CRAs...>::operator-=( const Matrix<MT2,SO>& rhs )
898 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
906 const SubType tmp( *
this - (~rhs) );
908 if( IsRestricted_v<MT> ) {
909 for(
size_t i=0UL; i<
rows(); ++i ) {
910 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
916 decltype(
auto) left( derestrict( *this ) );
943 template< typename MT
946 template< typename MT2
948 inline Rows<MT,true,false,SF,CRAs...>&
949 Rows<MT,true,false,SF,CRAs...>::operator%=( const Matrix<MT2,SO>& rhs )
958 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
966 const SchurType tmp( *
this % (~rhs) );
968 if( IsRestricted_v<MT> ) {
969 for(
size_t i=0UL; i<
rows(); ++i ) {
970 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
976 decltype(
auto) left( derestrict( *this ) );
1003 template< typename MT
1005 , typename... CRAs >
1006 inline MT& Rows<MT,true,false,SF,CRAs...>::operand() noexcept
1020 template<
typename MT
1022 ,
typename... CRAs >
1023 inline const MT& Rows<MT,true,false,SF,CRAs...>::operand() const noexcept
1037 template<
typename MT
1039 ,
typename... CRAs >
1042 return matrix_.columns();
1054 template<
typename MT
1056 ,
typename... CRAs >
1059 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
1074 template<
typename MT
1076 ,
typename... CRAs >
1081 return matrix_.capacity( idx(i) );
1093 template<
typename MT
1095 ,
typename... CRAs >
1098 size_t nonzeros( 0UL );
1100 for(
size_t i=0UL; i<
rows(); ++i )
1118 template<
typename MT
1120 ,
typename... CRAs >
1125 return matrix_.nonZeros( idx(i) );
1137 template<
typename MT
1139 ,
typename... CRAs >
1142 for(
size_t i=0UL; i<
rows(); ++i ) {
1143 matrix_.reset( idx(i) );
1160 template<
typename MT
1162 ,
typename... CRAs >
1165 matrix_.reset( idx(i) );
1182 template<
typename MT
1184 ,
typename... CRAs >
1185 inline void Rows<MT,true,false,SF,CRAs...>::reserve(
size_t nonzeros )
1187 const size_t current(
capacity() );
1189 if( nonzeros > current ) {
1190 matrix_.reserve( matrix_.capacity() + nonzeros - current );
1210 template<
typename MT
1212 ,
typename... CRAs >
1213 void Rows<MT,true,false,SF,CRAs...>::reserve(
size_t i,
size_t nonzeros )
1215 matrix_.reserve( idx(i), nonzeros );
1231 template<
typename MT
1233 ,
typename... CRAs >
1234 void Rows<MT,true,false,SF,CRAs...>::trim()
1236 for(
size_t i=0UL; i<
rows(); ++i ) {
1255 template<
typename MT
1257 ,
typename... CRAs >
1258 void Rows<MT,true,false,SF,CRAs...>::trim(
size_t i )
1262 matrix_.trim( idx(i) );
1278 template<
typename MT
1280 ,
typename... CRAs >
1281 inline size_t Rows<MT,true,false,SF,CRAs...>::extendCapacity(
size_t i )
const noexcept
1286 size_t nonzeros( 2UL*
capacity( i )+1UL );
1287 nonzeros =
max( nonzeros, 7UL );
1319 template<
typename MT
1321 ,
typename... CRAs >
1322 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1325 return matrix_.set( idx(i), j, value );
1345 template<
typename MT
1347 ,
typename... CRAs >
1348 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1349 Rows<MT,true,false,SF,CRAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
1351 return matrix_.insert( idx(i), j, value );
1401 template<
typename MT
1403 ,
typename... CRAs >
1404 inline void Rows<MT,true,false,SF,CRAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
1406 if( !check || !isDefault<strict>( value ) )
1407 matrix_.insert( idx(i), j, value );
1427 template<
typename MT
1429 ,
typename... CRAs >
1430 inline void Rows<MT,true,false,SF,CRAs...>::finalize(
size_t i )
1458 template<
typename MT
1460 ,
typename... CRAs >
1461 inline void Rows<MT,true,false,SF,CRAs...>::erase(
size_t i,
size_t j )
1466 matrix_.erase( idx(i), j );
1482 template<
typename MT
1484 ,
typename... CRAs >
1485 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1486 Rows<MT,true,false,SF,CRAs...>::erase(
size_t i, Iterator pos )
1490 return matrix_.erase( idx(i), pos );
1507 template<
typename MT
1509 ,
typename... CRAs >
1510 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1511 Rows<MT,true,false,SF,CRAs...>::erase(
size_t i, Iterator first, Iterator last )
1515 return matrix_.erase( idx(i), first, last );
1544 template<
typename MT
1546 ,
typename... CRAs >
1547 template<
typename Pred >
1548 inline void Rows<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1550 for(
size_t i=0UL; i<
rows(); ++i ) {
1551 matrix_.erase( idx(i),
begin(i),
end(i), predicate );
1585 template<
typename MT
1587 ,
typename... CRAs >
1588 template<
typename Pred >
1589 inline void Rows<MT,true,false,SF,CRAs...>::erase(
size_t i, Iterator first, Iterator last, Pred predicate )
1593 matrix_.erase( idx(i), first, last, predicate );
1622 template<
typename MT
1624 ,
typename... CRAs >
1625 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1626 Rows<MT,true,false,SF,CRAs...>::find(
size_t i,
size_t j )
1628 return matrix_.find( idx(i), j );
1649 template<
typename MT
1651 ,
typename... CRAs >
1652 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
1653 Rows<MT,true,false,SF,CRAs...>::find(
size_t i,
size_t j )
const 1655 return matrix_.find( idx(i), j );
1675 template<
typename MT
1677 ,
typename... CRAs >
1678 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1679 Rows<MT,true,false,SF,CRAs...>::lowerBound(
size_t i,
size_t j )
1681 return matrix_.lowerBound( idx(i), j );
1701 template<
typename MT
1703 ,
typename... CRAs >
1704 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
1705 Rows<MT,true,false,SF,CRAs...>::lowerBound(
size_t i,
size_t j )
const 1707 return matrix_.lowerBound( idx(i), j );
1727 template<
typename MT
1729 ,
typename... CRAs >
1730 inline typename Rows<MT,
true,
false,SF,CRAs...>::Iterator
1731 Rows<MT,true,false,SF,CRAs...>::upperBound(
size_t i,
size_t j )
1733 return matrix_.upperBound( idx(i), j );
1753 template<
typename MT
1755 ,
typename... CRAs >
1756 inline typename Rows<MT,
true,
false,SF,CRAs...>::ConstIterator
1757 Rows<MT,true,false,SF,CRAs...>::upperBound(
size_t i,
size_t j )
const 1759 return matrix_.upperBound( idx(i), j );
1786 template<
typename MT
1788 ,
typename... CRAs >
1789 inline Rows<MT,
true,
false,SF,CRAs...>&
1799 const ResultType tmp(
trans( *
this ) );
1801 if( IsRestricted_v<MT> ) {
1802 for(
size_t i=0UL; i<
rows(); ++i ) {
1803 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
1809 decltype(
auto) left( derestrict( *this ) );
1833 template< typename MT
1835 , typename... CRAs >
1836 inline Rows<MT,true,false,SF,CRAs...>&
1846 const ResultType tmp(
ctrans( *
this ) );
1848 if( IsRestricted_v<MT> ) {
1849 for(
size_t i=0UL; i<
rows(); ++i ) {
1850 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
1856 decltype(
auto) left( derestrict( *this ) );
1880 template< typename MT
1882 , typename... CRAs >
1883 template< typename Other >
1884 inline Rows<MT,true,false,SF,CRAs...>&
1885 Rows<MT,true,false,SF,CRAs...>::scale( const Other& scalar )
1891 for(
size_t i=0UL; i<
rows(); ++i ) {
1892 const Iterator last(
end(i) );
1893 for( Iterator element=
begin(i); element!=last; ++element )
1894 element->value() *= scalar;
1922 template<
typename MT
1924 ,
typename... CRAs >
1925 template<
typename Other >
1926 inline bool Rows<MT,true,false,SF,CRAs...>::canAlias(
const Other* alias )
const noexcept
1928 return matrix_.isAliased( alias );
1945 template<
typename MT
1947 ,
typename... CRAs >
1948 template<
typename Other >
1949 inline bool Rows<MT,true,false,SF,CRAs...>::isAliased(
const Other* alias )
const noexcept
1951 return matrix_.isAliased( alias );
1968 template<
typename MT
1970 ,
typename... CRAs >
1971 inline bool Rows<MT,true,false,SF,CRAs...>::canSMPAssign() const noexcept
1991 template<
typename MT
1993 ,
typename... CRAs >
1994 template<
typename MT2
1996 inline void Rows<MT,true,false,SF,CRAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
2005 for(
size_t i=0UL; i<
rows(); ++i )
2007 const size_t index( idx(i) );
2008 size_t remaining( matrix_.capacity( index ) );
2010 for(
size_t j=0UL; j<
columns(); ++j )
2012 if( remaining == 0UL ) {
2013 matrix_.reserve( index, extendCapacity( i ) );
2014 remaining = matrix_.capacity( index ) - matrix_.nonZeros( index );
2017 matrix_.append( index, j, (~rhs)(i,j),
true );
2038 template<
typename MT
2040 ,
typename... CRAs >
2041 template<
typename MT2 >
2042 inline void Rows<MT,true,false,SF,CRAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2051 for(
size_t i=0UL; i<
rows(); ++i )
2053 const size_t index( idx(i) );
2054 size_t remaining( matrix_.capacity( index ) );
2056 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
2058 if( remaining == 0UL ) {
2059 matrix_.reserve( index, extendCapacity( i ) );
2060 remaining = matrix_.capacity( index ) - matrix_.nonZeros( index );
2063 matrix_.append( index, element->index(), element->value(), true );
2084 template<
typename MT
2086 ,
typename... CRAs >
2087 template<
typename MT2 >
2088 inline void Rows<MT,true,false,SF,CRAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2100 std::vector<size_t> rowLengths(
rows(), 0UL );
2101 for(
size_t j=0UL; j<
columns(); ++j ) {
2102 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2103 ++rowLengths[element->index()];
2107 for(
size_t i=0UL; i<
rows(); ++i ) {
2108 reserve( i, rowLengths[i] );
2112 for(
size_t j=0UL; j<
columns(); ++j ) {
2113 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2114 append( element->index(), j, element->value(), true );
2133 template<
typename MT
2135 ,
typename... CRAs >
2136 template<
typename MT2
2138 inline void Rows<MT,true,false,SF,CRAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
2143 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
2150 const AddType tmp(
serial( *
this + (~rhs) ) );
2170 template<
typename MT
2172 ,
typename... CRAs >
2173 template<
typename MT2
2175 inline void Rows<MT,true,false,SF,CRAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
2180 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
2187 const SubType tmp(
serial( *
this - (~rhs) ) );
2207 template<
typename MT
2209 ,
typename... CRAs >
2210 template<
typename MT2
2212 inline void Rows<MT,true,false,SF,CRAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
2217 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
2225 const SchurType tmp(
serial( *
this % (~rhs) ) );
2253 template<
typename MT
2254 ,
typename... CRAs >
2255 class Rows<MT,false,false,false,CRAs...>
2256 :
public View< SparseMatrix< Rows<MT,false,false,false,CRAs...>, false > >
2257 ,
private RowsData<CRAs...>
2261 using DataType = RowsData<CRAs...>;
2262 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2272 using This = Rows<MT,
false,
false,
false,CRAs...>;
2274 using BaseType = SparseMatrix<This,false>;
2275 using ViewedType = MT;
2276 using ResultType = RowsTrait_t<MT,N>;
2277 using OppositeType = OppositeType_t<ResultType>;
2278 using TransposeType = TransposeType_t<ResultType>;
2279 using ElementType = ElementType_t<MT>;
2280 using ReturnType = ReturnType_t<MT>;
2281 using CompositeType =
const Rows&;
2284 using ConstReference = ConstReference_t<MT>;
2287 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2293 template<
typename MatrixType
2294 ,
typename IteratorType >
2296 :
private SparseElement
2305 inline RowsElement( IteratorType pos,
size_t column )
2317 template<
typename T >
inline RowsElement& operator=(
const T& v ) {
2329 template<
typename T >
inline RowsElement&
operator+=(
const T& v ) {
2341 template<
typename T >
inline RowsElement&
operator-=(
const T& v ) {
2353 template<
typename T >
inline RowsElement&
operator*=(
const T& v ) {
2365 template<
typename T >
inline RowsElement&
operator/=(
const T& v ) {
2376 inline const RowsElement* operator->()
const {
2386 inline decltype(
auto) value()
const {
2387 return pos_->value();
2396 inline size_t index()
const {
2412 template<
typename MatrixType
2413 ,
typename IteratorType >
2418 using IteratorCategory = std::forward_iterator_tag;
2419 using ValueType = RowsElement<MatrixType,IteratorType>;
2420 using PointerType = ValueType;
2421 using ReferenceType = ValueType;
2422 using DifferenceType = ptrdiff_t;
2425 using iterator_category = IteratorCategory;
2426 using value_type = ValueType;
2427 using pointer = PointerType;
2428 using reference = ReferenceType;
2429 using difference_type = DifferenceType;
2435 inline RowsIterator()
2436 : matrix_( nullptr )
2450 inline RowsIterator( MatrixType& matrix,
size_t row,
size_t column )
2451 : matrix_( &matrix )
2456 for( ; column_<matrix_->columns(); ++column_ ) {
2457 pos_ = matrix_->find( row_, column_ );
2458 if( pos_ != matrix_->end( column_ ) )
break;
2471 inline RowsIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2472 : matrix_( &matrix )
2486 template<
typename MatrixType2,
typename IteratorType2 >
2487 inline RowsIterator(
const RowsIterator<MatrixType2,IteratorType2>& it )
2488 : matrix_( it.matrix_ )
2490 , column_( it.column_ )
2500 inline RowsIterator& operator++() {
2502 for( ; column_<matrix_->columns(); ++column_ ) {
2503 pos_ = matrix_->find( row_, column_ );
2504 if( pos_ != matrix_->end( column_ ) )
break;
2516 inline const RowsIterator operator++(
int ) {
2517 const RowsIterator tmp( *
this );
2528 inline ReferenceType
operator*()
const {
2529 return ReferenceType( pos_, column_ );
2538 inline PointerType operator->()
const {
2539 return PointerType( pos_, column_ );
2549 template<
typename MatrixType2,
typename IteratorType2 >
2550 inline bool operator==(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2551 return column_ == rhs.column_;
2561 template<
typename MatrixType2,
typename IteratorType2 >
2562 inline bool operator!=(
const RowsIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2563 return !( *
this == rhs );
2573 inline DifferenceType
operator-(
const RowsIterator& rhs )
const {
2574 size_t counter( 0UL );
2575 for(
size_t j=rhs.column_; j<column_; ++j ) {
2576 if( matrix_->find( row_, j ) != matrix_->end( j ) )
2585 MatrixType* matrix_;
2592 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowsIterator;
2593 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
typename... CRAs2 >
friend class Rows;
2600 using ConstIterator = RowsIterator< const MT, ConstIterator_t<MT> >;
2603 using Iterator = If_t< IsConst_v<MT>, ConstIterator, RowsIterator< MT, Iterator_t<MT> > >;
2608 static constexpr
bool smpAssignable = MT::smpAssignable;
2611 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
2617 template<
typename... RRAs >
2618 explicit inline Rows( MT& matrix, RRAs... args );
2620 Rows(
const Rows& ) =
default;
2621 Rows( Rows&& ) =
default;
2635 inline Reference operator()(
size_t i,
size_t j );
2636 inline ConstReference operator()(
size_t i,
size_t j )
const;
2637 inline Reference at(
size_t i,
size_t j );
2638 inline ConstReference at(
size_t i,
size_t j )
const;
2639 inline Iterator
begin (
size_t i );
2640 inline ConstIterator
begin (
size_t i )
const;
2641 inline ConstIterator
cbegin(
size_t i )
const;
2642 inline Iterator
end (
size_t i );
2643 inline ConstIterator
end (
size_t i )
const;
2644 inline ConstIterator
cend (
size_t i )
const;
2651 inline Rows& operator=( initializer_list< initializer_list<ElementType> > list );
2652 inline Rows& operator=(
const Rows& rhs );
2654 template<
typename MT2,
bool SO >
inline Rows& operator= (
const Matrix<MT2,SO>& rhs );
2655 template<
typename MT2,
bool SO >
inline Rows&
operator+=(
const Matrix<MT2,SO>& rhs );
2656 template<
typename MT2,
bool SO >
inline Rows&
operator-=(
const Matrix<MT2,SO>& rhs );
2657 template<
typename MT2,
bool SO >
inline Rows& operator%=(
const Matrix<MT2,SO>& rhs );
2664 using DataType::idx;
2665 using DataType::idces;
2668 inline MT& operand() noexcept;
2669 inline const MT& operand() const noexcept;
2671 inline
size_t columns() const noexcept;
2672 inline
size_t capacity() const noexcept;
2673 inline
size_t capacity(
size_t i ) const noexcept;
2675 inline
size_t nonZeros(
size_t i ) const;
2676 inline
void reset();
2677 inline
void reset(
size_t i );
2678 inline
void reserve(
size_t nonzeros );
2679 void reserve(
size_t i,
size_t nonzeros );
2681 inline
void trim(
size_t j );
2688 inline Iterator
set (
size_t i,
size_t j, const ElementType& value );
2689 inline Iterator insert (
size_t i,
size_t j, const ElementType& value );
2690 inline
void append (
size_t i,
size_t j, const ElementType& value,
bool check=false );
2691 inline
void finalize(
size_t i );
2698 inline
void erase(
size_t i,
size_t j );
2699 inline Iterator erase(
size_t i, Iterator pos );
2700 inline Iterator erase(
size_t i, Iterator first, Iterator last );
2702 template< typename Pred >
2703 inline
void erase( Pred predicate );
2705 template< typename Pred >
2706 inline
void erase(
size_t i, Iterator first, Iterator last, Pred predicate );
2713 inline Iterator find (
size_t i,
size_t j );
2714 inline ConstIterator find (
size_t i,
size_t j ) const;
2715 inline Iterator lowerBound(
size_t i,
size_t j );
2716 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
2717 inline Iterator upperBound(
size_t i,
size_t j );
2718 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
2728 template< typename Other > inline Rows& scale( const Other& scalar );
2735 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
2736 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
2738 inline
bool canSMPAssign() const noexcept;
2740 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
2741 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
2742 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
2743 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
2744 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
2745 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
2794 template< typename MT
2795 , typename... CRAs >
2796 template< typename... RRAs >
2797 inline Rows<MT,false,false,false,CRAs...>::Rows( MT& matrix, RRAs... args )
2798 : DataType( args... )
2799 , matrix_ ( matrix )
2802 for(
size_t i=0UL; i<
rows(); ++i ) {
2803 if( matrix_.rows() <= idx(i) ) {
2832 template<
typename MT
2833 ,
typename... CRAs >
2834 inline typename Rows<MT,
false,
false,
false,CRAs...>::Reference
2835 Rows<MT,false,false,false,CRAs...>::operator()(
size_t i,
size_t j )
2840 return matrix_(idx(i),j);
2857 template<
typename MT
2858 ,
typename... CRAs >
2859 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstReference
2860 Rows<MT,false,false,false,CRAs...>::operator()(
size_t i,
size_t j )
const 2865 return const_cast<const MT&>( matrix_ )(idx(i),j);
2883 template<
typename MT
2884 ,
typename... CRAs >
2885 inline typename Rows<MT,
false,
false,
false,CRAs...>::Reference
2886 Rows<MT,false,false,false,CRAs...>::at(
size_t i,
size_t j )
2894 return (*
this)(i,j);
2912 template<
typename MT
2913 ,
typename... CRAs >
2914 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstReference
2915 Rows<MT,false,false,false,CRAs...>::at(
size_t i,
size_t j )
const 2923 return (*
this)(i,j);
2938 template<
typename MT
2939 ,
typename... CRAs >
2940 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
2945 return Iterator( matrix_, idx(i), 0UL );
2960 template<
typename MT
2961 ,
typename... CRAs >
2962 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
2967 return ConstIterator( matrix_, idx(i), 0UL );
2982 template<
typename MT
2983 ,
typename... CRAs >
2984 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
2989 return ConstIterator( matrix_, idx(i), 0UL );
3004 template<
typename MT
3005 ,
typename... CRAs >
3006 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
3011 return Iterator( matrix_, idx(i),
columns() );
3026 template<
typename MT
3027 ,
typename... CRAs >
3028 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
3033 return ConstIterator( matrix_, idx(i),
columns() );
3048 template<
typename MT
3049 ,
typename... CRAs >
3050 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
3055 return ConstIterator( matrix_, idx(i),
columns() );
3085 template<
typename MT
3086 ,
typename... CRAs >
3087 inline Rows<MT,
false,
false,
false,CRAs...>&
3088 Rows<MT,false,false,false,CRAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
3093 if( list.size() !=
rows() ) {
3097 const InitializerMatrix<ElementType> tmp( list,
columns() );
3099 if( IsRestricted_v<MT> ) {
3100 for(
size_t i=0UL; i<
rows(); ++i ) {
3101 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), i, 0UL ) ) {
3107 decltype(
auto) left( derestrict( *this ) );
3132 template< typename MT
3133 , typename... CRAs >
3134 inline Rows<MT,false,false,false,CRAs...>&
3135 Rows<MT,false,false,false,CRAs...>::operator=( const Rows& rhs )
3143 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && compareIndices( *
this, rhs ) ) )
3146 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
3150 if( IsRestricted_v<MT> ) {
3151 for(
size_t i=0UL; i<
rows(); ++i ) {
3152 if( !tryAssign( matrix_,
row( rhs, i,
unchecked ), idx(i), 0UL ) ) {
3158 decltype(
auto) left( derestrict( *this ) );
3160 if( rhs.canAlias( &matrix_ ) ) {
3161 const ResultType tmp( rhs );
3193 template<
typename MT
3194 ,
typename... CRAs >
3195 template<
typename MT2
3197 inline Rows<MT,
false,
false,
false,CRAs...>&
3198 Rows<MT,false,false,false,CRAs...>::operator=(
const Matrix<MT2,SO>& rhs )
3209 using Right = CompositeType_t<MT2>;
3210 Right right( ~rhs );
3212 if( IsRestricted_v<MT> ) {
3213 for(
size_t i=0UL; i<
rows(); ++i ) {
3214 if( !tryAssign( matrix_,
row( right, i,
unchecked ), idx(i), 0UL ) ) {
3220 decltype(
auto) left( derestrict( *this ) );
3223 const ResultType_t<MT2> tmp( right );
3229 if( IsSparseMatrix_v<MT2> )
3256 template<
typename MT
3257 ,
typename... CRAs >
3258 template<
typename MT2
3260 inline Rows<MT,
false,
false,
false,CRAs...>&
3270 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
3278 const AddType tmp( *
this + (~rhs) );
3280 if( IsRestricted_v<MT> ) {
3281 for(
size_t i=0UL; i<
rows(); ++i ) {
3282 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
3288 decltype(
auto) left( derestrict( *this ) );
3318 template<
typename MT
3319 ,
typename... CRAs >
3320 template<
typename MT2
3322 inline Rows<MT,
false,
false,
false,CRAs...>&
3332 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
3340 const SubType tmp( *
this - (~rhs) );
3342 if( IsRestricted_v<MT> ) {
3343 for(
size_t i=0UL; i<
rows(); ++i ) {
3344 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
3350 decltype(
auto) left( derestrict( *this ) );
3380 template<
typename MT
3381 ,
typename... CRAs >
3382 template<
typename MT2
3384 inline Rows<MT,
false,
false,
false,CRAs...>&
3385 Rows<MT,false,false,false,CRAs...>::operator%=(
const Matrix<MT2,SO>& rhs )
3394 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
3402 const SchurType tmp( *
this % (~rhs) );
3404 if( IsRestricted_v<MT> ) {
3405 for(
size_t i=0UL; i<
rows(); ++i ) {
3406 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
3412 decltype(
auto) left( derestrict( *this ) );
3442 template<
typename MT
3443 ,
typename... CRAs >
3444 inline MT& Rows<MT,false,false,false,CRAs...>::operand() noexcept
3458 template<
typename MT
3459 ,
typename... CRAs >
3460 inline const MT& Rows<MT,false,false,false,CRAs...>::operand() const noexcept
3474 template<
typename MT
3475 ,
typename... CRAs >
3478 return matrix_.columns();
3490 template<
typename MT
3491 ,
typename... CRAs >
3509 template<
typename MT
3510 ,
typename... CRAs >
3529 template<
typename MT
3530 ,
typename... CRAs >
3533 size_t nonzeros( 0UL );
3535 for(
size_t j=0UL; j<
columns(); ++j ) {
3536 const auto end( matrix_.end( j ) );
3537 for(
size_t i=0UL; i<
rows(); ++i ) {
3538 auto pos = matrix_.find( idx(i), j );
3560 template<
typename MT
3561 ,
typename... CRAs >
3566 size_t counter( 0UL );
3568 const ConstIterator last(
end(i) );
3569 for( ConstIterator element=
begin(i); element!=last; ++element ) {
3585 template<
typename MT
3586 ,
typename... CRAs >
3589 for(
size_t i=0UL; i<
rows(); ++i ) {
3607 template<
typename MT
3608 ,
typename... CRAs >
3611 const size_t index( idx(i) );
3613 const size_t jbegin( ( IsUpper_v<MT> )
3614 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3618 const size_t jend ( ( IsLower_v<MT> )
3619 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3624 for(
size_t j=jbegin; j<jend; ++j ) {
3625 matrix_.erase( index, j );
3643 template<
typename MT
3644 ,
typename... CRAs >
3645 inline void Rows<MT,false,false,false,CRAs...>::reserve(
size_t nonzeros )
3668 template<
typename MT
3669 ,
typename... CRAs >
3670 void Rows<MT,false,false,false,CRAs...>::reserve(
size_t i,
size_t nonzeros )
3690 template<
typename MT
3691 ,
typename... CRAs >
3692 void Rows<MT,false,false,false,CRAs...>::trim()
3711 template<
typename MT
3712 ,
typename... CRAs >
3713 void Rows<MT,false,false,false,CRAs...>::trim(
size_t i )
3746 template<
typename MT
3747 ,
typename... CRAs >
3748 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
3751 return Iterator( matrix_, idx(i), j, matrix_.set( idx(i), j, value ) );
3771 template<
typename MT
3772 ,
typename... CRAs >
3773 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
3774 Rows<MT,false,false,false,CRAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
3776 return Iterator( matrix_, idx(i), j, matrix_.insert( idx(i), j, value ) );
3826 template<
typename MT
3827 ,
typename... CRAs >
3828 inline void Rows<MT,false,false,false,CRAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
3830 if( !check || !isDefault<strict>( value ) )
3831 matrix_.insert( idx(i), j, value );
3851 template<
typename MT
3852 ,
typename... CRAs >
3853 inline void Rows<MT,false,false,false,CRAs...>::finalize(
size_t i )
3881 template<
typename MT
3882 ,
typename... CRAs >
3883 inline void Rows<MT,false,false,false,CRAs...>::erase(
size_t i,
size_t j )
3888 matrix_.erase( idx(i), j );
3904 template<
typename MT
3905 ,
typename... CRAs >
3906 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
3907 Rows<MT,false,false,false,CRAs...>::erase(
size_t i, Iterator pos )
3909 const size_t column( pos.column_ );
3914 matrix_.erase(
column, pos.pos_ );
3915 return Iterator( matrix_, idx(i),
column+1UL );
3932 template<
typename MT
3933 ,
typename... CRAs >
3934 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
3935 Rows<MT,false,false,false,CRAs...>::erase(
size_t i, Iterator first, Iterator last )
3941 for( ; first!=last; ++first ) {
3942 matrix_.erase( first.column_, first.pos_ );
3974 template<
typename MT
3975 ,
typename... CRAs >
3976 template<
typename Pred >
3977 inline void Rows<MT,false,false,false,CRAs...>::erase( Pred predicate )
3979 for(
size_t i=0UL; i<
rows(); ++i ) {
3980 for( Iterator element=
begin(i); element!=
end(i); ++element ) {
3981 if( predicate( element->value() ) )
3982 matrix_.erase( element.column_, element.pos_ );
4017 template<
typename MT
4018 ,
typename... CRAs >
4019 template<
typename Pred >
4020 inline void Rows<MT,false,false,false,CRAs...>::erase(
size_t i, Iterator first, Iterator last, Pred predicate )
4026 for( ; first!=last; ++first ) {
4027 if( predicate( first->value() ) )
4028 matrix_.erase( first.column_, first.pos_ );
4058 template<
typename MT
4059 ,
typename... CRAs >
4060 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
4061 Rows<MT,false,false,false,CRAs...>::find(
size_t i,
size_t j )
4063 const size_t index( idx(i) );
4064 const Iterator_t<MT> pos( matrix_.find( index, j ) );
4066 if( pos != matrix_.end( j ) )
4067 return Iterator( matrix_, index, j, pos );
4090 template<
typename MT
4091 ,
typename... CRAs >
4092 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
4093 Rows<MT,false,false,false,CRAs...>::find(
size_t i,
size_t j )
const 4095 const size_t index( idx(i) );
4096 const ConstIterator_t<MT> pos( matrix_.find( index, j ) );
4098 if( pos != matrix_.end( j ) )
4099 return ConstIterator( matrix_, index, j, pos );
4121 template<
typename MT
4122 ,
typename... CRAs >
4123 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
4124 Rows<MT,false,false,false,CRAs...>::lowerBound(
size_t i,
size_t j )
4126 const size_t index( idx(i) );
4130 const Iterator_t<MT> pos( matrix_.find( index, j ) );
4132 if( pos != matrix_.end( j ) )
4133 return Iterator( matrix_, index, j, pos );
4156 template<
typename MT
4157 ,
typename... CRAs >
4158 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
4159 Rows<MT,false,false,false,CRAs...>::lowerBound(
size_t i,
size_t j )
const 4161 const size_t index( idx(i) );
4165 const ConstIterator_t<MT> pos( matrix_.find( index, j ) );
4167 if( pos != matrix_.end( j ) )
4168 return ConstIterator( matrix_, index, j, pos );
4191 template<
typename MT
4192 ,
typename... CRAs >
4193 inline typename Rows<MT,
false,
false,
false,CRAs...>::Iterator
4194 Rows<MT,false,false,false,CRAs...>::upperBound(
size_t i,
size_t j )
4196 return lowerBound( i, j+1UL );
4216 template<
typename MT
4217 ,
typename... CRAs >
4218 inline typename Rows<MT,
false,
false,
false,CRAs...>::ConstIterator
4219 Rows<MT,false,false,false,CRAs...>::upperBound(
size_t i,
size_t j )
const 4221 return lowerBound( i, j+1UL );
4248 template<
typename MT
4249 ,
typename... CRAs >
4250 inline Rows<MT,
false,
false,
false,CRAs...>&
4260 const ResultType tmp(
trans( *
this ) );
4262 if( IsRestricted_v<MT> ) {
4263 for(
size_t i=0UL; i<
rows(); ++i ) {
4264 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
4270 decltype(
auto) left( derestrict( *this ) );
4294 template< typename MT
4295 , typename... CRAs >
4296 inline Rows<MT,false,false,false,CRAs...>&
4297 Rows<MT,false,false,false,CRAs...>::
ctranspose()
4306 const ResultType tmp(
ctrans( *
this ) );
4308 if( IsRestricted_v<MT> ) {
4309 for(
size_t i=0UL; i<
rows(); ++i ) {
4310 if( !tryAssign( matrix_,
row( tmp, i,
unchecked ), idx(i), 0UL ) ) {
4316 decltype(
auto) left( derestrict( *this ) );
4340 template< typename MT
4341 , typename... CRAs >
4342 template< typename Other >
4343 inline Rows<MT,false,false,false,CRAs...>&
4344 Rows<MT,false,false,false,CRAs...>::scale( const Other& scalar )
4350 for(
size_t j=0UL; j<
columns(); ++j ) {
4351 const auto end( matrix_.end( j ) );
4352 for(
size_t i=0UL; i<
rows(); ++i ) {
4353 auto pos = matrix_.find( idx(i), j );
4355 pos->value() *= scalar;
4385 template<
typename MT
4386 ,
typename... CRAs >
4387 template<
typename Other >
4388 inline bool Rows<MT,false,false,false,CRAs...>::canAlias(
const Other* alias )
const noexcept
4390 return matrix_.isAliased( alias );
4407 template<
typename MT
4408 ,
typename... CRAs >
4409 template<
typename Other >
4410 inline bool Rows<MT,false,false,false,CRAs...>::isAliased(
const Other* alias )
const noexcept
4412 return matrix_.isAliased( alias );
4429 template<
typename MT
4430 ,
typename... CRAs >
4431 inline bool Rows<MT,false,false,false,CRAs...>::canSMPAssign() const noexcept
4451 template<
typename MT
4452 ,
typename... CRAs >
4453 template<
typename MT2
4455 inline void Rows<MT,false,false,false,CRAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
4460 using RT = If_t< IsComputation_v<MT2>, ElementType_t<MT>,
const ElementType_t<MT2>& >;
4465 for(
size_t j=0UL; j<
columns(); ++j ) {
4466 for(
size_t i=0UL; i<
rows(); ++i ) {
4467 RT value( (~rhs)(i,j) );
4468 if( !isDefault<strict>( value ) )
4469 matrix_.set( idx(i), j, std::move( value ) );
4470 else matrix_.erase( idx(i), j );
4490 template<
typename MT
4491 ,
typename... CRAs >
4492 template<
typename MT2 >
4493 inline void Rows<MT,false,false,false,CRAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
4498 using RT = If_t< IsComputation_v<MT2>, ElementType_t<MT>,
const ElementType_t<MT2>& >;
4504 for(
size_t i=0UL; i<
rows(); ++i ) {
4505 const size_t index( idx(i) );
4506 for( ConstIterator_t<MT2> element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element ) {
4507 RT value( element->value() );
4508 if( !isDefault<strict>( value ) )
4509 matrix_.set( index, element->index(), std::move( value ) );
4510 else matrix_.erase( index, element->index() );
4530 template<
typename MT
4531 ,
typename... CRAs >
4532 template<
typename MT2 >
4533 inline void Rows<MT,false,false,false,CRAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
4540 using RT = If_t< IsComputation_v<MT2>, ElementType_t<MT>,
const ElementType_t<MT2>& >;
4546 for(
size_t j=0UL; j<
columns(); ++j ) {
4547 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element ) {
4548 RT value( element->value() );
4549 if( !isDefault<strict>( value ) )
4550 matrix_.set( idx( element->index() ), j, std::move( value ) );
4551 else matrix_.erase( idx( element->index() ), j );
4571 template<
typename MT
4572 ,
typename... CRAs >
4573 template<
typename MT2
4575 inline void Rows<MT,false,false,false,CRAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
4580 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4587 const AddType tmp(
serial( *
this + (~rhs) ) );
4607 template<
typename MT
4608 ,
typename... CRAs >
4609 template<
typename MT2
4611 inline void Rows<MT,false,false,false,CRAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
4616 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4623 const SubType tmp(
serial( *
this - (~rhs) ) );
4643 template<
typename MT
4644 ,
typename... CRAs >
4645 template<
typename MT2
4647 inline void Rows<MT,false,false,false,CRAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
4652 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4660 const SchurType tmp(
serial( *
this % (~rhs) ) );
4688 template<
typename MT
4689 ,
typename... CRAs >
4690 class Rows<MT,false,false,true,CRAs...>
4691 :
public View< SparseMatrix< Rows<MT,false,false,true,CRAs...>, false > >
4692 ,
private RowsData<CRAs...>
4696 using DataType = RowsData<CRAs...>;
4697 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4707 using This = Rows<MT,
false,
false,
true,CRAs...>;
4709 using BaseType = SparseMatrix<This,false>;
4710 using ViewedType = MT;
4711 using ResultType = RowsTrait_t<MT,N>;
4712 using OppositeType = OppositeType_t<ResultType>;
4713 using TransposeType = TransposeType_t<ResultType>;
4714 using ElementType = ElementType_t<MT>;
4715 using ReturnType = ReturnType_t<MT>;
4716 using CompositeType =
const Rows&;
4719 using ConstReference = ConstReference_t<MT>;
4722 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4725 using ConstIterator = ConstIterator_t<MT>;
4728 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4733 static constexpr
bool smpAssignable = MT::smpAssignable;
4736 static constexpr
bool compileTimeArgs = DataType::compileTimeArgs;
4742 template<
typename... RRAs >
4743 explicit inline Rows( MT& matrix, RRAs... args );
4745 Rows(
const Rows& ) =
default;
4746 Rows( Rows&& ) =
default;
4760 inline Reference operator()(
size_t i,
size_t j );
4761 inline ConstReference operator()(
size_t i,
size_t j )
const;
4762 inline Reference at(
size_t i,
size_t j );
4763 inline ConstReference at(
size_t i,
size_t j )
const;
4764 inline Iterator
begin (
size_t i );
4765 inline ConstIterator
begin (
size_t i )
const;
4766 inline ConstIterator
cbegin(
size_t i )
const;
4767 inline Iterator
end (
size_t i );
4768 inline ConstIterator
end (
size_t i )
const;
4769 inline ConstIterator
cend (
size_t i )
const;
4776 Rows& operator=(
const Rows& ) =
delete;
4783 using DataType::idx;
4784 using DataType::idces;
4787 inline MT& operand() noexcept;
4788 inline const MT& operand() const noexcept;
4790 inline
size_t columns() const noexcept;
4791 inline
size_t capacity() const noexcept;
4792 inline
size_t capacity(
size_t i ) const noexcept;
4794 inline
size_t nonZeros(
size_t i ) const;
4795 inline
void reset();
4796 inline
void reset(
size_t i );
4797 inline
void reserve(
size_t nonzeros );
4798 void reserve(
size_t i,
size_t nonzeros );
4800 inline
void trim(
size_t i );
4807 inline Iterator
set (
size_t i,
size_t j, const ElementType& value );
4808 inline Iterator insert (
size_t i,
size_t j, const ElementType& value );
4809 inline
void append (
size_t i,
size_t j, const ElementType& value,
bool check=false );
4810 inline
void finalize(
size_t i );
4817 inline
void erase(
size_t i,
size_t j );
4818 inline Iterator erase(
size_t i, Iterator pos );
4819 inline Iterator erase(
size_t i, Iterator first, Iterator last );
4821 template< typename Pred >
4822 inline
void erase( Pred predicate );
4824 template< typename Pred >
4825 inline
void erase(
size_t i, Iterator first, Iterator last, Pred predicate );
4832 inline Iterator find (
size_t i,
size_t j );
4833 inline ConstIterator find (
size_t i,
size_t j ) const;
4834 inline Iterator lowerBound(
size_t i,
size_t j );
4835 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
4836 inline Iterator upperBound(
size_t i,
size_t j );
4837 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
4844 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4845 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4847 inline
bool canSMPAssign() const noexcept;
4896 template< typename MT
4897 , typename... CRAs >
4898 template< typename... RRAs >
4899 inline Rows<MT,false,false,true,CRAs...>::Rows( MT& matrix, RRAs... args )
4900 : DataType( args... )
4901 , matrix_ ( matrix )
4904 for(
size_t i=0UL; i<
rows(); ++i ) {
4905 if( matrix_.rows() <= idx(i) ) {
4934 template<
typename MT
4935 ,
typename... CRAs >
4936 inline typename Rows<MT,
false,
false,
true,CRAs...>::Reference
4937 Rows<MT,false,false,true,CRAs...>::operator()(
size_t i,
size_t j )
4942 return matrix_(j,idx(i));
4959 template<
typename MT
4960 ,
typename... CRAs >
4961 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstReference
4962 Rows<MT,false,false,true,CRAs...>::operator()(
size_t i,
size_t j )
const 4967 return const_cast<const MT&>( matrix_ )(j,idx(i));
4985 template<
typename MT
4986 ,
typename... CRAs >
4987 inline typename Rows<MT,
false,
false,
true,CRAs...>::Reference
4988 Rows<MT,false,false,true,CRAs...>::at(
size_t i,
size_t j )
4996 return (*
this)(i,j);
5014 template<
typename MT
5015 ,
typename... CRAs >
5016 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstReference
5017 Rows<MT,false,false,true,CRAs...>::at(
size_t i,
size_t j )
const 5025 return (*
this)(i,j);
5040 template<
typename MT
5041 ,
typename... CRAs >
5042 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5047 return matrix_.begin( idx(i) );
5062 template<
typename MT
5063 ,
typename... CRAs >
5064 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5069 return matrix_.cbegin( idx(i) );
5084 template<
typename MT
5085 ,
typename... CRAs >
5086 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5091 return matrix_.cbegin( idx(i) );
5106 template<
typename MT
5107 ,
typename... CRAs >
5108 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5113 return matrix_.end( idx(i) );
5128 template<
typename MT
5129 ,
typename... CRAs >
5130 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5135 return matrix_.cend( idx(i) );
5150 template<
typename MT
5151 ,
typename... CRAs >
5152 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5157 return matrix_.cend( idx(i) );
5177 template<
typename MT
5178 ,
typename... CRAs >
5179 inline MT& Rows<MT,false,false,true,CRAs...>::operand() noexcept
5193 template<
typename MT
5194 ,
typename... CRAs >
5195 inline const MT& Rows<MT,false,false,true,CRAs...>::operand() const noexcept
5209 template<
typename MT
5210 ,
typename... CRAs >
5213 return matrix_.columns();
5225 template<
typename MT
5226 ,
typename... CRAs >
5229 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
5244 template<
typename MT
5245 ,
typename... CRAs >
5250 return matrix_.capacity( idx(i) );
5262 template<
typename MT
5263 ,
typename... CRAs >
5266 size_t nonzeros( 0UL );
5268 for(
size_t i=0UL; i<
rows(); ++i )
5286 template<
typename MT
5287 ,
typename... CRAs >
5292 return matrix_.nonZeros( idx(i) );
5304 template<
typename MT
5305 ,
typename... CRAs >
5308 for(
size_t i=0UL; i<
rows(); ++i ) {
5309 matrix_.reset( idx(i) );
5326 template<
typename MT
5327 ,
typename... CRAs >
5330 matrix_.reset( idx(i) );
5347 template<
typename MT
5348 ,
typename... CRAs >
5349 inline void Rows<MT,false,false,true,CRAs...>::reserve(
size_t nonzeros )
5351 const size_t current(
capacity() );
5353 if( nonzeros > current ) {
5354 matrix_.reserve( matrix_.capacity() + nonzeros - current );
5374 template<
typename MT
5375 ,
typename... CRAs >
5376 void Rows<MT,false,false,true,CRAs...>::reserve(
size_t i,
size_t nonzeros )
5378 matrix_.reserve( idx(i), nonzeros );
5394 template<
typename MT
5395 ,
typename... CRAs >
5396 void Rows<MT,false,false,true,CRAs...>::trim()
5398 for(
size_t i=0UL; i<
rows(); ++i ) {
5417 template<
typename MT
5418 ,
typename... CRAs >
5419 void Rows<MT,false,false,true,CRAs...>::trim(
size_t i )
5423 matrix_.trim( idx(i) );
5450 template<
typename MT
5451 ,
typename... CRAs >
5452 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5455 return matrix_.set( j, idx(i), value );
5475 template<
typename MT
5476 ,
typename... CRAs >
5477 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5478 Rows<MT,false,false,true,CRAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
5480 return matrix_.insert( j, idx(i), value );
5530 template<
typename MT
5531 ,
typename... CRAs >
5532 inline void Rows<MT,false,false,true,CRAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
5534 if( !check || !isDefault<strict>( value ) )
5535 matrix_.insert( j, idx(i), value );
5555 template<
typename MT
5556 ,
typename... CRAs >
5557 inline void Rows<MT,false,false,true,CRAs...>::finalize(
size_t i )
5585 template<
typename MT
5586 ,
typename... CRAs >
5587 inline void Rows<MT,false,false,true,CRAs...>::erase(
size_t i,
size_t j )
5592 matrix_.erase( j, idx(i) );
5608 template<
typename MT
5609 ,
typename... CRAs >
5610 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5611 Rows<MT,false,false,true,CRAs...>::erase(
size_t i, Iterator pos )
5615 return matrix_.erase( idx(i), pos );
5632 template<
typename MT
5633 ,
typename... CRAs >
5634 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5635 Rows<MT,false,false,true,CRAs...>::erase(
size_t i, Iterator first, Iterator last )
5639 return matrix_.erase( idx(i), first, last );
5668 template<
typename MT
5669 ,
typename... CRAs >
5670 template<
typename Pred >
5671 inline void Rows<MT,false,false,true,CRAs...>::erase( Pred predicate )
5673 for(
size_t i=0UL; i<
rows(); ++i ) {
5674 matrix_.erase( idx(i),
begin(i),
end(i), predicate );
5708 template<
typename MT
5709 ,
typename... CRAs >
5710 template<
typename Pred >
5711 inline void Rows<MT,false,false,true,CRAs...>::erase(
size_t i, Iterator first, Iterator last, Pred predicate )
5715 matrix_.erase( idx(i), first, last, predicate );
5744 template<
typename MT
5745 ,
typename... CRAs >
5746 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5747 Rows<MT,false,false,true,CRAs...>::find(
size_t i,
size_t j )
5749 return matrix_.find( j, idx(i) );
5770 template<
typename MT
5771 ,
typename... CRAs >
5772 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5773 Rows<MT,false,false,true,CRAs...>::find(
size_t i,
size_t j )
const 5775 return matrix_.find( j, idx(i) );
5795 template<
typename MT
5796 ,
typename... CRAs >
5797 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5798 Rows<MT,false,false,true,CRAs...>::lowerBound(
size_t i,
size_t j )
5800 return matrix_.lowerBound( j, idx(i) );
5820 template<
typename MT
5821 ,
typename... CRAs >
5822 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5823 Rows<MT,false,false,true,CRAs...>::lowerBound(
size_t i,
size_t j )
const 5825 return matrix_.lowerBound( j, idx(i) );
5845 template<
typename MT
5846 ,
typename... CRAs >
5847 inline typename Rows<MT,
false,
false,
true,CRAs...>::Iterator
5848 Rows<MT,false,false,true,CRAs...>::upperBound(
size_t i,
size_t j )
5850 return matrix_.upperBound( j, idx(i) );
5870 template<
typename MT
5871 ,
typename... CRAs >
5872 inline typename Rows<MT,
false,
false,
true,CRAs...>::ConstIterator
5873 Rows<MT,false,false,true,CRAs...>::upperBound(
size_t i,
size_t j )
const 5875 return matrix_.upperBound( j, idx(i) );
5900 template<
typename MT
5901 ,
typename... CRAs >
5902 template<
typename Other >
5903 inline bool Rows<MT,false,false,true,CRAs...>::canAlias(
const Other* alias )
const noexcept
5905 return matrix_.isAliased( alias );
5922 template<
typename MT
5923 ,
typename... CRAs >
5924 template<
typename Other >
5925 inline bool Rows<MT,false,false,true,CRAs...>::isAliased(
const Other* alias )
const noexcept
5927 return matrix_.isAliased( alias );
5944 template<
typename MT
5945 ,
typename... CRAs >
5946 inline bool Rows<MT,false,false,true,CRAs...>::canSMPAssign() const noexcept
#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
Headerfile for the generic min algorithm.
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 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 IsUniUpper type trait.
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
Header file for the View base class.
Header file for the IsSparseMatrix 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
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.
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
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
Header file for the extended initializer_list functionality.
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
Constraint on the data type.
Constraint on the data type.
Header file for the SparseMatrix base class.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
Headerfile for the generic max algorithm.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
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.
#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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#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
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
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
Header file for the SparseElement base class.
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
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 IsStrictlyLower type trait.
Constraint on the data type.
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:558
#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 IsConst type trait.
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
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
#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
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
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.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
#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
Header file for the rows trait.
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.
Header file for the IsComputation type trait class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
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:494
#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.
Header file for the implementation of the Rows base template.
Header file for the IsRestricted type trait.
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type,...
Definition: SparseMatrix.h:61
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