35 #ifndef _BLAZE_MATH_VIEWS_ROW_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_ROW_SPARSE_H_ 114 template<
typename MT
117 class Row<MT,true,false,SF,CRAs...>
118 :
public View< SparseVector< Row<MT,true,false,SF,CRAs...>, true > >
119 ,
private RowData<CRAs...>
123 using DataType = RowData<CRAs...>;
124 using Operand = If_< IsExpression<MT>, MT, MT& >;
130 using This = Row<MT,
true,
false,SF,CRAs...>;
132 using BaseType = SparseVector<This,true>;
133 using ViewedType = MT;
155 enum :
bool { smpAssignable =
false };
161 template<
typename... RRAs >
162 explicit inline Row( MT& matrix, RRAs... args );
174 inline Reference operator[](
size_t index );
175 inline ConstReference operator[](
size_t index )
const;
177 inline ConstReference at(
size_t index )
const;
179 inline ConstIterator
begin ()
const;
180 inline ConstIterator
cbegin()
const;
182 inline ConstIterator
end ()
const;
183 inline ConstIterator
cend ()
const;
190 inline Row& operator=( initializer_list<ElementType> list );
191 inline Row& operator=(
const Row& rhs );
193 template<
typename VT >
inline Row& operator= (
const DenseVector<VT,true>& rhs );
194 template<
typename VT >
inline Row& operator= (
const SparseVector<VT,true>& rhs );
195 template<
typename VT >
inline Row&
operator+=(
const DenseVector<VT,true>& rhs );
196 template<
typename VT >
inline Row&
operator+=(
const SparseVector<VT,true>& rhs );
197 template<
typename VT >
inline Row&
operator-=(
const DenseVector<VT,true>& rhs );
198 template<
typename VT >
inline Row&
operator-=(
const SparseVector<VT,true>& rhs );
199 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
200 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
201 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
210 inline MT& operand() noexcept;
211 inline const MT& operand() const noexcept;
213 inline
size_t size() const noexcept;
214 inline
size_t capacity() const noexcept;
217 inline
void reserve(
size_t n );
226 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
233 inline
void erase(
size_t index );
237 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
238 inline
void erase( Pred predicate );
240 template< typename Pred >
248 inline
Iterator find (
size_t index );
249 inline ConstIterator find (
size_t index ) const;
250 inline
Iterator lowerBound(
size_t index );
251 inline ConstIterator lowerBound(
size_t index ) const;
252 inline
Iterator upperBound(
size_t index );
253 inline ConstIterator upperBound(
size_t index ) const;
260 template< typename Other > inline Row& scale( const Other& scalar );
267 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
268 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
270 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
271 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
272 template< typename VT > inline
void addAssign( const DenseVector <VT,true>& rhs );
273 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
274 template< typename VT > inline
void subAssign( const DenseVector <VT,true>& rhs );
275 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
283 inline
size_t extendCapacity() const noexcept;
329 template< typename MT
332 template< typename... RRAs >
333 inline Row<MT,true,false,SF,CRAs...>::Row( MT& matrix, RRAs... args )
334 : DataType( args... )
337 if( !Contains< TypeList<RRAs...>,
Unchecked >::value ) {
338 if( matrix_.rows() <=
row() ) {
368 template<
typename MT
371 inline typename Row<MT,
true,
false,SF,CRAs...>
::Reference 372 Row<MT,true,false,SF,CRAs...>::operator[](
size_t index )
375 return matrix_(
row(),index);
391 template<
typename MT
395 Row<MT,true,false,SF,CRAs...>::operator[](
size_t index )
const 398 return const_cast<const MT&
>( matrix_ )(
row(),index);
415 template<
typename MT
418 inline typename Row<MT,
true,
false,SF,CRAs...>
::Reference 419 Row<MT,true,false,SF,CRAs...>::at(
size_t index )
421 if( index >=
size() ) {
424 return (*
this)[index];
441 template<
typename MT
445 Row<MT,true,false,SF,CRAs...>::at(
size_t index )
const 447 if( index >=
size() ) {
450 return (*
this)[index];
464 template<
typename MT
467 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 470 return matrix_.begin(
row() );
484 template<
typename MT
490 return matrix_.cbegin(
row() );
504 template<
typename MT
510 return matrix_.cbegin(
row() );
524 template<
typename MT
527 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 530 return matrix_.end(
row() );
544 template<
typename MT
550 return matrix_.cend(
row() );
564 template<
typename MT
570 return matrix_.cend(
row() );
599 template<
typename MT
602 inline Row<MT,
true,
false,SF,CRAs...>&
603 Row<MT,true,false,SF,CRAs...>::operator=( initializer_list<ElementType> list )
607 if( list.size() >
size() ) {
611 const InitializerVector<ElementType,true> tmp( list,
size() );
613 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
617 decltype(
auto) left( derestrict( *this ) );
644 template< typename MT
647 inline Row<MT,true,false,SF,CRAs...>&
648 Row<MT,true,false,SF,CRAs...>::operator=( const Row& rhs )
656 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() ) )
659 if(
size() != rhs.size() ) {
663 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
667 decltype(
auto) left( derestrict( *this ) );
669 if( rhs.canAlias( &matrix_ ) ) {
672 left.reserve( tmp.nonZeros() );
677 left.reserve( rhs.nonZeros() );
703 template<
typename MT
706 template<
typename VT >
707 inline Row<MT,
true,
false,SF,CRAs...>&
708 Row<MT,true,false,SF,CRAs...>::operator=(
const DenseVector<VT,true>& rhs )
720 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
723 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
727 decltype(
auto) left( derestrict( *this ) );
729 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
730 const ResultType_<VT> tmp( right );
736 assign( left, right );
761 template<
typename MT
764 template<
typename VT >
765 inline Row<MT,
true,
false,SF,CRAs...>&
766 Row<MT,true,false,SF,CRAs...>::operator=(
const SparseVector<VT,true>& rhs )
778 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
781 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
785 decltype(
auto) left( derestrict( *this ) );
787 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
788 const ResultType_<VT> tmp( right );
790 left.reserve( tmp.nonZeros() );
795 left.reserve( right.nonZeros() );
796 assign( left, right );
821 template<
typename MT
824 template<
typename VT >
825 inline Row<MT,
true,
false,SF,CRAs...>&
837 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
847 const AddType tmp( *
this + (~rhs) );
849 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
853 decltype(
auto) left( derestrict( *this ) );
880 template< typename MT
883 template< typename VT >
884 inline Row<MT,true,false,SF,CRAs...>&
885 Row<MT,true,false,SF,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
896 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
906 const AddType tmp( *
this + (~rhs) );
908 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
912 decltype(
auto) left( derestrict( *this ) );
941 template< typename MT
944 template< typename VT >
945 inline Row<MT,true,false,SF,CRAs...>&
946 Row<MT,true,false,SF,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
957 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
967 const SubType tmp( *
this - (~rhs) );
969 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
973 decltype(
auto) left( derestrict( *this ) );
1001 template< typename MT
1004 template< typename VT >
1005 inline Row<MT,true,false,SF,CRAs...>&
1006 Row<MT,true,false,SF,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
1008 using blaze::assign;
1017 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
1027 const SubType tmp( *
this - (~rhs) );
1029 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1033 decltype(
auto) left( derestrict( *this ) );
1036 left.reserve( tmp.nonZeros() );
1037 assign( left, tmp );
1060 template< typename MT
1063 template< typename VT >
1064 inline Row<MT,true,false,SF,CRAs...>&
1065 Row<MT,true,false,SF,CRAs...>::operator*=( const Vector<VT,true>& rhs )
1067 using blaze::assign;
1075 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
1084 const MultType tmp( *
this * (~rhs) );
1086 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1090 decltype(
auto) left( derestrict( *this ) );
1093 assign( left, tmp );
1115 template< typename MT
1118 template< typename VT >
1119 inline Row<MT,true,false,SF,CRAs...>&
1120 Row<MT,true,false,SF,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
1122 using blaze::assign;
1131 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
1141 const DivType tmp( *
this / (~rhs) );
1143 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1147 decltype(
auto) left( derestrict( *this ) );
1150 assign( left, tmp );
1173 template< typename MT
1176 template< typename VT >
1177 inline Row<MT,true,false,SF,CRAs...>&
1178 Row<MT,true,false,SF,CRAs...>::operator%=( const Vector<VT,true>& rhs )
1180 using blaze::assign;
1185 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
1191 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
1195 const CrossType tmp( *
this % (~rhs) );
1197 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
1201 decltype(
auto) left( derestrict( *this ) );
1204 assign( left, tmp );
1228 template< typename MT
1231 inline MT& Row<MT,true,false,SF,CRAs...>::operand() noexcept
1245 template<
typename MT
1248 inline const MT& Row<MT,true,false,SF,CRAs...>::operand() const noexcept
1262 template<
typename MT
1267 return matrix_.columns();
1279 template<
typename MT
1284 return matrix_.capacity(
row() );
1299 template<
typename MT
1304 return matrix_.nonZeros(
row() );
1316 template<
typename MT
1321 matrix_.reset(
row() );
1337 template<
typename MT
1340 void Row<MT,true,false,SF,CRAs...>::reserve(
size_t n )
1342 matrix_.reserve(
row(), n );
1357 template<
typename MT
1360 inline size_t Row<MT,true,false,SF,CRAs...>::extendCapacity() const noexcept
1365 size_t nonzeros( 2UL*
capacity()+1UL );
1366 nonzeros =
max( nonzeros, 7UL );
1367 nonzeros =
min( nonzeros,
size() );
1397 template<
typename MT
1400 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1403 return matrix_.set(
row(), index, value );
1422 template<
typename MT
1425 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1426 Row<MT,true,false,SF,CRAs...>::insert(
size_t index,
const ElementType& value )
1428 return matrix_.insert(
row(), index, value );
1459 template<
typename MT
1462 inline void Row<MT,true,false,SF,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
1464 matrix_.append(
row(), index, value, check );
1487 template<
typename MT
1490 inline void Row<MT,true,false,SF,CRAs...>::erase(
size_t index )
1492 matrix_.erase(
row(), index );
1507 template<
typename MT
1510 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1511 Row<MT,true,false,SF,CRAs...>::erase(
Iterator pos )
1513 return matrix_.erase(
row(), pos );
1529 template<
typename MT
1532 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1535 return matrix_.erase(
row(), first, last );
1564 template<
typename MT
1567 template<
typename Pred
1569 inline void Row<MT,true,false,SF,CRAs...>::erase( Pred predicate )
1571 matrix_.erase(
row(),
begin(),
end(), predicate );
1602 template<
typename MT
1605 template<
typename Pred >
1606 inline void Row<MT,true,false,SF,CRAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
1608 matrix_.erase(
row(), first, last, predicate );
1636 template<
typename MT
1639 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1640 Row<MT,true,false,SF,CRAs...>::find(
size_t index )
1642 return matrix_.find(
row(), index );
1662 template<
typename MT
1666 Row<MT,true,false,SF,CRAs...>::find(
size_t index )
const 1668 return matrix_.find(
row(), index );
1687 template<
typename MT
1690 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1691 Row<MT,true,false,SF,CRAs...>::lowerBound(
size_t index )
1693 return matrix_.lowerBound(
row(), index );
1712 template<
typename MT
1716 Row<MT,true,false,SF,CRAs...>::lowerBound(
size_t index )
const 1718 return matrix_.lowerBound(
row(), index );
1737 template<
typename MT
1740 inline typename Row<MT,
true,
false,SF,CRAs...>
::Iterator 1741 Row<MT,true,false,SF,CRAs...>::upperBound(
size_t index )
1743 return matrix_.upperBound(
row(), index );
1762 template<
typename MT
1766 Row<MT,true,false,SF,CRAs...>::upperBound(
size_t index )
const 1768 return matrix_.upperBound(
row(), index );
1795 template<
typename MT
1798 template<
typename Other >
1799 inline Row<MT,
true,
false,SF,CRAs...>&
1800 Row<MT,true,false,SF,CRAs...>::scale(
const Other& scalar )
1805 element->value() *= scalar;
1831 template<
typename MT
1834 template<
typename Other >
1835 inline bool Row<MT,true,false,SF,CRAs...>::canAlias(
const Other* alias )
const noexcept
1837 return matrix_.isAliased( alias );
1854 template<
typename MT
1857 template<
typename Other >
1858 inline bool Row<MT,true,false,SF,CRAs...>::isAliased(
const Other* alias )
const noexcept
1860 return matrix_.isAliased( alias );
1878 template<
typename MT
1881 template<
typename VT >
1882 inline void Row<MT,true,false,SF,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
1887 for(
size_t j=0UL; j<
size(); ++j )
1889 if( matrix_.nonZeros(
row() ) == matrix_.capacity(
row() ) )
1890 matrix_.reserve(
row(), extendCapacity() );
1892 matrix_.append(
row(), j, (~rhs)[j],
true );
1911 template<
typename MT
1914 template<
typename VT >
1915 inline void Row<MT,true,false,SF,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
1920 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
1921 matrix_.append(
row(), element->index(), element->value(), true );
1940 template<
typename MT
1943 template<
typename VT >
1944 inline void Row<MT,true,false,SF,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
1946 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1954 const AddType tmp(
serial( *
this + (~rhs) ) );
1955 matrix_.reset(
row() );
1974 template<
typename MT
1977 template<
typename VT >
1978 inline void Row<MT,true,false,SF,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
1980 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
1988 const AddType tmp(
serial( *
this + (~rhs) ) );
1989 matrix_.reset(
row() );
1990 matrix_.reserve(
row(), tmp.nonZeros() );
2009 template<
typename MT
2012 template<
typename VT >
2013 inline void Row<MT,true,false,SF,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
2015 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2023 const SubType tmp(
serial( *
this - (~rhs) ) );
2024 matrix_.reset(
row() );
2043 template<
typename MT
2046 template<
typename VT >
2047 inline void Row<MT,true,false,SF,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
2049 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
2057 const SubType tmp(
serial( *
this - (~rhs) ) );
2058 matrix_.reset(
row() );
2059 matrix_.reserve(
row(), tmp.nonZeros() );
2086 template<
typename MT
2088 class Row<MT,false,false,false,CRAs...>
2089 :
public View< SparseVector< Row<MT,false,false,false,CRAs...>, true > >
2090 ,
private RowData<CRAs...>
2094 using DataType = RowData<CRAs...>;
2095 using Operand = If_< IsExpression<MT>, MT, MT& >;
2101 using This = Row<MT,
false,
false,
false,CRAs...>;
2103 using BaseType = SparseVector<This,true>;
2104 using ViewedType = MT;
2112 using ConstReference = ConstReference_<MT>;
2121 template<
typename MatrixType
2122 ,
typename IteratorType >
2124 :
private SparseElement
2133 inline RowElement( IteratorType pos,
size_t column )
2145 template<
typename T >
inline RowElement& operator=(
const T& v ) {
2157 template<
typename T >
inline RowElement&
operator+=(
const T& v ) {
2169 template<
typename T >
inline RowElement&
operator-=(
const T& v ) {
2181 template<
typename T >
inline RowElement&
operator*=(
const T& v ) {
2193 template<
typename T >
inline RowElement&
operator/=(
const T& v ) {
2204 inline const RowElement* operator->()
const {
2214 inline decltype(
auto) value()
const {
2215 return pos_->value();
2224 inline size_t index()
const {
2240 template<
typename MatrixType
2241 ,
typename IteratorType >
2246 using IteratorCategory = std::forward_iterator_tag;
2247 using ValueType = RowElement<MatrixType,IteratorType>;
2248 using PointerType = ValueType;
2249 using ReferenceType = ValueType;
2250 using DifferenceType = ptrdiff_t;
2253 using iterator_category = IteratorCategory;
2254 using value_type = ValueType;
2255 using pointer = PointerType;
2256 using reference = ReferenceType;
2257 using difference_type = DifferenceType;
2263 inline RowIterator()
2264 : matrix_( nullptr )
2278 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
2279 : matrix_( &matrix )
2284 for( ; column_<matrix_->columns(); ++column_ ) {
2285 pos_ = matrix_->find( row_, column_ );
2286 if( pos_ != matrix_->end( column_ ) )
break;
2299 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2300 : matrix_( &matrix )
2314 template<
typename MatrixType2,
typename IteratorType2 >
2315 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
2316 : matrix_( it.matrix_ )
2318 , column_( it.column_ )
2328 inline RowIterator& operator++() {
2330 for( ; column_<matrix_->columns(); ++column_ ) {
2331 pos_ = matrix_->find( row_, column_ );
2332 if( pos_ != matrix_->end( column_ ) )
break;
2344 inline const RowIterator operator++(
int ) {
2345 const RowIterator tmp( *
this );
2356 inline ReferenceType
operator*()
const {
2357 return ReferenceType( pos_, column_ );
2366 inline PointerType operator->()
const {
2367 return PointerType( pos_, column_ );
2377 template<
typename MatrixType2,
typename IteratorType2 >
2378 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2379 return column_ == rhs.column_;
2389 template<
typename MatrixType2,
typename IteratorType2 >
2390 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const noexcept {
2391 return !( *
this == rhs );
2401 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
2402 size_t counter( 0UL );
2403 for(
size_t j=rhs.column_; j<column_; ++j ) {
2404 if( matrix_->find( row_, j ) != matrix_->end( j ) )
2413 MatrixType* matrix_;
2420 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
2421 template<
typename MT2,
bool SO2,
bool DF2,
bool SF2,
size_t... CRAs2 >
friend class Row;
2428 using ConstIterator = RowIterator< const MT, ConstIterator_<MT> >;
2436 enum :
bool { smpAssignable =
false };
2442 template<
typename... RRAs >
2443 explicit inline Row( MT& matrix, RRAs... args );
2455 inline Reference operator[](
size_t index );
2456 inline ConstReference operator[](
size_t index )
const;
2458 inline ConstReference at(
size_t index )
const;
2460 inline ConstIterator
begin ()
const;
2461 inline ConstIterator
cbegin()
const;
2463 inline ConstIterator
end ()
const;
2464 inline ConstIterator
cend ()
const;
2471 inline Row& operator=( initializer_list<ElementType> list );
2472 inline Row& operator=(
const Row& rhs );
2474 template<
typename VT >
inline Row& operator= (
const Vector<VT,true>& rhs );
2475 template<
typename VT >
inline Row&
operator+=(
const Vector<VT,true>& rhs );
2476 template<
typename VT >
inline Row&
operator-=(
const Vector<VT,true>& rhs );
2477 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
2478 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
2479 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
2488 inline MT& operand() noexcept;
2489 inline const MT& operand() const noexcept;
2491 inline
size_t size() const noexcept;
2492 inline
size_t capacity() const noexcept;
2493 inline
size_t nonZeros() const;
2494 inline
void reset();
2495 inline
void reserve(
size_t n );
2504 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
2511 inline
void erase(
size_t index );
2515 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
2516 inline
void erase( Pred predicate );
2518 template< typename Pred >
2526 inline
Iterator find (
size_t index );
2527 inline ConstIterator find (
size_t index ) const;
2528 inline
Iterator lowerBound(
size_t index );
2529 inline ConstIterator lowerBound(
size_t index ) const;
2530 inline
Iterator upperBound(
size_t index );
2531 inline ConstIterator upperBound(
size_t index ) const;
2538 template< typename Other > inline Row& scale( const Other& scalar );
2545 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
2546 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
2548 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
2549 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
2550 template< typename VT > inline
void addAssign( const Vector<VT,true>& rhs );
2551 template< typename VT > inline
void subAssign( const Vector<VT,true>& rhs );
2594 template< typename MT
2596 template< typename... RRAs >
2597 inline Row<MT,false,false,false,CRAs...>::Row( MT& matrix, RRAs... args )
2598 : DataType( args... )
2599 , matrix_ ( matrix )
2601 if( !Contains< TypeList<RRAs...>,
Unchecked >::value ) {
2602 if( matrix_.rows() <=
row() ) {
2632 template<
typename MT
2634 inline typename Row<MT,
false,
false,
false,CRAs...>
::Reference 2635 Row<MT,false,false,false,CRAs...>::operator[](
size_t index )
2638 return matrix_(
row(),index);
2654 template<
typename MT
2657 Row<MT,false,false,false,CRAs...>::operator[](
size_t index )
const 2660 return const_cast<const MT&
>( matrix_ )(
row(),index);
2677 template<
typename MT
2679 inline typename Row<MT,
false,
false,
false,CRAs...>
::Reference 2680 Row<MT,false,false,false,CRAs...>::at(
size_t index )
2682 if( index >=
size() ) {
2685 return (*
this)[index];
2702 template<
typename MT
2705 Row<MT,false,false,false,CRAs...>::at(
size_t index )
const 2707 if( index >=
size() ) {
2710 return (*
this)[index];
2724 template<
typename MT
2726 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 2743 template<
typename MT
2762 template<
typename MT
2781 template<
typename MT
2783 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 2800 template<
typename MT
2819 template<
typename MT
2853 template<
typename MT
2855 inline Row<MT,
false,
false,
false,CRAs...>&
2856 Row<MT,false,false,false,CRAs...>::operator=( initializer_list<ElementType> list )
2858 using blaze::assign;
2860 if( list.size() >
size() ) {
2864 const InitializerVector<ElementType,true> tmp( list,
size() );
2866 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
2870 decltype(
auto) left( derestrict( *this ) );
2872 assign( left, tmp );
2896 template< typename MT
2898 inline Row<MT,false,false,false,CRAs...>&
2899 Row<MT,false,false,false,CRAs...>::operator=( const Row& rhs )
2901 using blaze::assign;
2907 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
2910 if(
size() != rhs.size() ) {
2914 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
2918 decltype(
auto) left( derestrict( *this ) );
2920 if( rhs.canAlias( &matrix_ ) ) {
2922 assign( left, tmp );
2925 assign( left, rhs );
2950 template<
typename MT
2952 template<
typename VT >
2953 inline Row<MT,
false,
false,
false,CRAs...>&
2954 Row<MT,false,false,false,CRAs...>::operator=(
const Vector<VT,true>& rhs )
2956 using blaze::assign;
2962 const CompositeType_<VT> tmp( ~rhs );
2964 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
2968 decltype(
auto) left( derestrict( *this ) );
2970 assign( left, tmp );
2994 template< typename MT
2996 template< typename VT >
2997 inline Row<MT,false,false,false,CRAs...>&
2998 Row<MT,false,false,false,CRAs...>::operator+=( const Vector<VT,true>& rhs )
3000 using blaze::assign;
3008 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
3017 const AddType tmp( *
this + (~rhs) );
3019 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3023 decltype(
auto) left( derestrict( *this ) );
3025 assign( left, tmp );
3049 template< typename MT
3051 template< typename VT >
3052 inline Row<MT,false,false,false,CRAs...>&
3053 Row<MT,false,false,false,CRAs...>::operator-=( const Vector<VT,true>& rhs )
3055 using blaze::assign;
3063 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
3072 const SubType tmp( *
this - (~rhs) );
3074 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3078 decltype(
auto) left( derestrict( *this ) );
3080 assign( left, tmp );
3103 template< typename MT
3105 template< typename VT >
3106 inline Row<MT,false,false,false,CRAs...>&
3107 Row<MT,false,false,false,CRAs...>::operator*=( const Vector<VT,true>& rhs )
3109 using blaze::assign;
3117 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
3126 const MultType tmp( *
this * (~rhs) );
3128 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3132 decltype(
auto) left( derestrict( *this ) );
3134 assign( left, tmp );
3156 template< typename MT
3158 template< typename VT >
3159 inline Row<MT,false,false,false,CRAs...>&
3160 Row<MT,false,false,false,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
3162 using blaze::assign;
3171 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
3181 const DivType tmp( *
this / (~rhs) );
3183 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3187 decltype(
auto) left( derestrict( *this ) );
3189 assign( left, tmp );
3212 template< typename MT
3214 template< typename VT >
3215 inline Row<MT,false,false,false,CRAs...>&
3216 Row<MT,false,false,false,CRAs...>::operator%=( const Vector<VT,true>& rhs )
3218 using blaze::assign;
3223 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
3229 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
3233 const CrossType tmp( *
this % (~rhs) );
3235 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
3239 decltype(
auto) left( derestrict( *this ) );
3241 assign( left, tmp );
3265 template< typename MT
3267 inline MT& Row<MT,false,false,false,CRAs...>::operand() noexcept
3281 template<
typename MT
3283 inline const MT& Row<MT,false,false,false,CRAs...>::operand() const noexcept
3297 template<
typename MT
3301 return matrix_.columns();
3313 template<
typename MT
3317 return matrix_.columns();
3332 template<
typename MT
3336 size_t counter( 0UL );
3337 for( ConstIterator element=
begin(); element!=
end(); ++element ) {
3352 template<
typename MT
3356 const size_t jbegin( ( IsUpper<MT>::value )
3357 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3361 const size_t jend ( ( IsLower<MT>::value )
3362 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3367 for(
size_t j=jbegin; j<jend; ++j ) {
3368 matrix_.erase(
row(), j );
3385 template<
typename MT
3387 void Row<MT,false,false,false,CRAs...>::reserve(
size_t n )
3417 template<
typename MT
3419 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3422 return Iterator( matrix_,
row(), index, matrix_.set( row(), index, value ) );
3441 template<
typename MT
3443 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3444 Row<MT,false,false,false,CRAs...>::insert(
size_t index,
const ElementType& value )
3446 return Iterator( matrix_,
row(), index, matrix_.insert( row(), index, value ) );
3477 template<
typename MT
3479 inline void Row<MT,false,false,false,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
3481 if( !check || !isDefault<strict>( value ) )
3482 matrix_.insert(
row(), index, value );
3505 template<
typename MT
3507 inline void Row<MT,false,false,false,CRAs...>::erase(
size_t index )
3509 matrix_.erase(
row(), index );
3524 template<
typename MT
3526 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3527 Row<MT,false,false,false,CRAs...>::erase(
Iterator pos )
3529 const size_t column( pos.column_ );
3531 if( column ==
size() )
3534 matrix_.erase( column, pos.pos_ );
3551 template<
typename MT
3553 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3556 for( ; first!=last; ++first ) {
3557 matrix_.erase( first.column_, first.pos_ );
3588 template<
typename MT
3590 template<
typename Pred
3592 inline void Row<MT,false,false,false,CRAs...>::erase( Pred predicate )
3595 if( predicate( element->value() ) )
3596 matrix_.erase( element.column_, element.pos_ );
3628 template<
typename MT
3630 template<
typename Pred >
3631 inline void Row<MT,false,false,false,CRAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
3633 for( ; first!=last; ++first ) {
3634 if( predicate( first->value() ) )
3635 matrix_.erase( first.column_, first.pos_ );
3664 template<
typename MT
3666 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3667 Row<MT,false,false,false,CRAs...>::find(
size_t index )
3669 const Iterator_<MT> pos( matrix_.find( row(), index ) );
3671 if( pos != matrix_.end( index ) )
3694 template<
typename MT
3697 Row<MT,false,false,false,CRAs...>::find(
size_t index )
const 3699 const ConstIterator_<MT> pos( matrix_.find( row(), index ) );
3701 if( pos != matrix_.end( index ) )
3723 template<
typename MT
3725 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3726 Row<MT,false,false,false,CRAs...>::lowerBound(
size_t index )
3728 for(
size_t i=index; i<
size(); ++i )
3730 const Iterator_<MT> pos( matrix_.find( row(), i ) );
3732 if( pos != matrix_.end( i ) )
3755 template<
typename MT
3758 Row<MT,false,false,false,CRAs...>::lowerBound(
size_t index )
const 3760 for(
size_t i=index; i<
size(); ++i )
3762 const ConstIterator_<MT> pos( matrix_.find( row(), i ) );
3764 if( pos != matrix_.end( i ) )
3787 template<
typename MT
3789 inline typename Row<MT,
false,
false,
false,CRAs...>
::Iterator 3790 Row<MT,false,false,false,CRAs...>::upperBound(
size_t index )
3792 for(
size_t i=index+1UL; i<
size(); ++i )
3794 const Iterator_<MT> pos( matrix_.find( row(), i ) );
3796 if( pos != matrix_.end( i ) )
3819 template<
typename MT
3822 Row<MT,false,false,false,CRAs...>::upperBound(
size_t index )
const 3824 for(
size_t i=index+1UL; i<
size(); ++i )
3826 const ConstIterator_<MT> pos( matrix_.find( row(), i ) );
3828 if( pos != matrix_.end( i ) )
3859 template<
typename MT
3861 template<
typename Other >
3862 inline Row<MT,
false,
false,
false,CRAs...>&
3863 Row<MT,false,false,false,CRAs...>::scale(
const Other& scalar )
3868 element->value() *= scalar;
3894 template<
typename MT
3896 template<
typename Other >
3897 inline bool Row<MT,false,false,false,CRAs...>::canAlias(
const Other* alias )
const noexcept
3899 return matrix_.isAliased( alias );
3912 template<
typename MT
3914 template<
typename Other >
3915 inline bool Row<MT,false,false,false,CRAs...>::isAliased(
const Other* alias )
const noexcept
3917 return matrix_.isAliased( alias );
3935 template<
typename MT
3937 template<
typename VT >
3938 inline void Row<MT,false,false,false,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
3942 for(
size_t j=0UL; j<(~rhs).
size(); ++j ) {
3943 matrix_(
row(),j) = (~rhs)[j];
3962 template<
typename MT
3964 template<
typename VT >
3965 inline void Row<MT,false,false,false,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
3971 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
3972 for( ; j<element->index(); ++j )
3973 matrix_.erase( row(), j );
3974 matrix_(
row(),j++) = element->value();
3976 for( ; j<
size(); ++j ) {
3977 matrix_.erase(
row(), j );
3996 template<
typename MT
3998 template<
typename VT >
3999 inline void Row<MT,false,false,false,CRAs...>::addAssign(
const Vector<VT,true>& rhs )
4001 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4008 const AddType tmp(
serial( *
this + (~rhs) ) );
4027 template<
typename MT
4029 template<
typename VT >
4030 inline void Row<MT,false,false,false,CRAs...>::subAssign(
const Vector<VT,true>& rhs )
4032 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4039 const SubType tmp(
serial( *
this - (~rhs) ) );
4066 template<
typename MT
4068 class Row<MT,false,false,true,CRAs...>
4069 :
public View< SparseVector< Row<MT,false,false,true,CRAs...>, true > >
4070 ,
private RowData<CRAs...>
4074 using DataType = RowData<CRAs...>;
4075 using Operand = If_< IsExpression<MT>, MT, MT& >;
4081 using This = Row<MT,
false,
false,
true,CRAs...>;
4083 using BaseType = SparseVector<This,true>;
4084 using ViewedType = MT;
4092 using ConstReference = ConstReference_<MT>;
4098 using ConstIterator = ConstIterator_<MT>;
4106 enum :
bool { smpAssignable =
false };
4112 template<
typename... RRAs >
4113 explicit inline Row( MT& matrix, RRAs... args );
4125 inline Reference operator[](
size_t index );
4126 inline ConstReference operator[](
size_t index )
const;
4128 inline ConstReference at(
size_t index )
const;
4130 inline ConstIterator
begin ()
const;
4131 inline ConstIterator
cbegin()
const;
4133 inline ConstIterator
end ()
const;
4134 inline ConstIterator
cend ()
const;
4141 inline Row& operator=( initializer_list<ElementType> list );
4142 inline Row& operator=(
const Row& rhs );
4144 template<
typename VT >
inline Row& operator= (
const DenseVector<VT,true>& rhs );
4145 template<
typename VT >
inline Row& operator= (
const SparseVector<VT,true>& rhs );
4146 template<
typename VT >
inline Row&
operator+=(
const DenseVector<VT,true>& rhs );
4147 template<
typename VT >
inline Row&
operator+=(
const SparseVector<VT,true>& rhs );
4148 template<
typename VT >
inline Row&
operator-=(
const DenseVector<VT,true>& rhs );
4149 template<
typename VT >
inline Row&
operator-=(
const SparseVector<VT,true>& rhs );
4150 template<
typename VT >
inline Row&
operator*=(
const Vector<VT,true>& rhs );
4151 template<
typename VT >
inline Row&
operator/=(
const DenseVector<VT,true>& rhs );
4152 template<
typename VT >
inline Row& operator%=(
const Vector<VT,true>& rhs );
4161 inline MT& operand() noexcept;
4162 inline const MT& operand() const noexcept;
4164 inline
size_t size() const noexcept;
4165 inline
size_t capacity() const noexcept;
4166 inline
size_t nonZeros() const;
4167 inline
void reset();
4168 inline
void reserve(
size_t n );
4177 inline
void append(
size_t index, const
ElementType& value,
bool check=false );
4184 inline
void erase(
size_t index );
4188 template< typename Pred, typename =
DisableIf_< IsIntegral<Pred> > >
4189 inline
void erase( Pred predicate );
4191 template< typename Pred >
4199 inline
Iterator find (
size_t index );
4200 inline ConstIterator find (
size_t index ) const;
4201 inline
Iterator lowerBound(
size_t index );
4202 inline ConstIterator lowerBound(
size_t index ) const;
4203 inline
Iterator upperBound(
size_t index );
4204 inline ConstIterator upperBound(
size_t index ) const;
4211 template< typename Other > inline Row& scale( const Other& scalar );
4218 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
4219 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
4221 template< typename VT > inline
void assign ( const DenseVector <VT,true>& rhs );
4222 template< typename VT > inline
void assign ( const SparseVector<VT,true>& rhs );
4223 template< typename VT > inline
void addAssign( const DenseVector <VT,true>& rhs );
4224 template< typename VT > inline
void addAssign( const SparseVector<VT,true>& rhs );
4225 template< typename VT > inline
void subAssign( const DenseVector <VT,true>& rhs );
4226 template< typename VT > inline
void subAssign( const SparseVector<VT,true>& rhs );
4234 inline
size_t extendCapacity() const;
4281 template< typename MT
4283 template< typename... RRAs >
4284 inline Row<MT,false,false,true,CRAs...>::Row( MT& matrix, RRAs... args )
4285 : DataType( args... )
4286 , matrix_ ( matrix )
4288 if( !Contains< TypeList<RRAs...>,
Unchecked >::value ) {
4289 if( matrix_.rows() <=
row() ) {
4319 template<
typename MT
4321 inline typename Row<MT,
false,
false,
true,CRAs...>
::Reference 4322 Row<MT,false,false,true,CRAs...>::operator[](
size_t index )
4325 return matrix_(index,
row());
4341 template<
typename MT
4344 Row<MT,false,false,true,CRAs...>::operator[](
size_t index )
const 4347 return const_cast<const MT&
>( matrix_ )(index,
row());
4364 template<
typename MT
4366 inline typename Row<MT,
false,
false,
true,CRAs...>
::Reference 4367 Row<MT,false,false,true,CRAs...>::at(
size_t index )
4369 if( index >=
size() ) {
4372 return (*
this)[index];
4389 template<
typename MT
4392 Row<MT,false,false,true,CRAs...>::at(
size_t index )
const 4394 if( index >=
size() ) {
4397 return (*
this)[index];
4411 template<
typename MT
4413 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 4416 return matrix_.begin(
row() );
4430 template<
typename MT
4435 return matrix_.cbegin(
row() );
4449 template<
typename MT
4454 return matrix_.cbegin(
row() );
4468 template<
typename MT
4470 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 4473 return matrix_.end(
row() );
4487 template<
typename MT
4492 return matrix_.cend(
row() );
4506 template<
typename MT
4511 return matrix_.cend(
row() );
4540 template<
typename MT
4542 inline Row<MT,
false,
false,
true,CRAs...>&
4543 Row<MT,false,false,true,CRAs...>::operator=( initializer_list<ElementType> list )
4545 using blaze::assign;
4547 if( list.size() >
size() ) {
4551 const InitializerVector<ElementType,true> tmp( list,
size() );
4553 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4557 decltype(
auto) left( derestrict( *this ) );
4560 assign( left, tmp );
4584 template< typename MT
4586 inline Row<MT,false,false,true,CRAs...>&
4587 Row<MT,false,false,true,CRAs...>::operator=( const Row& rhs )
4589 using blaze::assign;
4595 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row() == rhs.row() ) )
4598 if(
size() != rhs.size() ) {
4602 if( !tryAssign( matrix_, rhs,
row(), 0UL ) ) {
4606 decltype(
auto) left( derestrict( *this ) );
4608 if( rhs.canAlias( &matrix_ ) ) {
4611 left.reserve( tmp.nonZeros() );
4612 assign( left, tmp );
4616 left.reserve( rhs.nonZeros() );
4617 assign( left, rhs );
4642 template<
typename MT
4644 template<
typename VT >
4645 inline Row<MT,
false,
false,
true,CRAs...>&
4646 Row<MT,false,false,true,CRAs...>::operator=(
const DenseVector<VT,true>& rhs )
4648 using blaze::assign;
4658 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4659 Right right( ~rhs );
4661 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4665 decltype(
auto) left( derestrict( *this ) );
4667 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4668 const ResultType_<VT> tmp( right );
4670 assign( left, tmp );
4674 assign( left, right );
4699 template<
typename MT
4701 template<
typename VT >
4702 inline Row<MT,
false,
false,
true,CRAs...>&
4703 Row<MT,false,false,true,CRAs...>::operator=(
const SparseVector<VT,true>& rhs )
4705 using blaze::assign;
4715 using Right = If_< IsRestricted<MT>, CompositeType_<VT>,
const VT& >;
4716 Right right( ~rhs );
4718 if( !tryAssign( matrix_, right,
row(), 0UL ) ) {
4722 decltype(
auto) left( derestrict( *this ) );
4724 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4725 const ResultType_<VT> tmp( right );
4727 left.reserve( tmp.nonZeros() );
4728 assign( left, tmp );
4732 left.reserve( right.nonZeros() );
4733 assign( left, right );
4758 template<
typename MT
4760 template<
typename VT >
4761 inline Row<MT,
false,
false,
true,CRAs...>&
4764 using blaze::assign;
4773 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4783 const AddType tmp( *
this + (~rhs) );
4785 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4789 decltype(
auto) left( derestrict( *this ) );
4792 assign( left, tmp );
4816 template< typename MT
4818 template< typename VT >
4819 inline Row<MT,false,false,true,CRAs...>&
4820 Row<MT,false,false,true,CRAs...>::operator+=( const SparseVector<VT,true>& rhs )
4822 using blaze::assign;
4831 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
4841 const AddType tmp( *
this + (~rhs) );
4843 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4847 decltype(
auto) left( derestrict( *this ) );
4850 left.reserve( tmp.nonZeros() );
4851 assign( left, tmp );
4876 template< typename MT
4878 template< typename VT >
4879 inline Row<MT,false,false,true,CRAs...>&
4880 Row<MT,false,false,true,CRAs...>::operator-=( const DenseVector<VT,true>& rhs )
4882 using blaze::assign;
4891 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4901 const SubType tmp( *
this - (~rhs) );
4903 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4907 decltype(
auto) left( derestrict( *this ) );
4910 assign( left, tmp );
4935 template< typename MT
4937 template< typename VT >
4938 inline Row<MT,false,false,true,CRAs...>&
4939 Row<MT,false,false,true,CRAs...>::operator-=( const SparseVector<VT,true>& rhs )
4941 using blaze::assign;
4950 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
4960 const SubType tmp( *
this - (~rhs) );
4962 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
4966 decltype(
auto) left( derestrict( *this ) );
4969 left.reserve( tmp.nonZeros() );
4970 assign( left, tmp );
4993 template< typename MT
4995 template< typename VT >
4996 inline Row<MT,false,false,true,CRAs...>&
4997 Row<MT,false,false,true,CRAs...>::operator*=( const Vector<VT,true>& rhs )
4999 using blaze::assign;
5007 using MultType = MultTrait_< ResultType, ResultType_<VT> >;
5016 const MultType tmp( *
this * (~rhs) );
5018 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5022 decltype(
auto) left( derestrict( *this ) );
5025 assign( left, tmp );
5047 template< typename MT
5049 template< typename VT >
5050 inline Row<MT,false,false,true,CRAs...>&
5051 Row<MT,false,false,true,CRAs...>::operator/=( const DenseVector<VT,true>& rhs )
5053 using blaze::assign;
5062 using DivType = DivTrait_< ResultType, ResultType_<VT> >;
5072 const DivType tmp( *
this / (~rhs) );
5074 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5078 decltype(
auto) left( derestrict( *this ) );
5081 assign( left, tmp );
5104 template< typename MT
5106 template< typename VT >
5107 inline Row<MT,false,false,true,CRAs...>&
5108 Row<MT,false,false,true,CRAs...>::operator%=( const Vector<VT,true>& rhs )
5110 using blaze::assign;
5115 using CrossType = CrossTrait_< ResultType, ResultType_<VT> >;
5121 if(
size() != 3UL || (~rhs).
size() != 3UL ) {
5125 const CrossType tmp( *
this % (~rhs) );
5127 if( !tryAssign( matrix_, tmp,
row(), 0UL ) ) {
5131 decltype(
auto) left( derestrict( *this ) );
5134 assign( left, tmp );
5158 template< typename MT
5160 inline MT& Row<MT,false,false,true,CRAs...>::operand() noexcept
5174 template<
typename MT
5176 inline const MT& Row<MT,false,false,true,CRAs...>::operand() const noexcept
5190 template<
typename MT
5194 return matrix_.columns();
5206 template<
typename MT
5210 return matrix_.capacity(
row() );
5225 template<
typename MT
5229 return matrix_.nonZeros(
row() );
5241 template<
typename MT
5245 matrix_.reset(
row() );
5261 template<
typename MT
5263 void Row<MT,false,false,true,CRAs...>::reserve(
size_t n )
5265 matrix_.reserve(
row(), n );
5280 template<
typename MT
5282 inline size_t Row<MT,false,false,true,CRAs...>::extendCapacity()
const 5287 size_t nonzeros( 2UL*
capacity()+1UL );
5288 nonzeros =
max( nonzeros, 7UL );
5289 nonzeros =
min( nonzeros,
size() );
5319 template<
typename MT
5321 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5324 return matrix_.set( index,
row(), value );
5343 template<
typename MT
5345 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5346 Row<MT,false,false,true,CRAs...>::insert(
size_t index,
const ElementType& value )
5348 return matrix_.insert( index,
row(), value );
5379 template<
typename MT
5381 inline void Row<MT,false,false,true,CRAs...>::append(
size_t index,
const ElementType& value,
bool check )
5383 matrix_.append( index,
row(), value, check );
5406 template<
typename MT
5408 inline void Row<MT,false,false,true,CRAs...>::erase(
size_t index )
5410 matrix_.erase( index,
row() );
5425 template<
typename MT
5427 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5428 Row<MT,false,false,true,CRAs...>::erase(
Iterator pos )
5430 return matrix_.erase(
row(), pos );
5446 template<
typename MT
5448 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5451 return matrix_.erase(
row(), first, last );
5480 template<
typename MT
5482 template<
typename Pred
5484 inline void Row<MT,false,false,true,CRAs...>::erase( Pred predicate )
5486 matrix_.erase(
row(),
begin(),
end(), predicate );
5517 template<
typename MT
5519 template<
typename Pred >
5520 inline void Row<MT,false,false,true,CRAs...>::erase(
Iterator first,
Iterator last, Pred predicate )
5522 matrix_.erase(
row(), first, last, predicate );
5550 template<
typename MT
5552 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5553 Row<MT,false,false,true,CRAs...>::find(
size_t index )
5555 return matrix_.find( index,
row() );
5575 template<
typename MT
5578 Row<MT,false,false,true,CRAs...>::find(
size_t index )
const 5580 return matrix_.find( index,
row() );
5599 template<
typename MT
5601 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5602 Row<MT,false,false,true,CRAs...>::lowerBound(
size_t index )
5604 return matrix_.lowerBound( index,
row() );
5623 template<
typename MT
5626 Row<MT,false,false,true,CRAs...>::lowerBound(
size_t index )
const 5628 return matrix_.lowerBound( index,
row() );
5647 template<
typename MT
5649 inline typename Row<MT,
false,
false,
true,CRAs...>
::Iterator 5650 Row<MT,false,false,true,CRAs...>::upperBound(
size_t index )
5652 return matrix_.upperBound( index,
row() );
5671 template<
typename MT
5674 Row<MT,false,false,true,CRAs...>::upperBound(
size_t index )
const 5676 return matrix_.upperBound( index,
row() );
5703 template<
typename MT
5705 template<
typename Other >
5706 inline Row<MT,
false,
false,
true,CRAs...>&
5707 Row<MT,false,false,true,CRAs...>::scale(
const Other& scalar )
5712 element->value() *= scalar;
5738 template<
typename MT
5740 template<
typename Other >
5741 inline bool Row<MT,false,false,true,CRAs...>::canAlias(
const Other* alias )
const noexcept
5743 return matrix_.isAliased( alias );
5760 template<
typename MT
5762 template<
typename Other >
5763 inline bool Row<MT,false,false,true,CRAs...>::isAliased(
const Other* alias )
const noexcept
5765 return matrix_.isAliased( alias );
5783 template<
typename MT
5785 template<
typename VT >
5786 inline void Row<MT,false,false,true,CRAs...>::assign(
const DenseVector<VT,true>& rhs )
5791 for(
size_t i=0UL; i<
size(); ++i )
5793 if( matrix_.nonZeros( row() ) == matrix_.capacity(
row() ) )
5794 matrix_.reserve( row(), extendCapacity() );
5796 matrix_.append( i,
row(), (~rhs)[i],
true );
5815 template<
typename MT
5817 template<
typename VT >
5818 inline void Row<MT,false,false,true,CRAs...>::assign(
const SparseVector<VT,true>& rhs )
5823 for( ConstIterator_<VT> element=(~rhs).
begin(); element!=(~rhs).
end(); ++element ) {
5824 matrix_.append( element->index(),
row(), element->value(), true );
5843 template<
typename MT
5845 template<
typename VT >
5846 inline void Row<MT,false,false,true,CRAs...>::addAssign(
const DenseVector<VT,true>& rhs )
5848 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5856 const AddType tmp(
serial( *
this + (~rhs) ) );
5857 matrix_.reset(
row() );
5876 template<
typename MT
5878 template<
typename VT >
5879 inline void Row<MT,false,false,true,CRAs...>::addAssign(
const SparseVector<VT,true>& rhs )
5881 using AddType = AddTrait_< ResultType, ResultType_<VT> >;
5889 const AddType tmp(
serial( *
this + (~rhs) ) );
5890 matrix_.reset(
row() );
5891 matrix_.reserve(
row(), tmp.nonZeros() );
5910 template<
typename MT
5912 template<
typename VT >
5913 inline void Row<MT,false,false,true,CRAs...>::subAssign(
const DenseVector<VT,true>& rhs )
5915 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5923 const SubType tmp(
serial( *
this - (~rhs) ) );
5924 matrix_.reset(
row() );
5943 template<
typename MT
5945 template<
typename VT >
5946 inline void Row<MT,false,false,true,CRAs...>::subAssign(
const SparseVector<VT,true>& rhs )
5948 using SubType = SubTrait_< ResultType, ResultType_<VT> >;
5956 const SubType tmp(
serial( *
this - (~rhs) ) );
5957 matrix_.reset(
row() );
5958 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:131
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
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
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.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#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:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
Header file for the IsIntegral type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
#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:3083
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
#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
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:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
Header file for the IsUniLower type trait.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
typename RowTrait< MT, CRAs... >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:145
BLAZE_ALWAYS_INLINE 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:474
BLAZE_ALWAYS_INLINE 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:408
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:3082
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:3075
#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:3079
#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:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
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.
BLAZE_ALWAYS_INLINE 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:430
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:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#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:131
Header file for the reset shim.
#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
Header file for the isDefault shim.
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:816
#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:3080
#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
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
#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
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.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
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.
Constraint on the data type.