35 #ifndef _BLAZE_MATH_VIEWS_SPARSESUBMATRIX_H_
36 #define _BLAZE_MATH_VIEWS_SPARSESUBMATRIX_H_
378 template<
typename MT
380 ,
bool SO = IsColumnMajorMatrix<MT>::value >
381 class SparseSubmatrix :
public SparseMatrix< SparseSubmatrix<MT,AF,SO>, SO >
422 ,
typename IteratorType >
530 return pos_->value();
556 ,
typename IteratorType >
601 template<
typename MatrixType2,
typename IteratorType2 >
657 template<
typename MatrixType2,
typename IteratorType2 >
669 template<
typename MatrixType2,
typename IteratorType2 >
671 return !( *
this == rhs );
691 inline IteratorType
base()
const {
724 enum { smpAssignable = MT::smpAssignable };
763 template<
typename Other >
765 operator*=( Other rhs );
767 template<
typename Other >
769 operator/=( Other rhs );
776 inline size_t rows()
const;
779 inline size_t capacity(
size_t i )
const;
781 inline size_t nonZeros(
size_t i )
const;
783 inline void reset(
size_t i );
785 inline void erase(
size_t i,
size_t j );
788 inline void reserve(
size_t nonzeros );
789 void reserve(
size_t i,
size_t nonzeros );
791 inline void trim(
size_t i );
793 template<
typename Other >
inline SparseSubmatrix& scale( Other scalar );
812 inline void append (
size_t i,
size_t j,
const ElementType& value,
bool check=
false );
820 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
821 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
849 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
853 template<
typename MT2,
bool AF2,
bool SO2 >
856 template<
typename MT2,
bool AF2,
bool SO2 >
859 template<
typename MT2,
bool AF2,
bool SO2 >
898 template<
typename MT
908 if( ( row + m > matrix.rows() ) || ( column + n > matrix.columns() ) )
909 throw std::invalid_argument(
"Invalid submatrix specification" );
929 template<
typename MT
938 return matrix_(row_+i,column_+j);
950 template<
typename MT
959 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
975 template<
typename MT
984 return Iterator( matrix_.begin( i + row_ ), column_ );
986 return Iterator( matrix_.lowerBound( i + row_, column_ ), column_ );
1002 template<
typename MT
1010 if( column_ == 0UL )
1011 return ConstIterator( matrix_.cbegin( i + row_ ), column_ );
1013 return ConstIterator( matrix_.lowerBound( i + row_, column_ ), column_ );
1029 template<
typename MT
1037 if( column_ == 0UL )
1038 return ConstIterator( matrix_.cbegin( i + row_ ), column_ );
1040 return ConstIterator( matrix_.lowerBound( i + row_, column_ ), column_ );
1056 template<
typename MT
1064 if( matrix_.columns() == column_ +
n_ )
1065 return Iterator( matrix_.end( i + row_ ), column_ );
1067 return Iterator( matrix_.lowerBound( i + row_, column_ +
n_ ), column_ );
1083 template<
typename MT
1091 if( matrix_.columns() == column_ +
n_ )
1094 return ConstIterator( matrix_.lowerBound( i + row_, column_ +
n_ ), column_ );
1110 template<
typename MT
1118 if( matrix_.columns() == column_ +
n_ )
1121 return ConstIterator( matrix_.lowerBound( i + row_, column_ +
n_ ), column_ );
1145 template<
typename MT
1156 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
1159 if(
rows() != rhs.rows() ||
columns() != rhs.columns() )
1160 throw std::invalid_argument(
"Submatrix sizes do not match" );
1162 if( rhs.canAlias( &matrix_ ) ) {
1187 template<
typename MT
1190 template<
typename MT2
1201 throw std::invalid_argument(
"Matrix sizes do not match" );
1228 template<
typename MT
1231 template<
typename MT2
1242 throw std::invalid_argument(
"Matrix sizes do not match" );
1269 template<
typename MT
1272 template<
typename MT2
1280 throw std::invalid_argument(
"Matrix sizes do not match" );
1299 template<
typename MT
1302 template<
typename MT2
1310 throw std::invalid_argument(
"Matrix sizes do not match" );
1329 template<
typename MT
1332 template<
typename MT2
1338 throw std::invalid_argument(
"Matrix sizes do not match" );
1346 const MultType tmp( *
this * (~rhs) );
1362 template<
typename MT
1365 template<
typename Other >
1369 for(
size_t i=0UL; i<
rows(); ++i ) {
1371 for(
Iterator element=begin(i); element!=last; ++element )
1372 element->value() *= rhs;
1387 template<
typename MT
1390 template<
typename Other >
1402 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1403 for(
size_t i=0UL; i<
rows(); ++i ) {
1405 for(
Iterator element=begin(i); element!=last; ++element )
1406 element->value() *= tmp;
1410 for(
size_t i=0UL; i<
rows(); ++i ) {
1412 for(
Iterator element=begin(i); element!=last; ++element )
1413 element->value() /= rhs;
1435 template<
typename MT
1450 template<
typename MT
1465 template<
typename MT
1470 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
1486 template<
typename MT
1492 return nonZeros( i ) + matrix_.capacity( row_+i ) - matrix_.nonZeros( row_+i );
1502 template<
typename MT
1507 size_t nonzeros( 0UL );
1509 for(
size_t i=0UL; i<
rows(); ++i )
1528 template<
typename MT
1534 return end(i) - begin(i);
1544 template<
typename MT
1549 for(
size_t i=row_; i<row_+
m_; ++i ) {
1550 matrix_.erase( i, matrix_.lowerBound( i, column_ ), matrix_.lowerBound( i, column_+
n_ ) );
1567 template<
typename MT
1573 const size_t index( row_ + i );
1574 matrix_.erase( index, matrix_.lowerBound( index, column_ ), matrix_.lowerBound( index, column_+
n_ ) );
1592 template<
typename MT
1598 return Iterator( matrix_.insert( row_+i, column_+j, value ), column_ );
1612 template<
typename MT
1620 matrix_.erase( row_ + i, column_ + j );
1636 template<
typename MT
1643 return Iterator( matrix_.erase( row_+i, pos.base() ), column_ );
1661 template<
typename MT
1668 return Iterator( matrix_.erase( row_+i, first.base(), last.base() ), column_ );
1683 template<
typename MT
1688 const size_t current(
capacity() );
1690 if( nonzeros > current ) {
1691 matrix_.reserve( matrix_.capacity() + nonzeros - current );
1712 template<
typename MT
1717 const size_t current(
capacity( i ) );
1718 const size_t index ( row_ + i );
1720 if( nonzeros > current ) {
1721 matrix_.reserve( index, matrix_.capacity( index ) + nonzeros - current );
1737 template<
typename MT
1742 for(
size_t i=0UL; i<
rows(); ++i )
1759 template<
typename MT
1765 matrix_.trim( row_ + i );
1781 template<
typename MT
1789 throw std::runtime_error(
"Invalid transpose of a non-quadratic submatrix" );
1805 template<
typename MT
1808 template<
typename Other >
1811 for(
size_t i=0UL; i<
rows(); ++i ) {
1813 for(
Iterator element=begin(i); element!=last; ++element )
1814 element->value() *= scalar;
1845 template<
typename MT
1851 const typename MT::Iterator pos( matrix_.find( row_ + i, column_ + j ) );
1853 if( pos != matrix_.end( row_ + i ) )
1876 template<
typename MT
1884 if( pos != matrix_.end( row_ + i ) )
1907 template<
typename MT
1913 return Iterator( matrix_.lowerBound( row_ + i, column_ + j ), column_ );
1933 template<
typename MT
1939 return ConstIterator( matrix_.lowerBound( row_ + i, column_ + j ), column_ );
1959 template<
typename MT
1965 return Iterator( matrix_.upperBound( row_ + i, column_ + j ), column_ );
1985 template<
typename MT
1991 return ConstIterator( matrix_.upperBound( row_ + i, column_ + j ), column_ );
2051 template<
typename MT
2056 if( column_ +
n_ == matrix_.columns() ) {
2057 matrix_.append( row_ + i, column_ + j, value, check );
2059 else if( !check || !
isDefault( value ) ) {
2060 matrix_.insert( row_ + i, column_ + j, value );
2079 template<
typename MT
2084 matrix_.trim( row_ + i );
2107 template<
typename MT
2110 template<
typename Other >
2113 return matrix_.isAliased( alias );
2128 template<
typename MT
2131 template<
typename Other >
2134 return matrix_.isAliased( alias );
2149 template<
typename MT
2170 template<
typename MT
2173 template<
typename MT2
2182 for(
size_t i=0UL; i<
rows(); ++i ) {
2183 for(
size_t j=0UL; j<
columns(); ++j ) {
2184 append( i, j, (~rhs)(i,j),
true );
2203 template<
typename MT
2206 template<
typename MT2 >
2214 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
2215 for(
typename MT2::ConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element ) {
2216 append( i, element->index(), element->value(), true );
2235 template<
typename MT
2238 template<
typename MT2 >
2247 std::vector<size_t> rowLengths(
m_, 0UL );
2248 for(
size_t j=0UL; j<
n_; ++j ) {
2249 for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2250 ++rowLengths[element->index()];
2254 for(
size_t i=0UL; i<
m_; ++i ) {
2255 reserve( i, rowLengths[i] );
2259 for(
size_t j=0UL; j<
n_; ++j ) {
2260 for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2261 append( element->index(), j, element->value() );
2278 template<
typename MT
2281 template<
typename MT2
2293 const AddType tmp(
serial( *
this + (~rhs) ) );
2311 template<
typename MT
2314 template<
typename MT2
2326 const AddType tmp(
serial( *
this + (~rhs) ) );
2344 template<
typename MT
2347 template<
typename MT2
2359 const SubType tmp(
serial( *
this - (~rhs) ) );
2377 template<
typename MT
2380 template<
typename MT2
2392 const SubType tmp(
serial( *
this - (~rhs) ) );
2419 template<
typename MT
2443 typedef SparseSubmatrix<MT,AF,true>
This;
2444 typedef typename SubmatrixTrait<MT>::Type
ResultType;
2455 typedef typename SelectType< useConst, ConstReference, typename MT::Reference >::Type
Reference;
2462 ,
typename IteratorType >
2463 class SubmatrixElement :
private SparseElement
2473 enum { returnConst = IsConst<MatrixType>::value };
2478 typedef typename SelectType< returnConst, const ElementType&, ElementType& >::Type
ReferenceType;
2569 return pos_->value();
2578 inline size_t index()
const {
2595 ,
typename IteratorType >
2596 class SubmatrixIterator
2601 typedef SubmatrixElement<MatrixType,IteratorType>
ValueType;
2640 template<
typename MatrixType2,
typename IteratorType2 >
2641 inline SubmatrixIterator(
const SubmatrixIterator<MatrixType2,IteratorType2>& it )
2696 template<
typename MatrixType2,
typename IteratorType2 >
2697 inline bool operator==(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
2698 return base() == rhs.base();
2708 template<
typename MatrixType2,
typename IteratorType2 >
2709 inline bool operator!=(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
2710 return !( *
this == rhs );
2721 return pos_ - rhs.pos_;
2730 inline IteratorType
base()
const {
2740 inline size_t offset()
const {
2755 typedef SubmatrixIterator<const MT,typename MT::ConstIterator>
ConstIterator;
2758 typedef typename SelectType< useConst, ConstIterator, SubmatrixIterator<MT,typename MT::Iterator> >::Type
Iterator;
2763 enum { smpAssignable = MT::smpAssignable };
2798 template<
typename MT2,
bool SO >
inline SparseSubmatrix& operator+=(
const Matrix<MT2,SO>& rhs );
2799 template<
typename MT2,
bool SO >
inline SparseSubmatrix& operator-=(
const Matrix<MT2,SO>& rhs );
2800 template<
typename MT2,
bool SO >
inline SparseSubmatrix& operator*=(
const Matrix<MT2,SO>& rhs );
2802 template<
typename Other >
2804 operator*=( Other rhs );
2806 template<
typename Other >
2808 operator/=( Other rhs );
2815 inline size_t rows()
const;
2816 inline size_t columns()
const;
2818 inline size_t capacity(
size_t i )
const;
2820 inline size_t nonZeros(
size_t i )
const;
2821 inline void reset();
2822 inline void reset(
size_t i );
2824 inline void erase(
size_t i,
size_t j );
2827 inline void reserve(
size_t nonzeros );
2828 void reserve(
size_t i,
size_t nonzeros );
2830 inline void trim(
size_t j );
2832 template<
typename Other >
inline SparseSubmatrix& scale( Other scalar );
2851 inline void append (
size_t i,
size_t j,
const ElementType& value,
bool check=
false );
2859 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2860 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2864 template<
typename MT2,
bool SO >
inline void assign (
const DenseMatrix<MT2,SO>& rhs );
2865 template<
typename MT2 >
inline void assign (
const SparseMatrix<MT2,false>& rhs );
2866 template<
typename MT2 >
inline void assign (
const SparseMatrix<MT2,true>& rhs );
2867 template<
typename MT2,
bool SO >
inline void addAssign(
const DenseMatrix<MT2,SO>& rhs );
2868 template<
typename MT2,
bool SO >
inline void addAssign(
const SparseMatrix<MT2,SO>& rhs );
2869 template<
typename MT2,
bool SO >
inline void subAssign(
const DenseMatrix<MT2,SO>& rhs );
2870 template<
typename MT2,
bool SO >
inline void subAssign(
const SparseMatrix<MT2,SO>& rhs );
2887 template<
bool AF1,
typename MT2,
bool AF2,
bool SO2 >
2888 friend const SparseSubmatrix<MT2,AF1,SO2>
2889 submatrix(
const SparseSubmatrix<MT2,AF2,SO2>& sm,
size_t row,
size_t column,
size_t m,
size_t n );
2891 template<
typename MT2,
bool AF2,
bool SO2 >
2892 friend bool isSame(
const SparseSubmatrix<MT2,AF2,SO2>& a,
const SparseMatrix<MT2,SO2>& b );
2894 template<
typename MT2,
bool AF2,
bool SO2 >
2895 friend bool isSame(
const SparseMatrix<MT2,SO2>& a,
const SparseSubmatrix<MT2,AF2,SO2>& b );
2897 template<
typename MT2,
bool AF2,
bool SO2 >
2898 friend bool isSame(
const SparseSubmatrix<MT2,AF2,SO2>& a,
const SparseSubmatrix<MT2,AF2,SO2>& b );
2935 template<
typename MT
2944 if( ( row + m > matrix.rows() ) || ( column + n > matrix.columns() ) )
2945 throw std::invalid_argument(
"Invalid submatrix specification" );
2967 template<
typename MT
2975 return matrix_(row_+i,column_+j);
2989 template<
typename MT
2997 return const_cast<const MT&
>( matrix_ )(row_+i,column_+j);
3010 template<
typename MT
3018 return Iterator( matrix_.begin( j + column_ ), row_ );
3020 return Iterator( matrix_.lowerBound( row_, j + column_ ), row_ );
3033 template<
typename MT
3041 return ConstIterator( matrix_.cbegin( j + column_ ), row_ );
3043 return ConstIterator( matrix_.lowerBound( row_, j + column_ ), row_ );
3056 template<
typename MT
3064 return ConstIterator( matrix_.cbegin( j + column_ ), row_ );
3066 return ConstIterator( matrix_.lowerBound( row_, j + column_ ), row_ );
3079 template<
typename MT
3086 if( matrix_.rows() == row_ +
m_ )
3087 return Iterator( matrix_.end( j + column_ ), row_ );
3089 return Iterator( matrix_.lowerBound( row_ +
m_, j + column_ ), row_ );
3102 template<
typename MT
3109 if( matrix_.rows() == row_ +
m_ )
3112 return ConstIterator( matrix_.lowerBound( row_ +
m_, j + column_ ), row_ );
3125 template<
typename MT
3132 if( matrix_.rows() == row_ +
m_ )
3135 return ConstIterator( matrix_.lowerBound( row_ +
m_, j + column_ ), row_ );
3161 template<
typename MT
3163 inline SparseSubmatrix<MT,AF,true>&
3171 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ && row_ == rhs.row_ && column_ == rhs.column_ ) )
3174 if(
rows() != rhs.rows() ||
columns() != rhs.columns() )
3175 throw std::invalid_argument(
"Submatrix sizes do not match" );
3177 if( rhs.canAlias( &matrix_ ) ) {
3204 template<
typename MT
3206 template<
typename MT2
3208 inline SparseSubmatrix<MT,AF,true>&
3216 throw std::invalid_argument(
"Matrix sizes do not match" );
3218 if( RequiresEvaluation<MT2>::value || (~rhs).canAlias( &matrix_ ) ) {
3245 template<
typename MT
3247 template<
typename MT2
3249 inline SparseSubmatrix<MT,AF,true>&
3258 throw std::invalid_argument(
"Matrix sizes do not match" );
3260 if( RequiresEvaluation<MT2>::value || (~rhs).canAlias( &matrix_ ) ) {
3287 template<
typename MT
3289 template<
typename MT2
3291 inline SparseSubmatrix<MT,AF,true>&
3292 SparseSubmatrix<MT,AF,true>::operator+=(
const Matrix<MT2,SO>& rhs )
3297 throw std::invalid_argument(
"Matrix sizes do not match" );
3318 template<
typename MT
3320 template<
typename MT2
3322 inline SparseSubmatrix<MT,AF,true>&
3323 SparseSubmatrix<MT,AF,true>::operator-=(
const Matrix<MT2,SO>& rhs )
3328 throw std::invalid_argument(
"Matrix sizes do not match" );
3349 template<
typename MT
3351 template<
typename MT2
3353 inline SparseSubmatrix<MT,AF,true>&
3354 SparseSubmatrix<MT,AF,true>::operator*=(
const Matrix<MT2,SO>& rhs )
3357 throw std::invalid_argument(
"Matrix sizes do not match" );
3359 typedef typename MultTrait<ResultType,typename MT2::ResultType>::Type MultType;
3365 const MultType tmp( *
this * (~rhs) );
3383 template<
typename MT
3385 template<
typename Other >
3386 inline typename EnableIf< IsNumeric<Other>, SparseSubmatrix<MT,AF,true> >::Type&
3387 SparseSubmatrix<MT,AF,true>::operator*=( Other rhs )
3389 for(
size_t i=0UL; i<
columns(); ++i ) {
3391 for(
Iterator element=begin(i); element!=last; ++element )
3392 element->value() *= rhs;
3409 template<
typename MT
3411 template<
typename Other >
3412 inline typename EnableIf< IsNumeric<Other>, SparseSubmatrix<MT,AF,true> >::Type&
3413 SparseSubmatrix<MT,AF,true>::operator/=( Other rhs )
3417 typedef typename DivTrait<ElementType,Other>::Type DT;
3418 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
3422 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3423 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3424 for(
size_t i=0UL; i<
columns(); ++i ) {
3426 for(
Iterator element=begin(i); element!=last; ++element )
3427 element->value() *= tmp;
3431 for(
size_t i=0UL; i<
columns(); ++i ) {
3433 for(
Iterator element=begin(i); element!=last; ++element )
3434 element->value() /= rhs;
3458 template<
typename MT
3474 template<
typename MT
3490 template<
typename MT
3494 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
3507 template<
typename MT
3512 return nonZeros( j ) + matrix_.capacity( column_+j ) - matrix_.nonZeros( column_+j );
3524 template<
typename MT
3528 size_t nonzeros( 0UL );
3530 for(
size_t i=0UL; i<
columns(); ++i )
3546 template<
typename MT
3551 return end(j) - begin(j);
3563 template<
typename MT
3567 for(
size_t j=column_; j<column_+
n_; ++j ) {
3568 matrix_.erase( j, matrix_.lowerBound( row_, j ), matrix_.lowerBound( row_+
m_, j ) );
3582 template<
typename MT
3587 const size_t index( column_ + j );
3588 matrix_.erase( index, matrix_.lowerBound( row_, index ), matrix_.lowerBound( row_+
m_, index ) );
3608 template<
typename MT
3613 return Iterator( matrix_.insert( row_+i, column_+j, value ), row_ );
3629 template<
typename MT
3636 matrix_.erase( row_ + i, column_ + j );
3652 template<
typename MT
3658 return Iterator( matrix_.erase( column_+j, pos.base() ), row_ );
3675 template<
typename MT
3681 return Iterator( matrix_.erase( column_+j, first.base(), last.base() ), row_ );
3698 template<
typename MT
3702 const size_t current(
capacity() );
3704 if( nonzeros > current ) {
3705 matrix_.reserve( matrix_.capacity() + nonzeros - current );
3724 template<
typename MT
3728 const size_t current(
capacity( j ) );
3729 const size_t index ( column_ + j );
3731 if( nonzeros > current ) {
3732 matrix_.reserve( index, matrix_.capacity( index ) + nonzeros - current );
3749 template<
typename MT
3753 for(
size_t j=0UL; j<
columns(); ++j )
3771 template<
typename MT
3776 matrix_.trim( column_ + j );
3794 template<
typename MT
3801 throw std::runtime_error(
"Invalid transpose of a non-quadratic submatrix" );
3819 template<
typename MT
3821 template<
typename Other >
3822 inline SparseSubmatrix<MT,AF,true>& SparseSubmatrix<MT,AF,true>::scale( Other scalar )
3824 for(
size_t i=0UL; i<
columns(); ++i ) {
3826 for(
Iterator element=begin(i); element!=last; ++element )
3827 element->value() *= scalar;
3860 template<
typename MT
3865 const typename MT::Iterator pos( matrix_.find( row_ + i, column_ + j ) );
3867 if( pos != matrix_.end( column_ + j ) )
3892 template<
typename MT
3899 if( pos != matrix_.end( column_ + j ) )
3924 template<
typename MT
3929 return Iterator( matrix_.lowerBound( row_ + i, column_ + j ), row_ );
3951 template<
typename MT
3956 return ConstIterator( matrix_.lowerBound( row_ + i, column_ + j ), row_ );
3978 template<
typename MT
3983 return Iterator( matrix_.upperBound( row_ + i, column_ + j ), row_ );
4005 template<
typename MT
4010 return ConstIterator( matrix_.upperBound( row_ + i, column_ + j ), row_ );
4072 template<
typename MT
4076 if( row_ +
m_ == matrix_.rows() ) {
4077 matrix_.append( row_ + i, column_ + j, value, check );
4079 else if( !check || !
isDefault( value ) ) {
4080 matrix_.insert( row_ + i, column_ + j, value );
4101 template<
typename MT
4105 matrix_.trim( column_ + j );
4130 template<
typename MT
4132 template<
typename Other >
4135 return matrix_.isAliased( alias );
4152 template<
typename MT
4154 template<
typename Other >
4157 return matrix_.isAliased( alias );
4174 template<
typename MT
4196 template<
typename MT
4198 template<
typename MT2
4207 for(
size_t j=0UL; j<
columns(); ++j ) {
4208 for(
size_t i=0UL; i<
rows(); ++i ) {
4209 append( i, j, (~rhs)(i,j),
true );
4230 template<
typename MT
4232 template<
typename MT2 >
4241 std::vector<size_t> columnLengths( n_, 0UL );
4242 for(
size_t i=0UL; i<
m_; ++i ) {
4243 for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
4244 ++columnLengths[element->index()];
4248 for(
size_t j=0UL; j<
n_; ++j ) {
4249 reserve( j, columnLengths[j] );
4253 for(
size_t i=0UL; i<
m_; ++i ) {
4254 for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
4255 append( i, element->index(), element->value() );
4274 template<
typename MT
4276 template<
typename MT2 >
4284 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
4285 for(
typename MT2::ConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element ) {
4286 append( element->index(), j, element->value(), true );
4307 template<
typename MT
4309 template<
typename MT2
4313 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
4321 const AddType tmp(
serial( *
this + (~rhs) ) );
4341 template<
typename MT
4343 template<
typename MT2
4347 typedef typename AddTrait<ResultType,typename MT2::ResultType>::Type AddType;
4355 const AddType tmp(
serial( *
this + (~rhs) ) );
4375 template<
typename MT
4377 template<
typename MT2
4381 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
4389 const SubType tmp(
serial( *
this - (~rhs) ) );
4409 template<
typename MT
4411 template<
typename MT2
4415 typedef typename SubTrait<ResultType,typename MT2::ResultType>::Type SubType;
4423 const SubType tmp(
serial( *
this - (~rhs) ) );
4446 template<
typename MT,
bool AF,
bool SO >
4447 inline void reset( SparseSubmatrix<MT,AF,SO>& sm );
4449 template<
typename MT,
bool AF,
bool SO >
4450 inline void clear( SparseSubmatrix<MT,AF,SO>& sm );
4452 template<
typename MT,
bool AF,
bool SO >
4453 inline bool isDefault(
const SparseSubmatrix<MT,AF,SO>& sm );
4455 template<
typename MT,
bool AF,
bool SO >
4456 inline bool isSame(
const SparseSubmatrix<MT,AF,SO>& a,
const SparseMatrix<MT,SO>& b );
4458 template<
typename MT,
bool AF,
bool SO >
4459 inline bool isSame(
const SparseMatrix<MT,SO>& a,
const SparseSubmatrix<MT,AF,SO>& b );
4461 template<
typename MT,
bool AF,
bool SO >
4462 inline bool isSame(
const SparseSubmatrix<MT,AF,SO>& a,
const SparseSubmatrix<MT,AF,SO>& b );
4474 template<
typename MT
4493 template<
typename MT
4521 template<
typename MT
4530 const size_t iend( ( SO ==
rowMajor)?( sm.rows() ):( sm.columns() ) );
4532 for(
size_t i=0UL; i<iend; ++i ) {
4533 for( ConstIterator element=sm.begin(i); element!=sm.end(i); ++element )
4534 if( !
isDefault( element->value() ) )
return false;
4554 template<
typename MT,
bool AF,
bool SO >
4557 return (
isSame( a.matrix_, ~b ) && ( a.rows() == (~b).
rows() ) && ( a.columns() == (~b).
columns() ) );
4574 template<
typename MT,
bool AF,
bool SO >
4577 return (
isSame( ~a, b.matrix_ ) && ( (~a).rows() == b.rows() ) && ( (~a).columns() == b.columns() ) );
4594 template<
typename MT,
bool AF,
bool SO >
4597 return (
isSame( a.matrix_, b.matrix_ ) &&
4598 ( a.row_ == b.row_ ) && ( a.column_ == b.column_ ) &&
4599 ( a.m_ == b.m_ ) && ( a.n_ == b.n_ ) );
4631 inline const SparseSubmatrix<MT,AF1,SO>
4632 submatrix(
const SparseSubmatrix<MT,AF2,SO>& sm,
size_t row,
size_t column,
size_t m,
size_t n )
4636 if( ( row + m > sm.rows() ) || ( column + n > sm.columns() ) )
4637 throw std::invalid_argument(
"Invalid submatrix specification" );
4639 return SparseSubmatrix<MT,AF1,SO>( sm.matrix_, sm.row_ +
row, sm.column_ +
column, m, n );
4655 template<
typename MT,
bool AF,
bool SO >
4656 struct SubmatrixTrait< SparseSubmatrix<MT,AF,SO> >
4674 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
4675 struct SubmatrixExprTrait< SparseSubmatrix<MT,AF1,SO>, AF2 >
4677 typedef SparseSubmatrix<MT,AF2,SO> Type;
4685 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
4686 struct SubmatrixExprTrait< const SparseSubmatrix<MT,AF1,SO>, AF2 >
4688 typedef SparseSubmatrix<MT,AF2,SO> Type;
4696 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
4697 struct SubmatrixExprTrait< volatile SparseSubmatrix<MT,AF1,SO>, AF2 >
4699 typedef SparseSubmatrix<MT,AF2,SO> Type;
4707 template<
typename MT,
bool AF1,
bool SO,
bool AF2 >
4708 struct SubmatrixExprTrait< const volatile SparseSubmatrix<MT,AF1,SO>, AF2 >
4710 typedef SparseSubmatrix<MT,AF2,SO> Type;
4726 template<
typename MT,
bool AF,
bool SO >
4727 struct RowTrait< SparseSubmatrix<MT,AF,SO> >
4745 template<
typename MT,
bool AF,
bool SO >
4746 struct ColumnTrait< SparseSubmatrix<MT,AF,SO> >
MT MatrixType
Type of the matrix.
Definition: Matrix.h:72
const size_t m_
The number of rows of the submatrix.
Definition: SparseSubmatrix.h:842
Constraint on the data type.
Pointer difference type of the Blaze library.
SubmatrixIterator(const SubmatrixIterator< MatrixType2, IteratorType2 > &it)
Conversion constructor from different SubmatrixIterator instances.
Definition: SparseSubmatrix.h:602
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SparseSubmatrix.h:565
IteratorType pos_
Iterator to the current position within the sparse submatrix.
Definition: SparseSubmatrix.h:546
SparseSubmatrix< MT, AF, SO > This
Type of this SparseSubmatrix instance.
Definition: SparseSubmatrix.h:403
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
size_t columns() const
Returns the number of columns of the sparse submatrix.
Definition: SparseSubmatrix.h:1453
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
Iterator lowerBound(size_t i, size_t j)
Returns an iterator to the first index not less then the given index.
Definition: SparseSubmatrix.h:1911
Header file for the subvector/submatrix alignment flag values.
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
Header file for the subtraction trait.
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: SparseSubmatrix.h:1033
Header file for the row trait.
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse submatrix.
Definition: SparseSubmatrix.h:1686
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:117
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
SubmatrixTrait< MT >::Type ResultType
Result type for expression template evaluations.
Definition: SparseSubmatrix.h:404
ReferenceType value() const
Access to the current value of the sparse submatrix element.
Definition: SparseSubmatrix.h:529
#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
size_t offset() const
Access to the offset of the submatrix iterator.
Definition: SparseSubmatrix.h:701
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
IteratorType pos_
Iterator to the current sparse element.
Definition: SparseSubmatrix.h:708
Reference operator()(size_t i, size_t j)
2D-access to the sparse submatrix elements.
Definition: SparseSubmatrix.h:933
Header file for the IsColumnMajorMatrix type trait.
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2555
SelectType< returnConst, const ElementType &, ElementType & >::Type ReferenceType
Return type of the value member function.
Definition: SparseSubmatrix.h:439
void addAssign(const DenseMatrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a dense matrix.
Definition: SparseSubmatrix.h:2283
void reset()
Reset to the default initial values.
Definition: SparseSubmatrix.h:1547
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:118
CompressedMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:249
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
Header file for the RequiresEvaluation type trait.
Iterator find(size_t i, size_t j)
Searches for a specific submatrix element.
Definition: SparseSubmatrix.h:1849
ValueType value_type
Type of the underlying elements.
Definition: SparseSubmatrix.h:569
DifferenceType operator-(const SubmatrixIterator &rhs) const
Calculating the number of elements between two submatrix iterators.
Definition: SparseSubmatrix.h:681
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SparseSubmatrix.h:561
ReferenceType operator*() const
Direct access to the current sparse submatrix element.
Definition: SparseSubmatrix.h:636
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
size_t index() const
Access to the current index of the sparse element.
Definition: SparseSubmatrix.h:539
Base class for all submatrices.The Submatrix class serves as a tag for all submatrices (i...
Definition: Submatrix.h:64
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: SparseSubmatrix.h:1060
size_t capacity() const
Returns the maximum capacity of the sparse submatrix.
Definition: SparseSubmatrix.h:1468
Header file for the SparseMatrix base class.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse submatrix.
Definition: SparseSubmatrix.h:1505
Constraint on the data type.
Header file for the matrix storage order types.
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
ValueType ReferenceType
Reference return type.
Definition: SparseSubmatrix.h:564
Operand matrix_
The sparse matrix containing the submatrix.
Definition: SparseSubmatrix.h:839
size_t offset_
Offset within the according row/column of the sparse matrix.
Definition: SparseSubmatrix.h:547
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: SparseSubmatrix.h:1114
size_t rows() const
Returns the number of rows of the sparse submatrix.
Definition: SparseSubmatrix.h:1438
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
SubmatrixElement< MatrixType, IteratorType > ValueType
Type of the underlying elements.
Definition: SparseSubmatrix.h:562
PointerType operator->() const
Direct access to the current sparse submatrix element.
Definition: SparseSubmatrix.h:646
Header file for the multiplication trait.
SubmatrixElement(IteratorType pos, size_t offset)
Constructor for the SubmatrixElement class.
Definition: SparseSubmatrix.h:448
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
SparseSubmatrix & operator=(const SparseSubmatrix &rhs)
Copy assignment operator for SparseSubmatrix.
Definition: SparseSubmatrix.h:1149
SubmatrixElement & operator-=(const T &v)
Subtraction assignment to the accessed sparse submatrix element.
Definition: SparseSubmatrix.h:484
void append(size_t i, size_t j, const ElementType &value, bool check=false)
Appending an element to the specified row/column of the sparse submatrix.
Definition: SparseSubmatrix.h:2054
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
Header file for the Or class template.
Constraint on the data type.
size_t nonZeros(const Matrix< MT, SO > &m)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:224
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
Access proxy for a specific element of the sparse submatrix.
Definition: SparseSubmatrix.h:423
bool isAliased(const Other *alias) const
Returns whether the submatrix is aliased with the given address alias.
Definition: SparseSubmatrix.h:2132
SubmatrixIterator(IteratorType iterator, size_t index)
Constructor for the SubmatrixIterator class.
Definition: SparseSubmatrix.h:590
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: SparseSubmatrix.h:979
Iterator upperBound(size_t i, size_t j)
Returns an iterator to the first index greater then the given index.
Definition: SparseSubmatrix.h:1963
const size_t row_
The first row of the submatrix.
Definition: SparseSubmatrix.h:840
Header file for the SparseElement base class.
void erase(size_t i, size_t j)
Erasing an element from the sparse submatrix.
Definition: SparseSubmatrix.h:1615
Constraint on the data type.
Constraints on the storage order of matrix types.
MT::ConstReference ConstReference
Reference to a constant submatrix value.
Definition: SparseSubmatrix.h:412
Iterator insert(size_t i, size_t j, const ElementType &value)
Inserting an element into the sparse submatrix.
Definition: SparseSubmatrix.h:1596
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:94
SubmatrixElement & operator/=(const T &v)
Division assignment to the accessed sparse submatrix element.
Definition: SparseSubmatrix.h:508
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2406
Constraint on the data type.
Header file for the SelectType class template.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2410
size_t offset_
The offset of the according row/column of the sparse matrix.
Definition: SparseSubmatrix.h:709
Header file for the EnableIf class template.
SubmatrixIterator & operator++()
Pre-increment operator.
Definition: SparseSubmatrix.h:613
SubmatrixIterator()
Default constructor for the SubmatrixIterator class.
Definition: SparseSubmatrix.h:578
Header file for the serial shim.
const size_t n_
The number of columns of the submatrix.
Definition: SparseSubmatrix.h:843
SelectType< useConst, ConstReference, typename MT::Reference >::Type Reference
Reference to a non-constant submatrix value.
Definition: SparseSubmatrix.h:415
bool canSMPAssign() const
Returns whether the submatrix can be used in SMP assignments.
Definition: SparseSubmatrix.h:2152
const bool unaligned
Alignment flag for unaligned subvectors and submatrices.
Definition: AlignmentFlag.h:63
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
ValueType PointerType
Pointer return type.
Definition: SparseSubmatrix.h:563
Header file for the SubmatrixExprTrait class template.
#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.
SelectType< IsExpression< MT >::value, MT, MT & >::Type Operand
Composite data type of the dense matrix expression.
Definition: SparseSubmatrix.h:387
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:141
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SparseSubmatrix.h:405
Base template for the MultTrait class.
Definition: MultTrait.h:141
Header file for the addition trait.
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
Header file for the submatrix trait.
const SubmatrixIterator operator++(int)
Post-increment operator.
Definition: SparseSubmatrix.h:624
bool operator==(const SubmatrixIterator< MatrixType2, IteratorType2 > &rhs) const
Equality comparison between two SubmatrixIterator objects.
Definition: SparseSubmatrix.h:658
bool operator!=(const SubmatrixIterator< MatrixType2, IteratorType2 > &rhs) const
Inequality comparison between two SubmatrixIterator objects.
Definition: SparseSubmatrix.h:670
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
View on a specific submatrix of a sparse matrix.The SparseSubmatrix template represents a view on a s...
Definition: Forward.h:53
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
void assign(const DenseMatrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a dense matrix.
Definition: SparseSubmatrix.h:2175
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2411
IteratorType base() const
Access to the current position of the submatrix iterator.
Definition: SparseSubmatrix.h:691
Header file for the column trait.
Header file for the isDefault shim.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:87
SelectType< useConst, ConstIterator, SubmatrixIterator< MT, typename MT::Iterator > >::Type Iterator
Iterator over non-constant elements.
Definition: SparseSubmatrix.h:719
SparseSubmatrix & transpose()
Transposing the submatrix.
Definition: SparseSubmatrix.h:1784
Base class for all sparse element types.The SparseElement class is the base class for all sparse elem...
Definition: SparseElement.h:57
SubmatrixElement & operator*=(const T &v)
Multiplication assignment to the accessed sparse submatrix element.
Definition: SparseSubmatrix.h:496
#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
Iterator over the elements of the sparse submatrix.
Definition: SparseSubmatrix.h:557
const size_t column_
The first column of the submatrix.
Definition: SparseSubmatrix.h:841
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
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2556
SubmatrixExprTrait< MT, unaligned >::Type submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:136
MT::ElementType ElementType
Type of the submatrix elements.
Definition: SparseSubmatrix.h:407
ReferenceType reference
Reference return type.
Definition: SparseSubmatrix.h:571
void subAssign(const DenseMatrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a dense matrix.
Definition: SparseSubmatrix.h:2349
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SparseSubmatrix.h:406
PointerType pointer
Pointer return type.
Definition: SparseSubmatrix.h:570
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:907
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:250
#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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: SparseSubmatrix.h:2082
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:170
Header file for basic type definitions.
const SubmatrixElement * operator->() const
Direct access to the sparse submatrix element at the current iterator position.
Definition: SparseSubmatrix.h:519
SubmatrixIterator< const MT, typename MT::ConstIterator > ConstIterator
Iterator over constant elements.
Definition: SparseSubmatrix.h:716
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2409
Base template for the SubTrait class.
Definition: SubTrait.h:141
Header file for the Submatrix base class.
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: SparseSubmatrix.h:408
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a N-dimensional matrix type...
Definition: Matrix.h:79
SubmatrixElement & operator=(const T &v)
Assignment to the accessed sparse submatrix element.
Definition: SparseSubmatrix.h:460
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:154
SubmatrixElement & operator+=(const T &v)
Addition assignment to the accessed sparse submatrix element.
Definition: SparseSubmatrix.h:472
#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
SparseSubmatrix(Operand matrix, size_t row, size_t column, size_t m, size_t n)
The constructor for SparseSubmatrix.
Definition: SparseSubmatrix.h:901
const SparseSubmatrix & CompositeType
Data type for composite expression templates.
Definition: SparseSubmatrix.h:409
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.
IteratorCategory iterator_category
The iterator category.
Definition: SparseSubmatrix.h:568
Constraint on the data type.
Header file for the FunctionTrace class.
bool canAlias(const Other *alias) const
Returns whether the submatrix can alias with the given address alias.
Definition: SparseSubmatrix.h:2111
DifferenceType difference_type
Difference between two iterators.
Definition: SparseSubmatrix.h:572
void trim()
Removing all excessive capacity from all rows/columns.
Definition: SparseSubmatrix.h:1740