35 #ifndef _BLAZE_MATH_VIEWS_SPARSECOLUMN_H_
36 #define _BLAZE_MATH_VIEWS_SPARSECOLUMN_H_
338 template<
typename MT
339 ,
bool SO = IsColumnMajorMatrix<MT>::value >
340 class SparseColumn :
public SparseVector< SparseColumn<MT,SO>, false >
384 enum { smpAssignable = 0 };
390 explicit inline SparseColumn( MT& matrix,
size_t index );
423 template<
typename Other >
425 operator*=( Other rhs );
427 template<
typename Other >
429 operator/=( Other rhs );
436 inline size_t size()
const;
441 inline void erase (
size_t index );
444 inline void reserve(
size_t n );
445 template<
typename Other >
inline SparseColumn& scale ( Other scalar );
471 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
472 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
525 template<
typename MT
531 if(
matrix_.columns() <= index )
532 throw std::invalid_argument(
"Invalid column access index" );
551 template<
typename MT
556 return matrix_(index,col_);
567 template<
typename MT
572 return const_cast<const MT&
>( matrix_ )(index,col_);
584 template<
typename MT
588 return matrix_.begin( col_ );
600 template<
typename MT
604 return matrix_.cbegin( col_ );
616 template<
typename MT
620 return matrix_.cbegin( col_ );
632 template<
typename MT
636 return matrix_.end( col_ );
648 template<
typename MT
652 return matrix_.cend( col_ );
664 template<
typename MT
668 return matrix_.cend( col_ );
691 template<
typename MT
701 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
704 if( size() != rhs.size() )
705 throw std::invalid_argument(
"Column sizes do not match" );
707 if( rhs.canAlias( &matrix_ ) ) {
709 matrix_.reset ( col_ );
710 matrix_.reserve( col_, tmp.nonZeros() );
714 matrix_.reset ( col_ );
715 matrix_.reserve( col_, rhs.nonZeros() );
734 template<
typename MT
736 template<
typename VT >
745 if( size() != (~rhs).size() )
746 throw std::invalid_argument(
"Vector sizes do not match" );
748 if( (~rhs).canAlias( &matrix_ ) ) {
750 matrix_.reset( col_ );
754 matrix_.reset( col_ );
773 template<
typename MT
775 template<
typename VT >
780 if( size() != (~rhs).size() )
781 throw std::invalid_argument(
"Vector sizes do not match" );
787 if( (~rhs).canAlias( &matrix_ ) ) {
789 matrix_.reset ( col_ );
790 matrix_.reserve( col_, tmp.nonZeros() );
794 matrix_.reset ( col_ );
795 matrix_.reserve( col_, (~rhs).nonZeros() );
814 template<
typename MT
816 template<
typename VT >
821 if( size() != (~rhs).size() )
822 throw std::invalid_argument(
"Vector sizes do not match" );
841 template<
typename MT
843 template<
typename VT >
848 if( size() != (~rhs).size() )
849 throw std::invalid_argument(
"Vector sizes do not match" );
869 template<
typename MT
871 template<
typename VT >
874 if( size() != (~rhs).size() )
875 throw std::invalid_argument(
"Vector sizes do not match" );
882 const MultType tmp( *
this * (~rhs) );
883 matrix_.reset( col_ );
902 template<
typename MT
904 template<
typename Other >
908 for(
Iterator element=begin(); element!=end(); ++element )
909 element->value() *= rhs;
927 template<
typename MT
929 template<
typename Other >
941 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
942 for(
Iterator element=begin(); element!=end(); ++element )
943 element->value() *= tmp;
946 for(
Iterator element=begin(); element!=end(); ++element )
947 element->value() /= rhs;
968 template<
typename MT
972 return matrix_.rows();
982 template<
typename MT
986 return matrix_.capacity( col_ );
999 template<
typename MT
1003 return matrix_.nonZeros( col_ );
1013 template<
typename MT
1017 matrix_.reset( col_ );
1034 template<
typename MT
1039 return matrix_.insert( index, col_, value );
1052 template<
typename MT
1056 matrix_.erase( index, col_ );
1069 template<
typename MT
1073 return matrix_.erase( col_, pos );
1087 template<
typename MT
1091 return matrix_.erase( col_, first, last );
1105 template<
typename MT
1109 matrix_.reserve( col_, n );
1120 template<
typename MT
1122 template<
typename Other >
1125 for(
Iterator element=begin(); element!=end(); ++element )
1126 element->value() *= scalar;
1140 template<
typename MT
1147 size_t nonzeros( 2UL*capacity()+1UL );
1148 nonzeros = max( nonzeros, 7UL );
1149 nonzeros = min( nonzeros, size() );
1179 template<
typename MT
1183 return matrix_.find( index, col_ );
1201 template<
typename MT
1205 return matrix_.find( index, col_ );
1222 template<
typename MT
1226 return matrix_.lowerBound( index, col_ );
1243 template<
typename MT
1247 return matrix_.lowerBound( index, col_ );
1264 template<
typename MT
1268 return matrix_.upperBound( index, col_ );
1285 template<
typename MT
1289 return matrix_.upperBound( index, col_ );
1326 template<
typename MT
1330 matrix_.append( index, col_, value, check );
1353 template<
typename MT
1355 template<
typename Other >
1358 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1373 template<
typename MT
1375 template<
typename Other >
1378 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1394 template<
typename MT
1396 template<
typename VT >
1402 for(
size_t i=0UL; i<size(); ++i )
1404 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
1405 matrix_.reserve( col_, extendCapacity() );
1407 matrix_.append( i, col_, (~rhs)[i],
true );
1424 template<
typename MT
1426 template<
typename VT >
1432 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1433 matrix_.append( element->index(), col_, element->value() );
1450 template<
typename MT
1452 template<
typename VT >
1463 const AddType tmp( *
this + (~rhs) );
1464 matrix_.reset( col_ );
1481 template<
typename MT
1483 template<
typename VT >
1494 const AddType tmp( *
this + (~rhs) );
1495 matrix_.reset ( col_ );
1496 matrix_.reserve( col_, tmp.nonZeros() );
1513 template<
typename MT
1515 template<
typename VT >
1526 const SubType tmp( *
this - (~rhs) );
1527 matrix_.reset( col_ );
1544 template<
typename MT
1546 template<
typename VT >
1557 const SubType tmp( *
this - (~rhs) );
1558 matrix_.reset ( col_ );
1559 matrix_.reserve( col_, tmp.nonZeros() );
1585 template<
typename MT >
1608 typedef SparseColumn<MT,false>
This;
1609 typedef typename ColumnTrait<MT>::Type
ResultType;
1619 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1625 template<
typename MatrixType
1626 ,
typename IteratorType >
1637 enum { returnConst = IsConst<MatrixType>::value };
1642 typedef typename SelectType< returnConst, const ElementType&, ElementType& >::Type ReferenceType;
1651 inline ColumnElement( IteratorType pos,
size_t row )
1663 template<
typename T >
inline ColumnElement&
operator=(
const T& v ) {
1675 template<
typename T >
inline ColumnElement& operator+=(
const T& v ) {
1687 template<
typename T >
inline ColumnElement& operator-=(
const T& v ) {
1699 template<
typename T >
inline ColumnElement& operator*=(
const T& v ) {
1711 template<
typename T >
inline ColumnElement& operator/=(
const T& v ) {
1722 inline const ColumnElement* operator->()
const {
1732 inline ReferenceType value()
const {
1733 return pos_->value();
1742 inline size_t index()
const {
1758 template<
typename MatrixType
1759 ,
typename IteratorType >
1760 class ColumnIterator
1764 typedef std::forward_iterator_tag IteratorCategory;
1765 typedef ColumnElement<MatrixType,IteratorType> ValueType;
1766 typedef ValueType PointerType;
1767 typedef ValueType ReferenceType;
1768 typedef ptrdiff_t DifferenceType;
1771 typedef IteratorCategory iterator_category;
1772 typedef ValueType value_type;
1773 typedef PointerType pointer;
1774 typedef ReferenceType reference;
1775 typedef DifferenceType difference_type;
1785 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
1791 for( ; row_<
matrix_.rows(); ++row_ ) {
1792 pos_ =
matrix_.find( row_, column_ );
1793 if( pos_ !=
matrix_.end( row_ ) )
break;
1806 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
1821 template<
typename MatrixType2,
typename IteratorType2 >
1822 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
1825 , column_( it.column_ )
1835 inline ColumnIterator& operator++() {
1837 for( ; row_<
matrix_.rows(); ++row_ ) {
1838 pos_ =
matrix_.find( row_, column_ );
1839 if( pos_ !=
matrix_.end( row_ ) )
break;
1851 inline const ColumnIterator operator++(
int ) {
1852 const ColumnIterator tmp( *
this );
1863 inline ReferenceType
operator*()
const {
1864 return ReferenceType( pos_, row_ );
1873 inline PointerType operator->()
const {
1874 return PointerType( pos_, row_ );
1884 template<
typename MatrixType2,
typename IteratorType2 >
1885 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
1886 return ( &
matrix_ == &rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1896 template<
typename MatrixType2,
typename IteratorType2 >
1897 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
1898 return !( *
this == rhs );
1908 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
1909 size_t counter( 0UL );
1910 for(
size_t i=rhs.row_; i<row_; ++i ) {
1927 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
1928 template<
typename MT2,
bool SO2 >
friend class SparseColumn;
1935 typedef ColumnIterator<const MT,typename MT::ConstIterator>
ConstIterator;
1938 typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT,typename MT::Iterator> >::Type
Iterator;
1943 enum { smpAssignable = 0 };
1949 explicit inline SparseColumn( MT& matrix,
size_t index );
1977 template<
typename VT >
inline SparseColumn& operator+=(
const Vector<VT,false>& rhs );
1978 template<
typename VT >
inline SparseColumn& operator-=(
const Vector<VT,false>& rhs );
1979 template<
typename VT >
inline SparseColumn& operator*=(
const Vector<VT,false>& rhs );
1981 template<
typename Other >
1982 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
1983 operator*=( Other rhs );
1985 template<
typename Other >
1986 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
1987 operator/=( Other rhs );
1994 inline size_t size()
const;
1997 inline void reset();
1999 inline void erase (
size_t index );
2002 inline void reserve(
size_t n );
2003 template<
typename Other >
inline SparseColumn& scale ( Other scalar );
2029 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2030 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2031 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2032 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2033 template<
typename VT >
inline void addAssign(
const Vector<VT,false>& rhs );
2034 template<
typename VT >
inline void subAssign(
const Vector<VT,false>& rhs );
2074 template<
typename MT >
2079 if(
matrix_.columns() <= index )
2080 throw std::invalid_argument(
"Invalid column access index" );
2101 template<
typename MT >
2105 return matrix_(index,col_);
2118 template<
typename MT >
2122 return const_cast<const MT&
>( matrix_ )(index,col_);
2136 template<
typename MT >
2139 return Iterator( matrix_, 0UL, col_ );
2153 template<
typename MT >
2170 template<
typename MT >
2187 template<
typename MT >
2190 return Iterator( matrix_, size(), col_ );
2204 template<
typename MT >
2221 template<
typename MT >
2249 template<
typename MT >
2258 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
2261 if( size() != rhs.size() )
2262 throw std::invalid_argument(
"Column sizes do not match" );
2264 if( rhs.canAlias( &matrix_ ) ) {
2289 template<
typename MT >
2290 template<
typename VT >
2295 if( size() != (~rhs).size() )
2296 throw std::invalid_argument(
"Vector sizes do not match" );
2318 template<
typename MT >
2319 template<
typename VT >
2320 inline SparseColumn<MT,false>& SparseColumn<MT,false>::operator+=(
const Vector<VT,false>& rhs )
2324 if( size() != (~rhs).size() )
2325 throw std::invalid_argument(
"Vector sizes do not match" );
2346 template<
typename MT >
2347 template<
typename VT >
2348 inline SparseColumn<MT,false>& SparseColumn<MT,false>::operator-=(
const Vector<VT,false>& rhs )
2352 if( size() != (~rhs).size() )
2353 throw std::invalid_argument(
"Vector sizes do not match" );
2375 template<
typename MT >
2376 template<
typename VT >
2377 inline SparseColumn<MT,false>& SparseColumn<MT,false>::operator*=(
const Vector<VT,false>& rhs )
2379 if( size() != (~rhs).size() )
2380 throw std::invalid_argument(
"Vector sizes do not match" );
2382 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
2387 const MultType tmp( *
this * (~rhs) );
2408 template<
typename MT >
2409 template<
typename Other >
2410 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false> >::Type&
2411 SparseColumn<MT,false>::operator*=( Other rhs )
2413 for(
Iterator element=begin(); element!=end(); ++element )
2414 element->value() *= rhs;
2434 template<
typename MT >
2435 template<
typename Other >
2436 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false> >::Type&
2437 SparseColumn<MT,false>::operator/=( Other rhs )
2441 typedef typename DivTrait<ElementType,Other>::Type DT;
2442 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2446 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2447 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2448 for(
Iterator element=begin(); element!=end(); ++element )
2449 element->value() *= tmp;
2452 for(
Iterator element=begin(); element!=end(); ++element )
2453 element->value() /= rhs;
2476 template<
typename MT >
2479 return matrix_.rows();
2491 template<
typename MT >
2494 return matrix_.rows();
2509 template<
typename MT >
2512 size_t counter( 0UL );
2513 for(
ConstIterator element=begin(); element!=end(); ++element ) {
2528 template<
typename MT >
2531 for(
size_t i=0UL; i<size(); ++i ) {
2532 matrix_.erase( i, col_ );
2552 template<
typename MT >
2556 return Iterator( matrix_, index, col_, matrix_.insert( index, col_, value ) );
2571 template<
typename MT >
2574 matrix_.erase( index, col_ );
2589 template<
typename MT >
2592 const size_t row( pos.row_ );
2597 matrix_.erase( row, pos.pos_ );
2598 return Iterator( matrix_, row+1UL, col_ );
2614 template<
typename MT >
2617 for( ; first!=last; ++first ) {
2618 matrix_.erase( first.row_, first.pos_ );
2636 template<
typename MT >
2653 template<
typename MT >
2654 template<
typename Other >
2655 inline SparseColumn<MT,false>& SparseColumn<MT,false>::scale( Other scalar )
2657 for(
Iterator element=begin(); element!=end(); ++element )
2658 element->value() *= scalar;
2687 template<
typename MT >
2690 const typename MT::Iterator pos( matrix_.find( index, col_ ) );
2692 if( pos != matrix_.end( index ) )
2693 return Iterator( matrix_, index, col_, pos );
2715 template<
typename MT >
2720 if( pos != matrix_.end( index ) )
2742 template<
typename MT >
2745 for(
size_t i=index; i<size(); ++i )
2747 const typename MT::Iterator pos( matrix_.find( i, col_ ) );
2749 if( pos != matrix_.end( i ) )
2750 return Iterator( matrix_, i, col_, pos );
2772 template<
typename MT >
2775 for(
size_t i=index; i<size(); ++i )
2779 if( pos != matrix_.end( i ) )
2802 template<
typename MT >
2805 for(
size_t i=index+1UL; i<size(); ++i )
2807 const typename MT::Iterator pos( matrix_.find( i, col_ ) );
2809 if( pos != matrix_.end( i ) )
2810 return Iterator( matrix_, i, col_, pos );
2832 template<
typename MT >
2835 for(
size_t i=index+1UL; i<size(); ++i )
2839 if( pos != matrix_.end( i ) )
2882 template<
typename MT >
2886 matrix_.insert( index, col_, value );
2911 template<
typename MT >
2912 template<
typename Other >
2915 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2928 template<
typename MT >
2929 template<
typename Other >
2932 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2950 template<
typename MT >
2951 template<
typename VT >
2956 for(
size_t i=0UL; i<(~rhs).size(); ++i ) {
2957 matrix_(i,col_) = (~rhs)[i];
2976 template<
typename MT >
2977 template<
typename VT >
2984 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2985 for( ; i<element->index(); ++i )
2986 matrix_.erase( i, col_ );
2987 matrix_(i++,col_) = element->value();
2989 for( ; i<size(); ++i ) {
2990 matrix_.erase( i, col_ );
3009 template<
typename MT >
3010 template<
typename VT >
3013 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3020 const AddType tmp( *
this + (~rhs) );
3039 template<
typename MT >
3040 template<
typename VT >
3043 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3050 const SubType tmp( *
this - (~rhs) );
3072 template<
typename MT,
bool SO >
3073 inline void reset( SparseColumn<MT,SO>& column );
3075 template<
typename MT,
bool SO >
3076 inline void clear( SparseColumn<MT,SO>& column );
3078 template<
typename MT,
bool SO >
3079 inline bool isDefault(
const SparseColumn<MT,SO>& column );
3091 template<
typename MT
3109 template<
typename MT
3136 template<
typename MT
3142 const ConstIterator end( column.end() );
3143 for( ConstIterator element=column.begin(); element!=end; ++element )
3144 if( !
isDefault( element->value() ) )
return false;
3160 template<
typename MT,
bool SO >
3161 struct SubvectorTrait< SparseColumn<MT,SO> >
Constraint on the data type.
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.
void subAssign(const DenseVector< VT, false > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: SparseColumn.h:1516
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#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
Operand matrix_
The sparse matrix containing the column.
Definition: SparseColumn.h:493
Header file for the UNUSED_PARAMETER function template.
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:4075
Header file for the subtraction trait.
Iterator end()
Returns an iterator just past the last element of the column.
Definition: SparseColumn.h:634
Header file for the SparseVector base class.
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: SparseColumn.h:666
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:114
#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: TransposeFlag.h:159
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:197
#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
Header file for the IsColumnMajorMatrix type trait.
void assign(const DenseVector< VT, false > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseColumn.h:1397
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2384
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:103
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:84
Iterator find(size_t index)
Searches for a specific column element.
Definition: SparseColumn.h:1181
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:86
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseColumn.h:364
#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
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
Header file for the column base class.
Constraint on the data type.
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseColumn.h:376
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: SparseColumn.h:379
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the DisableIf class template.
Header file for the multiplication trait.
MT::ElementType ElementType
Type of the column elements.
Definition: SparseColumn.h:365
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: StorageOrder.h:161
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
Header file for the Or class template.
Iterator begin()
Returns an iterator to the first element of the column.
Definition: SparseColumn.h:586
void addAssign(const DenseVector< VT, false > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseColumn.h:1453
size_t size() const
Returns the current size/dimension of the sparse column.
Definition: SparseColumn.h:970
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: SparseColumn.h:370
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
Header file for the subvector trait.
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseColumn.h:1224
void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:179
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
#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
Constraint on the data type.
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseColumn.h:1266
Constraint on the data type.
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: SparseColumn.h:1001
Constraints on the storage order of matrix types.
Constraint on the data type.
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:2382
Constraint on the data type.
Header file for the SelectType class template.
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
Header file for the EnableIf class template.
Header file for the IsNumeric type trait.
const size_t col_
The index of the column in the matrix.
Definition: SparseColumn.h:494
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:103
#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: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2383
Header file for the IsConst type trait.
void erase(size_t index)
Erasing an element from the sparse column.
Definition: SparseColumn.h:1054
SparseColumn< MT, SO > This
Type of this SparseColumn instance.
Definition: SparseColumn.h:362
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
Base template for the MultTrait class.
Definition: MultTrait.h:141
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: SparseColumn.h:346
Header file for the addition trait.
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseColumn.h:363
Header file for the division trait.
void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:209
void reserve(size_t n)
Setting the minimum capacity of the sparse column.
Definition: SparseColumn.h:1107
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
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.
void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:239
const VT::ElementType max(const SparseVector< VT, TF > &sv)
Returns the largest element of the sparse vector.
Definition: SparseVector.h:405
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
Header file for the column trait.
Header file for the isDefault shim.
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse column.
Definition: SparseColumn.h:1037
size_t capacity() const
Returns the maximum capacity of the sparse column.
Definition: SparseColumn.h:984
#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
ConstIterator cbegin() const
Returns an iterator to the first element of the column.
Definition: SparseColumn.h:618
Compile time check for constant data types.The IsConst type trait tests whether or not the given temp...
Definition: IsConst.h:94
const SparseColumn & CompositeType
Data type for composite expression templates.
Definition: SparseColumn.h:367
Base template for the DivTrait class.
Definition: DivTrait.h:141
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseColumn.h:366
#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
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:147
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:248
SparseColumn(MT &matrix, size_t index)
The constructor for SparseColumn.
Definition: SparseColumn.h:527
SparseColumn & operator=(const SparseColumn &rhs)
Copy assignment operator for SparseColumn.
Definition: SparseColumn.h:693
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
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:2379
void reset()
Reset to the default initial values.
Definition: SparseColumn.h:1015
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
Reference operator[](size_t index)
Subscript operator for the direct access to the column elements.
Definition: SparseColumn.h:553
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: SparseColumn.h:373
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2385
Base template for the SubTrait class.
Definition: SubTrait.h:141
const VT::ElementType min(const SparseVector< VT, TF > &sv)
Returns the smallest element of the sparse vector.
Definition: SparseVector.h:348
bool canAlias(const Other *alias) const
Returns whether the sparse column can alias with the given address alias.
Definition: SparseColumn.h:1356
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse column.
Definition: SparseColumn.h:1328
bool isAliased(const Other *alias) const
Returns whether the sparse column is aliased with the given address alias.
Definition: SparseColumn.h:1376
size_t extendCapacity() const
Calculating a new sparse column capacity.
Definition: SparseColumn.h:1142
#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
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.