35 #ifndef _BLAZE_MATH_VIEWS_SPARSEROW_H_
36 #define _BLAZE_MATH_VIEWS_SPARSEROW_H_
337 template<
typename MT
338 ,
bool SO = IsRowMajorMatrix<MT>::value >
339 class SparseRow :
public SparseVector< SparseRow<MT,SO>, true >
383 enum { smpAssignable = 0 };
389 explicit inline SparseRow( MT& matrix,
size_t index );
422 template<
typename Other >
424 operator*=( Other rhs );
426 template<
typename Other >
428 operator/=( Other rhs );
435 inline size_t size()
const;
440 inline void erase (
size_t index );
443 inline void reserve(
size_t n );
444 template<
typename Other >
inline SparseRow& scale ( Other scalar );
470 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
471 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
524 template<
typename MT
531 throw std::invalid_argument(
"Invalid row access index" );
550 template<
typename MT
555 return matrix_(row_,index);
566 template<
typename MT
571 return const_cast<const MT&
>( matrix_ )(row_,index);
583 template<
typename MT
587 return matrix_.begin( row_ );
599 template<
typename MT
603 return matrix_.cbegin( row_ );
615 template<
typename MT
619 return matrix_.cbegin( row_ );
631 template<
typename MT
635 return matrix_.end( row_ );
647 template<
typename MT
651 return matrix_.cend( row_ );
663 template<
typename MT
667 return matrix_.cend( row_ );
690 template<
typename MT
700 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
703 if( size() != rhs.size() )
704 throw std::invalid_argument(
"Row sizes do not match" );
706 if( rhs.canAlias( &matrix_ ) ) {
708 matrix_.reset ( row_ );
709 matrix_.reserve( row_, tmp.nonZeros() );
713 matrix_.reset ( row_ );
714 matrix_.reserve( row_, rhs.nonZeros() );
733 template<
typename MT
735 template<
typename VT >
744 if( size() != (~rhs).size() )
745 throw std::invalid_argument(
"Vector sizes do not match" );
747 if( (~rhs).canAlias( &matrix_ ) ) {
749 matrix_.reset( row_ );
753 matrix_.reset( row_ );
772 template<
typename MT
774 template<
typename VT >
783 if( size() != (~rhs).size() )
784 throw std::invalid_argument(
"Vector sizes do not match" );
786 if( (~rhs).canAlias( &matrix_ ) ) {
788 matrix_.reset ( row_ );
789 matrix_.reserve( row_, tmp.nonZeros() );
793 matrix_.reset ( row_ );
794 matrix_.reserve( row_, (~rhs).nonZeros() );
813 template<
typename MT
815 template<
typename VT >
820 if( size() != (~rhs).size() )
821 throw std::invalid_argument(
"Vector sizes do not match" );
840 template<
typename MT
842 template<
typename VT >
847 if( size() != (~rhs).size() )
848 throw std::invalid_argument(
"Vector sizes do not match" );
868 template<
typename MT
870 template<
typename VT >
873 if( size() != (~rhs).size() )
874 throw std::invalid_argument(
"Vector sizes do not match" );
881 const MultType tmp( *
this * (~rhs) );
882 matrix_.reset( row_ );
901 template<
typename MT
903 template<
typename Other >
907 for(
Iterator element=begin(); element!=end(); ++element )
908 element->value() *= rhs;
926 template<
typename MT
928 template<
typename Other >
940 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
941 for(
Iterator element=begin(); element!=end(); ++element )
942 element->value() *= tmp;
945 for(
Iterator element=begin(); element!=end(); ++element )
946 element->value() /= rhs;
967 template<
typename MT
971 return matrix_.columns();
981 template<
typename MT
985 return matrix_.capacity( row_ );
998 template<
typename MT
1002 return matrix_.nonZeros( row_ );
1012 template<
typename MT
1016 matrix_.reset( row_ );
1033 template<
typename MT
1038 return matrix_.insert( row_, index, value );
1051 template<
typename MT
1055 matrix_.erase( row_, index );
1068 template<
typename MT
1072 return matrix_.erase( row_, pos );
1086 template<
typename MT
1090 return matrix_.erase( row_, first, last );
1104 template<
typename MT
1108 matrix_.reserve( row_, n );
1119 template<
typename MT
1121 template<
typename Other >
1124 for(
Iterator element=begin(); element!=end(); ++element )
1125 element->value() *= scalar;
1139 template<
typename MT
1146 size_t nonzeros( 2UL*capacity()+1UL );
1147 nonzeros = max( nonzeros, 7UL );
1148 nonzeros = min( nonzeros, size() );
1178 template<
typename MT
1182 return matrix_.find( row_, index );
1200 template<
typename MT
1204 return matrix_.find( row_, index );
1221 template<
typename MT
1225 return matrix_.lowerBound( row_, index );
1242 template<
typename MT
1246 return matrix_.lowerBound( row_, index );
1263 template<
typename MT
1267 return matrix_.upperBound( row_, index );
1284 template<
typename MT
1288 return matrix_.upperBound( row_, index );
1325 template<
typename MT
1329 matrix_.append( row_, index, value, check );
1352 template<
typename MT
1354 template<
typename Other >
1357 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1372 template<
typename MT
1374 template<
typename Other >
1377 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
1393 template<
typename MT
1395 template<
typename VT >
1401 for(
size_t j=0UL; j<size(); ++j )
1403 if( matrix_.nonZeros( row_ ) == matrix_.capacity( row_ ) )
1404 matrix_.reserve( row_, extendCapacity() );
1406 matrix_.append( row_, j, (~rhs)[j],
true );
1423 template<
typename MT
1425 template<
typename VT >
1431 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1432 matrix_.append( row_, element->index(), element->value() );
1449 template<
typename MT
1451 template<
typename VT >
1462 const AddType tmp( *
this + (~rhs) );
1463 matrix_.reset( row_ );
1480 template<
typename MT
1482 template<
typename VT >
1493 const AddType tmp( *
this + (~rhs) );
1494 matrix_.reset ( row_ );
1495 matrix_.reserve( row_, tmp.nonZeros() );
1512 template<
typename MT
1514 template<
typename VT >
1525 const SubType tmp( *
this - (~rhs) );
1526 matrix_.reset ( row_ );
1543 template<
typename MT
1545 template<
typename VT >
1556 const SubType tmp( *
this - (~rhs) );
1557 matrix_.reset ( row_ );
1558 matrix_.reserve( row_, tmp.nonZeros() );
1584 template<
typename MT >
1607 typedef SparseRow<MT,false>
This;
1608 typedef typename RowTrait<MT>::Type
ResultType;
1618 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1624 template<
typename MatrixType
1625 ,
typename IteratorType >
1636 enum { returnConst = IsConst<MatrixType>::value };
1641 typedef typename SelectType< returnConst, const ElementType&, ElementType& >::Type ReferenceType;
1650 inline RowElement( IteratorType pos,
size_t column )
1662 template<
typename T >
inline RowElement&
operator=(
const T& v ) {
1674 template<
typename T >
inline RowElement& operator+=(
const T& v ) {
1686 template<
typename T >
inline RowElement& operator-=(
const T& v ) {
1698 template<
typename T >
inline RowElement& operator*=(
const T& v ) {
1710 template<
typename T >
inline RowElement& operator/=(
const T& v ) {
1721 inline const RowElement* operator->()
const {
1731 inline ReferenceType value()
const {
1732 return pos_->value();
1741 inline size_t index()
const {
1757 template<
typename MatrixType
1758 ,
typename IteratorType >
1763 typedef std::forward_iterator_tag IteratorCategory;
1764 typedef RowElement<MatrixType,IteratorType> ValueType;
1765 typedef ValueType PointerType;
1766 typedef ValueType ReferenceType;
1767 typedef ptrdiff_t DifferenceType;
1770 typedef IteratorCategory iterator_category;
1771 typedef ValueType value_type;
1772 typedef PointerType pointer;
1773 typedef ReferenceType reference;
1774 typedef DifferenceType difference_type;
1784 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
1790 for( ; column_<
matrix_.columns(); ++column_ ) {
1792 if( pos_ !=
matrix_.end( column_ ) )
break;
1805 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
1820 template<
typename MatrixType2,
typename IteratorType2 >
1821 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
1824 , column_( it.column_ )
1834 inline RowIterator& operator++() {
1836 for( ; column_<
matrix_.columns(); ++column_ ) {
1838 if( pos_ !=
matrix_.end( column_ ) )
break;
1850 inline const RowIterator operator++(
int ) {
1851 const RowIterator tmp( *
this );
1862 inline ReferenceType
operator*()
const {
1863 return ReferenceType( pos_, column_ );
1872 inline PointerType operator->()
const {
1873 return PointerType( pos_, column_ );
1883 template<
typename MatrixType2,
typename IteratorType2 >
1884 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
1885 return ( &
matrix_ == &rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1895 template<
typename MatrixType2,
typename IteratorType2 >
1896 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
1897 return !( *
this == rhs );
1907 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
1908 size_t counter( 0UL );
1909 for(
size_t j=rhs.column_; j<column_; ++j ) {
1926 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
1927 template<
typename MT2,
bool SO2 >
friend class SparseRow;
1934 typedef RowIterator<const MT,typename MT::ConstIterator>
ConstIterator;
1937 typedef typename SelectType< useConst, ConstIterator, RowIterator<MT,typename MT::Iterator> >::Type
Iterator;
1942 enum { smpAssignable = 0 };
1948 explicit inline SparseRow( MT& matrix,
size_t index );
1976 template<
typename VT >
inline SparseRow& operator+=(
const Vector<VT,true>& rhs );
1977 template<
typename VT >
inline SparseRow& operator-=(
const Vector<VT,true>& rhs );
1978 template<
typename VT >
inline SparseRow& operator*=(
const Vector<VT,true>& rhs );
1980 template<
typename Other >
1981 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
1982 operator*=( Other rhs );
1984 template<
typename Other >
1985 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
1986 operator/=( Other rhs );
1993 inline size_t size()
const;
1996 inline void reset();
1998 inline void erase (
size_t index );
2001 inline void reserve(
size_t n );
2002 template<
typename Other >
inline SparseRow& scale ( Other scalar );
2028 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2029 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2030 template<
typename VT >
inline void assign (
const DenseVector <VT,true>& rhs );
2031 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
2032 template<
typename VT >
inline void addAssign(
const Vector<VT,true>& rhs );
2033 template<
typename VT >
inline void subAssign(
const Vector<VT,true>& rhs );
2073 template<
typename MT >
2079 throw std::invalid_argument(
"Invalid row access index" );
2100 template<
typename MT >
2104 return matrix_(row_,index);
2117 template<
typename MT >
2121 return const_cast<const MT&
>( matrix_ )(row_,index);
2135 template<
typename MT >
2138 return Iterator( matrix_, row_, 0UL );
2152 template<
typename MT >
2169 template<
typename MT >
2186 template<
typename MT >
2189 return Iterator( matrix_, row_, size() );
2203 template<
typename MT >
2220 template<
typename MT >
2248 template<
typename MT >
2257 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
2260 if( size() != rhs.size() )
2261 throw std::invalid_argument(
"Row sizes do not match" );
2263 if( rhs.canAlias( &matrix_ ) ) {
2288 template<
typename MT >
2289 template<
typename VT >
2294 if( size() != (~rhs).size() )
2295 throw std::invalid_argument(
"Vector sizes do not match" );
2317 template<
typename MT >
2318 template<
typename VT >
2319 inline SparseRow<MT,false>& SparseRow<MT,false>::operator+=(
const Vector<VT,true>& rhs )
2323 if( size() != (~rhs).size() )
2324 throw std::invalid_argument(
"Vector sizes do not match" );
2345 template<
typename MT >
2346 template<
typename VT >
2347 inline SparseRow<MT,false>& SparseRow<MT,false>::operator-=(
const Vector<VT,true>& rhs )
2351 if( size() != (~rhs).size() )
2352 throw std::invalid_argument(
"Vector sizes do not match" );
2374 template<
typename MT >
2375 template<
typename VT >
2376 inline SparseRow<MT,false>& SparseRow<MT,false>::operator*=(
const Vector<VT,true>& rhs )
2378 if( size() != (~rhs).size() )
2379 throw std::invalid_argument(
"Vector sizes do not match" );
2381 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
2386 const MultType tmp( *
this * (~rhs) );
2407 template<
typename MT >
2408 template<
typename Other >
2409 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false> >::Type&
2410 SparseRow<MT,false>::operator*=( Other rhs )
2412 for(
Iterator element=begin(); element!=end(); ++element )
2413 element->value() *= rhs;
2433 template<
typename MT >
2434 template<
typename Other >
2435 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false> >::Type&
2436 SparseRow<MT,false>::operator/=( Other rhs )
2440 typedef typename DivTrait<ElementType,Other>::Type DT;
2441 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2445 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2446 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2447 for(
Iterator element=begin(); element!=end(); ++element )
2448 element->value() *= tmp;
2451 for(
Iterator element=begin(); element!=end(); ++element )
2452 element->value() /= rhs;
2475 template<
typename MT >
2478 return matrix_.columns();
2490 template<
typename MT >
2493 return matrix_.columns();
2508 template<
typename MT >
2511 size_t counter( 0UL );
2512 for(
ConstIterator element=begin(); element!=end(); ++element ) {
2527 template<
typename MT >
2530 for(
size_t j=0UL; j<size(); ++j ) {
2531 matrix_.erase( row_, j );
2551 template<
typename MT >
2555 return Iterator( matrix_, row_, index, matrix_.insert( row_, index, value ) );
2570 template<
typename MT >
2573 matrix_.erase( row_, index );
2588 template<
typename MT >
2591 const size_t column( pos.column_ );
2593 if( column == size() )
2596 matrix_.erase( column, pos.pos_ );
2597 return Iterator( matrix_, row_, column+1UL );
2613 template<
typename MT >
2616 for( ; first!=last; ++first ) {
2617 matrix_.erase( first.column_, first.pos_ );
2635 template<
typename MT >
2652 template<
typename MT >
2653 template<
typename Other >
2654 inline SparseRow<MT,false>& SparseRow<MT,false>::scale( Other scalar )
2656 for(
Iterator element=begin(); element!=end(); ++element )
2657 element->value() *= scalar;
2686 template<
typename MT >
2689 const typename MT::Iterator pos( matrix_.find( row_, index ) );
2691 if( pos != matrix_.end( index ) )
2692 return Iterator( matrix_, row_, index, pos );
2714 template<
typename MT >
2719 if( pos != matrix_.end( index ) )
2741 template<
typename MT >
2744 for(
size_t i=index; i<size(); ++i )
2746 const typename MT::Iterator pos( matrix_.find( row_, i ) );
2748 if( pos != matrix_.end( i ) )
2749 return Iterator( matrix_, row_, i, pos );
2771 template<
typename MT >
2774 for(
size_t i=index; i<size(); ++i )
2778 if( pos != matrix_.end( i ) )
2801 template<
typename MT >
2804 for(
size_t i=index+1UL; i<size(); ++i )
2806 const typename MT::Iterator pos( matrix_.find( row_, i ) );
2808 if( pos != matrix_.end( i ) )
2809 return Iterator( matrix_, row_, i, pos );
2831 template<
typename MT >
2834 for(
size_t i=index+1UL; i<size(); ++i )
2838 if( pos != matrix_.end( i ) )
2881 template<
typename MT >
2885 matrix_.insert( row_, index, value );
2910 template<
typename MT >
2911 template<
typename Other >
2914 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2927 template<
typename MT >
2928 template<
typename Other >
2931 return static_cast<const void*
>( &matrix_ ) == static_cast<const void*>( alias );
2949 template<
typename MT >
2950 template<
typename VT >
2955 for(
size_t j=0UL; j<(~rhs).size(); ++j ) {
2956 matrix_(row_,j) = (~rhs)[j];
2975 template<
typename MT >
2976 template<
typename VT >
2983 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2984 for( ; j<element->index(); ++j )
2985 matrix_.erase( row_, j );
2986 matrix_(row_,j++) = element->value();
2988 for( ; j<size(); ++j ) {
2989 matrix_.erase( row_, j );
3008 template<
typename MT >
3009 template<
typename VT >
3012 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3019 const AddType tmp( *
this + (~rhs) );
3038 template<
typename MT >
3039 template<
typename VT >
3042 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3049 const SubType tmp( *
this - (~rhs) );
3071 template<
typename MT,
bool SO >
3072 inline void reset( SparseRow<MT,SO>& row );
3074 template<
typename MT,
bool SO >
3075 inline void clear( SparseRow<MT,SO>& row );
3077 template<
typename MT,
bool SO >
3078 inline bool isDefault(
const SparseRow<MT,SO>& row );
3090 template<
typename MT
3108 template<
typename MT
3135 template<
typename MT
3141 const ConstIterator end( row.end() );
3142 for( ConstIterator element=row.begin(); element!=end; ++element )
3143 if( !
isDefault( element->value() ) )
return false;
3159 template<
typename MT,
bool SO >
3160 struct SubvectorTrait< SparseRow<MT,SO> >
Constraint on the data type.
const size_t row_
The index of the row in the matrix.
Definition: SparseRow.h:493
Iterator end()
Returns an iterator just past the last element of the row.
Definition: SparseRow.h:633
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.
size_t nonZeros() const
Returns the number of non-zero elements in the row.
Definition: SparseRow.h:1000
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
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.
bool isAliased(const Other *alias) const
Returns whether the sparse row is aliased with the given address alias.
Definition: SparseRow.h:1375
Header file for the SparseVector base class.
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseRow.h:365
size_t size() const
Returns the current size/dimension of the sparse row.
Definition: SparseRow.h:969
size_t capacity() const
Returns the maximum capacity of the sparse row.
Definition: SparseRow.h:983
void reset()
Reset to the default initial values.
Definition: SparseRow.h:1014
Header file for the row trait.
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
Header file for the row base class.
#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
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: SparseRow.h:375
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2384
Operand matrix_
The sparse matrix containing the row.
Definition: SparseRow.h:492
void erase(size_t index)
Erasing an element from the sparse row.
Definition: SparseRow.h:1053
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
void append(size_t index, const ElementType &value, bool check=false)
Appending an element to the sparse row.
Definition: SparseRow.h:1327
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:86
#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
bool canAlias(const Other *alias) const
Returns whether the sparse row can alias with the given address alias.
Definition: SparseRow.h:1355
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseRow.h:1265
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
void assign(const DenseVector< VT, true > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseRow.h:1396
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: SparseRow.h:369
Constraint on the data type.
Iterator begin()
Returns an iterator to the first element of the row.
Definition: SparseRow.h:585
Base template for the RowTrait class.
Definition: RowTrait.h:114
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.
Header file for the If class template.
ConstIterator cend() const
Returns an iterator just past the last element of the row.
Definition: SparseRow.h:665
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
Iterator find(size_t index)
Searches for a specific row element.
Definition: SparseRow.h:1180
Header file for the Or class template.
Reference operator[](size_t index)
Subscript operator for the direct access to the row elements.
Definition: SparseRow.h:552
Header file for the subvector trait.
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
SparseRow & operator=(const SparseRow &rhs)
Copy assignment operator for SparseRow.
Definition: SparseRow.h:692
void addAssign(const DenseVector< VT, true > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseRow.h:1452
Constraint on the data type.
Constraint on the data type.
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.
void subAssign(const DenseVector< VT, true > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: SparseRow.h:1515
void reserve(size_t n)
Setting the minimum capacity of the sparse row.
Definition: SparseRow.h:1106
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:103
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseRow.h:1223
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: SparseRow.h:617
#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.
Base class for all rows.The Row class serves as a tag for all rows (i.e. dense and sparse rows)...
Definition: Row.h:63
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
Base template for the MultTrait class.
Definition: MultTrait.h:141
Header file for the addition trait.
Reference to a specific row of a sparse matrix.The SparseRow template represents a reference to a spe...
Definition: Forward.h:52
Header file for the division trait.
size_t extendCapacity() const
Calculating a new sparse row capacity.
Definition: SparseRow.h:1141
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
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
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseRow.h:363
Header file for the reset shim.
SparseRow(MT &matrix, size_t index)
The constructor for SparseRow.
Definition: SparseRow.h:526
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 isDefault shim.
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: SparseRow.h:372
#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
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:141
#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
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: SparseRow.h:345
Header file for the IsRowMajorMatrix type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:147
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse row.
Definition: SparseRow.h:1036
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:248
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:105
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseRow.h:362
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
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.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: TransposeFlag.h:81
SelectType< useConst, ConstIterator, typename MT::Iterator >::Type Iterator
Iterator over non-constant elements.
Definition: SparseRow.h:378
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
MT::ElementType ElementType
Type of the row elements.
Definition: SparseRow.h:364
#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
const SparseRow & CompositeType
Data type for composite expression templates.
Definition: SparseRow.h:366
#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
SparseRow< MT, SO > This
Type of this SparseRow instance.
Definition: SparseRow.h:361
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.