35 #ifndef _BLAZE_MATH_VIEWS_SPARSECOLUMN_H_
36 #define _BLAZE_MATH_VIEWS_SPARSECOLUMN_H_
369 template<
typename MT
370 ,
bool SO = IsColumnMajorMatrix<MT>::value
371 ,
bool SF = IsSymmetric<MT>::value >
372 class SparseColumn :
public SparseVector< SparseColumn<MT,SO,SF>, false >
405 enum { smpAssignable = 0 };
411 explicit inline SparseColumn( MT& matrix,
size_t index );
424 inline ConstReference
operator[](
size_t index )
const;
425 inline Reference
at(
size_t index );
426 inline ConstReference
at(
size_t index )
const;
427 inline Iterator
begin ();
428 inline ConstIterator
begin ()
const;
429 inline ConstIterator
cbegin()
const;
430 inline Iterator
end ();
431 inline ConstIterator
end ()
const;
432 inline ConstIterator
cend ()
const;
449 template<
typename Other >
451 operator*=( Other rhs );
453 template<
typename Other >
455 operator/=( Other rhs );
462 inline size_t size()
const;
466 inline Iterator
set (
size_t index,
const ElementType& value );
467 inline Iterator
insert (
size_t index,
const ElementType& value );
468 inline void erase (
size_t index );
469 inline Iterator
erase ( Iterator pos );
470 inline Iterator
erase ( Iterator first, Iterator last );
471 inline void reserve(
size_t n );
472 template<
typename Other >
inline SparseColumn& scale (
const Other& scalar );
479 inline Iterator
find (
size_t index );
480 inline ConstIterator
find (
size_t index )
const;
482 inline ConstIterator
lowerBound(
size_t index )
const;
484 inline ConstIterator
upperBound(
size_t index )
const;
491 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
498 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
499 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
528 template<
typename MT2,
bool SO2,
bool SF2 >
531 template<
typename MT2,
bool SO2,
bool SF2 >
534 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
537 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
540 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
543 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
546 template<
typename MT2,
bool SO2,
bool SF2 >
581 template<
typename MT
588 if(
matrix_.columns() <= index ) {
612 template<
typename MT
619 return matrix_(index,col_);
633 template<
typename MT
640 return const_cast<const MT&
>( matrix_ )(index,col_);
655 template<
typename MT
661 if( index >=
size() ) {
664 return (*
this)[index];
679 template<
typename MT
685 if( index >=
size() ) {
688 return (*
this)[index];
700 template<
typename MT
705 return matrix_.begin( col_ );
717 template<
typename MT
722 return matrix_.cbegin( col_ );
734 template<
typename MT
739 return matrix_.cbegin( col_ );
751 template<
typename MT
756 return matrix_.end( col_ );
768 template<
typename MT
773 return matrix_.cend( col_ );
785 template<
typename MT
790 return matrix_.cend( col_ );
816 template<
typename MT
827 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
830 if(
size() != rhs.size() ) {
834 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
840 if( rhs.canAlias( &matrix_ ) ) {
843 left.reserve( tmp.nonZeros() );
848 left.reserve( rhs.nonZeros() );
872 template<
typename MT
875 template<
typename VT >
891 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
904 assign( left, right );
927 template<
typename MT
930 template<
typename VT >
946 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
955 left.reserve( tmp.nonZeros() );
960 left.reserve( right.nonZeros() );
961 assign( left, right );
984 template<
typename MT
987 template<
typename VT >
1009 const AddType tmp( *
this + (~rhs) );
1011 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1018 assign( left, tmp );
1040 template<
typename MT
1043 template<
typename VT >
1046 using blaze::assign;
1065 const AddType tmp( *
this + (~rhs) );
1067 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1074 left.reserve( tmp.nonZeros() );
1075 assign( left, tmp );
1098 template<
typename MT
1101 template<
typename VT >
1104 using blaze::assign;
1123 const SubType tmp( *
this - (~rhs) );
1125 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1132 assign( left, tmp );
1155 template<
typename MT
1158 template<
typename VT >
1161 using blaze::assign;
1180 const SubType tmp( *
this - (~rhs) );
1182 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1189 left.reserve( tmp.nonZeros() );
1190 assign( left, tmp );
1211 template<
typename MT
1214 template<
typename VT >
1217 using blaze::assign;
1234 const MultType tmp( *
this * (~rhs) );
1236 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
1243 assign( left, tmp );
1266 template<
typename MT
1269 template<
typename Other >
1276 element->value() *= rhs;
1299 template<
typename MT
1302 template<
typename Other >
1316 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1318 element->value() *= tmp;
1322 element->value() /= rhs;
1343 template<
typename MT
1348 return matrix_.rows();
1358 template<
typename MT
1363 return matrix_.capacity( col_ );
1376 template<
typename MT
1381 return matrix_.nonZeros( col_ );
1391 template<
typename MT
1396 matrix_.reset( col_ );
1412 template<
typename MT
1418 return matrix_.set( index, col_, value );
1435 template<
typename MT
1441 return matrix_.insert( index, col_, value );
1454 template<
typename MT
1459 matrix_.erase( index, col_ );
1472 template<
typename MT
1477 return matrix_.erase( col_, pos );
1491 template<
typename MT
1497 return matrix_.erase( col_, first, last );
1511 template<
typename MT
1516 matrix_.reserve( col_, n );
1531 template<
typename MT
1534 template<
typename Other >
1540 element->value() *= scalar;
1554 template<
typename MT
1562 size_t nonzeros( 2UL*
capacity()+1UL );
1563 nonzeros =
max( nonzeros, 7UL );
1564 nonzeros =
min( nonzeros,
size() );
1594 template<
typename MT
1599 return matrix_.find( index, col_ );
1617 template<
typename MT
1623 return matrix_.find( index, col_ );
1640 template<
typename MT
1645 return matrix_.lowerBound( index, col_ );
1662 template<
typename MT
1668 return matrix_.lowerBound( index, col_ );
1685 template<
typename MT
1690 return matrix_.upperBound( index, col_ );
1707 template<
typename MT
1713 return matrix_.upperBound( index, col_ );
1750 template<
typename MT
1755 matrix_.append( index, col_, value, check );
1778 template<
typename MT
1781 template<
typename Other >
1784 return matrix_.isAliased( alias );
1799 template<
typename MT
1802 template<
typename Other >
1805 return matrix_.isAliased( alias );
1821 template<
typename MT
1824 template<
typename VT >
1830 for(
size_t i=0UL; i<
size(); ++i )
1832 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
1833 matrix_.reserve( col_, extendCapacity() );
1835 matrix_.append( i, col_, (~rhs)[i],
true );
1852 template<
typename MT
1855 template<
typename VT >
1862 matrix_.append( element->index(), col_, element->value(), true );
1879 template<
typename MT
1882 template<
typename VT >
1893 const AddType tmp(
serial( *
this + (~rhs) ) );
1894 matrix_.reset( col_ );
1911 template<
typename MT
1914 template<
typename VT >
1925 const AddType tmp(
serial( *
this + (~rhs) ) );
1926 matrix_.reset( col_ );
1927 matrix_.reserve( col_, tmp.nonZeros() );
1944 template<
typename MT
1947 template<
typename VT >
1958 const SubType tmp(
serial( *
this - (~rhs) ) );
1959 matrix_.reset( col_ );
1976 template<
typename MT
1979 template<
typename VT >
1990 const SubType tmp(
serial( *
this - (~rhs) ) );
1991 matrix_.reset( col_ );
1992 matrix_.reserve( col_, tmp.nonZeros() );
2018 template<
typename MT >
2047 template<
typename MatrixType
2048 ,
typename IteratorType >
2064 typedef typename std::iterator_traits<IteratorType>::value_type SET;
2072 typedef typename SET::ValueType ValueType;
2073 typedef size_t IndexType;
2074 typedef typename IfTrue<returnConst,CRT,RT>::Type
Reference;
2084 inline ColumnElement( IteratorType pos,
size_t row )
2096 template<
typename T >
inline ColumnElement&
operator=(
const T& v ) {
2108 template<
typename T >
inline ColumnElement& operator+=(
const T& v ) {
2120 template<
typename T >
inline ColumnElement& operator-=(
const T& v ) {
2132 template<
typename T >
inline ColumnElement& operator*=(
const T& v ) {
2144 template<
typename T >
inline ColumnElement& operator/=(
const T& v ) {
2155 inline const ColumnElement* operator->()
const {
2165 inline Reference value()
const {
2166 return pos_->value();
2175 inline IndexType index()
const {
2191 template<
typename MatrixType
2192 ,
typename IteratorType >
2193 class ColumnIterator
2197 typedef std::forward_iterator_tag IteratorCategory;
2198 typedef ColumnElement<MatrixType,IteratorType> ValueType;
2199 typedef ValueType PointerType;
2200 typedef ValueType ReferenceType;
2201 typedef ptrdiff_t DifferenceType;
2204 typedef IteratorCategory iterator_category;
2205 typedef ValueType value_type;
2206 typedef PointerType pointer;
2207 typedef ReferenceType reference;
2208 typedef DifferenceType difference_type;
2214 inline ColumnIterator()
2229 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
2235 for( ; row_<
matrix_->rows(); ++row_ ) {
2236 pos_ =
matrix_->find( row_, column_ );
2237 if( pos_ !=
matrix_->end( row_ ) )
break;
2250 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
2265 template<
typename MatrixType2,
typename IteratorType2 >
2266 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
2269 , column_( it.column_ )
2279 inline ColumnIterator& operator++() {
2281 for( ; row_<
matrix_->rows(); ++row_ ) {
2282 pos_ =
matrix_->find( row_, column_ );
2283 if( pos_ !=
matrix_->end( row_ ) )
break;
2295 inline const ColumnIterator operator++(
int ) {
2296 const ColumnIterator tmp( *
this );
2307 inline ReferenceType
operator*()
const {
2308 return ReferenceType( pos_, row_ );
2317 inline PointerType operator->()
const {
2318 return PointerType( pos_, row_ );
2328 template<
typename MatrixType2,
typename IteratorType2 >
2329 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2330 return (
matrix_ == rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
2340 template<
typename MatrixType2,
typename IteratorType2 >
2341 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
2342 return !( *
this == rhs );
2352 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
2353 size_t counter( 0UL );
2354 for(
size_t i=rhs.row_; i<row_; ++i ) {
2371 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
2372 template<
typename MT2,
bool SO2,
bool SF2 >
friend class SparseColumn;
2379 typedef ColumnIterator<const MT,typename MT::ConstIterator>
ConstIterator;
2382 typedef typename If< IsConst<MT>,
ConstIterator, ColumnIterator<MT,typename MT::Iterator> >::Type
Iterator;
2387 enum { smpAssignable = 0 };
2393 explicit inline SparseColumn( MT& matrix,
size_t index );
2406 inline ConstReference
operator[](
size_t index )
const;
2407 inline Reference
at(
size_t index );
2408 inline ConstReference
at(
size_t index )
const;
2409 inline Iterator
begin ();
2410 inline ConstIterator
begin ()
const;
2411 inline ConstIterator
cbegin()
const;
2412 inline Iterator
end ();
2413 inline ConstIterator
end ()
const;
2414 inline ConstIterator
cend ()
const;
2423 template<
typename VT >
inline SparseColumn& operator+=(
const Vector<VT,false>& rhs );
2424 template<
typename VT >
inline SparseColumn& operator-=(
const Vector<VT,false>& rhs );
2425 template<
typename VT >
inline SparseColumn& operator*=(
const Vector<VT,false>& rhs );
2427 template<
typename Other >
2428 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
2429 operator*=( Other rhs );
2431 template<
typename Other >
2432 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
2433 operator/=( Other rhs );
2440 inline size_t size()
const;
2443 inline void reset();
2444 inline Iterator
set (
size_t index,
const ElementType& value );
2445 inline Iterator
insert (
size_t index,
const ElementType& value );
2446 inline void erase (
size_t index );
2447 inline Iterator
erase ( Iterator pos );
2448 inline Iterator
erase ( Iterator first, Iterator last );
2449 inline void reserve(
size_t n );
2450 template<
typename Other >
inline SparseColumn& scale (
const Other& scalar );
2457 inline Iterator
find (
size_t index );
2458 inline ConstIterator
find (
size_t index )
const;
2460 inline ConstIterator
lowerBound(
size_t index )
const;
2462 inline ConstIterator
upperBound(
size_t index )
const;
2469 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
2476 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2477 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2479 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2480 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2481 template<
typename VT >
inline void addAssign(
const Vector<VT,false>& rhs );
2482 template<
typename VT >
inline void subAssign(
const Vector<VT,false>& rhs );
2496 template<
typename MT2,
bool SO2,
bool SF2 >
2497 friend bool isIntact(
const SparseColumn<MT2,SO2,SF2>& column );
2499 template<
typename MT2,
bool SO2,
bool SF2 >
2500 friend bool isSame(
const SparseColumn<MT2,SO2,SF2>& a,
const SparseColumn<MT2,SO2,SF2>& b );
2502 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2503 friend bool tryAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2505 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2506 friend bool tryAddAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2508 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2509 friend bool trySubAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2511 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
2512 friend bool tryMultAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
2514 template<
typename MT2,
bool SO2,
bool SF2 >
2515 friend typename DerestrictTrait< SparseColumn<MT2,SO2,SF2> >::Type
2516 derestrict( SparseColumn<MT2,SO2,SF2>& dm );
2549 template<
typename MT >
2554 if(
matrix_.columns() <= index ) {
2580 template<
typename MT >
2585 return matrix_(index,col_);
2601 template<
typename MT >
2606 return const_cast<const MT&
>( matrix_ )(index,col_);
2623 template<
typename MT >
2627 if( index >=
size() ) {
2630 return (*
this)[index];
2647 template<
typename MT >
2651 if( index >=
size() ) {
2654 return (*
this)[index];
2668 template<
typename MT >
2671 return Iterator( matrix_, 0UL, col_ );
2685 template<
typename MT >
2703 template<
typename MT >
2721 template<
typename MT >
2738 template<
typename MT >
2756 template<
typename MT >
2788 template<
typename MT >
2789 inline SparseColumn<MT,false,false>&
2792 using blaze::assign;
2798 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
2801 if(
size() != rhs.size() ) {
2805 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
2809 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2811 if( rhs.canAlias( &matrix_ ) ) {
2812 const ResultType tmp( rhs );
2813 assign( left, tmp );
2816 assign( left, rhs );
2841 template<
typename MT >
2842 template<
typename VT >
2843 inline SparseColumn<MT,false,false>&
2846 using blaze::assign;
2854 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2858 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2860 assign( left, tmp );
2884 template<
typename MT >
2885 template<
typename VT >
2886 inline SparseColumn<MT,false,false>&
2887 SparseColumn<MT,false,false>::operator+=(
const Vector<VT,false>& rhs )
2889 using blaze::assign;
2897 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
2906 const AddType tmp( *
this + (~rhs) );
2908 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2912 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2914 assign( left, tmp );
2938 template<
typename MT >
2939 template<
typename VT >
2940 inline SparseColumn<MT,false,false>&
2941 SparseColumn<MT,false,false>::operator-=(
const Vector<VT,false>& rhs )
2943 using blaze::assign;
2951 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
2960 const SubType tmp( *
this - (~rhs) );
2962 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
2966 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
2968 assign( left, tmp );
2991 template<
typename MT >
2992 template<
typename VT >
2993 inline SparseColumn<MT,false,false>&
2994 SparseColumn<MT,false,false>::operator*=(
const Vector<VT,false>& rhs )
2996 using blaze::assign;
3004 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
3013 const MultType tmp( *
this * (~rhs) );
3015 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
3019 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
3021 assign( left, tmp );
3046 template<
typename MT >
3047 template<
typename Other >
3048 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false,false> >::Type&
3049 SparseColumn<MT,false,false>::operator*=( Other rhs )
3054 element->value() *= rhs;
3079 template<
typename MT >
3080 template<
typename Other >
3081 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false,false> >::Type&
3082 SparseColumn<MT,false,false>::operator/=( Other rhs )
3088 typedef typename DivTrait<ElementType,Other>::Type DT;
3089 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
3093 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3094 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3096 element->value() *= tmp;
3100 element->value() /= rhs;
3123 template<
typename MT >
3126 return matrix_.rows();
3138 template<
typename MT >
3141 return matrix_.rows();
3156 template<
typename MT >
3159 size_t counter( 0UL );
3175 template<
typename MT >
3178 const size_t ibegin( ( IsLower<MT>::value )
3179 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3183 const size_t iend ( ( IsUpper<MT>::value )
3184 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3189 for(
size_t i=ibegin; i<iend; ++i ) {
3190 matrix_.erase( i, col_ );
3209 template<
typename MT >
3213 return Iterator( matrix_, index, col_, matrix_.set( index, col_, value ) );
3232 template<
typename MT >
3236 return Iterator( matrix_, index, col_, matrix_.insert( index, col_, value ) );
3251 template<
typename MT >
3254 matrix_.erase( index, col_ );
3269 template<
typename MT >
3273 const size_t row( pos.row_ );
3278 matrix_.erase( row, pos.pos_ );
3279 return Iterator( matrix_, row+1UL, col_ );
3295 template<
typename MT >
3299 for( ; first!=last; ++first ) {
3300 matrix_.erase( first.row_, first.pos_ );
3318 template<
typename MT >
3340 template<
typename MT >
3341 template<
typename Other >
3342 inline SparseColumn<MT,false,false>& SparseColumn<MT,false,false>::scale(
const Other& scalar )
3347 element->value() *= scalar;
3376 template<
typename MT >
3380 const typename MT::Iterator pos( matrix_.find( index, col_ ) );
3382 if( pos != matrix_.end( index ) )
3383 return Iterator( matrix_, index, col_, pos );
3405 template<
typename MT >
3411 if( pos != matrix_.end( index ) )
3433 template<
typename MT >
3437 for(
size_t i=index; i<
size(); ++i )
3439 const typename MT::Iterator pos( matrix_.find( i, col_ ) );
3441 if( pos != matrix_.end( i ) )
3442 return Iterator( matrix_, i, col_, pos );
3464 template<
typename MT >
3468 for(
size_t i=index; i<
size(); ++i )
3472 if( pos != matrix_.end( i ) )
3495 template<
typename MT >
3499 for(
size_t i=index+1UL; i<
size(); ++i )
3501 const typename MT::Iterator pos( matrix_.find( i, col_ ) );
3503 if( pos != matrix_.end( i ) )
3504 return Iterator( matrix_, i, col_, pos );
3526 template<
typename MT >
3530 for(
size_t i=index+1UL; i<
size(); ++i )
3534 if( pos != matrix_.end( i ) )
3577 template<
typename MT >
3581 matrix_.insert( index, col_, value );
3606 template<
typename MT >
3607 template<
typename Other >
3610 return matrix_.isAliased( alias );
3623 template<
typename MT >
3624 template<
typename Other >
3627 return matrix_.isAliased( alias );
3645 template<
typename MT >
3646 template<
typename VT >
3651 for(
size_t i=0UL; i<(~rhs).
size(); ++i ) {
3652 matrix_(i,col_) = (~rhs)[i];
3671 template<
typename MT >
3672 template<
typename VT >
3680 for( ; i<element->index(); ++i )
3681 matrix_.erase( i, col_ );
3682 matrix_(i++,col_) = element->value();
3684 for( ; i<
size(); ++i ) {
3685 matrix_.erase( i, col_ );
3704 template<
typename MT >
3705 template<
typename VT >
3708 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3715 const AddType tmp(
serial( *
this + (~rhs) ) );
3734 template<
typename MT >
3735 template<
typename VT >
3738 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3745 const SubType tmp(
serial( *
this - (~rhs) ) );
3772 template<
typename MT >
3773 class SparseColumn<MT,false,true> :
public SparseVector< SparseColumn<MT,false,true>, false >
3779 typedef typename If< IsExpression<MT>, MT, MT& >::Type
Operand;
3784 typedef SparseColumn<MT,false,true>
This;
3785 typedef typename ColumnTrait<MT>::Type
ResultType;
3806 enum { smpAssignable = 0 };
3812 explicit inline SparseColumn( MT& matrix,
size_t index );
3825 inline ConstReference
operator[](
size_t index )
const;
3826 inline Reference
at(
size_t index );
3827 inline ConstReference
at(
size_t index )
const;
3828 inline Iterator
begin ();
3829 inline ConstIterator
begin ()
const;
3830 inline ConstIterator
cbegin()
const;
3831 inline Iterator
end ();
3832 inline ConstIterator
end ()
const;
3833 inline ConstIterator
cend ()
const;
3844 template<
typename VT >
inline SparseColumn& operator+=(
const DenseVector<VT,false>& rhs );
3845 template<
typename VT >
inline SparseColumn& operator+=(
const SparseVector<VT,false>& rhs );
3846 template<
typename VT >
inline SparseColumn& operator-=(
const DenseVector<VT,false>& rhs );
3847 template<
typename VT >
inline SparseColumn& operator-=(
const SparseVector<VT,false>& rhs );
3848 template<
typename VT >
inline SparseColumn& operator*=(
const Vector<VT,false>& rhs );
3850 template<
typename Other >
3851 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
3852 operator*=( Other rhs );
3854 template<
typename Other >
3855 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
3856 operator/=( Other rhs );
3863 inline size_t size()
const;
3866 inline void reset();
3867 inline Iterator
set (
size_t index,
const ElementType& value );
3868 inline Iterator
insert (
size_t index,
const ElementType& value );
3869 inline void erase (
size_t index );
3870 inline Iterator
erase ( Iterator pos );
3871 inline Iterator
erase ( Iterator first, Iterator last );
3872 inline void reserve(
size_t n );
3873 template<
typename Other >
inline SparseColumn& scale (
const Other& scalar );
3880 inline Iterator
find (
size_t index );
3881 inline ConstIterator
find (
size_t index )
const;
3883 inline ConstIterator
lowerBound(
size_t index )
const;
3885 inline ConstIterator
upperBound(
size_t index )
const;
3892 inline void append(
size_t index,
const ElementType& value,
bool check=
false );
3899 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
3900 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
3902 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
3903 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
3904 template<
typename VT >
inline void addAssign(
const DenseVector <VT,false>& rhs );
3905 template<
typename VT >
inline void addAssign(
const SparseVector<VT,false>& rhs );
3906 template<
typename VT >
inline void subAssign(
const DenseVector <VT,false>& rhs );
3907 template<
typename VT >
inline void subAssign(
const SparseVector<VT,false>& rhs );
3928 template<
typename MT2,
bool SO2,
bool SF2 >
3929 friend bool isIntact(
const SparseColumn<MT2,SO2,SF2>& column );
3931 template<
typename MT2,
bool SO2,
bool SF2 >
3932 friend bool isSame(
const SparseColumn<MT2,SO2,SF2>& a,
const SparseColumn<MT2,SO2,SF2>& b );
3934 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3935 friend bool tryAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
3937 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3938 friend bool tryAddAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
3940 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3941 friend bool trySubAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
3943 template<
typename MT2,
bool SO2,
bool SF2,
typename VT >
3944 friend bool tryMultAssign(
const SparseColumn<MT2,SO2,SF2>& lhs,
const Vector<VT,false>& rhs,
size_t index );
3946 template<
typename MT2,
bool SO2,
bool SF2 >
3947 friend typename DerestrictTrait< SparseColumn<MT2,SO2,SF2> >::Type
3948 derestrict( SparseColumn<MT2,SO2,SF2>& dm );
3981 template<
typename MT >
3986 if(
matrix_.columns() <= index ) {
4012 template<
typename MT >
4017 return matrix_(col_,index);
4033 template<
typename MT >
4038 return const_cast<const MT&
>( matrix_ )(col_,index);
4055 template<
typename MT >
4059 if( index >=
size() ) {
4062 return (*
this)[index];
4079 template<
typename MT >
4083 if( index >=
size() ) {
4086 return (*
this)[index];
4100 template<
typename MT >
4103 return matrix_.begin( col_ );
4117 template<
typename MT >
4121 return matrix_.cbegin( col_ );
4135 template<
typename MT >
4139 return matrix_.cbegin( col_ );
4153 template<
typename MT >
4156 return matrix_.end( col_ );
4170 template<
typename MT >
4174 return matrix_.cend( col_ );
4188 template<
typename MT >
4192 return matrix_.cend( col_ );
4220 template<
typename MT >
4223 using blaze::assign;
4229 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
4232 if(
size() != rhs.size() ) {
4236 if( !tryAssign( matrix_, rhs, 0UL, col_ ) ) {
4240 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4242 if( rhs.canAlias( &matrix_ ) ) {
4243 const ResultType tmp( rhs );
4245 left.reserve( tmp.nonZeros() );
4246 assign( left, tmp );
4250 left.reserve( rhs.nonZeros() );
4251 assign( left, rhs );
4276 template<
typename MT >
4277 template<
typename VT >
4278 inline SparseColumn<MT,false,true>&
4281 using blaze::assign;
4291 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4292 Right right( ~rhs );
4294 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4298 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4300 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4303 assign( left, tmp );
4307 assign( left, right );
4332 template<
typename MT >
4333 template<
typename VT >
4334 inline SparseColumn<MT,false,true>&
4337 using blaze::assign;
4347 typedef typename If< IsRestricted<MT>,
typename VT::CompositeType,
const VT& >::Type Right;
4348 Right right( ~rhs );
4350 if( !tryAssign( matrix_, right, 0UL, col_ ) ) {
4354 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4356 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
4359 left.reserve( tmp.nonZeros() );
4360 assign( left, tmp );
4364 left.reserve( right.nonZeros() );
4365 assign( left, right );
4390 template<
typename MT >
4391 template<
typename VT >
4392 inline SparseColumn<MT,false,true>&
4393 SparseColumn<MT,false,true>::operator+=(
const DenseVector<VT,false>& rhs )
4395 using blaze::assign;
4404 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
4414 const AddType tmp( *
this + (~rhs) );
4416 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4420 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4423 assign( left, tmp );
4447 template<
typename MT >
4448 template<
typename VT >
4449 inline SparseColumn<MT,false,true>&
4450 SparseColumn<MT,false,true>::operator+=(
const SparseVector<VT,false>& rhs )
4452 using blaze::assign;
4461 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
4471 const AddType tmp( *
this + (~rhs) );
4473 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4477 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4480 left.reserve( tmp.nonZeros() );
4481 assign( left, tmp );
4506 template<
typename MT >
4507 template<
typename VT >
4508 inline SparseColumn<MT,false,true>&
4509 SparseColumn<MT,false,true>::operator-=(
const DenseVector<VT,false>& rhs )
4511 using blaze::assign;
4520 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
4530 const SubType tmp( *
this - (~rhs) );
4532 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4536 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4539 assign( left, tmp );
4564 template<
typename MT >
4565 template<
typename VT >
4566 inline SparseColumn<MT,false,true>&
4567 SparseColumn<MT,false,true>::operator-=(
const SparseVector<VT,false>& rhs )
4569 using blaze::assign;
4578 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
4588 const SubType tmp( *
this - (~rhs) );
4590 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4594 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4597 left.reserve( tmp.nonZeros() );
4598 assign( left, tmp );
4621 template<
typename MT >
4622 template<
typename VT >
4623 inline SparseColumn<MT,false,true>&
4624 SparseColumn<MT,false,true>::operator*=(
const Vector<VT,false>& rhs )
4626 using blaze::assign;
4634 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
4643 const MultType tmp( *
this * (~rhs) );
4645 if( !tryAssign( matrix_, tmp, 0UL, col_ ) ) {
4649 typename DerestrictTrait<This>::Type left( derestrict( *
this ) );
4652 assign( left, tmp );
4677 template<
typename MT >
4678 template<
typename Other >
4679 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false,true> >::Type&
4680 SparseColumn<MT,false,true>::operator*=( Other rhs )
4685 element->value() *= rhs;
4710 template<
typename MT >
4711 template<
typename Other >
4712 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false,true> >::Type&
4713 SparseColumn<MT,false,true>::operator/=( Other rhs )
4719 typedef typename DivTrait<ElementType,Other>::Type DT;
4720 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
4724 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
4725 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
4727 element->value() *= tmp;
4731 element->value() /= rhs;
4754 template<
typename MT >
4757 return matrix_.rows();
4769 template<
typename MT >
4772 return matrix_.capacity( col_ );
4787 template<
typename MT >
4790 return matrix_.nonZeros( col_ );
4802 template<
typename MT >
4805 matrix_.reset( col_ );
4823 template<
typename MT >
4827 return matrix_.set( col_, index, value );
4846 template<
typename MT >
4850 return matrix_.insert( col_, index, value );
4865 template<
typename MT >
4868 matrix_.erase( col_, index );
4883 template<
typename MT >
4887 return matrix_.erase( col_, pos );
4903 template<
typename MT >
4907 return matrix_.erase( col_, first, last );
4923 template<
typename MT >
4926 matrix_.reserve( col_, n );
4943 template<
typename MT >
4944 template<
typename Other >
4945 inline SparseColumn<MT,false,true>& SparseColumn<MT,false,true>::scale(
const Other& scalar )
4950 element->value() *= scalar;
4966 template<
typename MT >
4972 size_t nonzeros( 2UL*
capacity()+1UL );
4973 nonzeros =
max( nonzeros, 7UL );
4974 nonzeros =
min( nonzeros,
size() );
5006 template<
typename MT >
5010 return matrix_.find( col_, index );
5030 template<
typename MT >
5034 return matrix_.find( col_, index );
5053 template<
typename MT >
5057 return matrix_.lowerBound( col_, index );
5076 template<
typename MT >
5080 return matrix_.lowerBound( col_, index );
5099 template<
typename MT >
5103 return matrix_.upperBound( col_, index );
5122 template<
typename MT >
5126 return matrix_.upperBound( col_, index );
5165 template<
typename MT >
5168 matrix_.append( col_, index, value, check );
5193 template<
typename MT >
5194 template<
typename Other >
5197 return matrix_.isAliased( alias );
5214 template<
typename MT >
5215 template<
typename Other >
5218 return matrix_.isAliased( alias );
5236 template<
typename MT >
5237 template<
typename VT >
5243 for(
size_t i=0UL; i<
size(); ++i )
5245 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
5246 matrix_.reserve( col_, extendCapacity() );
5248 matrix_.append( col_, i, (~rhs)[i],
true );
5267 template<
typename MT >
5268 template<
typename VT >
5275 matrix_.append( col_, element->index(), element->value(), true );
5294 template<
typename MT >
5295 template<
typename VT >
5298 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
5306 const AddType tmp(
serial( *
this + (~rhs) ) );
5307 matrix_.reset( col_ );
5326 template<
typename MT >
5327 template<
typename VT >
5330 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
5338 const AddType tmp(
serial( *
this + (~rhs) ) );
5339 matrix_.reset( col_ );
5340 matrix_.reserve( col_, tmp.nonZeros() );
5359 template<
typename MT >
5360 template<
typename VT >
5363 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
5371 const SubType tmp(
serial( *
this - (~rhs) ) );
5372 matrix_.reset( col_ );
5391 template<
typename MT >
5392 template<
typename VT >
5395 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
5403 const SubType tmp(
serial( *
this - (~rhs) ) );
5404 matrix_.reset( col_ );
5405 matrix_.reserve( col_, tmp.nonZeros() );
5427 template<
typename MT,
bool SO,
bool SF >
5428 inline void reset( SparseColumn<MT,SO,SF>& column );
5430 template<
typename MT,
bool SO,
bool SF >
5431 inline void clear( SparseColumn<MT,SO,SF>& column );
5433 template<
typename MT,
bool SO,
bool SF >
5434 inline bool isDefault(
const SparseColumn<MT,SO,SF>& column );
5436 template<
typename MT,
bool SO,
bool SF >
5437 inline bool isIntact(
const SparseColumn<MT,SO,SF>& column );
5439 template<
typename MT,
bool SO,
bool SF >
5440 inline bool isSame(
const SparseColumn<MT,SO,SF>& a,
const SparseColumn<MT,SO,SF>& b );
5452 template<
typename MT
5471 template<
typename MT
5499 template<
typename MT
5506 const ConstIterator
end( column.end() );
5507 for( ConstIterator element=column.begin(); element!=
end; ++element )
5508 if( !
isDefault( element->value() ) )
return false;
5532 template<
typename MT
5537 return ( column.col_ <= column.matrix_.columns() &&
5555 template<
typename MT
5560 return (
isSame( a.matrix_, b.matrix_ ) && ( a.col_ == b.col_ ) );
5580 template<
typename MT
5584 inline bool tryAssign(
const SparseColumn<MT,SO,SF>& lhs,
const Vector<VT,false>& rhs,
size_t index )
5589 return tryAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5610 template<
typename MT
5614 inline bool tryAddAssign(
const SparseColumn<MT,SO,SF>& lhs,
const Vector<VT,false>& rhs,
size_t index )
5619 return tryAddAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5640 template<
typename MT
5644 inline bool trySubAssign(
const SparseColumn<MT,SO,SF>& lhs,
const Vector<VT,false>& rhs,
size_t index )
5649 return trySubAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5670 template<
typename MT
5674 inline bool tryMultAssign(
const SparseColumn<MT,SO,SF>& lhs,
const Vector<VT,false>& rhs,
size_t index )
5679 return tryMultAssign( lhs.matrix_, ~rhs, index, lhs.col_ );
5700 template<
typename MT
5703 inline typename DerestrictTrait< SparseColumn<MT,SO,SF> >::Type
5704 derestrict( SparseColumn<MT,SO,SF>& column )
5706 typedef typename DerestrictTrait< SparseColumn<MT,SO,SF> >::Type
ReturnType;
5707 return ReturnType( derestrict( column.matrix_ ), column.col_ );
5723 template<
typename MT,
bool SO,
bool SF >
5724 struct IsRestricted< SparseColumn<MT,SO,SF> > :
public IsTrue< IsRestricted<MT>::value >
5740 template<
typename MT,
bool SO,
bool SF >
5741 struct DerestrictTrait< SparseColumn<MT,SO,SF> >
5743 typedef SparseColumn< typename RemoveReference< typename DerestrictTrait<MT>::Type >::Type > Type;
5759 template<
typename MT,
bool SO,
bool SF,
typename T >
5760 struct AddTrait< SparseColumn<MT,SO,SF>, T >
5762 typedef typename AddTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5765 template<
typename T,
typename MT,
bool SO,
bool SF >
5766 struct AddTrait< T, SparseColumn<MT,SO,SF> >
5768 typedef typename AddTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5784 template<
typename MT,
bool SO,
bool SF,
typename T >
5785 struct SubTrait< SparseColumn<MT,SO,SF>, T >
5787 typedef typename SubTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5790 template<
typename T,
typename MT,
bool SO,
bool SF >
5791 struct SubTrait< T, SparseColumn<MT,SO,SF> >
5793 typedef typename SubTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5809 template<
typename MT,
bool SO,
bool SF,
typename T >
5810 struct MultTrait< SparseColumn<MT,SO,SF>, T >
5812 typedef typename MultTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5815 template<
typename T,
typename MT,
bool SO,
bool SF >
5816 struct MultTrait< T, SparseColumn<MT,SO,SF> >
5818 typedef typename MultTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5834 template<
typename MT,
bool SO,
bool SF,
typename T >
5835 struct CrossTrait< SparseColumn<MT,SO,SF>, T >
5837 typedef typename CrossTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5840 template<
typename T,
typename MT,
bool SO,
bool SF >
5841 struct CrossTrait< T, SparseColumn<MT,SO,SF> >
5843 typedef typename CrossTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5859 template<
typename MT,
bool SO,
bool SF,
typename T >
5860 struct DivTrait< SparseColumn<MT,SO,SF>, T >
5862 typedef typename DivTrait< typename ColumnTrait<MT>::Type, T >::Type Type;
5865 template<
typename T,
typename MT,
bool SO,
bool SF >
5866 struct DivTrait< T, SparseColumn<MT,SO,SF> >
5868 typedef typename DivTrait< T, typename ColumnTrait<MT>::Type >::Type Type;
5884 template<
typename MT,
bool SO,
bool SF >
5885 struct SubvectorTrait< SparseColumn<MT,SO,SF> >
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseColumn.h:1688
#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.
bool canAlias(const Other *alias) const
Returns whether the sparse column can alias with the given address alias.
Definition: SparseColumn.h:1782
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.
ConstIterator cbegin() const
Returns an iterator to the first element of the column.
Definition: SparseColumn.h:737
#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.
Header file for basic type definitions.
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse column.
Definition: SparseColumn.h:1439
Iterator find(size_t index)
Searches for a specific column element.
Definition: SparseColumn.h:1597
Header file for the SparseVector base class.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
void subAssign(const DenseVector< VT, false > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: SparseColumn.h:1948
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
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:115
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: ColumnVector.h:79
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
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
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 reserve(size_t n)
Setting the minimum capacity of the sparse column.
Definition: SparseColumn.h:1514
size_t capacity() const
Returns the maximum capacity of the sparse column.
Definition: SparseColumn.h:1361
Header file for the IsColumnMajorMatrix type trait.
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.
#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
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseColumn.h:397
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.
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse column.
Definition: SparseColumn.h:1753
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
If< IsConst< MT >, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: SparseColumn.h:394
Header file for the column base class.
Constraint on the transpose flag of vector types.
const size_t col_
The index of the column in the matrix.
Definition: SparseColumn.h:522
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseColumn.h:385
Constraint on the data type.
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: SparseColumn.h:788
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.
Header file for the IsFloatingPoint type trait.
#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
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseColumn.h:1643
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.
#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
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
Iterator set(size_t index, const ElementType &value)
Setting an element of the sparse column.
Definition: SparseColumn.h:1416
Base class for all columns.The Column class serves as a tag for all columns (i.e. dense and sparse co...
Definition: Column.h:64
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseColumn.h:384
Header file for the subvector trait.
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
Header file for the SparseElement base class.
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseColumn.h:387
Constraint on the data type.
void reset()
Reset to the default initial values.
Definition: SparseColumn.h:1394
void erase(size_t index)
Erasing an element from the sparse column.
Definition: SparseColumn.h:1457
Constraint on the data type.
If< IsConst< MT >, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: SparseColumn.h:400
void assign(const DenseVector< VT, false > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseColumn.h:1825
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
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: SparseColumn.h:1379
Constraint on the data type.
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
const SparseColumn & CompositeType
Data type for composite expression templates.
Definition: SparseColumn.h:388
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
Header file for the serial shim.
bool isAliased(const Other *alias) const
Returns whether the sparse column is aliased with the given address alias.
Definition: SparseColumn.h:1803
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.
MT::ElementType ElementType
Type of the column elements.
Definition: SparseColumn.h:386
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.
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.
SparseColumn & operator=(const SparseColumn &rhs)
Copy assignment operator for SparseColumn.
Definition: SparseColumn.h:819
#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 column trait.
Header file for the isDefault shim.
Constraint on the data type.
Reference at(size_t index)
Checked access to the column elements.
Definition: SparseColumn.h:659
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
#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
void addAssign(const DenseVector< VT, false > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseColumn.h:1883
Iterator end()
Returns an iterator just past the last element of the column.
Definition: SparseColumn.h:754
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
Iterator begin()
Returns an iterator to the first element of the column.
Definition: SparseColumn.h:703
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: SparseColumn.h:616
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:258
If< IsExpression< MT >, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: SparseColumn.h:378
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
size_t extendCapacity() const
Calculating a new sparse column capacity.
Definition: SparseColumn.h:1557
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
SparseColumn< MT, SO, SF > This
Type of this SparseColumn instance.
Definition: SparseColumn.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.
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:79
Reference to a specific column of a sparse matrix.The SparseColumn template represents a reference to...
Definition: Forward.h:51
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: SparseColumn.h:391
Operand matrix_
The sparse matrix containing the column.
Definition: SparseColumn.h:521
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
size_t size() const
Returns the current size/dimension of the sparse column.
Definition: SparseColumn.h:1346
SparseColumn(MT &matrix, size_t index)
The constructor for SparseColumn.
Definition: SparseColumn.h:584
Header file for a safe C++ NULL pointer implementation.