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 >
384 explicit inline SparseRow( MT& matrix,
size_t index );
417 template<
typename Other >
419 operator*=( Other rhs );
421 template<
typename Other >
423 operator/=( Other rhs );
430 inline size_t size()
const;
435 inline void erase (
size_t index );
438 inline void reserve(
size_t n );
439 template<
typename Other >
inline SparseRow& scale ( Other scalar );
465 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
466 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
519 template<
typename MT
526 throw std::invalid_argument(
"Invalid row access index" );
545 template<
typename MT
561 template<
typename MT
566 return const_cast<const MT&
>(
matrix_ )(
row_,index);
578 template<
typename MT
594 template<
typename MT
610 template<
typename MT
626 template<
typename MT
642 template<
typename MT
658 template<
typename MT
685 template<
typename MT
695 if(
this == &rhs || ( &
matrix_ == &rhs.matrix_ &&
row_ == rhs.row_ ) )
698 if( size() != rhs.size() )
699 throw std::invalid_argument(
"Row sizes do not match" );
701 if( rhs.canAlias( &
matrix_ ) ) {
728 template<
typename MT
730 template<
typename VT >
739 if( size() != (~rhs).size() )
740 throw std::invalid_argument(
"Vector sizes do not match" );
742 if( (~rhs).canAlias( &
matrix_ ) ) {
767 template<
typename MT
769 template<
typename VT >
778 if( size() != (~rhs).size() )
779 throw std::invalid_argument(
"Vector sizes do not match" );
781 if( (~rhs).canAlias( &
matrix_ ) ) {
808 template<
typename MT
810 template<
typename VT >
815 if( size() != (~rhs).size() )
816 throw std::invalid_argument(
"Vector sizes do not match" );
835 template<
typename MT
837 template<
typename VT >
842 if( size() != (~rhs).size() )
843 throw std::invalid_argument(
"Vector sizes do not match" );
863 template<
typename MT
865 template<
typename VT >
868 if( size() != (~rhs).size() )
869 throw std::invalid_argument(
"Vector sizes do not match" );
876 const MultType tmp( *
this * (~rhs) );
896 template<
typename MT
898 template<
typename Other >
902 for(
Iterator element=begin(); element!=end(); ++element )
903 element->value() *= rhs;
921 template<
typename MT
923 template<
typename Other >
935 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
936 for(
Iterator element=begin(); element!=end(); ++element )
937 element->value() *= tmp;
940 for(
Iterator element=begin(); element!=end(); ++element )
941 element->value() /= rhs;
962 template<
typename MT
976 template<
typename MT
993 template<
typename MT
1007 template<
typename MT
1028 template<
typename MT
1046 template<
typename MT
1063 template<
typename MT
1081 template<
typename MT
1099 template<
typename MT
1114 template<
typename MT
1116 template<
typename Other >
1119 for(
Iterator element=begin(); element!=end(); ++element )
1120 element->value() *= scalar;
1134 template<
typename MT
1141 size_t nonzeros( 2UL*capacity()+1UL );
1142 nonzeros = max( nonzeros, 7UL );
1143 nonzeros = min( nonzeros, size() );
1173 template<
typename MT
1195 template<
typename MT
1216 template<
typename MT
1237 template<
typename MT
1258 template<
typename MT
1279 template<
typename MT
1320 template<
typename MT
1347 template<
typename MT
1349 template<
typename Other >
1352 return static_cast<const void*
>( &
matrix_ ) == static_cast<const void*>( alias );
1367 template<
typename MT
1369 template<
typename Other >
1372 return static_cast<const void*
>( &
matrix_ ) == static_cast<const void*>( alias );
1388 template<
typename MT
1390 template<
typename VT >
1396 for(
size_t j=0UL; j<size(); ++j )
1418 template<
typename MT
1420 template<
typename VT >
1426 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
1427 matrix_.append(
row_, element->index(), element->value() );
1444 template<
typename MT
1446 template<
typename VT >
1457 const AddType tmp( *
this + (~rhs) );
1475 template<
typename MT
1477 template<
typename VT >
1488 const AddType tmp( *
this + (~rhs) );
1507 template<
typename MT
1509 template<
typename VT >
1520 const SubType tmp( *
this - (~rhs) );
1538 template<
typename MT
1540 template<
typename VT >
1551 const SubType tmp( *
this - (~rhs) );
1579 template<
typename MT >
1602 typedef SparseRow<MT,false>
This;
1603 typedef typename RowTrait<MT>::Type
ResultType;
1613 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
1619 template<
typename MatrixType
1620 ,
typename IteratorType >
1631 enum { returnConst = IsConst<MatrixType>::value };
1636 typedef typename SelectType< returnConst, const ElementType&, ElementType& >::Type ReferenceType;
1645 inline RowElement( IteratorType pos,
size_t column )
1657 template<
typename T >
inline RowElement&
operator=(
const T& v ) {
1669 template<
typename T >
inline RowElement& operator+=(
const T& v ) {
1681 template<
typename T >
inline RowElement& operator-=(
const T& v ) {
1693 template<
typename T >
inline RowElement& operator*=(
const T& v ) {
1705 template<
typename T >
inline RowElement& operator/=(
const T& v ) {
1716 inline const RowElement* operator->()
const {
1726 inline ReferenceType value()
const {
1727 return pos_->value();
1736 inline size_t index()
const {
1752 template<
typename MatrixType
1753 ,
typename IteratorType >
1758 typedef std::forward_iterator_tag IteratorCategory;
1759 typedef RowElement<MatrixType,IteratorType> ValueType;
1760 typedef ValueType PointerType;
1761 typedef ValueType ReferenceType;
1762 typedef ptrdiff_t DifferenceType;
1765 typedef IteratorCategory iterator_category;
1766 typedef ValueType value_type;
1767 typedef PointerType pointer;
1768 typedef ReferenceType reference;
1769 typedef DifferenceType difference_type;
1779 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
1800 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column, IteratorType pos )
1815 template<
typename MatrixType2,
typename IteratorType2 >
1816 inline RowIterator(
const RowIterator<MatrixType2,IteratorType2>& it )
1829 inline RowIterator& operator++() {
1845 inline const RowIterator operator++(
int ) {
1846 const RowIterator tmp( *
this );
1857 inline ReferenceType
operator*()
const {
1858 return ReferenceType( pos_,
column_ );
1867 inline PointerType operator->()
const {
1868 return PointerType( pos_,
column_ );
1878 template<
typename MatrixType2,
typename IteratorType2 >
1879 inline bool operator==(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
1880 return ( &
matrix_ == &rhs.matrix_ ) && (
row_ == rhs.row_ ) && (
column_ == rhs.column_ );
1890 template<
typename MatrixType2,
typename IteratorType2 >
1891 inline bool operator!=(
const RowIterator<MatrixType2,IteratorType2>& rhs )
const {
1892 return !( *
this == rhs );
1902 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
1903 size_t counter( 0UL );
1904 for(
size_t j=rhs.column_; j<
column_; ++j ) {
1922 template<
typename MatrixType2,
typename IteratorType2 >
friend class RowIterator;
1923 template<
typename MT2,
bool SO2 >
friend class SparseRow;
1931 typedef RowIterator<const MT,typename MT::ConstIterator>
ConstIterator;
1934 typedef typename SelectType< useConst, ConstIterator, RowIterator<MT,typename MT::Iterator> >::Type
Iterator;
1940 explicit inline SparseRow( MT& matrix,
size_t index );
1968 template<
typename VT >
inline SparseRow& operator+=(
const Vector<VT,true>& rhs );
1969 template<
typename VT >
inline SparseRow& operator-=(
const Vector<VT,true>& rhs );
1970 template<
typename VT >
inline SparseRow& operator*=(
const Vector<VT,true>& rhs );
1972 template<
typename Other >
1973 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
1974 operator*=( Other rhs );
1976 template<
typename Other >
1977 inline typename EnableIf< IsNumeric<Other>,
SparseRow >::Type&
1978 operator/=( Other rhs );
1985 inline size_t size()
const;
1988 inline void reset();
1990 inline void erase (
size_t index );
1993 inline void reserve(
size_t n );
1994 template<
typename Other >
inline SparseRow& scale ( Other scalar );
2020 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2021 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2022 template<
typename VT >
inline void assign (
const DenseVector <VT,true>& rhs );
2023 template<
typename VT >
inline void assign (
const SparseVector<VT,true>& rhs );
2024 template<
typename VT >
inline void addAssign(
const Vector<VT,true>& rhs );
2025 template<
typename VT >
inline void subAssign(
const Vector<VT,true>& rhs );
2067 template<
typename MT >
2073 throw std::invalid_argument(
"Invalid row access index" );
2094 template<
typename MT >
2111 template<
typename MT >
2115 return const_cast<const MT&
>(
matrix_ )(
row_,index);
2129 template<
typename MT >
2146 template<
typename MT >
2163 template<
typename MT >
2180 template<
typename MT >
2197 template<
typename MT >
2214 template<
typename MT >
2242 template<
typename MT >
2243 inline SparseRow<MT,false>& SparseRow<MT,false>::operator=(
const SparseRow& rhs )
2251 if(
this == &rhs || ( &
matrix_ == &rhs.matrix_ &&
row_ == rhs.row_ ) )
2254 if( size() != rhs.size() )
2255 throw std::invalid_argument(
"Row sizes do not match" );
2257 if( rhs.canAlias( &
matrix_ ) ) {
2282 template<
typename MT >
2283 template<
typename VT >
2284 inline SparseRow<MT,false>& SparseRow<MT,false>::operator=(
const Vector<VT,true>& rhs )
2288 if( size() != (~rhs).size() )
2289 throw std::invalid_argument(
"Vector sizes do not match" );
2311 template<
typename MT >
2312 template<
typename VT >
2313 inline SparseRow<MT,false>& SparseRow<MT,false>::operator+=(
const Vector<VT,true>& rhs )
2317 if( size() != (~rhs).size() )
2318 throw std::invalid_argument(
"Vector sizes do not match" );
2339 template<
typename MT >
2340 template<
typename VT >
2341 inline SparseRow<MT,false>& SparseRow<MT,false>::operator-=(
const Vector<VT,true>& rhs )
2345 if( size() != (~rhs).size() )
2346 throw std::invalid_argument(
"Vector sizes do not match" );
2368 template<
typename MT >
2369 template<
typename VT >
2370 inline SparseRow<MT,false>& SparseRow<MT,false>::operator*=(
const Vector<VT,true>& rhs )
2372 if( size() != (~rhs).size() )
2373 throw std::invalid_argument(
"Vector sizes do not match" );
2375 typedef typename MultTrait<ResultType,typename VT::ResultType>::Type MultType;
2380 const MultType tmp( *
this * (~rhs) );
2401 template<
typename MT >
2402 template<
typename Other >
2403 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false> >::Type&
2404 SparseRow<MT,false>::operator*=( Other rhs )
2406 for(
Iterator element=begin(); element!=end(); ++element )
2407 element->value() *= rhs;
2427 template<
typename MT >
2428 template<
typename Other >
2429 inline typename EnableIf< IsNumeric<Other>, SparseRow<MT,false> >::Type&
2430 SparseRow<MT,false>::operator/=( Other rhs )
2434 typedef typename DivTrait<ElementType,Other>::Type DT;
2435 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
2439 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
2440 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
2441 for(
Iterator element=begin(); element!=end(); ++element )
2442 element->value() *= tmp;
2445 for(
Iterator element=begin(); element!=end(); ++element )
2446 element->value() /= rhs;
2469 template<
typename MT >
2470 inline size_t SparseRow<MT,false>::size()
const
2484 template<
typename MT >
2485 inline size_t SparseRow<MT,false>::capacity()
const
2502 template<
typename MT >
2503 inline size_t SparseRow<MT,false>::nonZeros()
const
2505 size_t counter( 0UL );
2506 for(
ConstIterator element=begin(); element!=end(); ++element ) {
2521 template<
typename MT >
2524 for(
size_t j=0UL; j<size(); ++j ) {
2545 template<
typename MT >
2547 SparseRow<MT,false>::insert(
size_t index,
const ElementType& value )
2564 template<
typename MT >
2565 inline void SparseRow<MT,false>::erase(
size_t index )
2582 template<
typename MT >
2585 const size_t column( pos.column_ );
2587 if( column == size() )
2590 matrix_.erase( column, pos.pos_ );
2607 template<
typename MT >
2610 for( ; first!=last; ++first ) {
2611 matrix_.erase( first.column_, first.pos_ );
2629 template<
typename MT >
2630 void SparseRow<MT,false>::reserve(
size_t n )
2646 template<
typename MT >
2647 template<
typename Other >
2648 inline SparseRow<MT,false>& SparseRow<MT,false>::scale( Other scalar )
2650 for(
Iterator element=begin(); element!=end(); ++element )
2651 element->value() *= scalar;
2680 template<
typename MT >
2685 if( pos !=
matrix_.end( index ) )
2708 template<
typename MT >
2713 if( pos !=
matrix_.end( index ) )
2735 template<
typename MT >
2738 for(
size_t i=index; i<size(); ++i )
2765 template<
typename MT >
2768 for(
size_t i=index; i<size(); ++i )
2795 template<
typename MT >
2798 for(
size_t i=index+1UL; i<size(); ++i )
2825 template<
typename MT >
2828 for(
size_t i=index+1UL; i<size(); ++i )
2875 template<
typename MT >
2876 inline void SparseRow<MT,false>::append(
size_t index,
const ElementType& value,
bool check )
2904 template<
typename MT >
2905 template<
typename Other >
2906 inline bool SparseRow<MT,false>::canAlias(
const Other* alias )
const
2908 return static_cast<const void*
>( &
matrix_ ) == static_cast<const void*>( alias );
2921 template<
typename MT >
2922 template<
typename Other >
2923 inline bool SparseRow<MT,false>::isAliased(
const Other* alias )
const
2925 return static_cast<const void*
>( &
matrix_ ) == static_cast<const void*>( alias );
2943 template<
typename MT >
2944 template<
typename VT >
2949 for(
size_t j=0UL; j<(~rhs).size(); ++j ) {
2969 template<
typename MT >
2970 template<
typename VT >
2977 for(
typename VT::ConstIterator element=(~rhs).begin(); element!=(~rhs).end(); ++element ) {
2978 for( ; j<element->index(); ++j )
2982 for( ; j<size(); ++j ) {
3002 template<
typename MT >
3003 template<
typename VT >
3006 typedef typename AddTrait<ResultType,typename VT::ResultType>::Type AddType;
3013 const AddType tmp( *
this + (~rhs) );
3032 template<
typename MT >
3033 template<
typename VT >
3036 typedef typename SubTrait<ResultType,typename VT::ResultType>::Type SubType;
3043 const SubType tmp( *
this - (~rhs) );
3065 template<
typename MT,
bool SO >
3066 inline void reset( SparseRow<MT,SO>& row );
3068 template<
typename MT,
bool SO >
3069 inline void clear( SparseRow<MT,SO>& row );
3071 template<
typename MT,
bool SO >
3072 inline bool isDefault(
const SparseRow<MT,SO>& row );
3084 template<
typename MT
3086 inline void reset( SparseRow<MT,SO>& row )
3102 template<
typename MT
3104 inline void clear( SparseRow<MT,SO>& row )
3129 template<
typename MT
3135 const ConstIterator end( row.end() );
3136 for( ConstIterator element=row.begin(); element!=end; ++element )
3137 if( !
isDefault( element->value() ) )
return false;
3172 template<
typename MT
3174 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >, SparseRow<MT> >::Type
3175 row( SparseMatrix<MT,SO>& sm,
size_t index )
3179 return SparseRow<MT>( ~sm, index );
3205 template<
typename MT
3207 inline typename DisableIf< Or< IsComputation<MT>, IsTransExpr<MT> >, SparseRow<const MT> >::Type
3208 row(
const SparseMatrix<MT,SO>& sm,
size_t index )
3212 return SparseRow<const MT>( ~sm, index );
3227 template<
typename MT,
bool SO >
3228 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:488
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, DenseColumn< MT > >::Type column(DenseMatrix< MT, SO > &dm, size_t index)
Creating a view on a specific column of the given dense matrix.
Definition: DenseColumn.h:3026
Iterator end()
Returns an iterator just past the last element of the row.
Definition: SparseRow.h:628
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:995
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4512
#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:3703
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:1370
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:964
size_t capacity() const
Returns the maximum capacity of the sparse row.
Definition: SparseRow.h:978
void reset()
Reset to the default initial values.
Definition: SparseRow.h:1009
Header file for the View base class.
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:4555
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
#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:2375
Operand matrix_
The sparse matrix containing the row.
Definition: SparseRow.h:487
void erase(size_t index)
Erasing an element from the sparse row.
Definition: SparseRow.h:1048
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:1322
const size_t row_
The first row of the submatrix.
Definition: DenseSubmatrix.h:2793
#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:1350
Iterator upperBound(size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseRow.h:1260
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4528
void assign(const DenseVector< VT, true > &rhs)
Default implementation of the assignment of a dense vector.
Definition: SparseRow.h:1391
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:580
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:660
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:2379
Iterator find(size_t index)
Searches for a specific row element.
Definition: SparseRow.h:1175
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:547
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:687
void addAssign(const DenseVector< VT, true > &rhs)
Default implementation of the addition assignment of a dense vector.
Definition: SparseRow.h:1447
Constraint on the data type.
Constraint on the data type.
Operand matrix_
The dense matrix containing the column.
Definition: DenseColumn.h:2069
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:2373
Constraint on the data type.
Header file for the SelectType class template.
const size_t column_
The first column of the submatrix.
Definition: DenseSubmatrix.h:2794
Constraint on the data type.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2377
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:1510
ColumnIterator< const MT > ConstIterator
Iterator over constant elements.
Definition: DenseColumn.h:1972
void reserve(size_t n)
Setting the minimum capacity of the sparse row.
Definition: SparseRow.h:1101
Header file for the IsNumeric type trait.
Iterator lowerBound(size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseRow.h:1218
const size_t row_
The index of the row in the matrix.
Definition: DenseRow.h:2069
ConstIterator cbegin() const
Returns an iterator to the first element of the row.
Definition: SparseRow.h:612
#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:2374
Header file for the IsConst type trait.
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:1136
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:521
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, DenseRow< MT > >::Type row(DenseMatrix< MT, SO > &dm, size_t index)
Creating a view on a specific row of the given dense matrix.
Definition: DenseRow.h:3025
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:2378
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
Base class for all views.The View class serves as a tag for all views (subvectors, submatrices, rows, columns, ...). All classes that represent a view and that are used within the expression template environment of the Blaze library have to derive from this class in order to qualify as a view. Only in case a class is derived from the View base class, the IsView type trait recognizes the class as valid view.
Definition: View.h:64
Iterator insert(size_t index, const ElementType &value)
Inserting an element into the sparse row.
Definition: SparseRow.h:1031
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:247
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
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
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:2370
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:2376
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
SelectType< useConst, ConstIterator, ColumnIterator< MT > >::Type Iterator
Iterator over non-constant elements.
Definition: DenseColumn.h:1980
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
Operand matrix_
The dense matrix containing the submatrix.
Definition: DenseSubmatrix.h:2792
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.