35 #ifndef _BLAZE_MATH_VIEWS_SPARSECOLUMN_H_
36 #define _BLAZE_MATH_VIEWS_SPARSECOLUMN_H_
339 template<
typename MT
340 ,
bool SO = IsColumnMajorMatrix<MT>::value >
341 class SparseColumn :
public SparseVector< SparseColumn<MT,SO>, false >
385 enum { smpAssignable = 0 };
391 explicit inline SparseColumn( MT& matrix,
size_t index );
424 template<
typename Other >
426 operator*=( Other rhs );
428 template<
typename Other >
430 operator/=( Other rhs );
437 inline size_t size()
const;
442 inline void erase (
size_t index );
445 inline void reserve(
size_t n );
446 template<
typename Other >
inline SparseColumn& scale ( Other scalar );
472 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
473 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
502 template<
typename MT2,
bool SO2 >
534 template<
typename MT
540 if(
matrix_.columns() <= index )
541 throw std::invalid_argument(
"Invalid column access index" );
560 template<
typename MT
565 return matrix_(index,col_);
576 template<
typename MT
581 return const_cast<const MT&
>( matrix_ )(index,col_);
593 template<
typename MT
597 return matrix_.begin( col_ );
609 template<
typename MT
613 return matrix_.cbegin( col_ );
625 template<
typename MT
629 return matrix_.cbegin( col_ );
641 template<
typename MT
645 return matrix_.end( col_ );
657 template<
typename MT
661 return matrix_.cend( col_ );
673 template<
typename MT
677 return matrix_.cend( col_ );
700 template<
typename MT
710 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
713 if( size() != rhs.size() )
714 throw std::invalid_argument(
"Column sizes do not match" );
716 if( rhs.canAlias( &matrix_ ) ) {
718 matrix_.reset ( col_ );
719 matrix_.reserve( col_, tmp.nonZeros() );
723 matrix_.reset ( col_ );
724 matrix_.reserve( col_, rhs.nonZeros() );
743 template<
typename MT
745 template<
typename VT >
754 if( size() != (~rhs).size() )
755 throw std::invalid_argument(
"Vector sizes do not match" );
757 if( (~rhs).canAlias( &matrix_ ) ) {
759 matrix_.reset( col_ );
763 matrix_.reset( col_ );
782 template<
typename MT
784 template<
typename VT >
789 if( size() != (~rhs).size() )
790 throw std::invalid_argument(
"Vector sizes do not match" );
796 if( (~rhs).canAlias( &matrix_ ) ) {
798 matrix_.reset ( col_ );
799 matrix_.reserve( col_, tmp.nonZeros() );
803 matrix_.reset ( col_ );
804 matrix_.reserve( col_, (~rhs).
nonZeros() );
823 template<
typename MT
825 template<
typename VT >
830 if( size() != (~rhs).size() )
831 throw std::invalid_argument(
"Vector sizes do not match" );
850 template<
typename MT
852 template<
typename VT >
857 if( size() != (~rhs).size() )
858 throw std::invalid_argument(
"Vector sizes do not match" );
878 template<
typename MT
880 template<
typename VT >
883 if( size() != (~rhs).size() )
884 throw std::invalid_argument(
"Vector sizes do not match" );
891 const MultType tmp( *
this * (~rhs) );
892 matrix_.reset( col_ );
911 template<
typename MT
913 template<
typename Other >
917 for(
Iterator element=begin(); element!=end(); ++element )
918 element->value() *= rhs;
936 template<
typename MT
938 template<
typename Other >
950 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
951 for(
Iterator element=begin(); element!=end(); ++element )
952 element->value() *= tmp;
955 for(
Iterator element=begin(); element!=end(); ++element )
956 element->value() /= rhs;
977 template<
typename MT
981 return matrix_.rows();
991 template<
typename MT
995 return matrix_.capacity( col_ );
1008 template<
typename MT
1012 return matrix_.nonZeros( col_ );
1022 template<
typename MT
1026 matrix_.reset( col_ );
1043 template<
typename MT
1048 return matrix_.insert( index, col_, value );
1061 template<
typename MT
1065 matrix_.erase( index, col_ );
1078 template<
typename MT
1082 return matrix_.erase( col_, pos );
1096 template<
typename MT
1100 return matrix_.erase( col_, first, last );
1114 template<
typename MT
1118 matrix_.reserve( col_, n );
1129 template<
typename MT
1131 template<
typename Other >
1134 for(
Iterator element=begin(); element!=end(); ++element )
1135 element->value() *= scalar;
1149 template<
typename MT
1156 size_t nonzeros( 2UL*
capacity()+1UL );
1157 nonzeros = max( nonzeros, 7UL );
1158 nonzeros = min( nonzeros, size() );
1188 template<
typename MT
1192 return matrix_.find( index, col_ );
1210 template<
typename MT
1214 return matrix_.find( index, col_ );
1231 template<
typename MT
1235 return matrix_.lowerBound( index, col_ );
1252 template<
typename MT
1256 return matrix_.lowerBound( index, col_ );
1273 template<
typename MT
1277 return matrix_.upperBound( index, col_ );
1294 template<
typename MT
1298 return matrix_.upperBound( index, col_ );
1335 template<
typename MT
1339 matrix_.append( index, col_, value, check );
1362 template<
typename MT
1364 template<
typename Other >
1367 return matrix_.isAliased( alias );
1382 template<
typename MT
1384 template<
typename Other >
1387 return matrix_.isAliased( alias );
1403 template<
typename MT
1405 template<
typename VT >
1411 for(
size_t i=0UL; i<size(); ++i )
1413 if( matrix_.nonZeros( col_ ) == matrix_.capacity( col_ ) )
1414 matrix_.reserve( col_, extendCapacity() );
1416 matrix_.append( i, col_, (~rhs)[i],
true );
1433 template<
typename MT
1435 template<
typename VT >
1441 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1442 matrix_.append( element->index(), col_, element->value() );
1459 template<
typename MT
1461 template<
typename VT >
1472 const AddType tmp(
serial( *
this + (~rhs) ) );
1473 matrix_.reset( col_ );
1490 template<
typename MT
1492 template<
typename VT >
1503 const AddType tmp(
serial( *
this + (~rhs) ) );
1504 matrix_.reset ( col_ );
1505 matrix_.reserve( col_, tmp.nonZeros() );
1522 template<
typename MT
1524 template<
typename VT >
1535 const SubType tmp(
serial( *
this - (~rhs) ) );
1536 matrix_.reset( col_ );
1553 template<
typename MT
1555 template<
typename VT >
1566 const SubType tmp(
serial( *
this - (~rhs) ) );
1567 matrix_.reset ( col_ );
1568 matrix_.reserve( col_, tmp.nonZeros() );
1594 template<
typename MT >
1617 typedef SparseColumn<MT,false>
This;
1618 typedef typename ColumnTrait<MT>::Type
ResultType;
1628 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1634 template<
typename MatrixType
1635 ,
typename IteratorType >
1646 enum { returnConst = IsConst<MatrixType>::value };
1651 typedef typename SelectType< returnConst, const ElementType&, ElementType& >::Type ReferenceType;
1660 inline ColumnElement( IteratorType pos,
size_t row )
1672 template<
typename T >
inline ColumnElement&
operator=(
const T& v ) {
1684 template<
typename T >
inline ColumnElement& operator+=(
const T& v ) {
1696 template<
typename T >
inline ColumnElement& operator-=(
const T& v ) {
1708 template<
typename T >
inline ColumnElement& operator*=(
const T& v ) {
1720 template<
typename T >
inline ColumnElement& operator/=(
const T& v ) {
1731 inline const ColumnElement* operator->()
const {
1741 inline ReferenceType value()
const {
1742 return pos_->value();
1751 inline size_t index()
const {
1767 template<
typename MatrixType
1768 ,
typename IteratorType >
1769 class ColumnIterator
1773 typedef std::forward_iterator_tag IteratorCategory;
1774 typedef ColumnElement<MatrixType,IteratorType> ValueType;
1775 typedef ValueType PointerType;
1776 typedef ValueType ReferenceType;
1777 typedef ptrdiff_t DifferenceType;
1780 typedef IteratorCategory iterator_category;
1781 typedef ValueType value_type;
1782 typedef PointerType pointer;
1783 typedef ReferenceType reference;
1784 typedef DifferenceType difference_type;
1794 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
1800 for( ; row_<
matrix_.rows(); ++row_ ) {
1801 pos_ =
matrix_.find( row_, column_ );
1802 if( pos_ !=
matrix_.end( row_ ) )
break;
1815 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
1830 template<
typename MatrixType2,
typename IteratorType2 >
1831 inline ColumnIterator(
const ColumnIterator<MatrixType2,IteratorType2>& it )
1834 , column_( it.column_ )
1844 inline ColumnIterator& operator++() {
1846 for( ; row_<
matrix_.rows(); ++row_ ) {
1847 pos_ =
matrix_.find( row_, column_ );
1848 if( pos_ !=
matrix_.end( row_ ) )
break;
1860 inline const ColumnIterator operator++(
int ) {
1861 const ColumnIterator tmp( *
this );
1872 inline ReferenceType
operator*()
const {
1873 return ReferenceType( pos_, row_ );
1882 inline PointerType operator->()
const {
1883 return PointerType( pos_, row_ );
1893 template<
typename MatrixType2,
typename IteratorType2 >
1894 inline bool operator==(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
1895 return ( &
matrix_ == &rhs.matrix_ ) && ( row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1905 template<
typename MatrixType2,
typename IteratorType2 >
1906 inline bool operator!=(
const ColumnIterator<MatrixType2,IteratorType2>& rhs )
const {
1907 return !( *
this == rhs );
1917 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
1918 size_t counter( 0UL );
1919 for(
size_t i=rhs.row_; i<row_; ++i ) {
1936 template<
typename MatrixType2,
typename IteratorType2 >
friend class ColumnIterator;
1937 template<
typename MT2,
bool SO2 >
friend class SparseColumn;
1944 typedef ColumnIterator<const MT,typename MT::ConstIterator>
ConstIterator;
1947 typedef typename SelectType< useConst, ConstIterator, ColumnIterator<MT,typename MT::Iterator> >::Type
Iterator;
1952 enum { smpAssignable = 0 };
1958 explicit inline SparseColumn( MT& matrix,
size_t index );
1986 template<
typename VT >
inline SparseColumn& operator+=(
const Vector<VT,false>& rhs );
1987 template<
typename VT >
inline SparseColumn& operator-=(
const Vector<VT,false>& rhs );
1988 template<
typename VT >
inline SparseColumn& operator*=(
const Vector<VT,false>& rhs );
1990 template<
typename Other >
1991 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
1992 operator*=( Other rhs );
1994 template<
typename Other >
1995 inline typename EnableIf< IsNumeric<Other>,
SparseColumn >::Type&
1996 operator/=( Other rhs );
2003 inline size_t size()
const;
2006 inline void reset();
2008 inline void erase (
size_t index );
2011 inline void reserve(
size_t n );
2012 template<
typename Other >
inline SparseColumn& scale ( Other scalar );
2038 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2039 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2041 template<
typename VT >
inline void assign (
const DenseVector <VT,false>& rhs );
2042 template<
typename VT >
inline void assign (
const SparseVector<VT,false>& rhs );
2043 template<
typename VT >
inline void addAssign(
const Vector<VT,false>& rhs );
2044 template<
typename VT >
inline void subAssign(
const Vector<VT,false>& rhs );
2058 template<
typename MT2,
bool SO2 >
2059 friend bool isSame(
const SparseColumn<MT2,SO2>& a,
const SparseColumn<MT2,SO2>& b );
2089 template<
typename MT >
2094 if(
matrix_.columns() <= index )
2095 throw std::invalid_argument(
"Invalid column access index" );
2116 template<
typename MT >
2120 return matrix_(index,col_);
2133 template<
typename MT >
2137 return const_cast<const MT&
>( matrix_ )(index,col_);
2151 template<
typename MT >
2154 return Iterator( matrix_, 0UL, col_ );
2168 template<
typename MT >
2185 template<
typename MT >
2202 template<
typename MT >
2205 return Iterator( matrix_, size(), col_ );
2219 template<
typename MT >
2236 template<
typename MT >
2264 template<
typename MT >
2273 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && col_ == rhs.col_ ) )
2276 if( size() != rhs.size() )
2277 throw std::invalid_argument(
"Column sizes do not match" );
2279 if( rhs.canAlias( &matrix_ ) ) {
2304 template<
typename MT >
2305 template<
typename VT >
2310 if( size() != (~rhs).size() )
2311 throw std::invalid_argument(
"Vector sizes do not match" );
2333 template<
typename MT >
2334 template<
typename VT >
2335 inline SparseColumn<MT,false>& SparseColumn<MT,false>::operator+=(
const Vector<VT,false>& rhs )
2339 if( size() != (~rhs).size() )
2340 throw std::invalid_argument(
"Vector sizes do not match" );
2361 template<
typename MT >
2362 template<
typename VT >
2363 inline SparseColumn<MT,false>& SparseColumn<MT,false>::operator-=(
const Vector<VT,false>& rhs )
2367 if( size() != (~rhs).size() )
2368 throw std::invalid_argument(
"Vector sizes do not match" );
2390 template<
typename MT >
2391 template<
typename VT >
2392 inline SparseColumn<MT,false>& SparseColumn<MT,false>::operator*=(
const Vector<VT,false>& rhs )
2394 if( size() != (~rhs).size() )
2395 throw std::invalid_argument(
"Vector sizes do not match" );
2397 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
2402 const MultType tmp( *
this * (~rhs) );
2423 template<
typename MT >
2424 template<
typename Other >
2425 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false> >::Type&
2426 SparseColumn<MT,false>::operator*=( Other rhs )
2428 for(
Iterator element=begin(); element!=end(); ++element )
2429 element->value() *= rhs;
2449 template<
typename MT >
2450 template<
typename Other >
2451 inline typename EnableIf< IsNumeric<Other>, SparseColumn<MT,false> >::Type&
2452 SparseColumn<MT,false>::operator/=( Other rhs )
2456 typedef typename DivTrait<ElementType,Other>::Type DT;
2457 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2461 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2462 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2463 for(
Iterator element=begin(); element!=end(); ++element )
2464 element->value() *= tmp;
2467 for(
Iterator element=begin(); element!=end(); ++element )
2468 element->value() /= rhs;
2491 template<
typename MT >
2494 return matrix_.rows();
2506 template<
typename MT >
2509 return matrix_.rows();
2524 template<
typename MT >
2527 size_t counter( 0UL );
2528 for(
ConstIterator element=begin(); element!=end(); ++element ) {
2543 template<
typename MT >
2546 for(
size_t i=0UL; i<size(); ++i ) {
2547 matrix_.erase( i, col_ );
2567 template<
typename MT >
2571 return Iterator( matrix_, index, col_, matrix_.insert( index, col_, value ) );
2586 template<
typename MT >
2589 matrix_.erase( index, col_ );
2604 template<
typename MT >
2607 const size_t row( pos.row_ );
2612 matrix_.erase( row, pos.pos_ );
2613 return Iterator( matrix_, row+1UL, col_ );
2629 template<
typename MT >
2632 for( ; first!=last; ++first ) {
2633 matrix_.erase( first.row_, first.pos_ );
2651 template<
typename MT >
2668 template<
typename MT >
2669 template<
typename Other >
2670 inline SparseColumn<MT,false>& SparseColumn<MT,false>::scale( Other scalar )
2672 for(
Iterator element=begin(); element!=end(); ++element )
2673 element->value() *= scalar;
2702 template<
typename MT >
2705 const typename MT::Iterator pos( matrix_.find( index, col_ ) );
2707 if( pos != matrix_.end( index ) )
2708 return Iterator( matrix_, index, col_, pos );
2730 template<
typename MT >
2735 if( pos != matrix_.end( index ) )
2757 template<
typename MT >
2760 for(
size_t i=index; i<size(); ++i )
2762 const typename MT::Iterator pos( matrix_.find( i, col_ ) );
2764 if( pos != matrix_.end( i ) )
2765 return Iterator( matrix_, i, col_, pos );
2787 template<
typename MT >
2790 for(
size_t i=index; i<size(); ++i )
2794 if( pos != matrix_.end( i ) )
2817 template<
typename MT >
2820 for(
size_t i=index+1UL; i<size(); ++i )
2822 const typename MT::Iterator pos( matrix_.find( i, col_ ) );
2824 if( pos != matrix_.end( i ) )
2825 return Iterator( matrix_, i, col_, pos );
2847 template<
typename MT >
2850 for(
size_t i=index+1UL; i<size(); ++i )
2854 if( pos != matrix_.end( i ) )
2897 template<
typename MT >
2901 matrix_.insert( index, col_, value );
2926 template<
typename MT >
2927 template<
typename Other >
2930 return matrix_.isAliased( alias );
2943 template<
typename MT >
2944 template<
typename Other >
2947 return matrix_.isAliased( alias );
2965 template<
typename MT >
2966 template<
typename VT >
2971 for(
size_t i=0UL; i<(~rhs).size(); ++i ) {
2972 matrix_(i,col_) = (~rhs)[i];
2991 template<
typename MT >
2992 template<
typename VT >
2999 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
3000 for( ; i<element->index(); ++i )
3001 matrix_.erase( i, col_ );
3002 matrix_(i++,col_) = element->value();
3004 for( ; i<size(); ++i ) {
3005 matrix_.erase( i, col_ );
3024 template<
typename MT >
3025 template<
typename VT >
3028 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3035 const AddType tmp(
serial( *
this + (~rhs) ) );
3054 template<
typename MT >
3055 template<
typename VT >
3058 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3065 const SubType tmp(
serial( *
this - (~rhs) ) );
3087 template<
typename MT,
bool SO >
3088 inline void reset( SparseColumn<MT,SO>& column );
3090 template<
typename MT,
bool SO >
3091 inline void clear( SparseColumn<MT,SO>& column );
3093 template<
typename MT,
bool SO >
3094 inline bool isDefault(
const SparseColumn<MT,SO>& column );
3096 template<
typename MT,
bool SO >
3097 inline bool isSame(
const SparseColumn<MT,SO>& a,
const SparseColumn<MT,SO>& b );
3109 template<
typename MT
3127 template<
typename MT
3154 template<
typename MT
3160 const ConstIterator end( column.end() );
3161 for( ConstIterator element=column.begin(); element!=end; ++element )
3162 if( !
isDefault( element->value() ) )
return false;
3180 template<
typename MT,
bool SO >
3183 return (
isSame( a.matrix_, b.matrix_ ) && ( a.col_ == b.col_ ) );
3198 template<
typename MT,
bool SO >
3199 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:1525
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
#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:495
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:4329
Header file for the subtraction trait.
Iterator end()
Returns an iterator just past the last element of the column.
Definition: SparseColumn.h:643
Header file for the SparseVector base class.
ConstIterator cend() const
Returns an iterator just past the last element of the column.
Definition: SparseColumn.h:675
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:4642
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
#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:1406
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
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:1190
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:690
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:365
#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:4615
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:409
Header file for the column base class.
Constraint on the data type.
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseColumn.h:377
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: SparseColumn.h:380
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:366
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:2412
Header file for the Or class template.
Iterator begin()
Returns an iterator to the first element of the column.
Definition: SparseColumn.h:595
void addAssign(const DenseVector< VT, false > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseColumn.h:1462
size_t size() const
Returns the current size/dimension of the sparse column.
Definition: SparseColumn.h:979
size_t nonZeros(const Matrix< MT, SO > &m)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:224
MT::ConstReference ConstReference
Reference to a constant column value.
Definition: SparseColumn.h:371
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:1233
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:271
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:1275
Constraint on the data type.
size_t nonZeros() const
Returns the number of non-zero elements in the column.
Definition: SparseColumn.h:1010
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:2406
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:2410
Header file for the EnableIf class template.
Header file for the serial shim.
Header file for the IsNumeric type trait.
const size_t col_
The index of the column in the matrix.
Definition: SparseColumn.h:496
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:2407
Header file for the IsConst type trait.
void erase(size_t index)
Erasing an element from the sparse column.
Definition: SparseColumn.h:1063
SparseColumn< MT, SO > This
Type of this SparseColumn instance.
Definition: SparseColumn.h:363
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:347
Header file for the addition trait.
ColumnTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseColumn.h:364
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:301
void reserve(size_t n)
Setting the minimum capacity of the sparse column.
Definition: SparseColumn.h:1116
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:331
const VT::ElementType max(const SparseVector< VT, TF > &sv)
Returns the largest element of the sparse vector.
Definition: SparseVector.h:408
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
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:1046
size_t capacity() const
Returns the maximum capacity of the sparse column.
Definition: SparseColumn.h:993
#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:627
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:368
Base template for the DivTrait class.
Definition: DivTrait.h:141
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseColumn.h:367
#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:151
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:250
SparseColumn(MT &matrix, size_t index)
The constructor for SparseColumn.
Definition: SparseColumn.h:536
SparseColumn & operator=(const SparseColumn &rhs)
Copy assignment operator for SparseColumn.
Definition: SparseColumn.h:702
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
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:2403
void reset()
Reset to the default initial values.
Definition: SparseColumn.h:1024
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:562
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant column value.
Definition: SparseColumn.h:374
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2409
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:351
bool canAlias(const Other *alias) const
Returns whether the sparse column can alias with the given address alias.
Definition: SparseColumn.h:1365
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse column.
Definition: SparseColumn.h:1337
bool isAliased(const Other *alias) const
Returns whether the sparse column is aliased with the given address alias.
Definition: SparseColumn.h:1385
size_t extendCapacity() const
Calculating a new sparse column capacity.
Definition: SparseColumn.h:1151
#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
size_t capacity(const Matrix< MT, SO > &m)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:186
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.