35#ifndef _BLAZE_MATH_VIEWS_ROW_SPARSE_H_
36#define _BLAZE_MATH_VIEWS_ROW_SPARSE_H_
115class Row<MT,true,false,SF,CRAs...>
116 :
public View< SparseVector< Row<MT,true,false,SF,CRAs...>, true > >
117 ,
private RowData<CRAs...>
121 using DataType = RowData<CRAs...>;
122 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
128 using This = Row<MT,
true,
false,SF,CRAs...>;
131 using BaseType = View< SparseVector<This,true> >;
133 using ViewedType = MT;
135 using TransposeType = TransposeType_t<ResultType>;
136 using ElementType = ElementType_t<MT>;
137 using ReturnType = ReturnType_t<MT>;
138 using CompositeType =
const Row&;
141 using ConstReference = ConstReference_t<MT>;
144 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
147 using ConstIterator = ConstIterator_t<MT>;
150 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
155 static constexpr bool smpAssignable =
false;
158 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
164 template<
typename... RRAs >
165 explicit inline Row( MT& matrix, RRAs... args );
167 Row(
const Row& ) =
default;
181 inline Reference operator[](
size_t index );
182 inline ConstReference operator[](
size_t index )
const;
183 inline Reference at(
size_t index );
184 inline ConstReference at(
size_t index )
const;
185 inline Iterator
begin ();
186 inline ConstIterator
begin ()
const;
187 inline ConstIterator
cbegin()
const;
188 inline Iterator
end ();
189 inline ConstIterator
end ()
const;
190 inline ConstIterator
cend ()
const;
198 inline Row& operator=(
const Row& rhs );
200 template<
typename VT >
inline Row& operator= (
const DenseVector<VT,true>& rhs );
201 template<
typename VT >
inline Row& operator= (
const SparseVector<VT,true>& rhs );
202 template<
typename VT >
inline Row&
operator+=(
const DenseVector<VT,true>& rhs );
203 template<
typename VT >
inline Row&
operator+=(
const SparseVector<VT,true>& rhs );
204 template<
typename VT >
inline Row&
operator-=(
const DenseVector<VT,true>& rhs );
205 template<
typename VT >
inline Row&
operator-=(
const SparseVector<VT,true>& rhs );
206 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
207 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
208 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
217 inline MT& operand() noexcept;
218 inline const MT& operand() const noexcept;
220 inline
size_t size() const noexcept;
221 inline
size_t capacity() const noexcept;
224 inline
void reserve(
size_t n );
231 inline Iterator
set (
size_t index, const ElementType& value );
232 inline Iterator insert(
size_t index, const ElementType& value );
233 inline
void append(
size_t index, const ElementType& value,
bool check=false );
240 inline
void erase(
size_t index );
241 inline Iterator erase( Iterator pos );
242 inline Iterator erase( Iterator first, Iterator last );
245 inline
void erase( Pred predicate );
247 template< typename Pred >
248 inline
void erase( Iterator first, Iterator last, Pred predicate );
255 inline Iterator
find (
size_t index );
256 inline ConstIterator
find (
size_t index ) const;
258 inline ConstIterator
lowerBound(
size_t index ) const;
260 inline ConstIterator
upperBound(
size_t index ) const;
267 template< typename Other > inline Row& scale( const Other& scalar );
274 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
275 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
277 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
278 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
279 template< typename VT > inline
void addAssign( const DenseVector <VT,true>& rhs );
280 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
281 template< typename VT > inline
void subAssign( const DenseVector <VT,true>& rhs );
282 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
290 inline
size_t extendCapacity() const noexcept;
339template< typename... RRAs >
340inline Row<MT,true,false,SF,CRAs...>::Row( MT& matrix, RRAs... args )
341 : DataType( args... )
345 if( matrix_.rows() <=
row() ) {
378inline typename Row<MT,
true,
false,SF,CRAs...>::Reference
379 Row<MT,true,false,SF,CRAs...>::operator[](
size_t index )
382 return matrix_(
row(),index);
401inline typename Row<MT,
true,
false,SF,CRAs...>::ConstReference
402 Row<MT,true,false,SF,CRAs...>::operator[](
size_t index )
const
405 return const_cast<const MT&
>( matrix_ )(
row(),index);
425inline typename Row<MT,
true,
false,SF,CRAs...>::Reference
426 Row<MT,true,false,SF,CRAs...>::at(
size_t index )
428 if( index >=
size() ) {
431 return (*
this)[index];
451inline typename Row<MT,
true,
false,SF,CRAs...>::ConstReference
452 Row<MT,true,false,SF,CRAs...>::at(
size_t index )
const
454 if( index >=
size() ) {
457 return (*
this)[index];
474inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
477 return matrix_.begin(
row() );
494inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
497 return matrix_.cbegin(
row() );
514inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
517 return matrix_.cbegin(
row() );
534inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
537 return matrix_.end(
row() );
554inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
557 return matrix_.cend(
row() );
574inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
577 return matrix_.cend(
row() );
609inline Row<MT,
true,
false,SF,CRAs...>&
614 if( list.size() >
size() ) {
618 const InitializerVector<ElementType,true> tmp( list,
size() );
620 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
624 decltype(
auto) left( derestrict( *
this ) );
654inline Row<MT,
true,
false,SF,CRAs...>&
655 Row<MT,true,false,SF,CRAs...>::operator=(
const Row& rhs )
663 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
666 if(
size() != rhs.size() ) {
670 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
674 decltype(
auto) left( derestrict( *
this ) );
676 if( rhs.canAlias(
this ) ) {
677 const ResultType tmp( rhs );
679 left.reserve( tmp.nonZeros() );
684 left.reserve( rhs.nonZeros() );
713template<
typename VT >
714inline Row<MT,
true,
false,SF,CRAs...>&
715 Row<MT,true,false,SF,CRAs...>::operator=(
const DenseVector<VT,true>& rhs )
723 if(
size() != (*rhs).size() ) {
727 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
730 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
734 decltype(
auto) left( derestrict( *
this ) );
736 if( IsReference_v<Right> && right.canAlias(
this ) ) {
737 const ResultType_t<VT> tmp( right );
743 assign( left, right );
771template<
typename VT >
772inline Row<MT,
true,
false,SF,CRAs...>&
773 Row<MT,true,false,SF,CRAs...>::operator=(
const SparseVector<VT,true>& rhs )
781 if(
size() != (*rhs).size() ) {
785 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
788 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
792 decltype(
auto) left( derestrict( *
this ) );
794 if( IsReference_v<Right> && right.canAlias(
this ) ) {
795 const ResultType_t<VT> tmp( right );
797 left.reserve( tmp.nonZeros() );
802 left.reserve( right.nonZeros() );
803 assign( left, right );
831template<
typename VT >
832inline Row<MT,
true,
false,SF,CRAs...>&
844 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
850 if(
size() != (*rhs).size() ) {
854 const AddType tmp( *
this + (*rhs) );
856 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
860 decltype(
auto) left( derestrict( *
this ) );
890template<
typename VT >
891inline Row<MT,
true,
false,SF,CRAs...>&
903 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
909 if(
size() != (*rhs).size() ) {
913 const AddType tmp( *
this + (*rhs) );
915 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
919 decltype(
auto) left( derestrict( *
this ) );
922 left.reserve( tmp.nonZeros() );
951template<
typename VT >
952inline Row<MT,
true,
false,SF,CRAs...>&
964 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
970 if(
size() != (*rhs).size() ) {
974 const SubType tmp( *
this - (*rhs) );
976 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
980 decltype(
auto) left( derestrict( *
this ) );
1008template<
typename MT
1011template<
typename VT >
1012inline Row<MT,
true,
false,SF,CRAs...>&
1015 using blaze::assign;
1024 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1030 if(
size() != (*rhs).size() ) {
1034 const SubType tmp( *
this - (*rhs) );
1036 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1040 decltype(
auto) left( derestrict( *
this ) );
1043 left.reserve( tmp.nonZeros() );
1044 assign( left, tmp );
1067template<
typename MT
1070template<
typename VT >
1071inline Row<MT,
true,
false,SF,CRAs...>&
1074 using blaze::assign;
1082 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1087 if(
size() != (*rhs).size() ) {
1091 const MultType tmp( *
this * (*rhs) );
1093 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1097 decltype(
auto) left( derestrict( *
this ) );
1100 assign( left, tmp );
1122template<
typename MT
1125template<
typename VT >
1126inline Row<MT,
true,
false,SF,CRAs...>&
1129 using blaze::assign;
1138 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1144 if(
size() != (*rhs).size() ) {
1148 const DivType tmp( *
this / (*rhs) );
1150 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1154 decltype(
auto) left( derestrict( *
this ) );
1157 assign( left, tmp );
1180template<
typename MT
1183template<
typename VT >
1184inline Row<MT,
true,
false,SF,CRAs...>&
1185 Row<MT,true,false,SF,CRAs...>::operator%=(
const Vector<VT,true>& rhs )
1187 using blaze::assign;
1192 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1198 if(
size() != 3UL || (*rhs).size() != 3UL ) {
1202 const CrossType tmp( *
this % (*rhs) );
1204 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1208 decltype(
auto) left( derestrict( *
this ) );
1211 assign( left, tmp );
1235template<
typename MT
1238inline MT& Row<MT,true,false,SF,CRAs...>::operand() noexcept
1252template<
typename MT
1255inline const MT& Row<MT,true,false,SF,CRAs...>::operand() const noexcept
1269template<
typename MT
1274 return matrix_.columns();
1286template<
typename MT
1291 return matrix_.capacity(
row() );
1306template<
typename MT
1311 return matrix_.nonZeros(
row() );
1323template<
typename MT
1328 matrix_.reset(
row() );
1344template<
typename MT
1347void Row<MT,true,false,SF,CRAs...>::reserve(
size_t n )
1349 matrix_.reserve(
row(), n );
1364template<
typename MT
1367inline size_t Row<MT,true,false,SF,CRAs...>::extendCapacity() const noexcept
1372 size_t nonzeros( 2UL*
capacity()+1UL );
1373 nonzeros =
max( nonzeros, 7UL );
1374 nonzeros =
min( nonzeros,
size() );
1404template<
typename MT
1407inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1410 return matrix_.set(
row(), index, value );
1429template<
typename MT
1432inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1433 Row<MT,true,false,SF,CRAs...>::insert(
size_t index,
const ElementType& value )
1435 return matrix_.insert(
row(), index, value );
1466template<
typename MT
1469inline void Row<MT,true,false,SF,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
1471 matrix_.append(
row(), index, value, check );
1494template<
typename MT
1497inline void Row<MT,true,false,SF,CRAs...>::erase(
size_t index )
1499 matrix_.erase(
row(), index );
1514template<
typename MT
1517inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1518 Row<MT,true,false,SF,CRAs...>::erase( Iterator pos )
1520 return matrix_.erase(
row(), pos );
1536template<
typename MT
1539inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1540 Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last )
1542 return matrix_.erase(
row(), first, last );
1571template<
typename MT
1574template<
typename Pred
1576inline void Row<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1578 matrix_.erase(
row(),
begin(),
end(), predicate );
1609template<
typename MT
1612template<
typename Pred >
1613inline void Row<MT,true,false,SF,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
1615 matrix_.erase(
row(), first, last, predicate );
1643template<
typename MT
1646inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1649 return matrix_.find(
row(), index );
1669template<
typename MT
1672inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
1675 return matrix_.find(
row(), index );
1694template<
typename MT
1697inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1700 return matrix_.lowerBound(
row(), index );
1719template<
typename MT
1722inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
1725 return matrix_.lowerBound(
row(), index );
1744template<
typename MT
1747inline typename Row<MT,
true,
false,SF,CRAs...>::Iterator
1750 return matrix_.upperBound(
row(), index );
1769template<
typename MT
1772inline typename Row<MT,
true,
false,SF,CRAs...>::ConstIterator
1775 return matrix_.upperBound(
row(), index );
1802template<
typename MT
1805template<
typename Other >
1806inline Row<MT,
true,
false,SF,CRAs...>&
1807 Row<MT,true,false,SF,CRAs...>::scale(
const Other& scalar )
1811 for( Iterator element=
begin(); element!=
end(); ++element )
1812 element->value() *= scalar;
1838template<
typename MT
1841template<
typename Other >
1842inline bool Row<MT,true,false,SF,CRAs...>::canAlias(
const Other* alias )
const noexcept
1844 return matrix_.isAliased( &unview( *alias ) );
1861template<
typename MT
1864template<
typename Other >
1865inline bool Row<MT,true,false,SF,CRAs...>::isAliased(
const Other* alias )
const noexcept
1867 return matrix_.isAliased( &unview( *alias ) );
1885template<
typename MT
1888template<
typename VT >
1889inline void Row<MT,true,false,SF,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
1894 for(
size_t j=0UL; j<
size(); ++j )
1896 if( matrix_.nonZeros(
row() ) == matrix_.capacity(
row() ) )
1897 matrix_.reserve(
row(), extendCapacity() );
1899 matrix_.append(
row(), j, (*rhs)[j], true );
1918template<
typename MT
1921template<
typename VT >
1922inline void Row<MT,true,false,SF,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
1927 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
1928 matrix_.append(
row(), element->index(), element->value(),
true );
1947template<
typename MT
1950template<
typename VT >
1951inline void Row<MT,true,false,SF,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
1953 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1961 const AddType tmp(
serial( *
this + (*rhs) ) );
1962 matrix_.reset(
row() );
1981template<
typename MT
1984template<
typename VT >
1985inline void Row<MT,true,false,SF,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
1987 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1995 const AddType tmp(
serial( *
this + (*rhs) ) );
1996 matrix_.reset(
row() );
1997 matrix_.reserve(
row(), tmp.nonZeros() );
2016template<
typename MT
2019template<
typename VT >
2020inline void Row<MT,true,false,SF,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
2022 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2030 const SubType tmp(
serial( *
this - (*rhs) ) );
2031 matrix_.reset(
row() );
2050template<
typename MT
2053template<
typename VT >
2054inline void Row<MT,true,false,SF,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
2056 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2064 const SubType tmp(
serial( *
this - (*rhs) ) );
2065 matrix_.reset(
row() );
2066 matrix_.reserve(
row(), tmp.nonZeros() );
2093template<
typename MT
2095class Row<MT,false,false,false,CRAs...>
2096 :
public View< SparseVector< Row<MT,false,false,false,CRAs...>, true > >
2097 ,
private RowData<CRAs...>
2101 using DataType = RowData<CRAs...>;
2102 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2108 using This = Row<MT,
false,
false,
false,CRAs...>;
2111 using BaseType = View< SparseVector<This,true> >;
2113 using ViewedType = MT;
2115 using TransposeType = TransposeType_t<ResultType>;
2116 using ElementType = ElementType_t<MT>;
2117 using ReturnType = ReturnType_t<MT>;
2118 using CompositeType =
const Row&;
2121 using ConstReference = ConstReference_t<MT>;
2124 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
2130 template<
typename MatrixType
2131 ,
typename IteratorType >
2133 :
private SparseElement
2142 inline RowElement( IteratorType pos,
size_t column )
2154 template<
typename T >
inline RowElement& operator=(
const T& v ) {
2166 template<
typename T >
inline RowElement&
operator+=(
const T& v ) {
2178 template<
typename T >
inline RowElement&
operator-=(
const T& v ) {
2190 template<
typename T >
inline RowElement&
operator*=(
const T& v ) {
2202 template<
typename T >
inline RowElement&
operator/=(
const T& v ) {
2213 inline const RowElement* operator->()
const {
2223 inline decltype(
auto) value()
const {
2224 return pos_->value();
2233 inline size_t index()
const {
2249 template<
typename MatrixType
2250 ,
typename IteratorType >
2255 using IteratorCategory = std::forward_iterator_tag;
2256 using ValueType = RowElement<MatrixType,IteratorType>;
2257 using PointerType = ValueType;
2258 using ReferenceType = ValueType;
2262 using iterator_category = IteratorCategory;
2263 using value_type = ValueType;
2264 using pointer = PointerType;
2265 using reference = ReferenceType;
2266 using difference_type = DifferenceType;
2272 inline RowIterator()
2273 : matrix_( nullptr )
2287 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
2288 : matrix_( &matrix )
2293 for( ; column_<matrix_->columns(); ++column_ ) {
2294 pos_ = matrix_->find( row_, column_ );
2295 if( pos_ != matrix_->end( column_ ) )
break;
2308 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2309 : matrix_( &matrix )
2323 template<
typename MatrixType2,
typename IteratorType2 >
2324 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
2325 : matrix_( it.matrix_ )
2327 , column_( it.column_ )
2337 inline RowIterator& operator++() {
2339 for( ; column_<matrix_->columns(); ++column_ ) {
2340 pos_ = matrix_->find( row_, column_ );
2341 if( pos_ != matrix_->end( column_ ) )
break;
2353 inline const RowIterator operator++(
int ) {
2354 const RowIterator tmp( *
this );
2365 inline ReferenceType
operator*()
const {
2366 return ReferenceType( pos_, column_ );
2375 inline PointerType operator->()
const {
2376 return PointerType( pos_, column_ );
2386 template<
typename MatrixType2,
typename IteratorType2 >
2387 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2388 return column_ == rhs.column_;
2398 template<
typename MatrixType2,
typename IteratorType2 >
2399 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2400 return !( *
this == rhs );
2410 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
2411 size_t counter( 0UL );
2412 for(
size_t j=rhs.column_; j<column_; ++j ) {
2413 if( matrix_->find( row_, j ) != matrix_->end( j ) )
2422 MatrixType* matrix_;
2429 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
2430 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CRAs2 >
friend class Row;
2437 using ConstIterator = RowIterator< const MT, ConstIterator_t<MT> >;
2440 using Iterator = If_t< IsConst_v<MT>, ConstIterator, RowIterator< MT, Iterator_t<MT> > >;
2445 static constexpr bool smpAssignable =
false;
2448 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
2454 template<
typename... RRAs >
2455 explicit inline Row( MT& matrix, RRAs... args );
2457 Row(
const Row& ) =
default;
2471 inline Reference operator[](
size_t index );
2472 inline ConstReference operator[](
size_t index )
const;
2473 inline Reference at(
size_t index );
2474 inline ConstReference at(
size_t index )
const;
2475 inline Iterator
begin ();
2476 inline ConstIterator
begin ()
const;
2477 inline ConstIterator
cbegin()
const;
2478 inline Iterator
end ();
2479 inline ConstIterator
end ()
const;
2480 inline ConstIterator
cend ()
const;
2488 inline Row& operator=(
const Row& rhs );
2490 template<
typename VT >
inline Row& operator= (
const Vector<VT,true>& rhs );
2491 template<
typename VT >
inline Row&
operator+=(
const Vector<VT,true>& rhs );
2492 template<
typename VT >
inline Row&
operator-=(
const Vector<VT,true>& rhs );
2493 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
2494 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
2495 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
2504 inline MT& operand() noexcept;
2505 inline const MT& operand() const noexcept;
2507 inline
size_t size() const noexcept;
2508 inline
size_t capacity() const noexcept;
2510 inline
void reset();
2511 inline
void reserve(
size_t n );
2518 inline Iterator
set (
size_t index, const ElementType& value );
2519 inline Iterator insert(
size_t index, const ElementType& value );
2520 inline
void append(
size_t index, const ElementType& value,
bool check=false );
2527 inline
void erase(
size_t index );
2528 inline Iterator erase( Iterator pos );
2529 inline Iterator erase( Iterator first, Iterator last );
2532 inline
void erase( Pred predicate );
2534 template< typename Pred >
2535 inline
void erase( Iterator first, Iterator last, Pred predicate );
2542 inline Iterator
find (
size_t index );
2543 inline ConstIterator
find (
size_t index ) const;
2545 inline ConstIterator
lowerBound(
size_t index ) const;
2547 inline ConstIterator
upperBound(
size_t index ) const;
2554 template< typename Other > inline Row& scale( const Other& scalar );
2561 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
2562 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
2564 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2565 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2566 template< typename VT > inline
void addAssign( const Vector<VT,true>& rhs );
2567 template< typename VT > inline
void subAssign( const Vector<VT,true>& rhs );
2610template< typename MT
2612template< typename... RRAs >
2613inline Row<MT,false,false,false,CRAs...>::Row( MT& matrix, RRAs... args )
2614 : DataType( args... )
2615 , matrix_ ( matrix )
2618 if( matrix_.rows() <=
row() ) {
2648template<
typename MT
2650inline typename Row<MT,
false,
false,
false,CRAs...>::Reference
2651 Row<MT,false,false,false,CRAs...>::operator[](
size_t index )
2654 return matrix_(
row(),index);
2670template<
typename MT
2672inline typename Row<MT,
false,
false,
false,CRAs...>::ConstReference
2673 Row<MT,false,false,false,CRAs...>::operator[](
size_t index )
const
2676 return const_cast<const MT&
>( matrix_ )(
row(),index);
2693template<
typename MT
2695inline typename Row<MT,
false,
false,
false,CRAs...>::Reference
2696 Row<MT,false,false,false,CRAs...>::at(
size_t index )
2698 if( index >=
size() ) {
2701 return (*
this)[index];
2718template<
typename MT
2720inline typename Row<MT,
false,
false,
false,CRAs...>::ConstReference
2721 Row<MT,false,false,false,CRAs...>::at(
size_t index )
const
2723 if( index >=
size() ) {
2726 return (*
this)[index];
2740template<
typename MT
2742inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
2745 return Iterator( matrix_,
row(), 0UL );
2759template<
typename MT
2761inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
2764 return ConstIterator( matrix_,
row(), 0UL );
2778template<
typename MT
2780inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
2783 return ConstIterator( matrix_,
row(), 0UL );
2797template<
typename MT
2799inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
2802 return Iterator( matrix_,
row(),
size() );
2816template<
typename MT
2818inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
2821 return ConstIterator( matrix_,
row(),
size() );
2835template<
typename MT
2837inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
2840 return ConstIterator( matrix_,
row(),
size() );
2869template<
typename MT
2871inline Row<MT,
false,
false,
false,CRAs...>&
2874 using blaze::assign;
2876 if( list.size() >
size() ) {
2880 const InitializerVector<ElementType,true> tmp( list,
size() );
2882 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
2886 decltype(
auto) left( derestrict( *
this ) );
2888 assign( left, tmp );
2912template<
typename MT
2914inline Row<MT,
false,
false,
false,CRAs...>&
2915 Row<MT,false,false,false,CRAs...>::operator=(
const Row& rhs )
2917 using blaze::assign;
2923 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
2926 if(
size() != rhs.size() ) {
2930 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
2934 decltype(
auto) left( derestrict( *
this ) );
2936 if( rhs.canAlias(
this ) ) {
2937 const ResultType tmp( rhs );
2938 assign( left, tmp );
2941 assign( left, rhs );
2966template<
typename MT
2968template<
typename VT >
2969inline Row<MT,
false,
false,
false,CRAs...>&
2970 Row<MT,false,false,false,CRAs...>::operator=(
const Vector<VT,true>& rhs )
2972 using blaze::assign;
2974 if(
size() != (*rhs).size() ) {
2978 const CompositeType_t<VT> tmp( *rhs );
2980 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
2984 decltype(
auto) left( derestrict( *
this ) );
2986 assign( left, tmp );
3010template<
typename MT
3012template<
typename VT >
3013inline Row<MT,
false,
false,
false,CRAs...>&
3016 using blaze::assign;
3024 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3029 if(
size() != (*rhs).size() ) {
3033 const AddType tmp( *
this + (*rhs) );
3035 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3039 decltype(
auto) left( derestrict( *
this ) );
3041 assign( left, tmp );
3065template<
typename MT
3067template<
typename VT >
3068inline Row<MT,
false,
false,
false,CRAs...>&
3071 using blaze::assign;
3079 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3084 if(
size() != (*rhs).size() ) {
3088 const SubType tmp( *
this - (*rhs) );
3090 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3094 decltype(
auto) left( derestrict( *
this ) );
3096 assign( left, tmp );
3119template<
typename MT
3121template<
typename VT >
3122inline Row<MT,
false,
false,
false,CRAs...>&
3125 using blaze::assign;
3133 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3138 if(
size() != (*rhs).size() ) {
3142 const MultType tmp( *
this * (*rhs) );
3144 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3148 decltype(
auto) left( derestrict( *
this ) );
3150 assign( left, tmp );
3172template<
typename MT
3174template<
typename VT >
3175inline Row<MT,
false,
false,
false,CRAs...>&
3178 using blaze::assign;
3187 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3193 if(
size() != (*rhs).size() ) {
3197 const DivType tmp( *
this / (*rhs) );
3199 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3203 decltype(
auto) left( derestrict( *
this ) );
3205 assign( left, tmp );
3228template<
typename MT
3230template<
typename VT >
3231inline Row<MT,
false,
false,
false,CRAs...>&
3232 Row<MT,false,false,false,CRAs...>::operator%=(
const Vector<VT,true>& rhs )
3234 using blaze::assign;
3239 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3245 if(
size() != 3UL || (*rhs).size() != 3UL ) {
3249 const CrossType tmp( *
this % (*rhs) );
3251 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3255 decltype(
auto) left( derestrict( *
this ) );
3257 assign( left, tmp );
3281template<
typename MT
3283inline MT& Row<MT,false,false,false,CRAs...>::operand() noexcept
3297template<
typename MT
3299inline const MT& Row<MT,false,false,false,CRAs...>::operand() const noexcept
3313template<
typename MT
3317 return matrix_.columns();
3329template<
typename MT
3333 return matrix_.columns();
3348template<
typename MT
3352 size_t counter( 0UL );
3353 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3368template<
typename MT
3372 const size_t jbegin( ( IsUpper_v<MT> )
3373 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3377 const size_t jend ( ( IsLower_v<MT> )
3378 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3383 for(
size_t j=jbegin; j<jend; ++j ) {
3384 matrix_.erase(
row(), j );
3401template<
typename MT
3403void Row<MT,false,false,false,CRAs...>::reserve(
size_t n )
3433template<
typename MT
3435inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3438 return Iterator( matrix_,
row(), index, matrix_.set(
row(), index, value ) );
3457template<
typename MT
3459inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3460 Row<MT,false,false,false,CRAs...>::insert(
size_t index,
const ElementType& value )
3462 return Iterator( matrix_,
row(), index, matrix_.insert(
row(), index, value ) );
3493template<
typename MT
3495inline void Row<MT,false,false,false,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
3497 if( !check || !isDefault<strict>( value ) )
3498 matrix_.insert(
row(), index, value );
3521template<
typename MT
3523inline void Row<MT,false,false,false,CRAs...>::erase(
size_t index )
3525 matrix_.erase(
row(), index );
3540template<
typename MT
3542inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3543 Row<MT,false,false,false,CRAs...>::erase( Iterator pos )
3545 const size_t column( pos.column_ );
3550 matrix_.erase(
column, pos.pos_ );
3551 return Iterator( matrix_,
row(),
column+1UL );
3567template<
typename MT
3569inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3570 Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last )
3572 for( ; first!=last; ++first ) {
3573 matrix_.erase( first.column_, first.pos_ );
3604template<
typename MT
3606template<
typename Pred
3608inline void Row<MT,false,false,false,CRAs...>::erase( Pred predicate )
3610 for( Iterator element=
begin(); element!=
end(); ++element ) {
3611 if( predicate( element->value() ) )
3612 matrix_.erase( element.column_, element.pos_ );
3644template<
typename MT
3646template<
typename Pred >
3647inline void Row<MT,false,false,false,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
3649 for( ; first!=last; ++first ) {
3650 if( predicate( first->value() ) )
3651 matrix_.erase( first.column_, first.pos_ );
3680template<
typename MT
3682inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3685 const Iterator_t<MT> pos( matrix_.find(
row(), index ) );
3687 if( pos != matrix_.end( index ) )
3688 return Iterator( matrix_,
row(), index, pos );
3710template<
typename MT
3712inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
3715 const ConstIterator_t<MT> pos( matrix_.find(
row(), index ) );
3717 if( pos != matrix_.end( index ) )
3718 return ConstIterator( matrix_,
row(), index, pos );
3739template<
typename MT
3741inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3744 for(
size_t i=index; i<
size(); ++i )
3746 const Iterator_t<MT> pos( matrix_.find(
row(), i ) );
3748 if( pos != matrix_.end( i ) )
3749 return Iterator( matrix_,
row(), i, pos );
3771template<
typename MT
3773inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
3776 for(
size_t i=index; i<
size(); ++i )
3778 const ConstIterator_t<MT> pos( matrix_.find(
row(), i ) );
3780 if( pos != matrix_.end( i ) )
3781 return ConstIterator( matrix_,
row(), i, pos );
3803template<
typename MT
3805inline typename Row<MT,
false,
false,
false,CRAs...>::Iterator
3808 for(
size_t i=index+1UL; i<
size(); ++i )
3810 const Iterator_t<MT> pos( matrix_.find(
row(), i ) );
3812 if( pos != matrix_.end( i ) )
3813 return Iterator( matrix_,
row(), i, pos );
3835template<
typename MT
3837inline typename Row<MT,
false,
false,
false,CRAs...>::ConstIterator
3840 for(
size_t i=index+1UL; i<
size(); ++i )
3842 const ConstIterator_t<MT> pos( matrix_.find(
row(), i ) );
3844 if( pos != matrix_.end( i ) )
3845 return ConstIterator( matrix_,
row(), i, pos );
3875template<
typename MT
3877template<
typename Other >
3878inline Row<MT,
false,
false,
false,CRAs...>&
3879 Row<MT,false,false,false,CRAs...>::scale(
const Other& scalar )
3883 for( Iterator element=
begin(); element!=
end(); ++element )
3884 element->value() *= scalar;
3910template<
typename MT
3912template<
typename Other >
3913inline bool Row<MT,false,false,false,CRAs...>::canAlias(
const Other* alias )
const noexcept
3915 return matrix_.isAliased( &unview( *alias ) );
3928template<
typename MT
3930template<
typename Other >
3931inline bool Row<MT,false,false,false,CRAs...>::isAliased(
const Other* alias )
const noexcept
3933 return matrix_.isAliased( &unview( *alias ) );
3951template<
typename MT
3953template<
typename VT >
3954inline void Row<MT,false,false,false,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
3958 for(
size_t j=0UL; j<(*rhs).size(); ++j ) {
3959 matrix_(
row(),j) = (*rhs)[j];
3978template<
typename MT
3980template<
typename VT >
3981inline void Row<MT,false,false,false,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
3987 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
3988 for( ; j<element->index(); ++j )
3989 matrix_.erase(
row(), j );
3990 matrix_(
row(),j++) = element->value();
3992 for( ; j<
size(); ++j ) {
3993 matrix_.erase(
row(), j );
4012template<
typename MT
4014template<
typename VT >
4015inline void Row<MT,false,false,false,CRAs...>::addAssign(
const Vector<VT,true>& rhs )
4017 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4024 const AddType tmp(
serial( *
this + (*rhs) ) );
4043template<
typename MT
4045template<
typename VT >
4046inline void Row<MT,false,false,false,CRAs...>::subAssign(
const Vector<VT,true>& rhs )
4048 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4055 const SubType tmp(
serial( *
this - (*rhs) ) );
4082template<
typename MT
4084class Row<MT,false,false,true,CRAs...>
4085 :
public View< SparseVector< Row<MT,false,false,true,CRAs...>, true > >
4086 ,
private RowData<CRAs...>
4090 using DataType = RowData<CRAs...>;
4091 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4097 using This = Row<MT,
false,
false,
true,CRAs...>;
4100 using BaseType = View< SparseVector<This,true> >;
4102 using ViewedType = MT;
4104 using TransposeType = TransposeType_t<ResultType>;
4105 using ElementType = ElementType_t<MT>;
4106 using ReturnType = ReturnType_t<MT>;
4107 using CompositeType =
const Row&;
4110 using ConstReference = ConstReference_t<MT>;
4113 using Reference = If_t< IsConst_v<MT>, ConstReference, Reference_t<MT> >;
4116 using ConstIterator = ConstIterator_t<MT>;
4119 using Iterator = If_t< IsConst_v<MT>, ConstIterator, Iterator_t<MT> >;
4124 static constexpr bool smpAssignable =
false;
4127 static constexpr bool compileTimeArgs = DataType::compileTimeArgs;
4133 template<
typename... RRAs >
4134 explicit inline Row( MT& matrix, RRAs... args );
4136 Row(
const Row& ) =
default;
4150 inline Reference operator[](
size_t index );
4151 inline ConstReference operator[](
size_t index )
const;
4152 inline Reference at(
size_t index );
4153 inline ConstReference at(
size_t index )
const;
4154 inline Iterator
begin ();
4155 inline ConstIterator
begin ()
const;
4156 inline ConstIterator
cbegin()
const;
4157 inline Iterator
end ();
4158 inline ConstIterator
end ()
const;
4159 inline ConstIterator
cend ()
const;
4167 inline Row& operator=(
const Row& rhs );
4169 template<
typename VT >
inline Row& operator= (
const DenseVector<VT,true>& rhs );
4170 template<
typename VT >
inline Row& operator= (
const SparseVector<VT,true>& rhs );
4171 template<
typename VT >
inline Row&
operator+=(
const DenseVector<VT,true>& rhs );
4172 template<
typename VT >
inline Row&
operator+=(
const SparseVector<VT,true>& rhs );
4173 template<
typename VT >
inline Row&
operator-=(
const DenseVector<VT,true>& rhs );
4174 template<
typename VT >
inline Row&
operator-=(
const SparseVector<VT,true>& rhs );
4175 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
4176 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
4177 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
4186 inline MT& operand() noexcept;
4187 inline const MT& operand() const noexcept;
4189 inline
size_t size() const noexcept;
4190 inline
size_t capacity() const noexcept;
4192 inline
void reset();
4193 inline
void reserve(
size_t n );
4200 inline Iterator
set (
size_t index, const ElementType& value );
4201 inline Iterator insert(
size_t index, const ElementType& value );
4202 inline
void append(
size_t index, const ElementType& value,
bool check=false );
4209 inline
void erase(
size_t index );
4210 inline Iterator erase( Iterator pos );
4211 inline Iterator erase( Iterator first, Iterator last );
4214 inline
void erase( Pred predicate );
4216 template< typename Pred >
4217 inline
void erase( Iterator first, Iterator last, Pred predicate );
4224 inline Iterator
find (
size_t index );
4225 inline ConstIterator
find (
size_t index ) const;
4227 inline ConstIterator
lowerBound(
size_t index ) const;
4229 inline ConstIterator
upperBound(
size_t index ) const;
4236 template< typename Other > inline Row& scale( const Other& scalar );
4243 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4244 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4246 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
4247 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
4248 template< typename VT > inline
void addAssign( const DenseVector <VT,true>& rhs );
4249 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4250 template< typename VT > inline
void subAssign( const DenseVector <VT,true>& rhs );
4251 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4259 inline
size_t extendCapacity() const;
4306template< typename MT
4308template< typename... RRAs >
4309inline Row<MT,false,false,true,CRAs...>::Row( MT& matrix, RRAs... args )
4310 : DataType( args... )
4311 , matrix_ ( matrix )
4314 if( matrix_.rows() <=
row() ) {
4344template<
typename MT
4346inline typename Row<MT,
false,
false,
true,CRAs...>::Reference
4347 Row<MT,false,false,true,CRAs...>::operator[](
size_t index )
4350 return matrix_(index,
row());
4366template<
typename MT
4368inline typename Row<MT,
false,
false,
true,CRAs...>::ConstReference
4369 Row<MT,false,false,true,CRAs...>::operator[](
size_t index )
const
4372 return const_cast<const MT&
>( matrix_ )(index,
row());
4389template<
typename MT
4391inline typename Row<MT,
false,
false,
true,CRAs...>::Reference
4392 Row<MT,false,false,true,CRAs...>::at(
size_t index )
4394 if( index >=
size() ) {
4397 return (*
this)[index];
4414template<
typename MT
4416inline typename Row<MT,
false,
false,
true,CRAs...>::ConstReference
4417 Row<MT,false,false,true,CRAs...>::at(
size_t index )
const
4419 if( index >=
size() ) {
4422 return (*
this)[index];
4436template<
typename MT
4438inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
4441 return matrix_.begin(
row() );
4455template<
typename MT
4457inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
4460 return matrix_.cbegin(
row() );
4474template<
typename MT
4476inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
4479 return matrix_.cbegin(
row() );
4493template<
typename MT
4495inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
4498 return matrix_.end(
row() );
4512template<
typename MT
4514inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
4517 return matrix_.cend(
row() );
4531template<
typename MT
4533inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
4536 return matrix_.cend(
row() );
4565template<
typename MT
4567inline Row<MT,
false,
false,
true,CRAs...>&
4570 using blaze::assign;
4572 if( list.size() >
size() ) {
4576 const InitializerVector<ElementType,true> tmp( list,
size() );
4578 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4582 decltype(
auto) left( derestrict( *
this ) );
4585 assign( left, tmp );
4609template<
typename MT
4611inline Row<MT,
false,
false,
true,CRAs...>&
4612 Row<MT,false,false,true,CRAs...>::operator=(
const Row& rhs )
4614 using blaze::assign;
4620 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
4623 if(
size() != rhs.size() ) {
4627 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
4631 decltype(
auto) left( derestrict( *
this ) );
4633 if( rhs.canAlias(
this ) ) {
4634 const ResultType tmp( rhs );
4636 left.reserve( tmp.nonZeros() );
4637 assign( left, tmp );
4641 left.reserve( rhs.nonZeros() );
4642 assign( left, rhs );
4667template<
typename MT
4669template<
typename VT >
4670inline Row<MT,
false,
false,
true,CRAs...>&
4671 Row<MT,false,false,true,CRAs...>::operator=(
const DenseVector<VT,true>& rhs )
4673 using blaze::assign;
4679 if(
size() != (*rhs).size() ) {
4683 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4684 Right right( *rhs );
4686 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4690 decltype(
auto) left( derestrict( *
this ) );
4692 if( IsReference_v<Right> && right.canAlias(
this ) ) {
4693 const ResultType_t<VT> tmp( right );
4695 assign( left, tmp );
4699 assign( left, right );
4724template<
typename MT
4726template<
typename VT >
4727inline Row<MT,
false,
false,
true,CRAs...>&
4728 Row<MT,false,false,true,CRAs...>::operator=(
const SparseVector<VT,true>& rhs )
4730 using blaze::assign;
4736 if(
size() != (*rhs).size() ) {
4740 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4741 Right right( *rhs );
4743 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4747 decltype(
auto) left( derestrict( *
this ) );
4749 if( IsReference_v<Right> && right.canAlias(
this ) ) {
4750 const ResultType_t<VT> tmp( right );
4752 left.reserve( tmp.nonZeros() );
4753 assign( left, tmp );
4757 left.reserve( right.nonZeros() );
4758 assign( left, right );
4783template<
typename MT
4785template<
typename VT >
4786inline Row<MT,
false,
false,
true,CRAs...>&
4789 using blaze::assign;
4798 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4804 if(
size() != (*rhs).size() ) {
4808 const AddType tmp( *
this + (*rhs) );
4810 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4814 decltype(
auto) left( derestrict( *
this ) );
4817 assign( left, tmp );
4841template<
typename MT
4843template<
typename VT >
4844inline Row<MT,
false,
false,
true,CRAs...>&
4847 using blaze::assign;
4856 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4862 if(
size() != (*rhs).size() ) {
4866 const AddType tmp( *
this + (*rhs) );
4868 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4872 decltype(
auto) left( derestrict( *
this ) );
4875 left.reserve( tmp.nonZeros() );
4876 assign( left, tmp );
4901template<
typename MT
4903template<
typename VT >
4904inline Row<MT,
false,
false,
true,CRAs...>&
4907 using blaze::assign;
4916 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4922 if(
size() != (*rhs).size() ) {
4926 const SubType tmp( *
this - (*rhs) );
4928 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4932 decltype(
auto) left( derestrict( *
this ) );
4935 assign( left, tmp );
4960template<
typename MT
4962template<
typename VT >
4963inline Row<MT,
false,
false,
true,CRAs...>&
4966 using blaze::assign;
4975 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4981 if(
size() != (*rhs).size() ) {
4985 const SubType tmp( *
this - (*rhs) );
4987 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4991 decltype(
auto) left( derestrict( *
this ) );
4994 left.reserve( tmp.nonZeros() );
4995 assign( left, tmp );
5018template<
typename MT
5020template<
typename VT >
5021inline Row<MT,
false,
false,
true,CRAs...>&
5024 using blaze::assign;
5032 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5037 if(
size() != (*rhs).size() ) {
5041 const MultType tmp( *
this * (*rhs) );
5043 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5047 decltype(
auto) left( derestrict( *
this ) );
5050 assign( left, tmp );
5072template<
typename MT
5074template<
typename VT >
5075inline Row<MT,
false,
false,
true,CRAs...>&
5078 using blaze::assign;
5087 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5093 if(
size() != (*rhs).size() ) {
5097 const DivType tmp( *
this / (*rhs) );
5099 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5103 decltype(
auto) left( derestrict( *
this ) );
5106 assign( left, tmp );
5129template<
typename MT
5131template<
typename VT >
5132inline Row<MT,
false,
false,
true,CRAs...>&
5133 Row<MT,false,false,true,CRAs...>::operator%=(
const Vector<VT,true>& rhs )
5135 using blaze::assign;
5140 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5146 if(
size() != 3UL || (*rhs).size() != 3UL ) {
5150 const CrossType tmp( *
this % (*rhs) );
5152 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5156 decltype(
auto) left( derestrict( *
this ) );
5159 assign( left, tmp );
5183template<
typename MT
5185inline MT& Row<MT,false,false,true,CRAs...>::operand() noexcept
5199template<
typename MT
5201inline const MT& Row<MT,false,false,true,CRAs...>::operand() const noexcept
5215template<
typename MT
5219 return matrix_.columns();
5231template<
typename MT
5235 return matrix_.capacity(
row() );
5250template<
typename MT
5254 return matrix_.nonZeros(
row() );
5266template<
typename MT
5270 matrix_.reset(
row() );
5286template<
typename MT
5288void Row<MT,false,false,true,CRAs...>::reserve(
size_t n )
5290 matrix_.reserve(
row(), n );
5305template<
typename MT
5307inline size_t Row<MT,false,false,true,CRAs...>::extendCapacity()
const
5312 size_t nonzeros( 2UL*
capacity()+1UL );
5313 nonzeros =
max( nonzeros, 7UL );
5314 nonzeros =
min( nonzeros,
size() );
5344template<
typename MT
5346inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5349 return matrix_.set( index,
row(), value );
5368template<
typename MT
5370inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5371 Row<MT,false,false,true,CRAs...>::insert(
size_t index,
const ElementType& value )
5373 return matrix_.insert( index,
row(), value );
5404template<
typename MT
5406inline void Row<MT,false,false,true,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
5408 matrix_.append( index,
row(), value, check );
5431template<
typename MT
5433inline void Row<MT,false,false,true,CRAs...>::erase(
size_t index )
5435 matrix_.erase( index,
row() );
5450template<
typename MT
5452inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5453 Row<MT,false,false,true,CRAs...>::erase( Iterator pos )
5455 return matrix_.erase(
row(), pos );
5471template<
typename MT
5473inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5474 Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last )
5476 return matrix_.erase(
row(), first, last );
5505template<
typename MT
5507template<
typename Pred
5509inline void Row<MT,false,false,true,CRAs...>::erase( Pred predicate )
5511 matrix_.erase(
row(),
begin(),
end(), predicate );
5542template<
typename MT
5544template<
typename Pred >
5545inline void Row<MT,false,false,true,CRAs...>::erase( Iterator first, Iterator last, Pred predicate )
5547 matrix_.erase(
row(), first, last, predicate );
5575template<
typename MT
5577inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5580 return matrix_.find( index,
row() );
5600template<
typename MT
5602inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
5605 return matrix_.find( index,
row() );
5624template<
typename MT
5626inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5629 return matrix_.lowerBound( index,
row() );
5648template<
typename MT
5650inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
5653 return matrix_.lowerBound( index,
row() );
5672template<
typename MT
5674inline typename Row<MT,
false,
false,
true,CRAs...>::Iterator
5677 return matrix_.upperBound( index,
row() );
5696template<
typename MT
5698inline typename Row<MT,
false,
false,
true,CRAs...>::ConstIterator
5701 return matrix_.upperBound( index,
row() );
5728template<
typename MT
5730template<
typename Other >
5731inline Row<MT,
false,
false,
true,CRAs...>&
5732 Row<MT,false,false,true,CRAs...>::scale(
const Other& scalar )
5736 for( Iterator element=
begin(); element!=
end(); ++element )
5737 element->value() *= scalar;
5763template<
typename MT
5765template<
typename Other >
5766inline bool Row<MT,false,false,true,CRAs...>::canAlias(
const Other* alias )
const noexcept
5768 return matrix_.isAliased( &unview( *alias ) );
5785template<
typename MT
5787template<
typename Other >
5788inline bool Row<MT,false,false,true,CRAs...>::isAliased(
const Other* alias )
const noexcept
5790 return matrix_.isAliased( &unview( *alias ) );
5808template<
typename MT
5810template<
typename VT >
5811inline void Row<MT,false,false,true,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
5816 for(
size_t i=0UL; i<
size(); ++i )
5818 if( matrix_.nonZeros(
row() ) == matrix_.capacity(
row() ) )
5819 matrix_.reserve(
row(), extendCapacity() );
5821 matrix_.append( i,
row(), (*rhs)[i], true );
5840template<
typename MT
5842template<
typename VT >
5843inline void Row<MT,false,false,true,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
5848 for( ConstIterator_t<VT> element=(*rhs).begin(); element!=(*rhs).end(); ++element ) {
5849 matrix_.append( element->index(),
row(), element->value(),
true );
5868template<
typename MT
5870template<
typename VT >
5871inline void Row<MT,false,false,true,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
5873 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5881 const AddType tmp(
serial( *
this + (*rhs) ) );
5882 matrix_.reset(
row() );
5901template<
typename MT
5903template<
typename VT >
5904inline void Row<MT,false,false,true,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
5906 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5914 const AddType tmp(
serial( *
this + (*rhs) ) );
5915 matrix_.reset(
row() );
5916 matrix_.reserve(
row(), tmp.nonZeros() );
5935template<
typename MT
5937template<
typename VT >
5938inline void Row<MT,false,false,true,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
5940 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5948 const SubType tmp(
serial( *
this - (*rhs) ) );
5949 matrix_.reset(
row() );
5968template<
typename MT
5970template<
typename VT >
5971inline void Row<MT,false,false,true,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
5973 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5981 const SubType tmp(
serial( *
this - (*rhs) ) );
5982 matrix_.reset(
row() );
5983 matrix_.reserve(
row(), tmp.nonZeros() );
Header file for the addition trait.
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Constraints on the storage order of matrix types.
Header file for the cross product trait.
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:751
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the If class template.
Header file for the IsConst type trait.
Header file for the isDefault shim.
Header file for the IsExpression type trait class.
Header file for the IsIntegral type trait.
Header file for the IsLower type trait.
Header file for the IsReference type trait.
Header file for the IsRestricted type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUpper type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of the RowData class template.
Constraints on the storage order of matrix types.
Header file for the row trait.
Constraint on the transpose flag of vector types.
Header file for the subtraction trait.
Constraint on the data type.
Constraint on the data type.
Initializer list type of the Blaze library.
Pointer difference type of the Blaze library.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of a vector representation of an initializer list.
Header file for the SparseVector base class.
Header file for the View base class.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:574
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:1339
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:1375
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:386
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:510
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
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:9640
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:448
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: RowMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.
Definition: TransExpr.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:60
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: SparseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.
Definition: DenseVector.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.
Definition: RowVector.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: UniTriangular.h:81
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
typename RowTrait< MT, CRAs... >::Type RowTrait_t
Auxiliary alias declaration for the RowTrait type trait.
Definition: RowTrait.h:144
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 operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
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:628
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:730
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:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
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:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
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
MT::Iterator upperBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index greater than the given index.
Definition: SparseMatrix.h:244
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition: SparseMatrix.h:194
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition: SparseMatrix.h:144
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.
Definition: IsIntegral.h:95
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
constexpr bool isChecked(const Ts &... args)
Extracting blaze::Check arguments from a given list of arguments.
Definition: Check.h:225
Header file for the exception macros of the math module.
Header file for the reset shim.
Header file for the serial shim.
Header file for the SparseElement base class.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.
Header file for the implementation of the Row base template.