35 #ifndef _BLAZE_MATH_VIEWS_ROW_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_ROW_SPARSE_H_ 115 template<
typename MT
118 class Row<MT,true,false,SF,CRAs...>
119 :
public View< SparseVector< Row<MT,true,false,SF,CRAs...>, true > >
120 ,
private RowData<CRAs...>
124 using DataType = RowData<CRAs...>;
125 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
131 using This = Row<MT,
true,
false,SF,CRAs...>;
133 using BaseType = SparseVector<This,true>;
134 using ViewedType = MT;
162 template<
typename... RRAs >
163 explicit inline Row( MT& matrix, RRAs... args );
165 Row(
const Row& ) =
default;
179 inline Reference operator[](
size_t index );
195 inline Row& operator=( initializer_list<ElementType> list );
196 inline Row& operator=(
const Row& rhs );
198 template<
typename VT >
inline Row& operator= (
const DenseVector<VT,true>& rhs );
199 template<
typename VT >
inline Row& operator= (
const SparseVector<VT,true>& 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 Vector<VT,true>& rhs );
205 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
206 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
215 inline MT& operand() noexcept;
216 inline const MT& operand() const noexcept;
218 inline
size_t size() const noexcept;
219 inline
size_t capacity() const noexcept;
222 inline
void reserve(
size_t n );
231 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
238 inline
void erase(
size_t index );
243 inline
void erase( Pred predicate );
245 template< typename Pred >
253 inline
Iterator find (
size_t index );
255 inline
Iterator lowerBound(
size_t index );
257 inline
Iterator upperBound(
size_t index );
265 template< typename Other > inline Row& scale( const Other& scalar );
272 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
273 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
275 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
276 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
277 template< typename VT > inline
void addAssign( const DenseVector <VT,true>& rhs );
278 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
279 template< typename VT > inline
void subAssign( const DenseVector <VT,true>& rhs );
280 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
288 inline
size_t extendCapacity() const noexcept;
334 template< typename MT
337 template< typename... RRAs >
338 inline Row<MT,true,false,SF,CRAs...>::Row( MT& matrix, RRAs... args )
339 : DataType( args... )
343 if( matrix_.rows() <=
row() ) {
373 template<
typename MT
376 inline typename Row<MT,
true,
false,SF,CRAs...>
::Reference 377 Row<MT,true,false,SF,CRAs...>::operator[](
size_t index )
380 return matrix_(
row(),index);
396 template<
typename MT
400 Row<MT,true,false,SF,CRAs...>::operator[](
size_t index )
const 403 return const_cast<const MT&
>( matrix_ )(
row(),index);
420 template<
typename MT
423 inline typename Row<MT,
true,
false,SF,CRAs...>
::Reference 424 Row<MT,true,false,SF,CRAs...>::at(
size_t index )
426 if( index >=
size() ) {
429 return (*
this)[index];
446 template<
typename MT
450 Row<MT,true,false,SF,CRAs...>::at(
size_t index )
const 452 if( index >=
size() ) {
455 return (*
this)[index];
469 template<
typename MT
472 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 475 return matrix_.begin(
row() );
489 template<
typename MT
495 return matrix_.cbegin(
row() );
509 template<
typename MT
515 return matrix_.cbegin(
row() );
529 template<
typename MT
532 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 535 return matrix_.end(
row() );
549 template<
typename MT
555 return matrix_.cend(
row() );
569 template<
typename MT
575 return matrix_.cend(
row() );
604 template<
typename MT
607 inline Row<MT,
true,
false,SF,CRAs...>&
608 Row<MT,true,false,SF,CRAs...>::operator=( initializer_list<ElementType> list )
612 if( list.size() >
size() ) {
616 const InitializerVector<ElementType,true> tmp( list,
size() );
618 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
622 decltype(
auto) left( derestrict( *this ) );
649 template< typename MT
652 inline Row<MT,true,false,SF,CRAs...>&
653 Row<MT,true,false,SF,CRAs...>::operator=( const Row& rhs )
661 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
664 if(
size() != rhs.size() ) {
668 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
672 decltype(
auto) left( derestrict( *this ) );
674 if( rhs.canAlias( &matrix_ ) ) {
677 left.reserve( tmp.nonZeros() );
682 left.reserve( rhs.nonZeros() );
708 template<
typename MT
711 template<
typename VT >
712 inline Row<MT,
true,
false,SF,CRAs...>&
713 Row<MT,true,false,SF,CRAs...>::operator=(
const DenseVector<VT,true>& rhs )
725 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
728 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
732 decltype(
auto) left( derestrict( *this ) );
735 const ResultType_t<VT> tmp( right );
741 assign( left, right );
766 template<
typename MT
769 template<
typename VT >
770 inline Row<MT,
true,
false,SF,CRAs...>&
771 Row<MT,true,false,SF,CRAs...>::operator=(
const SparseVector<VT,true>& rhs )
783 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
786 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
790 decltype(
auto) left( derestrict( *this ) );
793 const ResultType_t<VT> tmp( right );
795 left.reserve( tmp.nonZeros() );
800 left.reserve( right.nonZeros() );
801 assign( left, right );
826 template<
typename MT
829 template<
typename VT >
830 inline Row<MT,
true,
false,SF,CRAs...>&
842 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
852 const AddType tmp( *
this + (~rhs) );
854 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
858 decltype(
auto) left( derestrict( *this ) );
885 template< typename MT
888 template< typename VT >
889 inline Row<MT,true,false,SF,CRAs...>&
890 Row<MT,true,false,SF,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
901 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
911 const AddType tmp( *
this + (~rhs) );
913 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
917 decltype(
auto) left( derestrict( *this ) );
946 template< typename MT
949 template< typename VT >
950 inline Row<MT,true,false,SF,CRAs...>&
951 Row<MT,true,false,SF,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
962 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
972 const SubType tmp( *
this - (~rhs) );
974 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
978 decltype(
auto) left( derestrict( *this ) );
1006 template< typename MT
1009 template< typename VT >
1010 inline Row<MT,true,false,SF,CRAs...>&
1011 Row<MT,true,false,SF,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
1013 using blaze::assign;
1022 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
1032 const SubType tmp( *
this - (~rhs) );
1034 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1038 decltype(
auto) left( derestrict( *this ) );
1042 assign( left, tmp );
1065 template< typename MT
1068 template< typename VT >
1069 inline Row<MT,true,false,SF,CRAs...>&
1070 Row<MT,true,false,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1072 using blaze::assign;
1080 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
1089 const MultType tmp( *
this * (~rhs) );
1091 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1095 decltype(
auto) left( derestrict( *this ) );
1098 assign( left, tmp );
1120 template< typename MT
1123 template< typename VT >
1124 inline Row<MT,true,false,SF,CRAs...>&
1125 Row<MT,true,false,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1127 using blaze::assign;
1136 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
1146 const DivType tmp( *
this / (~rhs) );
1148 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1152 decltype(
auto) left( derestrict( *this ) );
1155 assign( left, tmp );
1178 template< typename MT
1181 template< typename VT >
1182 inline Row<MT,true,false,SF,CRAs...>&
1183 Row<MT,true,false,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1185 using blaze::assign;
1190 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
1196 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1200 const CrossType tmp( *
this % (~rhs) );
1202 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1206 decltype(
auto) left( derestrict( *this ) );
1209 assign( left, tmp );
1233 template< typename MT
1236 inline MT& Row<MT,true,false,SF,CRAs...>::operand() noexcept
1250 template<
typename MT
1253 inline const MT& Row<MT,true,false,SF,CRAs...>::operand() const noexcept
1267 template<
typename MT
1272 return matrix_.columns();
1284 template<
typename MT
1289 return matrix_.capacity(
row() );
1304 template<
typename MT
1309 return matrix_.nonZeros(
row() );
1321 template<
typename MT
1326 matrix_.reset(
row() );
1342 template<
typename MT
1345 void Row<MT,true,false,SF,CRAs...>::reserve(
size_t n )
1347 matrix_.reserve(
row(), n );
1362 template<
typename MT
1365 inline size_t Row<MT,true,false,SF,CRAs...>::extendCapacity() const noexcept
1370 size_t nonzeros( 2UL*
capacity()+1UL );
1371 nonzeros =
max( nonzeros, 7UL );
1372 nonzeros =
min( nonzeros,
size() );
1402 template<
typename MT
1405 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1408 return matrix_.set(
row(), index, value );
1427 template<
typename MT
1430 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1431 Row<MT,true,false,SF,CRAs...>::insert(
size_t index,
const ElementType& value )
1433 return matrix_.insert(
row(), index, value );
1464 template<
typename MT
1467 inline void Row<MT,true,false,SF,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
1469 matrix_.append(
row(), index, value, check );
1492 template<
typename MT
1495 inline void Row<MT,true,false,SF,CRAs...>::erase(
size_t index )
1497 matrix_.erase(
row(), index );
1512 template<
typename MT
1515 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1516 Row<MT,true,false,SF,CRAs...>::erase(
Iterator pos )
1518 return matrix_.erase(
row(), pos );
1534 template<
typename MT
1537 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1540 return matrix_.erase(
row(), first, last );
1569 template<
typename MT
1572 template<
typename Pred
1574 inline void Row<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1576 matrix_.erase(
row(),
begin(),
end(), predicate );
1607 template<
typename MT
1610 template<
typename Pred >
1611 inline void Row<MT,true,false,SF,CRAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
1613 matrix_.erase(
row(), first, last, predicate );
1641 template<
typename MT
1644 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1645 Row<MT,true,false,SF,CRAs...>::find(
size_t index )
1647 return matrix_.find(
row(), index );
1667 template<
typename MT
1671 Row<MT,true,false,SF,CRAs...>::find(
size_t index )
const 1673 return matrix_.find(
row(), index );
1692 template<
typename MT
1695 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1696 Row<MT,true,false,SF,CRAs...>::lowerBound(
size_t index )
1698 return matrix_.lowerBound(
row(), index );
1717 template<
typename MT
1721 Row<MT,true,false,SF,CRAs...>::lowerBound(
size_t index )
const 1723 return matrix_.lowerBound(
row(), index );
1742 template<
typename MT
1745 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1746 Row<MT,true,false,SF,CRAs...>::upperBound(
size_t index )
1748 return matrix_.upperBound(
row(), index );
1767 template<
typename MT
1771 Row<MT,true,false,SF,CRAs...>::upperBound(
size_t index )
const 1773 return matrix_.upperBound(
row(), index );
1800 template<
typename MT
1803 template<
typename Other >
1804 inline Row<MT,
true,
false,SF,CRAs...>&
1805 Row<MT,true,false,SF,CRAs...>::scale(
const Other& scalar )
1810 element->value() *= scalar;
1836 template<
typename MT
1839 template<
typename Other >
1840 inline bool Row<MT,true,false,SF,CRAs...>::canAlias(
const Other* alias )
const noexcept
1842 return matrix_.isAliased( alias );
1859 template<
typename MT
1862 template<
typename Other >
1863 inline bool Row<MT,true,false,SF,CRAs...>::isAliased(
const Other* alias )
const noexcept
1865 return matrix_.isAliased( alias );
1883 template<
typename MT
1886 template<
typename VT >
1887 inline void Row<MT,true,false,SF,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
1892 for(
size_t j=0UL; j<
size(); ++j )
1894 if( matrix_.nonZeros(
row() ) == matrix_.capacity(
row() ) )
1895 matrix_.reserve(
row(), extendCapacity() );
1897 matrix_.append(
row(), j, (~rhs)[j],
true );
1916 template<
typename MT
1919 template<
typename VT >
1920 inline void Row<MT,true,false,SF,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
1925 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1926 matrix_.append(
row(), element->index(), element->value(), true );
1945 template<
typename MT
1948 template<
typename VT >
1949 inline void Row<MT,true,false,SF,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
1951 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1959 const AddType tmp(
serial( *
this + (~rhs) ) );
1960 matrix_.reset(
row() );
1979 template<
typename MT
1982 template<
typename VT >
1983 inline void Row<MT,true,false,SF,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
1985 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
1993 const AddType tmp(
serial( *
this + (~rhs) ) );
1994 matrix_.reset(
row() );
1995 matrix_.reserve(
row(), tmp.nonZeros() );
2014 template<
typename MT
2017 template<
typename VT >
2018 inline void Row<MT,true,false,SF,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
2020 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2028 const SubType tmp(
serial( *
this - (~rhs) ) );
2029 matrix_.reset(
row() );
2048 template<
typename MT
2051 template<
typename VT >
2052 inline void Row<MT,true,false,SF,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
2054 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
2062 const SubType tmp(
serial( *
this - (~rhs) ) );
2063 matrix_.reset(
row() );
2064 matrix_.reserve(
row(), tmp.nonZeros() );
2091 template<
typename MT
2093 class Row<MT,false,false,false,CRAs...>
2094 :
public View< SparseVector< Row<MT,false,false,false,CRAs...>, true > >
2095 ,
private RowData<CRAs...>
2099 using DataType = RowData<CRAs...>;
2100 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2106 using This = Row<MT,
false,
false,
false,CRAs...>;
2108 using BaseType = SparseVector<This,true>;
2109 using ViewedType = MT;
2126 template<
typename MatrixType
2127 ,
typename IteratorType >
2129 :
private SparseElement
2138 inline RowElement( IteratorType pos,
size_t column )
2150 template<
typename T >
inline RowElement& operator=(
const T& v ) {
2162 template<
typename T >
inline RowElement&
operator+=(
const T& v ) {
2174 template<
typename T >
inline RowElement&
operator-=(
const T& v ) {
2186 template<
typename T >
inline RowElement&
operator*=(
const T& v ) {
2198 template<
typename T >
inline RowElement&
operator/=(
const T& v ) {
2209 inline const RowElement* operator->()
const {
2219 inline decltype(
auto) value()
const {
2220 return pos_->value();
2229 inline size_t index()
const {
2245 template<
typename MatrixType
2246 ,
typename IteratorType >
2251 using IteratorCategory = std::forward_iterator_tag;
2252 using ValueType = RowElement<MatrixType,IteratorType>;
2253 using PointerType = ValueType;
2254 using ReferenceType = ValueType;
2255 using DifferenceType = ptrdiff_t;
2258 using iterator_category = IteratorCategory;
2259 using value_type = ValueType;
2260 using pointer = PointerType;
2261 using reference = ReferenceType;
2262 using difference_type = DifferenceType;
2268 inline RowIterator()
2269 : matrix_( nullptr )
2283 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
2284 : matrix_( &matrix )
2289 for( ; column_<matrix_->columns(); ++column_ ) {
2290 pos_ = matrix_->find( row_, column_ );
2291 if( pos_ != matrix_->end( column_ ) )
break;
2304 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2305 : matrix_( &matrix )
2319 template<
typename MatrixType2,
typename IteratorType2 >
2320 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
2321 : matrix_( it.matrix_ )
2323 , column_( it.column_ )
2333 inline RowIterator& operator++() {
2335 for( ; column_<matrix_->columns(); ++column_ ) {
2336 pos_ = matrix_->find( row_, column_ );
2337 if( pos_ != matrix_->end( column_ ) )
break;
2349 inline const RowIterator operator++(
int ) {
2350 const RowIterator tmp( *
this );
2361 inline ReferenceType
operator*()
const {
2362 return ReferenceType( pos_, column_ );
2371 inline PointerType operator->()
const {
2372 return PointerType( pos_, column_ );
2382 template<
typename MatrixType2,
typename IteratorType2 >
2383 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2384 return column_ == rhs.column_;
2394 template<
typename MatrixType2,
typename IteratorType2 >
2395 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2396 return !( *
this == rhs );
2406 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
2407 size_t counter( 0UL );
2408 for(
size_t j=rhs.column_; j<column_; ++j ) {
2409 if( matrix_->find( row_, j ) != matrix_->end( j ) )
2418 MatrixType* matrix_;
2425 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
2426 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CRAs2 >
friend class Row;
2433 using ConstIterator = RowIterator< const MT, ConstIterator_t<MT> >;
2447 template<
typename... RRAs >
2448 explicit inline Row( MT& matrix, RRAs... args );
2450 Row(
const Row& ) =
default;
2464 inline Reference operator[](
size_t index );
2480 inline Row& operator=( initializer_list<ElementType> list );
2481 inline Row& operator=(
const Row& rhs );
2483 template<
typename VT >
inline Row& operator= (
const Vector<VT,true>& rhs );
2484 template<
typename VT >
inline Row&
operator+=(
const Vector<VT,true>& rhs );
2485 template<
typename VT >
inline Row&
operator-=(
const Vector<VT,true>& rhs );
2486 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
2487 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
2488 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
2497 inline MT& operand() noexcept;
2498 inline const MT& operand() const noexcept;
2500 inline
size_t size() const noexcept;
2501 inline
size_t capacity() const noexcept;
2503 inline
void reset();
2504 inline
void reserve(
size_t n );
2513 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
2520 inline
void erase(
size_t index );
2525 inline
void erase( Pred predicate );
2527 template< typename Pred >
2535 inline
Iterator find (
size_t index );
2537 inline
Iterator lowerBound(
size_t index );
2539 inline
Iterator upperBound(
size_t index );
2547 template< typename Other > inline Row& scale( const Other& scalar );
2554 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
2555 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
2557 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2558 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2559 template< typename VT > inline
void addAssign( const Vector<VT,true>& rhs );
2560 template< typename VT > inline
void subAssign( const Vector<VT,true>& rhs );
2603 template< typename MT
2605 template< typename... RRAs >
2606 inline Row<MT,false,false,false,CRAs...>::Row( MT& matrix, RRAs... args )
2607 : DataType( args... )
2608 , matrix_ ( matrix )
2611 if( matrix_.rows() <=
row() ) {
2641 template<
typename MT
2643 inline typename Row<MT,
false,
false,
false,CRAs...>
::Reference 2644 Row<MT,false,false,false,CRAs...>::operator[](
size_t index )
2647 return matrix_(
row(),index);
2663 template<
typename MT
2666 Row<MT,false,false,false,CRAs...>::operator[](
size_t index )
const 2669 return const_cast<const MT&
>( matrix_ )(
row(),index);
2686 template<
typename MT
2688 inline typename Row<MT,
false,
false,
false,CRAs...>
::Reference 2689 Row<MT,false,false,false,CRAs...>::at(
size_t index )
2691 if( index >=
size() ) {
2694 return (*
this)[index];
2711 template<
typename MT
2714 Row<MT,false,false,false,CRAs...>::at(
size_t index )
const 2716 if( index >=
size() ) {
2719 return (*
this)[index];
2733 template<
typename MT
2735 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 2752 template<
typename MT
2771 template<
typename MT
2790 template<
typename MT
2792 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 2809 template<
typename MT
2828 template<
typename MT
2862 template<
typename MT
2864 inline Row<MT,
false,
false,
false,CRAs...>&
2865 Row<MT,false,false,false,CRAs...>::operator=( initializer_list<ElementType> list )
2867 using blaze::assign;
2869 if( list.size() >
size() ) {
2873 const InitializerVector<ElementType,true> tmp( list,
size() );
2875 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
2879 decltype(
auto) left( derestrict( *this ) );
2881 assign( left, tmp );
2905 template< typename MT
2907 inline Row<MT,false,false,false,CRAs...>&
2908 Row<MT,false,false,false,CRAs...>::operator=( const Row& rhs )
2910 using blaze::assign;
2916 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
2919 if(
size() != rhs.size() ) {
2923 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
2927 decltype(
auto) left( derestrict( *this ) );
2929 if( rhs.canAlias( &matrix_ ) ) {
2931 assign( left, tmp );
2934 assign( left, rhs );
2959 template<
typename MT
2961 template<
typename VT >
2962 inline Row<MT,
false,
false,
false,CRAs...>&
2963 Row<MT,false,false,false,CRAs...>::operator=(
const Vector<VT,true>& rhs )
2965 using blaze::assign;
2971 const CompositeType_t<VT> tmp( ~rhs );
2973 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
2977 decltype(
auto) left( derestrict( *this ) );
2979 assign( left, tmp );
3003 template< typename MT
3005 template< typename VT >
3006 inline Row<MT,false,false,false,CRAs...>&
3007 Row<MT,false,false,false,CRAs...>::operator+=( const Vector<VT,true>& rhs )
3009 using blaze::assign;
3017 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
3026 const AddType tmp( *
this + (~rhs) );
3028 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3032 decltype(
auto) left( derestrict( *this ) );
3034 assign( left, tmp );
3058 template< typename MT
3060 template< typename VT >
3061 inline Row<MT,false,false,false,CRAs...>&
3062 Row<MT,false,false,false,CRAs...>::operator-=( const Vector<VT,true>& rhs )
3064 using blaze::assign;
3072 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
3081 const SubType tmp( *
this - (~rhs) );
3083 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3087 decltype(
auto) left( derestrict( *this ) );
3089 assign( left, tmp );
3112 template< typename MT
3114 template< typename VT >
3115 inline Row<MT,false,false,false,CRAs...>&
3116 Row<MT,false,false,false,CRAs...>::operator*=( const Vector<VT,true>& rhs )
3118 using blaze::assign;
3126 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
3135 const MultType tmp( *
this * (~rhs) );
3137 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3141 decltype(
auto) left( derestrict( *this ) );
3143 assign( left, tmp );
3165 template< typename MT
3167 template< typename VT >
3168 inline Row<MT,false,false,false,CRAs...>&
3169 Row<MT,false,false,false,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
3171 using blaze::assign;
3180 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
3190 const DivType tmp( *
this / (~rhs) );
3192 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3196 decltype(
auto) left( derestrict( *this ) );
3198 assign( left, tmp );
3221 template< typename MT
3223 template< typename VT >
3224 inline Row<MT,false,false,false,CRAs...>&
3225 Row<MT,false,false,false,CRAs...>::operator%=( const Vector<VT,true>& rhs )
3227 using blaze::assign;
3232 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
3238 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3242 const CrossType tmp( *
this % (~rhs) );
3244 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3248 decltype(
auto) left( derestrict( *this ) );
3250 assign( left, tmp );
3274 template< typename MT
3276 inline MT& Row<MT,false,false,false,CRAs...>::operand() noexcept
3290 template<
typename MT
3292 inline const MT& Row<MT,false,false,false,CRAs...>::operand() const noexcept
3306 template<
typename MT
3310 return matrix_.columns();
3322 template<
typename MT
3326 return matrix_.columns();
3341 template<
typename MT
3345 size_t counter( 0UL );
3361 template<
typename MT
3365 const size_t jbegin( ( IsUpper_v<MT> )
3366 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3370 const size_t jend ( ( IsLower_v<MT> )
3371 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3376 for(
size_t j=jbegin; j<jend; ++j ) {
3377 matrix_.erase(
row(), j );
3394 template<
typename MT
3396 void Row<MT,false,false,false,CRAs...>::reserve(
size_t n )
3426 template<
typename MT
3428 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3431 return Iterator( matrix_,
row(), index, matrix_.set(
row(), index, value ) );
3450 template<
typename MT
3452 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3453 Row<MT,false,false,false,CRAs...>::insert(
size_t index,
const ElementType& value )
3455 return Iterator( matrix_,
row(), index, matrix_.insert(
row(), index, value ) );
3486 template<
typename MT
3488 inline void Row<MT,false,false,false,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
3490 if( !check || !isDefault<strict>( value ) )
3491 matrix_.insert(
row(), index, value );
3514 template<
typename MT
3516 inline void Row<MT,false,false,false,CRAs...>::erase(
size_t index )
3518 matrix_.erase(
row(), index );
3533 template<
typename MT
3535 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3536 Row<MT,false,false,false,CRAs...>::erase(
Iterator pos )
3538 const size_t column( pos.column_ );
3543 matrix_.erase(
column, pos.pos_ );
3560 template<
typename MT
3562 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3565 for( ; first!=last; ++first ) {
3566 matrix_.erase( first.column_, first.pos_ );
3597 template<
typename MT
3599 template<
typename Pred
3601 inline void Row<MT,false,false,false,CRAs...>::erase( Pred predicate )
3604 if( predicate( element->value() ) )
3605 matrix_.erase( element.column_, element.pos_ );
3637 template<
typename MT
3639 template<
typename Pred >
3640 inline void Row<MT,false,false,false,CRAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
3642 for( ; first!=last; ++first ) {
3643 if( predicate( first->value() ) )
3644 matrix_.erase( first.column_, first.pos_ );
3673 template<
typename MT
3675 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3676 Row<MT,false,false,false,CRAs...>::find(
size_t index )
3678 const Iterator_t<MT> pos( matrix_.find(
row(), index ) );
3680 if( pos != matrix_.end( index ) )
3703 template<
typename MT
3706 Row<MT,false,false,false,CRAs...>::find(
size_t index )
const 3708 const ConstIterator_t<MT> pos( matrix_.find(
row(), index ) );
3710 if( pos != matrix_.end( index ) )
3732 template<
typename MT
3734 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3735 Row<MT,false,false,false,CRAs...>::lowerBound(
size_t index )
3737 for(
size_t i=index; i<
size(); ++i )
3739 const Iterator_t<MT> pos( matrix_.find(
row(), i ) );
3741 if( pos != matrix_.end( i ) )
3764 template<
typename MT
3767 Row<MT,false,false,false,CRAs...>::lowerBound(
size_t index )
const 3769 for(
size_t i=index; i<
size(); ++i )
3771 const ConstIterator_t<MT> pos( matrix_.find(
row(), i ) );
3773 if( pos != matrix_.end( i ) )
3796 template<
typename MT
3798 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3799 Row<MT,false,false,false,CRAs...>::upperBound(
size_t index )
3801 for(
size_t i=index+1UL; i<
size(); ++i )
3803 const Iterator_t<MT> pos( matrix_.find(
row(), i ) );
3805 if( pos != matrix_.end( i ) )
3828 template<
typename MT
3831 Row<MT,false,false,false,CRAs...>::upperBound(
size_t index )
const 3833 for(
size_t i=index+1UL; i<
size(); ++i )
3835 const ConstIterator_t<MT> pos( matrix_.find(
row(), i ) );
3837 if( pos != matrix_.end( i ) )
3868 template<
typename MT
3870 template<
typename Other >
3871 inline Row<MT,
false,
false,
false,CRAs...>&
3872 Row<MT,false,false,false,CRAs...>::scale(
const Other& scalar )
3877 element->value() *= scalar;
3903 template<
typename MT
3905 template<
typename Other >
3906 inline bool Row<MT,false,false,false,CRAs...>::canAlias(
const Other* alias )
const noexcept
3908 return matrix_.isAliased( alias );
3921 template<
typename MT
3923 template<
typename Other >
3924 inline bool Row<MT,false,false,false,CRAs...>::isAliased(
const Other* alias )
const noexcept
3926 return matrix_.isAliased( alias );
3944 template<
typename MT
3946 template<
typename VT >
3947 inline void Row<MT,false,false,false,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
3951 for(
size_t j=0UL; j<(~rhs).
size(); ++j ) {
3952 matrix_(
row(),j) = (~rhs)[j];
3971 template<
typename MT
3973 template<
typename VT >
3974 inline void Row<MT,false,false,false,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
3980 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3981 for( ; j<element->index(); ++j )
3982 matrix_.erase(
row(), j );
3983 matrix_(
row(),j++) = element->value();
3985 for( ; j<
size(); ++j ) {
3986 matrix_.erase(
row(), j );
4005 template<
typename MT
4007 template<
typename VT >
4008 inline void Row<MT,false,false,false,CRAs...>::addAssign(
const Vector<VT,true>& rhs )
4010 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4017 const AddType tmp(
serial( *
this + (~rhs) ) );
4036 template<
typename MT
4038 template<
typename VT >
4039 inline void Row<MT,false,false,false,CRAs...>::subAssign(
const Vector<VT,true>& rhs )
4041 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4048 const SubType tmp(
serial( *
this - (~rhs) ) );
4075 template<
typename MT
4077 class Row<MT,false,false,true,CRAs...>
4078 :
public View< SparseVector< Row<MT,false,false,true,CRAs...>, true > >
4079 ,
private RowData<CRAs...>
4083 using DataType = RowData<CRAs...>;
4084 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
4090 using This = Row<MT,
false,
false,
true,CRAs...>;
4092 using BaseType = SparseVector<This,true>;
4093 using ViewedType = MT;
4121 template<
typename... RRAs >
4122 explicit inline Row( MT& matrix, RRAs... args );
4124 Row(
const Row& ) =
default;
4138 inline Reference operator[](
size_t index );
4154 inline Row& operator=( initializer_list<ElementType> list );
4155 inline Row& operator=(
const Row& rhs );
4157 template<
typename VT >
inline Row& operator= (
const DenseVector<VT,true>& rhs );
4158 template<
typename VT >
inline Row& operator= (
const SparseVector<VT,true>& rhs );
4159 template<
typename VT >
inline Row&
operator+=(
const DenseVector<VT,true>& rhs );
4160 template<
typename VT >
inline Row&
operator+=(
const SparseVector<VT,true>& rhs );
4161 template<
typename VT >
inline Row&
operator-=(
const DenseVector<VT,true>& rhs );
4162 template<
typename VT >
inline Row&
operator-=(
const SparseVector<VT,true>& rhs );
4163 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
4164 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
4165 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
4174 inline MT& operand() noexcept;
4175 inline const MT& operand() const noexcept;
4177 inline
size_t size() const noexcept;
4178 inline
size_t capacity() const noexcept;
4180 inline
void reset();
4181 inline
void reserve(
size_t n );
4190 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
4197 inline
void erase(
size_t index );
4202 inline
void erase( Pred predicate );
4204 template< typename Pred >
4212 inline
Iterator find (
size_t index );
4214 inline
Iterator lowerBound(
size_t index );
4216 inline
Iterator upperBound(
size_t index );
4224 template< typename Other > inline Row& scale( const Other& scalar );
4231 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4232 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4234 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
4235 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
4236 template< typename VT > inline
void addAssign( const DenseVector <VT,true>& rhs );
4237 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4238 template< typename VT > inline
void subAssign( const DenseVector <VT,true>& rhs );
4239 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4247 inline
size_t extendCapacity() const;
4294 template< typename MT
4296 template< typename... RRAs >
4297 inline Row<MT,false,false,true,CRAs...>::Row( MT& matrix, RRAs... args )
4298 : DataType( args... )
4299 , matrix_ ( matrix )
4302 if( matrix_.rows() <=
row() ) {
4332 template<
typename MT
4334 inline typename Row<MT,
false,
false,
true,CRAs...>
::Reference 4335 Row<MT,false,false,true,CRAs...>::operator[](
size_t index )
4338 return matrix_(index,
row());
4354 template<
typename MT
4357 Row<MT,false,false,true,CRAs...>::operator[](
size_t index )
const 4360 return const_cast<const MT&
>( matrix_ )(index,
row());
4377 template<
typename MT
4379 inline typename Row<MT,
false,
false,
true,CRAs...>
::Reference 4380 Row<MT,false,false,true,CRAs...>::at(
size_t index )
4382 if( index >=
size() ) {
4385 return (*
this)[index];
4402 template<
typename MT
4405 Row<MT,false,false,true,CRAs...>::at(
size_t index )
const 4407 if( index >=
size() ) {
4410 return (*
this)[index];
4424 template<
typename MT
4426 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 4429 return matrix_.begin(
row() );
4443 template<
typename MT
4448 return matrix_.cbegin(
row() );
4462 template<
typename MT
4467 return matrix_.cbegin(
row() );
4481 template<
typename MT
4483 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 4486 return matrix_.end(
row() );
4500 template<
typename MT
4505 return matrix_.cend(
row() );
4519 template<
typename MT
4524 return matrix_.cend(
row() );
4553 template<
typename MT
4555 inline Row<MT,
false,
false,
true,CRAs...>&
4556 Row<MT,false,false,true,CRAs...>::operator=( initializer_list<ElementType> list )
4558 using blaze::assign;
4560 if( list.size() >
size() ) {
4564 const InitializerVector<ElementType,true> tmp( list,
size() );
4566 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4570 decltype(
auto) left( derestrict( *this ) );
4573 assign( left, tmp );
4597 template< typename MT
4599 inline Row<MT,false,false,true,CRAs...>&
4600 Row<MT,false,false,true,CRAs...>::operator=( const Row& rhs )
4602 using blaze::assign;
4608 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
4611 if(
size() != rhs.size() ) {
4615 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
4619 decltype(
auto) left( derestrict( *this ) );
4621 if( rhs.canAlias( &matrix_ ) ) {
4624 left.reserve( tmp.nonZeros() );
4625 assign( left, tmp );
4629 left.reserve( rhs.nonZeros() );
4630 assign( left, rhs );
4655 template<
typename MT
4657 template<
typename VT >
4658 inline Row<MT,
false,
false,
true,CRAs...>&
4659 Row<MT,false,false,true,CRAs...>::operator=(
const DenseVector<VT,true>& rhs )
4661 using blaze::assign;
4671 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4672 Right right( ~rhs );
4674 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4678 decltype(
auto) left( derestrict( *this ) );
4681 const ResultType_t<VT> tmp( right );
4683 assign( left, tmp );
4687 assign( left, right );
4712 template<
typename MT
4714 template<
typename VT >
4715 inline Row<MT,
false,
false,
true,CRAs...>&
4716 Row<MT,false,false,true,CRAs...>::operator=(
const SparseVector<VT,true>& rhs )
4718 using blaze::assign;
4728 using Right = If_t< IsRestricted_v<MT>, CompositeType_t<VT>,
const VT& >;
4729 Right right( ~rhs );
4731 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4735 decltype(
auto) left( derestrict( *this ) );
4738 const ResultType_t<VT> tmp( right );
4740 left.reserve( tmp.nonZeros() );
4741 assign( left, tmp );
4745 left.reserve( right.nonZeros() );
4746 assign( left, right );
4771 template<
typename MT
4773 template<
typename VT >
4774 inline Row<MT,
false,
false,
true,CRAs...>&
4777 using blaze::assign;
4786 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4796 const AddType tmp( *
this + (~rhs) );
4798 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4802 decltype(
auto) left( derestrict( *this ) );
4805 assign( left, tmp );
4829 template< typename MT
4831 template< typename VT >
4832 inline Row<MT,false,false,true,CRAs...>&
4833 Row<MT,false,false,true,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
4835 using blaze::assign;
4844 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
4854 const AddType tmp( *
this + (~rhs) );
4856 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4860 decltype(
auto) left( derestrict( *this ) );
4864 assign( left, tmp );
4889 template< typename MT
4891 template< typename VT >
4892 inline Row<MT,false,false,true,CRAs...>&
4893 Row<MT,false,false,true,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
4895 using blaze::assign;
4904 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4914 const SubType tmp( *
this - (~rhs) );
4916 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4920 decltype(
auto) left( derestrict( *this ) );
4923 assign( left, tmp );
4948 template< typename MT
4950 template< typename VT >
4951 inline Row<MT,false,false,true,CRAs...>&
4952 Row<MT,false,false,true,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
4954 using blaze::assign;
4963 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
4973 const SubType tmp( *
this - (~rhs) );
4975 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4979 decltype(
auto) left( derestrict( *this ) );
4983 assign( left, tmp );
5006 template< typename MT
5008 template< typename VT >
5009 inline Row<MT,false,false,true,CRAs...>&
5010 Row<MT,false,false,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
5012 using blaze::assign;
5020 using MultType = MultTrait_t< ResultType, ResultType_t<VT> >;
5029 const MultType tmp( *
this * (~rhs) );
5031 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5035 decltype(
auto) left( derestrict( *this ) );
5038 assign( left, tmp );
5060 template< typename MT
5062 template< typename VT >
5063 inline Row<MT,false,false,true,CRAs...>&
5064 Row<MT,false,false,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5066 using blaze::assign;
5075 using DivType = DivTrait_t< ResultType, ResultType_t<VT> >;
5085 const DivType tmp( *
this / (~rhs) );
5087 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5091 decltype(
auto) left( derestrict( *this ) );
5094 assign( left, tmp );
5117 template< typename MT
5119 template< typename VT >
5120 inline Row<MT,false,false,true,CRAs...>&
5121 Row<MT,false,false,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5123 using blaze::assign;
5128 using CrossType = CrossTrait_t< ResultType, ResultType_t<VT> >;
5134 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5138 const CrossType tmp( *
this % (~rhs) );
5140 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5144 decltype(
auto) left( derestrict( *this ) );
5147 assign( left, tmp );
5171 template< typename MT
5173 inline MT& Row<MT,false,false,true,CRAs...>::operand() noexcept
5187 template<
typename MT
5189 inline const MT& Row<MT,false,false,true,CRAs...>::operand() const noexcept
5203 template<
typename MT
5207 return matrix_.columns();
5219 template<
typename MT
5223 return matrix_.capacity(
row() );
5238 template<
typename MT
5242 return matrix_.nonZeros(
row() );
5254 template<
typename MT
5258 matrix_.reset(
row() );
5274 template<
typename MT
5276 void Row<MT,false,false,true,CRAs...>::reserve(
size_t n )
5278 matrix_.reserve(
row(), n );
5293 template<
typename MT
5295 inline size_t Row<MT,false,false,true,CRAs...>::extendCapacity()
const 5300 size_t nonzeros( 2UL*
capacity()+1UL );
5301 nonzeros =
max( nonzeros, 7UL );
5302 nonzeros =
min( nonzeros,
size() );
5332 template<
typename MT
5334 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5337 return matrix_.set( index,
row(), value );
5356 template<
typename MT
5358 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5359 Row<MT,false,false,true,CRAs...>::insert(
size_t index,
const ElementType& value )
5361 return matrix_.insert( index,
row(), value );
5392 template<
typename MT
5394 inline void Row<MT,false,false,true,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
5396 matrix_.append( index,
row(), value, check );
5419 template<
typename MT
5421 inline void Row<MT,false,false,true,CRAs...>::erase(
size_t index )
5423 matrix_.erase( index,
row() );
5438 template<
typename MT
5440 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5441 Row<MT,false,false,true,CRAs...>::erase(
Iterator pos )
5443 return matrix_.erase(
row(), pos );
5459 template<
typename MT
5461 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5464 return matrix_.erase(
row(), first, last );
5493 template<
typename MT
5495 template<
typename Pred
5497 inline void Row<MT,false,false,true,CRAs...>::erase( Pred predicate )
5499 matrix_.erase(
row(),
begin(),
end(), predicate );
5530 template<
typename MT
5532 template<
typename Pred >
5533 inline void Row<MT,false,false,true,CRAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
5535 matrix_.erase(
row(), first, last, predicate );
5563 template<
typename MT
5565 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5566 Row<MT,false,false,true,CRAs...>::find(
size_t index )
5568 return matrix_.find( index,
row() );
5588 template<
typename MT
5591 Row<MT,false,false,true,CRAs...>::find(
size_t index )
const 5593 return matrix_.find( index,
row() );
5612 template<
typename MT
5614 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5615 Row<MT,false,false,true,CRAs...>::lowerBound(
size_t index )
5617 return matrix_.lowerBound( index,
row() );
5636 template<
typename MT
5639 Row<MT,false,false,true,CRAs...>::lowerBound(
size_t index )
const 5641 return matrix_.lowerBound( index,
row() );
5660 template<
typename MT
5662 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5663 Row<MT,false,false,true,CRAs...>::upperBound(
size_t index )
5665 return matrix_.upperBound( index,
row() );
5684 template<
typename MT
5687 Row<MT,false,false,true,CRAs...>::upperBound(
size_t index )
const 5689 return matrix_.upperBound( index,
row() );
5716 template<
typename MT
5718 template<
typename Other >
5719 inline Row<MT,
false,
false,
true,CRAs...>&
5720 Row<MT,false,false,true,CRAs...>::scale(
const Other& scalar )
5725 element->value() *= scalar;
5751 template<
typename MT
5753 template<
typename Other >
5754 inline bool Row<MT,false,false,true,CRAs...>::canAlias(
const Other* alias )
const noexcept
5756 return matrix_.isAliased( alias );
5773 template<
typename MT
5775 template<
typename Other >
5776 inline bool Row<MT,false,false,true,CRAs...>::isAliased(
const Other* alias )
const noexcept
5778 return matrix_.isAliased( alias );
5796 template<
typename MT
5798 template<
typename VT >
5799 inline void Row<MT,false,false,true,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
5804 for(
size_t i=0UL; i<
size(); ++i )
5806 if( matrix_.nonZeros(
row() ) == matrix_.capacity(
row() ) )
5807 matrix_.reserve(
row(), extendCapacity() );
5809 matrix_.append( i,
row(), (~rhs)[i],
true );
5828 template<
typename MT
5830 template<
typename VT >
5831 inline void Row<MT,false,false,true,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
5836 for( ConstIterator_t<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5837 matrix_.append( element->index(),
row(), element->value(), true );
5856 template<
typename MT
5858 template<
typename VT >
5859 inline void Row<MT,false,false,true,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
5861 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5869 const AddType tmp(
serial( *
this + (~rhs) ) );
5870 matrix_.reset(
row() );
5889 template<
typename MT
5891 template<
typename VT >
5892 inline void Row<MT,false,false,true,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
5894 using AddType = AddTrait_t< ResultType, ResultType_t<VT> >;
5902 const AddType tmp(
serial( *
this + (~rhs) ) );
5903 matrix_.reset(
row() );
5904 matrix_.reserve(
row(), tmp.nonZeros() );
5923 template<
typename MT
5925 template<
typename VT >
5926 inline void Row<MT,false,false,true,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
5928 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5936 const SubType tmp(
serial( *
this - (~rhs) ) );
5937 matrix_.reset(
row() );
5956 template<
typename MT
5958 template<
typename VT >
5959 inline void Row<MT,false,false,true,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
5961 using SubType = SubTrait_t< ResultType, ResultType_t<VT> >;
5969 const SubType tmp(
serial( *
this - (~rhs) ) );
5970 matrix_.reset(
row() );
5971 matrix_.reserve(
row(), tmp.nonZeros() );
#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.
Header file for the implementation of the RowData class template.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
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 SparseVector base class.
Header file for the View base class.
Header file for the row trait.
Header file for the serial shim.
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
#define BLAZE_CONSTRAINT_MUST_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a symmetric matrix type...
Definition: Symmetric.h:60
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the IsUniLower type trait.
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.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the implementation of the Row base template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
Header file for the implementation of a vector representation of an initializer list.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
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:1147
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Header file for the SparseElement base class.
Constraint on the data type.
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:1179
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the cross product trait.
Header file for the division 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, a compilation error is created.
Definition: Reference.h:79
typename RowTrait< MT, CRAs... >::Type RowTrait_t
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_t alias declaration provides a c...
Definition: RowTrait.h:170
Header file for the isDefault shim.
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
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
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.
Header file for the RemoveReference type trait.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: RowVector.h:61
constexpr bool IsIntegral_v
Auxiliary variable template for the IsIntegral type trait.The IsIntegral_v variable template provides...
Definition: IsIntegral.h:95
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
Header file for the IsRestricted type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#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
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Constraint on the data type.