35 #ifndef _BLAZE_MATH_VIEWS_SPARSEROW_H_
36 #define _BLAZE_MATH_VIEWS_SPARSEROW_H_
338 template<
typename MT
339 ,
bool SO = IsRowMajorMatrix<MT>::value >
340 class SparseRow :
public SparseVector< SparseRow<MT,SO>, true >
384 enum { smpAssignable = 0 };
390 explicit inline SparseRow( 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 SparseRow& 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;
501 template<
typename MT2,
bool SO2 >
533 template<
typename MT
540 throw std::invalid_argument(
"Invalid row access index" );
559 template<
typename MT
564 return matrix_(row_,index);
575 template<
typename MT
580 return const_cast<const MT&
>( matrix_ )(row_,index);
592 template<
typename MT
596 return matrix_.begin( row_ );
608 template<
typename MT
612 return matrix_.cbegin( row_ );
624 template<
typename MT
628 return matrix_.cbegin( row_ );
640 template<
typename MT
644 return matrix_.end( row_ );
656 template<
typename MT
660 return matrix_.cend( row_ );
672 template<
typename MT
676 return matrix_.cend( row_ );
699 template<
typename MT
709 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
712 if( size() != rhs.size() )
713 throw std::invalid_argument(
"Row sizes do not match" );
715 if( rhs.canAlias( &matrix_ ) ) {
717 matrix_.reset ( row_ );
718 matrix_.reserve( row_, tmp.nonZeros() );
722 matrix_.reset ( row_ );
723 matrix_.reserve( row_, rhs.nonZeros() );
742 template<
typename MT
744 template<
typename VT >
753 if( size() != (~rhs).size() )
754 throw std::invalid_argument(
"Vector sizes do not match" );
756 if( (~rhs).canAlias( &matrix_ ) ) {
758 matrix_.reset( row_ );
762 matrix_.reset( row_ );
781 template<
typename MT
783 template<
typename VT >
792 if( size() != (~rhs).size() )
793 throw std::invalid_argument(
"Vector sizes do not match" );
795 if( (~rhs).canAlias( &matrix_ ) ) {
797 matrix_.reset ( row_ );
798 matrix_.reserve( row_, tmp.nonZeros() );
802 matrix_.reset ( row_ );
803 matrix_.reserve( row_, (~rhs).
nonZeros() );
822 template<
typename MT
824 template<
typename VT >
829 if( size() != (~rhs).size() )
830 throw std::invalid_argument(
"Vector sizes do not match" );
849 template<
typename MT
851 template<
typename VT >
856 if( size() != (~rhs).size() )
857 throw std::invalid_argument(
"Vector sizes do not match" );
877 template<
typename MT
879 template<
typename VT >
882 if( size() != (~rhs).size() )
883 throw std::invalid_argument(
"Vector sizes do not match" );
890 const MultType tmp( *
this * (~rhs) );
891 matrix_.reset( row_ );
910 template<
typename MT
912 template<
typename Other >
916 for(
Iterator element=begin(); element!=end(); ++element )
917 element->value() *= rhs;
935 template<
typename MT
937 template<
typename Other >
949 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
950 for(
Iterator element=begin(); element!=end(); ++element )
951 element->value() *= tmp;
954 for(
Iterator element=begin(); element!=end(); ++element )
955 element->value() /= rhs;
976 template<
typename MT
980 return matrix_.columns();
990 template<
typename MT
994 return matrix_.capacity( row_ );
1007 template<
typename MT
1011 return matrix_.nonZeros( row_ );
1021 template<
typename MT
1025 matrix_.reset( row_ );
1042 template<
typename MT
1047 return matrix_.insert( row_, index, value );
1060 template<
typename MT
1064 matrix_.erase( row_, index );
1077 template<
typename MT
1081 return matrix_.erase( row_, pos );
1095 template<
typename MT
1099 return matrix_.erase( row_, first, last );
1113 template<
typename MT
1117 matrix_.reserve( row_, n );
1128 template<
typename MT
1130 template<
typename Other >
1133 for(
Iterator element=begin(); element!=end(); ++element )
1134 element->value() *= scalar;
1148 template<
typename MT
1155 size_t nonzeros( 2UL*
capacity()+1UL );
1156 nonzeros = max( nonzeros, 7UL );
1157 nonzeros = min( nonzeros, size() );
1187 template<
typename MT
1191 return matrix_.find( row_, index );
1209 template<
typename MT
1213 return matrix_.find( row_, index );
1230 template<
typename MT
1234 return matrix_.lowerBound( row_, index );
1251 template<
typename MT
1255 return matrix_.lowerBound( row_, index );
1272 template<
typename MT
1276 return matrix_.upperBound( row_, index );
1293 template<
typename MT
1297 return matrix_.upperBound( row_, index );
1334 template<
typename MT
1338 matrix_.append( row_, index, value, check );
1361 template<
typename MT
1363 template<
typename Other >
1366 return matrix_.isAliased( alias );
1381 template<
typename MT
1383 template<
typename Other >
1386 return matrix_.isAliased( alias );
1402 template<
typename MT
1404 template<
typename VT >
1410 for(
size_t j=0UL; j<size(); ++j )
1412 if( matrix_.nonZeros( row_ ) == matrix_.capacity( row_ ) )
1413 matrix_.reserve( row_, extendCapacity() );
1415 matrix_.append( row_, j, (~rhs)[j],
true );
1432 template<
typename MT
1434 template<
typename VT >
1440 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1441 matrix_.append( row_, element->index(), element->value() );
1458 template<
typename MT
1460 template<
typename VT >
1471 const AddType tmp(
serial( *
this + (~rhs) ) );
1472 matrix_.reset( row_ );
1489 template<
typename MT
1491 template<
typename VT >
1502 const AddType tmp(
serial( *
this + (~rhs) ) );
1503 matrix_.reset ( row_ );
1504 matrix_.reserve( row_, tmp.nonZeros() );
1521 template<
typename MT
1523 template<
typename VT >
1534 const SubType tmp(
serial( *
this - (~rhs) ) );
1535 matrix_.reset ( row_ );
1552 template<
typename MT
1554 template<
typename VT >
1565 const SubType tmp(
serial( *
this - (~rhs) ) );
1566 matrix_.reset ( row_ );
1567 matrix_.reserve( row_, tmp.nonZeros() );
1593 template<
typename MT >
1616 typedef SparseRow<MT,false>
This;
1617 typedef typename RowTrait<MT>::Type
ResultType;
1627 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1633 template<
typename MatrixType
1634 ,
typename IteratorType >
1645 enum { returnConst = IsConst<MatrixType>::value };
1650 typedef typename SelectType< returnConst, const ElementType&, ElementType& >::Type ReferenceType;
1659 inline RowElement( IteratorType pos,
size_t column )
1671 template<
typename T >
inline RowElement&
operator=(
const T& v ) {
1683 template<
typename T >
inline RowElement& operator+=(
const T& v ) {
1695 template<
typename T >
inline RowElement& operator-=(
const T& v ) {
1707 template<
typename T >
inline RowElement& operator*=(
const T& v ) {
1719 template<
typename T >
inline RowElement& operator/=(
const T& v ) {
1730 inline const RowElement* operator->()
const {
1740 inline ReferenceType value()
const {
1741 return pos_->value();
1750 inline size_t index()
const {
1766 template<
typename MatrixType
1767 ,
typename IteratorType >
1772 typedef std::forward_iterator_tag IteratorCategory;
1773 typedef RowElement<MatrixType,IteratorType> ValueType;
1774 typedef ValueType PointerType;
1775 typedef ValueType ReferenceType;
1776 typedef ptrdiff_t DifferenceType;
1779 typedef IteratorCategory iterator_category;
1780 typedef ValueType value_type;
1781 typedef PointerType pointer;
1782 typedef ReferenceType reference;
1783 typedef DifferenceType difference_type;
1793 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
1799 for( ; column_<
matrix_.columns(); ++column_ ) {
1801 if( pos_ !=
matrix_.end( column_ ) )
break;
1814 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
1829 template<
typename MatrixType2,
typename IteratorType2 >
1830 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
1833 , column_( it.column_ )
1843 inline RowIterator& operator++() {
1845 for( ; column_<
matrix_.columns(); ++column_ ) {
1847 if( pos_ !=
matrix_.end( column_ ) )
break;
1859 inline const RowIterator operator++(
int ) {
1860 const RowIterator tmp( *
this );
1871 inline ReferenceType
operator*()
const {
1872 return ReferenceType( pos_, column_ );
1881 inline PointerType operator->()
const {
1882 return PointerType( pos_, column_ );
1892 template<
typename MatrixType2,
typename IteratorType2 >
1893 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
1894 return ( &
matrix_ == &rhs.matrix_ ) && (
row_ == rhs.row_ ) && ( column_ == rhs.column_ );
1904 template<
typename MatrixType2,
typename IteratorType2 >
1905 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
1906 return !( *
this == rhs );
1916 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
1917 size_t counter( 0UL );
1918 for(
size_t j=rhs.column_; j<column_; ++j ) {
1935 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
1936 template<
typename MT2,
bool SO2 >
friend class SparseRow;
1943 typedef RowIterator<const MT,typename MT::ConstIterator>
ConstIterator;
1946 typedef typename SelectType< useConst, ConstIterator, RowIterator<MT,typename MT::Iterator> >::Type
Iterator;
1951 enum { smpAssignable = 0 };
1957 explicit inline SparseRow( MT& matrix,
size_t index );
1985 template<
typename VT >
inline SparseRow& operator+=(
const Vector<VT,true>& rhs );
1986 template<
typename VT >
inline SparseRow& operator-=(
const Vector<VT,true>& rhs );
1987 template<
typename VT >
inline SparseRow& operator*=(
const Vector<VT,true>& rhs );
1989 template<
typename Other >
1990 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
1991 operator*=( Other rhs );
1993 template<
typename Other >
1994 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
1995 operator/=( Other rhs );
2002 inline size_t size()
const;
2005 inline void reset();
2007 inline void erase (
size_t index );
2010 inline void reserve(
size_t n );
2011 template<
typename Other >
inline SparseRow& scale ( Other scalar );
2037 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2038 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2040 template<
typename VT >
inline void assign (
const DenseVector <VT,true>& rhs );
2041 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
2042 template<
typename VT >
inline void addAssign(
const Vector<VT,true>& rhs );
2043 template<
typename VT >
inline void subAssign(
const Vector<VT,true>& rhs );
2057 template<
typename MT2,
bool SO2 >
2058 friend bool isSame(
const SparseRow<MT2,SO2>& a,
const SparseRow<MT2,SO2>& b );
2088 template<
typename MT >
2094 throw std::invalid_argument(
"Invalid row access index" );
2115 template<
typename MT >
2119 return matrix_(row_,index);
2132 template<
typename MT >
2136 return const_cast<const MT&
>( matrix_ )(row_,index);
2150 template<
typename MT >
2153 return Iterator( matrix_, row_, 0UL );
2167 template<
typename MT >
2184 template<
typename MT >
2201 template<
typename MT >
2204 return Iterator( matrix_, row_, size() );
2218 template<
typename MT >
2235 template<
typename MT >
2263 template<
typename MT >
2272 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ ) )
2275 if( size() != rhs.size() )
2276 throw std::invalid_argument(
"Row sizes do not match" );
2278 if( rhs.canAlias( &matrix_ ) ) {
2303 template<
typename MT >
2304 template<
typename VT >
2309 if( size() != (~rhs).size() )
2310 throw std::invalid_argument(
"Vector sizes do not match" );
2332 template<
typename MT >
2333 template<
typename VT >
2334 inline SparseRow<MT,false>& SparseRow<MT,false>::operator+=(
const Vector<VT,true>& rhs )
2338 if( size() != (~rhs).size() )
2339 throw std::invalid_argument(
"Vector sizes do not match" );
2360 template<
typename MT >
2361 template<
typename VT >
2362 inline SparseRow<MT,false>& SparseRow<MT,false>::operator-=(
const Vector<VT,true>& rhs )
2366 if( size() != (~rhs).size() )
2367 throw std::invalid_argument(
"Vector sizes do not match" );
2389 template<
typename MT >
2390 template<
typename VT >
2391 inline SparseRow<MT,false>& SparseRow<MT,false>::operator*=(
const Vector<VT,true>& rhs )
2393 if( size() != (~rhs).size() )
2394 throw std::invalid_argument(
"Vector sizes do not match" );
2396 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
2401 const MultType tmp( *
this * (~rhs) );
2422 template<
typename MT >
2423 template<
typename Other >
2424 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false> >::Type&
2425 SparseRow<MT,false>::operator*=( Other rhs )
2427 for(
Iterator element=begin(); element!=end(); ++element )
2428 element->value() *= rhs;
2448 template<
typename MT >
2449 template<
typename Other >
2450 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false> >::Type&
2451 SparseRow<MT,false>::operator/=( Other rhs )
2455 typedef typename DivTrait<ElementType,Other>::Type DT;
2456 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2460 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2461 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2462 for(
Iterator element=begin(); element!=end(); ++element )
2463 element->value() *= tmp;
2466 for(
Iterator element=begin(); element!=end(); ++element )
2467 element->value() /= rhs;
2490 template<
typename MT >
2493 return matrix_.columns();
2505 template<
typename MT >
2508 return matrix_.columns();
2523 template<
typename MT >
2526 size_t counter( 0UL );
2527 for(
ConstIterator element=begin(); element!=end(); ++element ) {
2542 template<
typename MT >
2545 for(
size_t j=0UL; j<size(); ++j ) {
2546 matrix_.erase( row_, j );
2566 template<
typename MT >
2570 return Iterator( matrix_, row_, index, matrix_.insert( row_, index, value ) );
2585 template<
typename MT >
2588 matrix_.erase( row_, index );
2603 template<
typename MT >
2606 const size_t column( pos.column_ );
2608 if( column == size() )
2611 matrix_.erase( column, pos.pos_ );
2612 return Iterator( matrix_, row_, column+1UL );
2628 template<
typename MT >
2631 for( ; first!=last; ++first ) {
2632 matrix_.erase( first.column_, first.pos_ );
2650 template<
typename MT >
2667 template<
typename MT >
2668 template<
typename Other >
2669 inline SparseRow<MT,false>& SparseRow<MT,false>::scale( Other scalar )
2671 for(
Iterator element=begin(); element!=end(); ++element )
2672 element->value() *= scalar;
2701 template<
typename MT >
2704 const typename MT::Iterator pos( matrix_.find( row_, index ) );
2706 if( pos != matrix_.end( index ) )
2707 return Iterator( matrix_, row_, index, pos );
2729 template<
typename MT >
2734 if( pos != matrix_.end( index ) )
2756 template<
typename MT >
2759 for(
size_t i=index; i<size(); ++i )
2761 const typename MT::Iterator pos( matrix_.find( row_, i ) );
2763 if( pos != matrix_.end( i ) )
2764 return Iterator( matrix_, row_, i, pos );
2786 template<
typename MT >
2789 for(
size_t i=index; i<size(); ++i )
2793 if( pos != matrix_.end( i ) )
2816 template<
typename MT >
2819 for(
size_t i=index+1UL; i<size(); ++i )
2821 const typename MT::Iterator pos( matrix_.find( row_, i ) );
2823 if( pos != matrix_.end( i ) )
2824 return Iterator( matrix_, row_, i, pos );
2846 template<
typename MT >
2849 for(
size_t i=index+1UL; i<size(); ++i )
2853 if( pos != matrix_.end( i ) )
2896 template<
typename MT >
2900 matrix_.insert( row_, index, value );
2925 template<
typename MT >
2926 template<
typename Other >
2929 return matrix_.isAliased( alias );
2942 template<
typename MT >
2943 template<
typename Other >
2946 return matrix_.isAliased( alias );
2964 template<
typename MT >
2965 template<
typename VT >
2970 for(
size_t j=0UL; j<(~rhs).size(); ++j ) {
2971 matrix_(row_,j) = (~rhs)[j];
2990 template<
typename MT >
2991 template<
typename VT >
2998 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2999 for( ; j<element->index(); ++j )
3000 matrix_.erase( row_, j );
3001 matrix_(row_,j++) = element->value();
3003 for( ; j<size(); ++j ) {
3004 matrix_.erase( row_, j );
3023 template<
typename MT >
3024 template<
typename VT >
3027 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3034 const AddType tmp(
serial( *
this + (~rhs) ) );
3053 template<
typename MT >
3054 template<
typename VT >
3057 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3064 const SubType tmp(
serial( *
this - (~rhs) ) );
3086 template<
typename MT,
bool SO >
3087 inline void reset( SparseRow<MT,SO>& row );
3089 template<
typename MT,
bool SO >
3090 inline void clear( SparseRow<MT,SO>& row );
3092 template<
typename MT,
bool SO >
3093 inline bool isDefault(
const SparseRow<MT,SO>& row );
3095 template<
typename MT,
bool SO >
3096 inline bool isSame(
const SparseRow<MT,SO>& a,
const SparseRow<MT,SO>& b );
3108 template<
typename MT
3126 template<
typename MT
3153 template<
typename MT
3159 const ConstIterator end( row.end() );
3160 for( ConstIterator element=row.begin(); element!=end; ++element )
3161 if( !
isDefault( element->value() ) )
return false;
3179 template<
typename MT,
bool SO >
3182 return (
isSame( a.matrix_, b.matrix_ ) && ( a.row_ == b.row_ ) );
3197 template<
typename MT,
bool SO >
3198 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:495
Iterator end()
Returns an iterator just past the last element of the row.
Definition: SparseRow.h:642
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:1009
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
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.
bool isAliased(const Other *alias) const
Returns whether the sparse row is aliased with the given address alias.
Definition: SparseRow.h:1384
Header file for the SparseVector base class.
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseRow.h:366
size_t size() const
Returns the current size/dimension of the sparse row.
Definition: SparseRow.h:978
size_t capacity() const
Returns the maximum capacity of the sparse row.
Definition: SparseRow.h:992
void reset()
Reset to the default initial values.
Definition: SparseRow.h:1023
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:4642
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:199
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:376
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2408
Operand matrix_
The sparse matrix containing the row.
Definition: SparseRow.h:494
void erase(size_t index)
Erasing an element from the sparse row.
Definition: SparseRow.h:1062
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:1336
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
#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:1364
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseRow.h:1274
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
void assign(const DenseVector< VT, true > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseRow.h:1405
MT::ConstReference ConstReference
Reference to a constant row value.
Definition: SparseRow.h:370
Constraint on the data type.
Iterator begin()
Returns an iterator to the first element of the row.
Definition: SparseRow.h:594
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:674
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
Iterator find(size_t index)
Searches for a specific row element.
Definition: SparseRow.h:1189
Header file for the Or class template.
size_t nonZeros(const Matrix< MT, SO > &m)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:224
Reference operator[](size_t index)
Subscript operator for the direct access to the row elements.
Definition: SparseRow.h:561
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: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
SparseRow & operator=(const SparseRow &rhs)
Copy assignment operator for SparseRow.
Definition: SparseRow.h:701
void addAssign(const DenseVector< VT, true > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseRow.h:1461
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: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.
void subAssign(const DenseVector< VT, true > &rhs)
Default implementation of the subtraction assignment of a dense vector.
Definition: SparseRow.h:1524
void reserve(size_t n)
Setting the minimum capacity of the sparse row.
Definition: SparseRow.h:1115
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:1232
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: SparseRow.h:626
#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.
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:1150
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
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:364
Header file for the reset shim.
SparseRow(MT &matrix, size_t index)
The constructor for SparseRow.
Definition: SparseRow.h:535
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 isDefault shim.
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant row value.
Definition: SparseRow.h:373
#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:346
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:151
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse row.
Definition: SparseRow.h:1045
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:250
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
RowTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseRow.h:363
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
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:379
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
MT::ElementType ElementType
Type of the row elements.
Definition: SparseRow.h:365
#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:367
#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:362
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.