35 #ifndef _BLAZE_MATH_VIEWS_SPARSEROW_H_
36 #define _BLAZE_MATH_VIEWS_SPARSEROW_H_
367 template<
typename MT
368 ,
bool SO = IsRowMajorMatrix<MT>::value
369 ,
bool SF = IsSymmetric<MT>::value >
370 class SparseRow :
public SparseVector< SparseRow<MT,SO,SF>, true >
403 enum { smpAssignable = 0 };
409 explicit inline SparseRow( MT& matrix,
size_t index );
422 inline ConstReference
operator[](
size_t index )
const;
423 inline Reference
at(
size_t index );
424 inline ConstReference
at(
size_t index )
const;
425 inline Iterator
begin ();
426 inline ConstIterator
begin ()
const;
427 inline ConstIterator
cbegin()
const;
428 inline Iterator
end ();
429 inline ConstIterator
end ()
const;
430 inline ConstIterator
cend ()
const;
447 template<
typename Other >
449 operator*=( Other rhs );
451 template<
typename Other >
453 operator/=( Other rhs );
460 inline size_t size()
const;
464 inline Iterator
set (
size_t index,
const ElementType& value );
465 inline Iterator
insert (
size_t index,
const ElementType& value );
466 inline void erase (
size_t index );
467 inline Iterator
erase ( Iterator pos );
468 inline Iterator
erase ( Iterator first, Iterator last );
469 inline void reserve(
size_t n );
470 template<
typename Other >
inline SparseRow& scale (
const Other& scalar );
477 inline Iterator
find (
size_t index );
478 inline ConstIterator
find (
size_t index )
const;
480 inline ConstIterator
lowerBound(
size_t index )
const;
482 inline ConstIterator
upperBound(
size_t index )
const;
489 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
496 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
497 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
526 template<
typename MT2,
bool SO2,
bool SF2 >
529 template<
typename MT2,
bool SO2,
bool SF2 >
532 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
535 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
538 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
541 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
544 template<
typename MT2,
bool SO2,
bool SF2 >
579 template<
typename MT
586 if(
matrix_.rows() <= index ) {
610 template<
typename MT
616 return matrix_(row_,index);
630 template<
typename MT
637 return const_cast<const MT&
>( matrix_ )(row_,index);
652 template<
typename MT
657 if( index >=
size() ) {
660 return (*
this)[index];
675 template<
typename MT
680 if( index >=
size() ) {
683 return (*
this)[index];
695 template<
typename MT
700 return matrix_.begin( row_ );
712 template<
typename MT
717 return matrix_.cbegin( row_ );
729 template<
typename MT
734 return matrix_.cbegin( row_ );
746 template<
typename MT
751 return matrix_.end( row_ );
763 template<
typename MT
768 return matrix_.cend( row_ );
780 template<
typename MT
785 return matrix_.cend( row_ );
811 template<
typename MT
822 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
825 if(
size() != rhs.size() ) {
829 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
835 if( rhs.canAlias( &matrix_ ) ) {
838 left.reserve( tmp.nonZeros() );
843 left.reserve( rhs.nonZeros() );
867 template<
typename MT
870 template<
typename VT >
886 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
899 assign( left, right );
922 template<
typename MT
925 template<
typename VT >
941 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
950 left.reserve( tmp.nonZeros() );
955 left.reserve( right.nonZeros() );
956 assign( left, right );
979 template<
typename MT
982 template<
typename VT >
1004 const AddType tmp( *
this + (~rhs) );
1006 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
1013 assign( left, tmp );
1035 template<
typename MT
1038 template<
typename VT >
1041 using blaze::assign;
1060 const AddType tmp( *
this + (~rhs) );
1062 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
1069 left.reserve( tmp.nonZeros() );
1070 assign( left, tmp );
1093 template<
typename MT
1096 template<
typename VT >
1099 using blaze::assign;
1118 const SubType tmp( *
this - (~rhs) );
1120 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
1127 assign( left, tmp );
1150 template<
typename MT
1153 template<
typename VT >
1156 using blaze::assign;
1175 const SubType tmp( *
this - (~rhs) );
1177 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
1184 left.reserve( tmp.nonZeros() );
1185 assign( left, tmp );
1206 template<
typename MT
1209 template<
typename VT >
1212 using blaze::assign;
1229 const MultType tmp( *
this * (~rhs) );
1231 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
1238 assign( left, tmp );
1261 template<
typename MT
1264 template<
typename Other >
1271 element->value() *= rhs;
1294 template<
typename MT
1297 template<
typename Other >
1311 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1313 element->value() *= tmp;
1317 element->value() /= rhs;
1338 template<
typename MT
1343 return matrix_.columns();
1353 template<
typename MT
1358 return matrix_.capacity( row_ );
1371 template<
typename MT
1376 return matrix_.nonZeros( row_ );
1386 template<
typename MT
1391 matrix_.reset( row_ );
1407 template<
typename MT
1413 return matrix_.set( row_, index, value );
1430 template<
typename MT
1436 return matrix_.insert( row_, index, value );
1449 template<
typename MT
1454 matrix_.erase( row_, index );
1467 template<
typename MT
1472 return matrix_.erase( row_, pos );
1486 template<
typename MT
1492 return matrix_.erase( row_, first, last );
1506 template<
typename MT
1511 matrix_.reserve( row_, n );
1526 template<
typename MT
1529 template<
typename Other >
1535 element->value() *= scalar;
1549 template<
typename MT
1557 size_t nonzeros( 2UL*
capacity()+1UL );
1558 nonzeros =
max( nonzeros, 7UL );
1559 nonzeros =
min( nonzeros,
size() );
1589 template<
typename MT
1594 return matrix_.find( row_, index );
1612 template<
typename MT
1617 return matrix_.find( row_, index );
1634 template<
typename MT
1639 return matrix_.lowerBound( row_, index );
1656 template<
typename MT
1661 return matrix_.lowerBound( row_, index );
1678 template<
typename MT
1683 return matrix_.upperBound( row_, index );
1700 template<
typename MT
1705 return matrix_.upperBound( row_, index );
1742 template<
typename MT
1747 matrix_.append( row_, index, value, check );
1770 template<
typename MT
1773 template<
typename Other >
1776 return matrix_.isAliased( alias );
1791 template<
typename MT
1794 template<
typename Other >
1797 return matrix_.isAliased( alias );
1813 template<
typename MT
1816 template<
typename VT >
1822 for(
size_t j=0UL; j<
size(); ++j )
1824 if( matrix_.nonZeros( row_ ) == matrix_.capacity( row_ ) )
1825 matrix_.reserve( row_, extendCapacity() );
1827 matrix_.append( row_, j, (~rhs)[j],
true );
1844 template<
typename MT
1847 template<
typename VT >
1854 matrix_.append( row_, element->index(), element->value(), true );
1871 template<
typename MT
1874 template<
typename VT >
1885 const AddType tmp(
serial( *
this + (~rhs) ) );
1886 matrix_.reset( row_ );
1903 template<
typename MT
1906 template<
typename VT >
1917 const AddType tmp(
serial( *
this + (~rhs) ) );
1918 matrix_.reset( row_ );
1919 matrix_.reserve( row_, tmp.nonZeros() );
1936 template<
typename MT
1939 template<
typename VT >
1950 const SubType tmp(
serial( *
this - (~rhs) ) );
1951 matrix_.reset( row_ );
1968 template<
typename MT
1971 template<
typename VT >
1982 const SubType tmp(
serial( *
this - (~rhs) ) );
1983 matrix_.reset( row_ );
1984 matrix_.reserve( row_, tmp.nonZeros() );
2010 template<
typename MT >
2039 template<
typename MatrixType
2040 ,
typename IteratorType >
2056 typedef typename std::iterator_traits<IteratorType>::value_type SET;
2064 typedef typename SET::ValueType ValueType;
2065 typedef size_t IndexType;
2066 typedef typename IfTrue<returnConst,CRT,RT>::Type
Reference;
2076 inline RowElement( IteratorType pos,
size_t column )
2088 template<
typename T >
inline RowElement&
operator=(
const T& v ) {
2100 template<
typename T >
inline RowElement& operator+=(
const T& v ) {
2112 template<
typename T >
inline RowElement& operator-=(
const T& v ) {
2124 template<
typename T >
inline RowElement& operator*=(
const T& v ) {
2136 template<
typename T >
inline RowElement& operator/=(
const T& v ) {
2147 inline const RowElement* operator->()
const {
2157 inline Reference value()
const {
2158 return pos_->value();
2167 inline IndexType index()
const {
2183 template<
typename MatrixType
2184 ,
typename IteratorType >
2189 typedef std::forward_iterator_tag IteratorCategory;
2190 typedef RowElement<MatrixType,IteratorType> ValueType;
2191 typedef ValueType PointerType;
2192 typedef ValueType ReferenceType;
2193 typedef ptrdiff_t DifferenceType;
2196 typedef IteratorCategory iterator_category;
2197 typedef ValueType value_type;
2198 typedef PointerType pointer;
2199 typedef ReferenceType reference;
2200 typedef DifferenceType difference_type;
2206 inline RowIterator()
2221 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
2227 for( ; column_<
matrix_->columns(); ++column_ ) {
2229 if( pos_ !=
matrix_->end( column_ ) )
break;
2242 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2257 template<
typename MatrixType2,
typename IteratorType2 >
2258 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
2261 , column_( it.column_ )
2271 inline RowIterator& operator++() {
2273 for( ; column_<
matrix_->columns(); ++column_ ) {
2275 if( pos_ !=
matrix_->end( column_ ) )
break;
2287 inline const RowIterator operator++(
int ) {
2288 const RowIterator tmp( *
this );
2299 inline ReferenceType
operator*()
const {
2300 return ReferenceType( pos_, column_ );
2309 inline PointerType operator->()
const {
2310 return PointerType( pos_, column_ );
2320 template<
typename MatrixType2,
typename IteratorType2 >
2321 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
2322 return (
matrix_ == rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2332 template<
typename MatrixType2,
typename IteratorType2 >
2333 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
2334 return !( *
this == rhs );
2344 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
2345 size_t counter( 0UL );
2346 for(
size_t j=rhs.column_; j<column_; ++j ) {
2363 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
2364 template<
typename MT2,
bool SO2,
bool SF2 >
friend class SparseRow;
2371 typedef RowIterator<const MT,typename MT::ConstIterator>
ConstIterator;
2374 typedef typename If< IsConst<MT>,
ConstIterator, RowIterator<MT,typename MT::Iterator> >::Type
Iterator;
2379 enum { smpAssignable = 0 };
2385 explicit inline SparseRow( MT& matrix,
size_t index );
2398 inline ConstReference
operator[](
size_t index )
const;
2399 inline Reference
at(
size_t index );
2400 inline ConstReference
at(
size_t index )
const;
2401 inline Iterator
begin ();
2402 inline ConstIterator
begin ()
const;
2403 inline ConstIterator
cbegin()
const;
2404 inline Iterator
end ();
2405 inline ConstIterator
end ()
const;
2406 inline ConstIterator
cend ()
const;
2415 template<
typename VT >
inline SparseRow& operator+=(
const Vector<VT,true>& rhs );
2416 template<
typename VT >
inline SparseRow& operator-=(
const Vector<VT,true>& rhs );
2417 template<
typename VT >
inline SparseRow& operator*=(
const Vector<VT,true>& rhs );
2419 template<
typename Other >
2420 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
2421 operator*=( Other rhs );
2423 template<
typename Other >
2424 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
2425 operator/=( Other rhs );
2432 inline size_t size()
const;
2435 inline void reset();
2436 inline Iterator
set (
size_t index,
const ElementType& value );
2437 inline Iterator
insert (
size_t index,
const ElementType& value );
2438 inline void erase (
size_t index );
2439 inline Iterator
erase ( Iterator pos );
2440 inline Iterator
erase ( Iterator first, Iterator last );
2441 inline void reserve(
size_t n );
2442 template<
typename Other >
inline SparseRow& scale (
const Other& scalar );
2449 inline Iterator
find (
size_t index );
2450 inline ConstIterator
find (
size_t index )
const;
2452 inline ConstIterator
lowerBound(
size_t index )
const;
2454 inline ConstIterator
upperBound(
size_t index )
const;
2461 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
2468 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2469 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2471 template<
typename VT >
inline void assign (
const DenseVector <VT,true>& rhs );
2472 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
2473 template<
typename VT >
inline void addAssign(
const Vector<VT,true>& rhs );
2474 template<
typename VT >
inline void subAssign(
const Vector<VT,true>& rhs );
2488 template<
typename MT2,
bool SO2,
bool SF2 >
2489 friend bool isIntact(
const SparseRow<MT2,SO2,SF2>& row );
2491 template<
typename MT2,
bool SO2,
bool SF2 >
2492 friend bool isSame(
const SparseRow<MT2,SO2,SF2>& a,
const SparseRow<MT2,SO2,SF2>& b );
2494 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2495 friend bool tryAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
2497 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2498 friend bool tryAddAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
2500 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2501 friend bool trySubAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
2503 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2504 friend bool tryMultAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
2506 template<
typename MT2,
bool SO2,
bool SF2 >
2507 friend typename DerestrictTrait< SparseRow<MT2,SO2,SF2> >::Type
2508 derestrict( SparseRow<MT2,SO2,SF2>& dm );
2541 template<
typename MT >
2546 if(
matrix_.rows() <= index ) {
2572 template<
typename MT >
2577 return matrix_(row_,index);
2593 template<
typename MT >
2598 return const_cast<const MT&
>( matrix_ )(row_,index);
2615 template<
typename MT >
2619 if( index >=
size() ) {
2622 return (*
this)[index];
2639 template<
typename MT >
2643 if( index >=
size() ) {
2646 return (*
this)[index];
2660 template<
typename MT >
2663 return Iterator( matrix_, row_, 0UL );
2677 template<
typename MT >
2694 template<
typename MT >
2711 template<
typename MT >
2728 template<
typename MT >
2745 template<
typename MT >
2776 template<
typename MT >
2779 using blaze::assign;
2785 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
2788 if(
size() != rhs.size() ) {
2792 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
2796 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2798 if( rhs.canAlias( &matrix_ ) ) {
2799 const ResultType tmp( rhs );
2800 assign( left, tmp );
2803 assign( left, rhs );
2828 template<
typename MT >
2829 template<
typename VT >
2832 using blaze::assign;
2840 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
2844 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2846 assign( left, tmp );
2870 template<
typename MT >
2871 template<
typename VT >
2872 inline SparseRow<MT,false,false>& SparseRow<MT,false,false>::operator+=(
const Vector<VT,true>& rhs )
2874 using blaze::assign;
2882 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
2891 const AddType tmp( *
this + (~rhs) );
2893 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
2897 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2899 assign( left, tmp );
2923 template<
typename MT >
2924 template<
typename VT >
2925 inline SparseRow<MT,false,false>& SparseRow<MT,false,false>::operator-=(
const Vector<VT,true>& rhs )
2927 using blaze::assign;
2935 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
2944 const SubType tmp( *
this - (~rhs) );
2946 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
2950 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2952 assign( left, tmp );
2975 template<
typename MT >
2976 template<
typename VT >
2977 inline SparseRow<MT,false,false>& SparseRow<MT,false,false>::operator*=(
const Vector<VT,true>& rhs )
2979 using blaze::assign;
2987 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
2996 const MultType tmp( *
this * (~rhs) );
2998 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
3002 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3004 assign( left, tmp );
3029 template<
typename MT >
3030 template<
typename Other >
3031 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false,false> >::Type&
3032 SparseRow<MT,false,false>::operator*=( Other rhs )
3037 element->value() *= rhs;
3062 template<
typename MT >
3063 template<
typename Other >
3064 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false,false> >::Type&
3065 SparseRow<MT,false,false>::operator/=( Other rhs )
3071 typedef typename DivTrait<ElementType,Other>::Type DT;
3072 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
3076 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3077 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3079 element->value() *= tmp;
3083 element->value() /= rhs;
3106 template<
typename MT >
3109 return matrix_.columns();
3121 template<
typename MT >
3124 return matrix_.columns();
3139 template<
typename MT >
3142 size_t counter( 0UL );
3158 template<
typename MT >
3161 const size_t jbegin( ( IsUpper<MT>::value )
3162 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3166 const size_t jend ( ( IsLower<MT>::value )
3167 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3172 for(
size_t j=jbegin; j<jend; ++j ) {
3173 matrix_.erase( row_, j );
3193 template<
typename MT >
3197 return Iterator( matrix_, row_, index, matrix_.insert( row_, index, value ) );
3215 template<
typename MT >
3219 return Iterator( matrix_, row_, index, matrix_.set( row_, index, value ) );
3234 template<
typename MT >
3237 matrix_.erase( row_, index );
3252 template<
typename MT >
3255 const size_t column( pos.column_ );
3257 if( column ==
size() )
3260 matrix_.erase( column, pos.pos_ );
3261 return Iterator( matrix_, row_, column+1UL );
3277 template<
typename MT >
3281 for( ; first!=last; ++first ) {
3282 matrix_.erase( first.column_, first.pos_ );
3300 template<
typename MT >
3322 template<
typename MT >
3323 template<
typename Other >
3324 inline SparseRow<MT,false,false>& SparseRow<MT,false,false>::scale(
const Other& scalar )
3329 element->value() *= scalar;
3358 template<
typename MT >
3361 const typename MT::Iterator pos( matrix_.find( row_, index ) );
3363 if( pos != matrix_.end( index ) )
3364 return Iterator( matrix_, row_, index, pos );
3386 template<
typename MT >
3392 if( pos != matrix_.end( index ) )
3414 template<
typename MT >
3418 for(
size_t i=index; i<
size(); ++i )
3420 const typename MT::Iterator pos( matrix_.find( row_, i ) );
3422 if( pos != matrix_.end( i ) )
3423 return Iterator( matrix_, row_, i, pos );
3445 template<
typename MT >
3449 for(
size_t i=index; i<
size(); ++i )
3453 if( pos != matrix_.end( i ) )
3476 template<
typename MT >
3480 for(
size_t i=index+1UL; i<
size(); ++i )
3482 const typename MT::Iterator pos( matrix_.find( row_, i ) );
3484 if( pos != matrix_.end( i ) )
3485 return Iterator( matrix_, row_, i, pos );
3507 template<
typename MT >
3511 for(
size_t i=index+1UL; i<
size(); ++i )
3515 if( pos != matrix_.end( i ) )
3558 template<
typename MT >
3562 matrix_.insert( row_, index, value );
3587 template<
typename MT >
3588 template<
typename Other >
3591 return matrix_.isAliased( alias );
3604 template<
typename MT >
3605 template<
typename Other >
3608 return matrix_.isAliased( alias );
3626 template<
typename MT >
3627 template<
typename VT >
3632 for(
size_t j=0UL; j<(~rhs).
size(); ++j ) {
3633 matrix_(row_,j) = (~rhs)[j];
3652 template<
typename MT >
3653 template<
typename VT >
3661 for( ; j<element->index(); ++j )
3662 matrix_.erase( row_, j );
3663 matrix_(row_,j++) = element->value();
3665 for( ; j<
size(); ++j ) {
3666 matrix_.erase( row_, j );
3685 template<
typename MT >
3686 template<
typename VT >
3689 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3696 const AddType tmp(
serial( *
this + (~rhs) ) );
3715 template<
typename MT >
3716 template<
typename VT >
3719 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3726 const SubType tmp(
serial( *
this - (~rhs) ) );
3753 template<
typename MT >
3754 class SparseRow<MT,false,true> :
public SparseVector< SparseRow<MT,false,true>, true >
3760 typedef typename If< IsExpression<MT>, MT, MT& >::Type
Operand;
3765 typedef SparseRow<MT,false,true>
This;
3766 typedef typename RowTrait<MT>::Type
ResultType;
3787 enum { smpAssignable = 0 };
3793 explicit inline SparseRow( MT& matrix,
size_t index );
3806 inline ConstReference
operator[](
size_t index )
const;
3807 inline Reference
at(
size_t index );
3808 inline ConstReference
at(
size_t index )
const;
3809 inline Iterator
begin ();
3810 inline ConstIterator
begin ()
const;
3811 inline ConstIterator
cbegin()
const;
3812 inline Iterator
end ();
3813 inline ConstIterator
end ()
const;
3814 inline ConstIterator
cend ()
const;
3823 template<
typename VT >
inline SparseRow&
operator= (
const DenseVector<VT,true>& rhs );
3824 template<
typename VT >
inline SparseRow&
operator= (
const SparseVector<VT,true>& rhs );
3825 template<
typename VT >
inline SparseRow& operator+=(
const DenseVector<VT,true>& rhs );
3826 template<
typename VT >
inline SparseRow& operator+=(
const SparseVector<VT,true>& rhs );
3827 template<
typename VT >
inline SparseRow& operator-=(
const DenseVector<VT,true>& rhs );
3828 template<
typename VT >
inline SparseRow& operator-=(
const SparseVector<VT,true>& rhs );
3829 template<
typename VT >
inline SparseRow& operator*=(
const Vector<VT,true>& rhs );
3831 template<
typename Other >
3832 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
3833 operator*=( Other rhs );
3835 template<
typename Other >
3836 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
3837 operator/=( Other rhs );
3844 inline size_t size()
const;
3847 inline void reset();
3848 inline Iterator
set (
size_t index,
const ElementType& value );
3849 inline Iterator
insert (
size_t index,
const ElementType& value );
3850 inline void erase (
size_t index );
3851 inline Iterator
erase ( Iterator pos );
3852 inline Iterator
erase ( Iterator first, Iterator last );
3853 inline void reserve(
size_t n );
3854 template<
typename Other >
inline SparseRow& scale (
const Other& scalar );
3861 inline Iterator
find (
size_t index );
3862 inline ConstIterator
find (
size_t index )
const;
3864 inline ConstIterator
lowerBound(
size_t index )
const;
3866 inline ConstIterator
upperBound(
size_t index )
const;
3873 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
3880 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
3881 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
3883 template<
typename VT >
inline void assign (
const DenseVector <VT,true>& rhs );
3884 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
3885 template<
typename VT >
inline void addAssign(
const DenseVector <VT,true>& rhs );
3886 template<
typename VT >
inline void addAssign(
const SparseVector<VT,true>& rhs );
3887 template<
typename VT >
inline void subAssign(
const DenseVector <VT,true>& rhs );
3888 template<
typename VT >
inline void subAssign(
const SparseVector<VT,true>& rhs );
3909 template<
typename MT2,
bool SO2,
bool SF2 >
3910 friend bool isIntact(
const SparseRow<MT2,SO2,SF2>& row );
3912 template<
typename MT2,
bool SO2,
bool SF2 >
3913 friend bool isSame(
const SparseRow<MT2,SO2,SF2>& a,
const SparseRow<MT2,SO2,SF2>& b );
3915 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3916 friend bool tryAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
3918 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3919 friend bool tryAddAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
3921 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3922 friend bool trySubAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
3924 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3925 friend bool tryMultAssign(
const SparseRow<MT2,SO2,SF2>& lhs,
const Vector<VT,true>& rhs,
size_t index );
3927 template<
typename MT2,
bool SO2,
bool SF2 >
3928 friend typename DerestrictTrait< SparseRow<MT2,SO2,SF2> >::Type
3929 derestrict( SparseRow<MT2,SO2,SF2>& dm );
3962 template<
typename MT >
3967 if(
matrix_.rows() <= index ) {
3993 template<
typename MT >
3998 return matrix_(index,row_);
4014 template<
typename MT >
4019 return const_cast<const MT&
>( matrix_ )(index,row_);
4036 template<
typename MT >
4040 if( index >=
size() ) {
4043 return (*
this)[index];
4060 template<
typename MT >
4064 if( index >=
size() ) {
4067 return (*
this)[index];
4081 template<
typename MT >
4084 return matrix_.begin( row_ );
4098 template<
typename MT >
4101 return matrix_.cbegin( row_ );
4115 template<
typename MT >
4118 return matrix_.cbegin( row_ );
4132 template<
typename MT >
4135 return matrix_.end( row_ );
4149 template<
typename MT >
4152 return matrix_.cend( row_ );
4166 template<
typename MT >
4169 return matrix_.cend( row_ );
4197 template<
typename MT >
4200 using blaze::assign;
4206 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
4209 if(
size() != rhs.size() ) {
4213 if( !tryAssign( matrix_, rhs, row_, 0UL ) ) {
4217 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4219 if( rhs.canAlias( &matrix_ ) ) {
4220 const ResultType tmp( rhs );
4222 left.reserve( tmp.nonZeros() );
4223 assign( left, tmp );
4227 left.reserve( rhs.nonZeros() );
4228 assign( left, rhs );
4253 template<
typename MT >
4254 template<
typename VT >
4255 inline SparseRow<MT,false,true>&
4258 using blaze::assign;
4268 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4269 Right right( ~rhs );
4271 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4275 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4277 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4280 assign( left, tmp );
4284 assign( left, right );
4309 template<
typename MT >
4310 template<
typename VT >
4311 inline SparseRow<MT,false,true>&
4314 using blaze::assign;
4324 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4325 Right right( ~rhs );
4327 if( !tryAssign( matrix_, right, row_, 0UL ) ) {
4331 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4333 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4336 left.reserve( tmp.nonZeros() );
4337 assign( left, tmp );
4341 left.reserve( right.nonZeros() );
4342 assign( left, right );
4367 template<
typename MT >
4368 template<
typename VT >
4369 inline SparseRow<MT,false,true>&
4370 SparseRow<MT,false,true>::operator+=(
const DenseVector<VT,true>& rhs )
4372 using blaze::assign;
4381 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
4391 const AddType tmp( *
this + (~rhs) );
4393 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
4397 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4400 assign( left, tmp );
4424 template<
typename MT >
4425 template<
typename VT >
4426 inline SparseRow<MT,false,true>&
4427 SparseRow<MT,false,true>::operator+=(
const SparseVector<VT,true>& rhs )
4429 using blaze::assign;
4438 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
4448 const AddType tmp( *
this + (~rhs) );
4450 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
4454 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4457 left.reserve( tmp.nonZeros() );
4458 assign( left, tmp );
4483 template<
typename MT >
4484 template<
typename VT >
4485 inline SparseRow<MT,false,true>&
4486 SparseRow<MT,false,true>::operator-=(
const DenseVector<VT,true>& rhs )
4488 using blaze::assign;
4497 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
4507 const SubType tmp( *
this - (~rhs) );
4509 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
4513 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4516 assign( left, tmp );
4541 template<
typename MT >
4542 template<
typename VT >
4543 inline SparseRow<MT,false,true>&
4544 SparseRow<MT,false,true>::operator-=(
const SparseVector<VT,true>& rhs )
4546 using blaze::assign;
4555 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
4565 const SubType tmp( *
this - (~rhs) );
4567 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
4571 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4574 left.reserve( tmp.nonZeros() );
4575 assign( left, tmp );
4598 template<
typename MT >
4599 template<
typename VT >
4600 inline SparseRow<MT,false,true>&
4601 SparseRow<MT,false,true>::operator*=(
const Vector<VT,true>& rhs )
4603 using blaze::assign;
4611 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
4620 const MultType tmp( *
this * (~rhs) );
4622 if( !tryAssign( matrix_, tmp, row_, 0UL ) ) {
4626 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4629 assign( left, tmp );
4654 template<
typename MT >
4655 template<
typename Other >
4656 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false,true> >::Type&
4657 SparseRow<MT,false,true>::operator*=( Other rhs )
4662 element->value() *= rhs;
4687 template<
typename MT >
4688 template<
typename Other >
4689 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false,true> >::Type&
4690 SparseRow<MT,false,true>::operator/=( Other rhs )
4696 typedef typename DivTrait<ElementType,Other>::Type DT;
4697 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
4701 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
4702 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
4704 element->value() *= tmp;
4708 element->value() /= rhs;
4731 template<
typename MT >
4734 return matrix_.columns();
4746 template<
typename MT >
4749 return matrix_.capacity( row_ );
4764 template<
typename MT >
4767 return matrix_.nonZeros( row_ );
4779 template<
typename MT >
4782 matrix_.reset( row_ );
4800 template<
typename MT >
4804 return matrix_.set( index, row_, value );
4823 template<
typename MT >
4827 return matrix_.insert( index, row_, value );
4842 template<
typename MT >
4845 matrix_.erase( index, row_ );
4860 template<
typename MT >
4864 return matrix_.erase( row_, pos );
4880 template<
typename MT >
4884 return matrix_.erase( row_, first, last );
4900 template<
typename MT >
4903 matrix_.reserve( row_, n );
4920 template<
typename MT >
4921 template<
typename Other >
4922 inline SparseRow<MT,false,true>& SparseRow<MT,false,true>::scale(
const Other& scalar )
4927 element->value() *= scalar;
4943 template<
typename MT >
4949 size_t nonzeros( 2UL*
capacity()+1UL );
4950 nonzeros =
max( nonzeros, 7UL );
4951 nonzeros =
min( nonzeros,
size() );
4983 template<
typename MT >
4987 return matrix_.find( index, row_ );
5007 template<
typename MT >
5011 return matrix_.find( index, row_ );
5030 template<
typename MT >
5034 return matrix_.lowerBound( index, row_ );
5053 template<
typename MT >
5057 return matrix_.lowerBound( index, row_ );
5076 template<
typename MT >
5080 return matrix_.upperBound( index, row_ );
5099 template<
typename MT >
5103 return matrix_.upperBound( index, row_ );
5142 template<
typename MT >
5145 matrix_.append( index, row_, value, check );
5170 template<
typename MT >
5171 template<
typename Other >
5174 return matrix_.isAliased( alias );
5191 template<
typename MT >
5192 template<
typename Other >
5195 return matrix_.isAliased( alias );
5213 template<
typename MT >
5214 template<
typename VT >
5220 for(
size_t i=0UL; i<
size(); ++i )
5222 if( matrix_.nonZeros( row_ ) == matrix_.capacity( row_ ) )
5223 matrix_.reserve( row_, extendCapacity() );
5225 matrix_.append( i, row_, (~rhs)[i],
true );
5244 template<
typename MT >
5245 template<
typename VT >
5252 matrix_.append( element->index(), row_, element->value(), true );
5271 template<
typename MT >
5272 template<
typename VT >
5275 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
5283 const AddType tmp(
serial( *
this + (~rhs) ) );
5284 matrix_.reset( row_ );
5303 template<
typename MT >
5304 template<
typename VT >
5307 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
5315 const AddType tmp(
serial( *
this + (~rhs) ) );
5316 matrix_.reset( row_ );
5317 matrix_.reserve( row_, tmp.nonZeros() );
5336 template<
typename MT >
5337 template<
typename VT >
5340 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
5348 const SubType tmp(
serial( *
this - (~rhs) ) );
5349 matrix_.reset( row_ );
5368 template<
typename MT >
5369 template<
typename VT >
5372 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
5380 const SubType tmp(
serial( *
this - (~rhs) ) );
5381 matrix_.reset( row_ );
5382 matrix_.reserve( row_, tmp.nonZeros() );
5404 template<
typename MT,
bool SO,
bool SF >
5405 inline void reset( SparseRow<MT,SO,SF>& row );
5407 template<
typename MT,
bool SO,
bool SF >
5408 inline void clear( SparseRow<MT,SO,SF>& row );
5410 template<
typename MT,
bool SO,
bool SF >
5411 inline bool isDefault(
const SparseRow<MT,SO,SF>& row );
5413 template<
typename MT,
bool SO,
bool SF >
5414 inline bool isIntact(
const SparseRow<MT,SO,SF>& row );
5416 template<
typename MT,
bool SO,
bool SF >
5417 inline bool isSame(
const SparseRow<MT,SO,SF>& a,
const SparseRow<MT,SO,SF>& b );
5429 template<
typename MT
5448 template<
typename MT
5476 template<
typename MT
5483 const ConstIterator
end( row.end() );
5484 for( ConstIterator element=row.begin(); element!=
end; ++element )
5485 if( !
isDefault( element->value() ) )
return false;
5508 template<
typename MT
5513 return ( row.row_ <= row.matrix_.rows() &&
5531 template<
typename MT
5536 return (
isSame( a.matrix_, b.matrix_ ) && ( a.row_ == b.row_ ) );
5556 template<
typename MT
5560 inline bool tryAssign(
const SparseRow<MT,SO,SF>& lhs,
const Vector<VT,true>& rhs,
size_t index )
5565 return tryAssign( lhs.matrix_, ~rhs, lhs.row_, index );
5586 template<
typename MT
5590 inline bool tryAddAssign(
const SparseRow<MT,SO,SF>& lhs,
const Vector<VT,true>& rhs,
size_t index )
5595 return tryAddAssign( lhs.matrix_, ~rhs, lhs.row_, index );
5616 template<
typename MT
5620 inline bool trySubAssign(
const SparseRow<MT,SO,SF>& lhs,
const Vector<VT,true>& rhs,
size_t index )
5625 return trySubAssign( lhs.matrix_, ~rhs, lhs.row_, index );
5646 template<
typename MT
5650 inline bool tryMultAssign(
const SparseRow<MT,SO,SF>& lhs,
const Vector<VT,true>& rhs,
size_t index )
5655 return tryMultAssign( lhs.matrix_, ~rhs, lhs.row_, index );
5676 template<
typename MT
5679 inline typename DerestrictTrait< SparseRow<MT,SO,SF> >::Type
5680 derestrict( SparseRow<MT,SO,SF>& row )
5682 typedef typename DerestrictTrait< SparseRow<MT,SO,SF> >::Type
ReturnType;
5683 return ReturnType( derestrict( row.matrix_ ), row.row_ );
5699 template<
typename MT,
bool SO,
bool SF >
5700 struct IsRestricted< SparseRow<MT,SO,SF> > :
public IsTrue< IsRestricted<MT>::value >
5716 template<
typename MT,
bool SO,
bool SF >
5717 struct DerestrictTrait< SparseRow<MT,SO,SF> >
5719 typedef SparseRow< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type > Type;
5735 template<
typename MT,
bool SO,
bool SF,
typename T >
5736 struct AddTrait< SparseRow<MT,SO,SF>, T >
5738 typedef typename AddTrait< typename RowTrait<MT>::Type, T >::Type Type;
5741 template<
typename T,
typename MT,
bool SO,
bool SF >
5742 struct AddTrait< T, SparseRow<MT,SO,SF> >
5744 typedef typename AddTrait< T, typename RowTrait<MT>::Type >::Type Type;
5760 template<
typename MT,
bool SO,
bool SF,
typename T >
5761 struct SubTrait< SparseRow<MT,SO,SF>, T >
5763 typedef typename SubTrait< typename RowTrait<MT>::Type, T >::Type Type;
5766 template<
typename T,
typename MT,
bool SO,
bool SF >
5767 struct SubTrait< T, SparseRow<MT,SO,SF> >
5769 typedef typename SubTrait< T, typename RowTrait<MT>::Type >::Type Type;
5785 template<
typename MT,
bool SO,
bool SF,
typename T >
5786 struct MultTrait< SparseRow<MT,SO,SF>, T >
5788 typedef typename MultTrait< typename RowTrait<MT>::Type, T >::Type Type;
5791 template<
typename T,
typename MT,
bool SO,
bool SF >
5792 struct MultTrait< T, SparseRow<MT,SO,SF> >
5794 typedef typename MultTrait< T, typename RowTrait<MT>::Type >::Type Type;
5810 template<
typename MT,
bool SO,
bool SF,
typename T >
5811 struct CrossTrait< SparseRow<MT,SO,SF>, T >
5813 typedef typename CrossTrait< typename RowTrait<MT>::Type, T >::Type Type;
5816 template<
typename T,
typename MT,
bool SO,
bool SF >
5817 struct CrossTrait< T, SparseRow<MT,SO,SF> >
5819 typedef typename CrossTrait< T, typename RowTrait<MT>::Type >::Type Type;
5835 template<
typename MT,
bool SO,
bool SF,
typename T >
5836 struct DivTrait< SparseRow<MT,SO,SF>, T >
5838 typedef typename DivTrait< typename RowTrait<MT>::Type, T >::Type Type;
5841 template<
typename T,
typename MT,
bool SO,
bool SF >
5842 struct DivTrait< T, SparseRow<MT,SO,SF> >
5844 typedef typename DivTrait< T, typename RowTrait<MT>::Type >::Type Type;
5860 template<
typename MT,
bool SO,
bool SF >
5861 struct SubvectorTrait< SparseRow<MT,SO,SF> >
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Constraint on the data type.
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
Header file for mathematical functions.
#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.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7820
Header file for the subtraction trait.
SparseRow< MT, SO, SF > This
Type of this SparseRow instance.
Definition: SparseRow.h:381
Header file for basic type definitions.
Header file for the SparseVector base class.
SparseRow & operator=(const SparseRow &rhs)
Copy assignment operator for SparseRow.
Definition: SparseRow.h:814
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
Header file for the row trait.
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:250
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse row.
Definition: SparseRow.h:1745
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
Header file for the row base class.
Header file for the IsDiagonal type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
size_t size() const
Returns the current size/dimension of the sparse row.
Definition: SparseRow.h:1341
BLAZE_ALWAYS_INLINE bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b)
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:647
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:107
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the And class template.
bool canAlias(const Other *alias) const
Returns whether the sparse row can alias with the given address alias.
Definition: SparseRow.h:1774
#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:118
size_t nonZeros() const
Returns the number of non-zero elements in the row.
Definition: SparseRow.h:1374
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
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:378
#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:78
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:118
Header file for the IsUniLower type trait.
size_t extendCapacity() const
Calculating a new sparse row capacity.
Definition: SparseRow.h:1552
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
void subAssign(const DenseVector< VT, true > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: SparseRow.h:1940
Constraint on the data type.
Base template for the RowTrait class.
Definition: RowTrait.h:115
If< IsConst< MT >, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: SparseRow.h:398
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: SparseRow.h:732
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Reference at(size_t index)
Checked access to the row elements.
Definition: SparseRow.h:655
Header file for the IsFloatingPoint type trait.
void erase(size_t index)
Erasing an element from the sparse row.
Definition: SparseRow.h:1452
#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:79
const SparseRow & CompositeType
Data type for composite expression templates.
Definition: SparseRow.h:386
Operand matrix_
The sparse matrix containing the row.
Definition: SparseRow.h:519
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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:116
Header file for the Or class template.
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseRow.h:385
void reset()
Reset to the default initial values.
Definition: SparseRow.h:1389
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
void reserve(size_t n)
Setting the minimum capacity of the sparse row.
Definition: SparseRow.h:1509
size_t capacity() const
Returns the maximum capacity of the sparse row.
Definition: SparseRow.h:1356
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
Header file for the subvector trait.
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseRow.h:382
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseRow.h:395
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
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:79
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:642
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: SparseRow.h:389
Header file for the SparseElement base class.
Constraint on the data type.
MT::ElementType ElementType
Type of the row elements.
Definition: SparseRow.h:384
void addAssign(const DenseVector< VT, true > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseRow.h:1875
Constraint on the data type.
Reference operator[](size_t index)
Subscript operator for the direct access to the row elements.
Definition: SparseRow.h:613
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:187
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:94
SparseRow(MT &matrix, size_t index)
The constructor for SparseRow.
Definition: SparseRow.h:582
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse row.
Definition: SparseRow.h:1434
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: SparseRow.h:376
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Iterator set(size_t index, const ElementType &value)
Setting an element of the sparse row.
Definition: SparseRow.h:1411
Header file for the serial shim.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:107
#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:116
#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:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for the IsConst type trait.
Iterator end()
Returns an iterator just past the last element of the row.
Definition: SparseRow.h:749
Base class for all rows.The Row class serves as a tag for all rows (i.e. dense and sparse rows)...
Definition: Row.h:63
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:138
Base template for the MultTrait class.
Definition: MultTrait.h:138
Header file for the addition trait.
Header file for the cross product trait.
Reference to a specific row of a sparse matrix.The SparseRow template represents a reference to a spe...
Definition: Forward.h:52
Header file for the division trait.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
Base class for all sparse element types.The SparseElement class is the base class for all sparse elem...
Definition: SparseElement.h:57
#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:118
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Header file for the IsReference type trait.
Header file for the RemoveReference type trait.
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
Base template for the DivTrait class.
Definition: DivTrait.h:138
Iterator find(size_t index)
Searches for a specific row element.
Definition: SparseRow.h:1592
bool isAliased(const Other *alias) const
Returns whether the sparse row is aliased with the given address alias.
Definition: SparseRow.h:1795
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseRow.h:1637
#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:79
Header file for the IsRowMajorMatrix type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:258
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:118
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Compile time type check.This class tests whether the given template parameter T is a reference type (...
Definition: IsReference.h:94
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
#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:79
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseRow.h:383
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
Base template for the SubTrait class.
Definition: SubTrait.h:138
Header file for the IsUpper type trait.
Header file for exception macros.
ConstIterator cend() const
Returns an iterator just past the last element of the row.
Definition: SparseRow.h:783
Header file for the IsRestricted type trait.
If< IsConst< MT >, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: SparseRow.h:392
Iterator begin()
Returns an iterator to the first element of the row.
Definition: SparseRow.h:698
#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
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseRow.h:1681
#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:79
const size_t row_
The index of the row in the matrix.
Definition: SparseRow.h:520
Constraint on the transpose flag of vector types.
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
Header file for a safe C++ NULL pointer implementation.
void assign(const DenseVector< VT, true > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseRow.h:1817