35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDMATRIX_H_ 36 #define _BLAZE_MATH_SPARSE_COMPRESSEDMATRIX_H_ 214 template<
typename Type
215 ,
bool SO = defaultStorageOrder >
236 explicit Element() =
default;
237 Element(
const Element& rhs ) =
default;
238 Element( Element&& rhs ) =
default;
242 inline Element&
operator=(
const Element& rhs )
244 this->value_ = rhs.value_;
248 inline Element&
operator=( Element&& rhs )
250 this->value_ = std::move( rhs.value_ );
254 template<
typename Other >
258 this->value_ = rhs.value();
262 template<
typename Other >
267 this->value_ = std::move( rhs.value() );
271 template<
typename Other >
279 template<
typename Other >
281 , IsRValueReference<Other&&> >, Element& >
284 this->value_ = std::move( v );
315 template<
typename NewType >
324 template<
size_t NewM
345 explicit CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros );
379 inline CompressedMatrix&
operator=(
const CompressedMatrix& rhs );
380 inline CompressedMatrix&
operator=( CompressedMatrix&& rhs ) noexcept;
386 template<
typename MT,
bool SO2 >
inline CompressedMatrix& operator%=(
const DenseMatrix<MT,SO2>& rhs );
387 template<
typename MT,
bool SO2 >
inline CompressedMatrix& operator%=(
const SparseMatrix<MT,SO2>& rhs );
390 template<
typename Other >
393 template<
typename Other >
401 inline size_t rows()
const noexcept;
402 inline size_t columns()
const noexcept;
403 inline size_t capacity()
const noexcept;
404 inline size_t capacity(
size_t i )
const noexcept;
406 inline size_t nonZeros(
size_t i )
const;
408 inline void reset(
size_t i );
410 void resize (
size_t m,
size_t n,
bool preserve=
true );
411 inline void reserve(
size_t nonzeros );
412 void reserve(
size_t i,
size_t nonzeros );
414 inline void trim (
size_t i );
416 inline void swap( CompressedMatrix& sm ) noexcept;
423 inline Iterator set (
size_t i,
size_t j,
const Type& value );
425 inline void append (
size_t i,
size_t j,
const Type& value,
bool check=
false );
433 inline void erase(
size_t i,
size_t j );
437 template<
typename Pred >
438 inline void erase( Pred predicate );
440 template<
typename Pred >
463 template<
typename Other >
inline CompressedMatrix& scale(
const Other& scalar );
464 template<
typename Other >
inline CompressedMatrix& scaleDiagonal(
const Other& scalar );
471 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
472 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
540 template<
typename Type,
bool SO >
555 template<
typename Type
575 template<
typename Type
584 for(
size_t i=0UL; i<2UL*
m_+2UL; ++i )
599 template<
typename Type
608 begin_[0UL] = allocate<Element>( nonzeros );
609 for(
size_t i=1UL; i<(2UL*
m_+1UL); ++i )
627 template<
typename Type
636 BLAZE_USER_ASSERT( nonzeros.size() == m,
"Size of capacity vector and number of rows don't match" );
638 size_t newCapacity( 0UL );
639 for( std::vector<size_t>::const_iterator it=nonzeros.begin(); it!=nonzeros.end(); ++it )
642 begin_[0UL] =
end_[0UL] = allocate<Element>( newCapacity );
643 for(
size_t i=0UL; i<
m_; ++i ) {
655 template<
typename Type
664 const size_t nonzeros( sm.
nonZeros() );
666 begin_[0UL] = allocate<Element>( nonzeros );
667 for(
size_t i=0UL; i<
m_; ++i ) {
669 begin_[i+1UL] =
end_[i];
671 end_[
m_] = begin_[0UL]+nonzeros;
681 template<
typename Type
704 template<
typename Type
706 template<
typename MT
717 for(
size_t i=0UL; i<2UL*
m_+2UL; ++i )
730 template<
typename Type
732 template<
typename MT
743 const size_t nonzeros( (~sm).
nonZeros() );
745 begin_[0UL] = allocate<Element>( nonzeros );
746 for(
size_t i=0UL; i<
m_; ++i )
766 template<
typename Type
799 template<
typename Type
822 template<
typename Type
832 if( pos ==
end_[i] || pos->index_ != j )
853 template<
typename Type
880 template<
typename Type
907 template<
typename Type
929 template<
typename Type
951 template<
typename Type
973 template<
typename Type
995 template<
typename Type
1017 template<
typename Type
1045 template<
typename Type
1050 if( &rhs ==
this )
return *
this;
1052 const size_t nonzeros( rhs.
nonZeros() );
1059 newBegin[0UL] = allocate<Element>( nonzeros );
1060 for(
size_t i=0UL; i<rhs.
m_; ++i ) {
1062 newBegin[i+1UL] = newEnd[i];
1064 newEnd[rhs.
m_] = newBegin[0UL]+nonzeros;
1070 if( newBegin !=
nullptr ) {
1076 for(
size_t i=0UL; i<rhs.
m_; ++i ) {
1096 template<
typename Type
1101 if(
begin_ !=
nullptr ) {
1114 rhs.capacity_ = 0UL;
1115 rhs.begin_ =
nullptr;
1132 template<
typename Type
1134 template<
typename MT
1139 using blaze::assign;
1164 template<
typename Type
1166 template<
typename MT
1171 using blaze::assign;
1200 template<
typename Type
1202 template<
typename MT
1207 using blaze::addAssign;
1229 template<
typename Type
1231 template<
typename MT
1235 using blaze::subAssign;
1258 template<
typename Type
1260 template<
typename MT
1265 using blaze::schurAssign;
1296 template<
typename Type
1298 template<
typename MT
1325 template<
typename Type
1327 template<
typename MT
1332 if( (~rhs).
rows() !=
n_ ) {
1351 template<
typename Type
1353 template<
typename Other >
1357 for(
size_t i=0UL; i<
m_; ++i ) {
1360 element->value_ *= rhs;
1374 template<
typename Type
1376 template<
typename Other >
1388 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1389 for(
size_t i=0UL; i<
m_; ++i ) {
1392 element->value_ *= tmp;
1396 for(
size_t i=0UL; i<
m_; ++i ) {
1399 element->value_ /= rhs;
1421 template<
typename Type
1435 template<
typename Type
1449 template<
typename Type
1471 template<
typename Type
1486 template<
typename Type
1490 size_t nonzeros( 0UL );
1492 for(
size_t i=0UL; i<
m_; ++i )
1511 template<
typename Type
1526 template<
typename Type
1530 for(
size_t i=0UL; i<
m_; ++i )
1547 template<
typename Type
1564 template<
typename Type
1568 if(
end_ !=
nullptr )
1591 template<
typename Type
1598 if( m ==
m_ && n ==
n_ )
return;
1605 for(
size_t i=0UL; i<2UL*m+2UL; ++i ) {
1614 Iterator* newEnd ( newBegin+m+1UL );
1616 newBegin[0UL] =
begin_[0UL];
1619 for(
size_t i=0UL; i<
m_; ++i ) {
1620 newEnd [i] =
end_ [i];
1621 newBegin[i+1UL] =
begin_[i+1UL];
1623 for(
size_t i=m_; i<m; ++i ) {
1624 newBegin[i+1UL] = newEnd[i] =
begin_[
m_];
1628 for(
size_t i=0UL; i<m; ++i ) {
1629 newBegin[i+1UL] = newEnd[i] =
begin_[0UL];
1645 for(
size_t i=0UL; i<
m_; ++i )
1649 for(
size_t i=
m_; i<m; ++i ) {
1656 for(
size_t i=0UL; i<m; ++i )
1660 for(
size_t i=0UL; i<m; ++i )
1686 template<
typename Type
1710 template<
typename Type
1719 const size_t current(
capacity(i) );
1721 if( current >= nonzeros )
return;
1723 const ptrdiff_t additional( nonzeros - current );
1727 const size_t newCapacity(
begin_[
m_] -
begin_[0UL] + additional );
1733 newBegin[0UL] = allocate<Element>( newCapacity );
1734 newEnd [
m_ ] = newBegin[0UL]+newCapacity;
1736 for(
size_t k=0UL; k<i; ++k ) {
1738 newBegin[k+1UL] = newBegin[k] +
capacity(k);
1741 newBegin[i+1UL] = newBegin[i] + nonzeros;
1742 for(
size_t k=i+1UL; k<
m_; ++k ) {
1744 newBegin[k+1UL] = newBegin[k] +
capacity(k);
1758 for(
size_t j=
m_-1UL; j>i; --j ) {
1760 end_ [j] += additional;
1780 template<
typename Type
1784 for(
size_t i=0UL; i<
m_; ++i )
1801 template<
typename Type
1807 if( i < (
m_ - 1UL ) )
1823 template<
typename Type
1840 template<
typename Type
1861 template<
typename Type
1865 size_t nonzeros( 2UL*
capacity()+1UL );
1881 template<
typename Type
1888 newBegin[0UL] = allocate<Element>( nonzeros );
1890 for(
size_t k=0UL; k<
m_; ++k ) {
1893 newBegin[k+1UL] = newBegin[k] + (
begin_[k+1UL] -
begin_[k] );
1896 newEnd[
m_] = newBegin[0UL]+nonzeros;
1901 if( newBegin !=
nullptr ) {
1917 template<
typename Type
1922 return static_cast<Iterator>( it );
1935 template<
typename Type
1965 template<
typename Type
1975 if( pos !=
end_[i] && pos->index_ == j ) {
1976 pos->value() = value;
1979 else return insert( pos, i, j, value );
1997 template<
typename Type
2007 if( pos !=
end_[i] && pos->index_ == j ) {
2011 return insert( pos, i, j, value );
2026 template<
typename Type
2033 pos->value_ = value;
2042 pos->value_ = value;
2045 for(
size_t k=i+1UL; k<
m_+1UL; ++k ) {
2058 newBegin[0UL] = allocate<Element>( newCapacity );
2060 for(
size_t k=0UL; k<i; ++k ) {
2061 const size_t nonzeros(
end_[k] -
begin_[k] );
2063 newEnd [k] = newBegin[k] + nonzeros;
2064 newBegin[k+1UL] = newBegin[k] + total;
2066 newEnd [i] = newBegin[i] + (
end_[i] -
begin_[i] ) + 1;
2067 newBegin[i+1UL] = newBegin[i] + (
begin_[i+1] -
begin_[i] ) + 1;
2068 for(
size_t k=i+1UL; k<
m_; ++k ) {
2069 const size_t nonzeros(
end_[k] -
begin_[k] );
2071 newEnd [k] = newBegin[k] + nonzeros;
2072 newBegin[k+1UL] = newBegin[k] + total;
2075 newEnd[
m_] = newEnd[
capacity_] = newBegin[0UL]+newCapacity;
2078 tmp->value_ = value;
2080 std::move( pos,
end_[m_-1UL],
castUp( tmp+1UL ) );
2146 template<
typename Type
2155 end_[i]->value_ = value;
2157 if( !check || !isDefault<strict>(
end_[i]->value_ ) ) {
2158 end_[i]->index_ = j;
2178 template<
typename Type
2208 template<
typename Type
2216 if( pos !=
end_[i] )
2233 template<
typename Type
2241 if( pos !=
end_[i] )
2261 template<
typename Type
2300 template<
typename Type
2302 template<
typename Pred >
2305 for(
size_t i=0UL; i<
m_; ++i ) {
2307 [predicate=predicate](
const ElementBase& element) {
2308 return predicate( element.
value() );
2342 template<
typename Type
2344 template<
typename Pred >
2352 const auto pos = std::remove_if(
castUp( first ),
castUp( last ),
2353 [predicate=predicate](
const ElementBase& element ) {
2354 return predicate( element.
value() );
2385 template<
typename Type
2390 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( i, j ) );
2410 template<
typename Type
2416 if( pos !=
end_[i] && pos->index_ == j )
2418 else return end_[i];
2438 template<
typename Type
2463 template<
typename Type
2469 return std::lower_bound(
begin_[i],
end_[i], j,
2470 [](
const Element& element,
size_t index )
2472 return element.index() < index;
2493 template<
typename Type
2518 template<
typename Type
2524 return std::upper_bound(
begin_[i],
end_[i], j,
2525 [](
size_t index,
const Element& element )
2527 return index < element.index();
2546 template<
typename Type
2562 template<
typename Type
2590 template<
typename Type
2592 template<
typename Other >
2595 for(
size_t i=0UL; i<
m_; ++i )
2597 element->value_ *= scalar;
2613 template<
typename Type
2615 template<
typename Other >
2620 for(
size_t i=0UL; i<
size; ++i ) {
2622 if( pos !=
end_[i] && pos->index_ == i )
2623 pos->value_ *= scalar;
2649 template<
typename Type
2651 template<
typename Other >
2654 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2669 template<
typename Type
2671 template<
typename Other >
2674 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2689 template<
typename Type
2709 template<
typename Type
2711 template<
typename MT
2718 if(
m_ == 0UL ||
n_ == 0UL )
2721 size_t nonzeros( 0UL );
2723 for(
size_t i=1UL; i<=
m_; ++i )
2726 for(
size_t i=0UL; i<
m_; ++i )
2737 for(
size_t j=jbegin; j<jend; ++j )
2741 for(
size_t k=i+1UL; k<=
m_; ++k )
2745 end_[i]->value_ = (~rhs)(i,j);
2747 if( !isDefault<strict>(
end_[i]->value_ ) ) {
2748 end_[i]->index_ = j;
2771 template<
typename Type
2773 template<
typename MT >
2781 if(
m_ == 0UL ||
begin_[0] ==
nullptr )
2784 for(
size_t i=0UL; i<
m_; ++i ) {
2803 template<
typename Type
2805 template<
typename MT >
2818 std::vector<size_t> rowLengths(
m_, 0UL );
2819 for(
size_t j=0UL; j<
n_; ++j ) {
2820 for( RhsIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2821 ++rowLengths[element->index()];
2825 for(
size_t i=0UL; i<
m_; ++i ) {
2830 for(
size_t j=0UL; j<
n_; ++j ) {
2831 for( RhsIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2832 append( element->index(), j, element->value() );
2849 template<
typename Type
2851 template<
typename MT
2875 template<
typename Type
2877 template<
typename MT
2901 template<
typename Type
2903 template<
typename MT
2927 template<
typename Type
2929 template<
typename MT
2953 template<
typename Type
2955 template<
typename MT
2964 for(
size_t i=0UL; i<
m_; ++i ) {
2967 element->value_ *= (~rhs)(i,element->index_);
2993 template<
typename Type >
2995 :
public SparseMatrix< CompressedMatrix<Type,true>, true >
3014 explicit Element() =
default;
3015 Element(
const Element& rhs ) =
default;
3016 Element( Element&& rhs ) =
default;
3020 inline Element&
operator=(
const Element& rhs )
3022 this->value_ = rhs.value_;
3026 inline Element&
operator=( Element&& rhs )
3028 this->value_ = std::move( rhs.value_ );
3032 template<
typename Other >
3036 this->value_ = rhs.value();
3040 template<
typename Other >
3045 this->value_ = std::move( rhs.value() );
3049 template<
typename Other >
3057 template<
typename Other >
3059 , IsRValueReference<Other&&> >, Element& >
3062 this->value_ = std::move( v );
3093 template<
typename NewType >
3102 template<
size_t NewM
3123 explicit CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros );
3157 inline CompressedMatrix&
operator=(
const CompressedMatrix& rhs );
3158 inline CompressedMatrix&
operator=( CompressedMatrix&& rhs ) noexcept;
3164 template<
typename MT,
bool SO >
inline CompressedMatrix& operator%=(
const DenseMatrix<MT,SO>& rhs );
3165 template<
typename MT,
bool SO >
inline CompressedMatrix& operator%=(
const SparseMatrix<MT,SO>& rhs );
3168 template<
typename Other >
3169 inline EnableIf_< IsNumeric<Other>, CompressedMatrix >& operator*=(
Other rhs );
3171 template<
typename Other >
3172 inline EnableIf_< IsNumeric<Other>, CompressedMatrix >&
operator/=(
Other rhs );
3179 inline size_t rows()
const noexcept;
3180 inline size_t columns()
const noexcept;
3181 inline size_t capacity()
const noexcept;
3182 inline size_t capacity(
size_t j )
const noexcept;
3184 inline size_t nonZeros(
size_t j )
const;
3185 inline void reset();
3186 inline void reset(
size_t j );
3187 inline void clear();
3188 void resize (
size_t m,
size_t n,
bool preserve=
true );
3189 inline void reserve(
size_t nonzeros );
3190 void reserve(
size_t j,
size_t nonzeros );
3191 inline void trim ();
3192 inline void trim (
size_t j );
3194 inline void swap( CompressedMatrix& sm ) noexcept;
3201 inline Iterator set (
size_t i,
size_t j,
const Type& value );
3202 inline Iterator insert (
size_t i,
size_t j,
const Type& value );
3203 inline void append (
size_t i,
size_t j,
const Type& value,
bool check=
false );
3211 inline void erase(
size_t i,
size_t j );
3215 template<
typename Pred >
3216 inline void erase( Pred predicate );
3218 template<
typename Pred >
3241 template<
typename Other >
inline CompressedMatrix& scale(
const Other& scalar );
3242 template<
typename Other >
inline CompressedMatrix& scaleDiagonal(
const Other& scalar );
3249 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
3250 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
3319 template<
typename Type >
3335 template<
typename Type >
3356 template<
typename Type >
3364 for(
size_t j=0UL; j<2UL*
n_+2UL; ++j )
3381 template<
typename Type >
3389 begin_[0UL] = allocate<Element>( nonzeros );
3390 for(
size_t j=1UL; j<(2UL*
n_+1UL); ++j )
3409 template<
typename Type >
3417 BLAZE_USER_ASSERT( nonzeros.size() == n,
"Size of capacity vector and number of columns don't match" );
3419 size_t newCapacity( 0UL );
3420 for( std::vector<size_t>::const_iterator it=nonzeros.begin(); it!=nonzeros.end(); ++it )
3423 begin_[0UL] =
end_[0UL] = allocate<Element>( newCapacity );
3424 for(
size_t j=0UL; j<
n_; ++j ) {
3438 template<
typename Type >
3446 const size_t nonzeros( sm.
nonZeros() );
3448 begin_[0UL] = allocate<Element>( nonzeros );
3449 for(
size_t j=0UL; j<
n_; ++j ) {
3450 end_[j] = castDown( std::copy( sm.
begin(j), sm.
end(j), castUp( begin_[j] ) ) );
3451 begin_[j+1UL] =
end_[j];
3453 end_[
n_] = begin_[0UL]+nonzeros;
3465 template<
typename Type >
3489 template<
typename Type >
3490 template<
typename MT
3496 , begin_ ( new
Iterator[2UL*n_+2UL] )
3497 ,
end_ ( begin_+(n_+1UL) )
3499 using blaze::assign;
3501 for(
size_t j=0UL; j<2UL*n_+2UL; ++j )
3502 begin_[j] =
nullptr;
3504 assign( *
this, ~dm );
3516 template<
typename Type >
3517 template<
typename MT
3523 , begin_ ( new
Iterator[2UL*n_+2UL] )
3524 ,
end_ ( begin_+(n_+1UL) )
3526 using blaze::assign;
3528 const size_t nonzeros( (~sm).
nonZeros() );
3530 begin_[0UL] = allocate<Element>( nonzeros );
3531 for(
size_t j=0UL; j<
n_; ++j )
3532 begin_[j+1UL] =
end_[j] = begin_[0UL];
3533 end_[
n_] = begin_[0UL]+nonzeros;
3535 assign( *
this, ~sm );
3553 template<
typename Type >
3556 if( begin_ !=
nullptr ) {
3587 template<
typename Type >
3611 template<
typename Type >
3620 if( pos ==
end_[j] || pos->index_ != i )
3643 template<
typename Type >
3653 return (*
this)(i,j);
3671 template<
typename Type >
3681 return (*
this)(i,j);
3694 template<
typename Type >
3712 template<
typename Type >
3730 template<
typename Type >
3748 template<
typename Type >
3766 template<
typename Type >
3784 template<
typename Type >
3813 template<
typename Type >
3817 if( &rhs ==
this )
return *
this;
3819 const size_t nonzeros( rhs.
nonZeros() );
3826 newBegin[0UL] = allocate<Element>( nonzeros );
3827 for(
size_t j=0UL; j<rhs.
n_; ++j ) {
3828 newEnd[j] = castDown( std::copy( rhs.
begin_[j], rhs.
end_[j], castUp( newBegin[j] ) ) );
3829 newBegin[j+1UL] = newEnd[j];
3831 newEnd[rhs.
n_] = newBegin[0UL]+nonzeros;
3837 if( newBegin !=
nullptr ) {
3843 for(
size_t j=0UL; j<rhs.
n_; ++j ) {
3844 end_[j] = castDown( std::copy( rhs.
begin_[j], rhs.
end_[j], castUp( begin_[j] ) ) );
3845 begin_[j+1UL] =
end_[j];
3865 template<
typename Type >
3869 if( begin_ !=
nullptr ) {
3902 template<
typename Type >
3903 template<
typename MT
3908 using blaze::assign;
3910 if( (~rhs).canAlias(
this ) ) {
3916 assign( *
this, ~rhs );
3935 template<
typename Type >
3936 template<
typename MT
3941 using blaze::assign;
3943 if( (~rhs).canAlias(
this ) ||
3952 assign( *
this, ~rhs );
3972 template<
typename Type >
3973 template<
typename MT
3977 using blaze::addAssign;
3983 addAssign( *
this, ~rhs );
4001 template<
typename Type >
4002 template<
typename MT
4006 using blaze::subAssign;
4012 subAssign( *
this, ~rhs );
4031 template<
typename Type >
4032 template<
typename MT
4037 using blaze::schurAssign;
4043 if( (~rhs).canAlias(
this ) ) {
4049 schurAssign( *
this, tmp );
4070 template<
typename Type >
4071 template<
typename MT
4100 template<
typename Type >
4101 template<
typename MT
4106 if( (~rhs).
rows() != n_ ) {
4127 template<
typename Type >
4128 template<
typename Other >
4132 for(
size_t j=0UL; j<
n_; ++j ) {
4135 element->value_ *= rhs;
4151 template<
typename Type >
4152 template<
typename Other >
4153 inline EnableIf_< IsNumeric<Other>, CompressedMatrix<Type,true> >&
4154 CompressedMatrix<Type,true>::operator/=( Other rhs )
4158 using DT = DivTrait_<Type,Other>;
4159 using Tmp = If_< IsNumeric<DT>, DT, Other >;
4163 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
4164 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
4165 for(
size_t j=0UL; j<
n_; ++j ) {
4168 element->value_ *= tmp;
4172 for(
size_t j=0UL; j<
n_; ++j ) {
4175 element->value_ /= rhs;
4199 template<
typename Type >
4214 template<
typename Type >
4229 template<
typename Type >
4232 if( begin_ !=
nullptr )
4233 return end_[
n_] - begin_[0UL];
4247 template<
typename Type >
4251 return begin_[j+1UL] - begin_[j];
4263 template<
typename Type >
4266 size_t nonzeros( 0UL );
4268 for(
size_t j=0UL; j<
n_; ++j )
4284 template<
typename Type >
4288 return end_[j] - begin_[j];
4300 template<
typename Type >
4303 for(
size_t j=0UL; j<
n_; ++j )
4304 end_[j] = begin_[j];
4320 template<
typename Type >
4324 end_[j] = begin_[j];
4338 template<
typename Type >
4341 if(
end_ !=
nullptr )
4366 template<
typename Type >
4372 if( m ==
m_ && n == n_ )
return;
4374 if( begin_ ==
nullptr )
4377 end_ = begin_+n+1UL;
4379 for(
size_t j=0UL; j<2UL*n+2UL; ++j ) {
4380 begin_[j] =
nullptr;
4388 Iterator* newEnd ( newBegin+n+1UL );
4390 newBegin[0UL] = begin_[0UL];
4393 for(
size_t j=0UL; j<
n_; ++j ) {
4394 newEnd [j] =
end_ [j];
4395 newBegin[j+1UL] = begin_[j+1UL];
4397 for(
size_t j=n_; j<n; ++j ) {
4398 newBegin[j+1UL] = newEnd[j] = begin_[
n_];
4402 for(
size_t j=0UL; j<n; ++j ) {
4403 newBegin[j+1UL] = newEnd[j] = begin_[0UL];
4419 for(
size_t j=0UL; j<
n_; ++j )
4420 end_[j] = begin_[j];
4423 for(
size_t j=n_; j<n; ++j ) {
4424 begin_[j+1UL] =
end_[j] = begin_[
n_];
4430 for(
size_t j=0UL; j<n; ++j )
4431 end_[j] = lowerBound( m, j );
4434 for(
size_t j=0UL; j<n; ++j )
4435 end_[j] = begin_[j];
4462 template<
typename Type >
4466 reserveElements( nonzeros );
4484 template<
typename Type >
4492 const size_t current(
capacity(j) );
4494 if( current >= nonzeros )
return;
4496 const ptrdiff_t additional( nonzeros - current );
4498 if(
end_[n_] - begin_[n_] < additional )
4500 const size_t newCapacity( begin_[n_] - begin_[0UL] + additional );
4504 Iterator* newEnd ( newBegin+n_+1UL );
4506 newBegin[0UL] = allocate<Element>( newCapacity );
4507 newEnd [
n_ ] = newBegin[0UL]+newCapacity;
4509 for(
size_t k=0UL; k<j; ++k ) {
4510 newEnd [k ] = castDown(
transfer( begin_[k],
end_[k], castUp( newBegin[k] ) ) );
4511 newBegin[k+1UL] = newBegin[k] +
capacity(k);
4513 newEnd [j ] = castDown(
transfer( begin_[j],
end_[j], castUp( newBegin[j] ) ) );
4514 newBegin[j+1UL] = newBegin[j] + nonzeros;
4515 for(
size_t k=j+1UL; k<
n_; ++k ) {
4516 newEnd [k ] = castDown(
transfer( begin_[k],
end_[k], castUp( newBegin[k] ) ) );
4517 newBegin[k+1UL] = newBegin[k] +
capacity(k);
4530 begin_[
n_] += additional;
4531 for(
size_t k=n_-1UL; k>j; --k ) {
4532 begin_[k] = castDown( std::move_backward( begin_[k],
end_[k], castUp(
end_[k]+additional ) ) );
4533 end_ [k] += additional;
4554 template<
typename Type >
4557 for(
size_t j=0UL; j<
n_; ++j )
4575 template<
typename Type >
4580 if( j < ( n_ - 1UL ) )
4581 end_[j+1] = castDown( std::move( begin_[j+1],
end_[j+1], castUp(
end_[j] ) ) );
4582 begin_[j+1] =
end_[j];
4598 template<
typename Type >
4602 CompressedMatrix( *this ).swap( *
this );
4616 template<
typename Type >
4638 template<
typename Type >
4641 size_t nonzeros( 2UL*
capacity()+1UL );
4659 template<
typename Type >
4665 newBegin[0UL] = allocate<Element>( nonzeros );
4667 for(
size_t k=0UL; k<
n_; ++k ) {
4669 newEnd [k] = castDown(
transfer( begin_[k],
end_[k], castUp( newBegin[k] ) ) );
4670 newBegin[k+1UL] = newBegin[k] + ( begin_[k+1UL] - begin_[k] );
4673 newEnd[
n_] = newBegin[0UL]+nonzeros;
4678 if( newBegin !=
nullptr ) {
4695 template<
typename Type >
4699 return static_cast<Iterator>( it );
4712 template<
typename Type >
4716 return static_cast<IteratorBase
>( it );
4742 template<
typename Type >
4749 const Iterator pos( lowerBound( i, j ) );
4751 if( pos !=
end_[j] && pos->index_ == i ) {
4752 pos->value() = value;
4755 else return insert( pos, i, j, value );
4775 template<
typename Type >
4782 const Iterator pos( lowerBound( i, j ) );
4784 if( pos !=
end_[j] && pos->index_ == i ) {
4788 return insert( pos, i, j, value );
4805 template<
typename Type >
4809 if( begin_[j+1UL] -
end_[j] != 0 ) {
4810 std::move_backward( pos,
end_[j], castUp(
end_[j]+1UL ) );
4811 pos->value_ = value;
4817 else if(
end_[n_] - begin_[n_] != 0 ) {
4818 std::move_backward( pos,
end_[n_-1UL], castUp(
end_[n_-1]+1UL ) );
4820 pos->value_ = value;
4823 for(
size_t k=j+1UL; k<n_+1UL; ++k ) {
4831 size_t newCapacity( extendCapacity() );
4836 newBegin[0UL] = allocate<Element>( newCapacity );
4838 for(
size_t k=0UL; k<j; ++k ) {
4839 const size_t nonzeros(
end_[k] - begin_[k] );
4840 const size_t total( begin_[k+1UL] - begin_[k] );
4841 newEnd [k] = newBegin[k] + nonzeros;
4842 newBegin[k+1UL] = newBegin[k] + total;
4844 newEnd [j] = newBegin[j] + (
end_[j] - begin_[j] ) + 1;
4845 newBegin[j+1UL] = newBegin[j] + ( begin_[j+1UL] - begin_[j] ) + 1;
4846 for(
size_t k=j+1UL; k<
n_; ++k ) {
4847 const size_t nonzeros(
end_[k] - begin_[k] );
4848 const size_t total( begin_[k+1UL] - begin_[k] );
4849 newEnd [k] = newBegin[k] + nonzeros;
4850 newBegin[k+1UL] = newBegin[k] + total;
4853 newEnd[
n_] = newEnd[
capacity_] = newBegin[0UL]+newCapacity;
4855 Iterator tmp = castDown( std::move( begin_[0UL], pos, castUp( newBegin[0UL] ) ) );
4856 tmp->value_ = value;
4858 std::move( pos,
end_[n_-1UL], castUp( tmp+1UL ) );
4925 template<
typename Type >
4933 end_[j]->value_ = value;
4935 if( !check || !isDefault<strict>(
end_[j]->value_ ) ) {
4936 end_[j]->index_ = i;
4958 template<
typename Type >
4963 begin_[j+1UL] =
end_[j];
4989 template<
typename Type >
4995 const Iterator pos( find( i, j ) );
4996 if( pos !=
end_[j] )
4997 end_[j] = castDown( std::move( pos+1,
end_[j], castUp( pos ) ) );
5013 template<
typename Type >
5020 if( pos !=
end_[j] )
5021 end_[j] = castDown( std::move( pos+1,
end_[j], castUp( pos ) ) );
5040 template<
typename Type >
5050 end_[j] = castDown( std::move( last,
end_[j], castUp( first ) ) );
5080 template<
typename Type >
5081 template<
typename Pred >
5084 for(
size_t j=0UL; j<
n_; ++j ) {
5085 end_[j] = castDown( std::remove_if( castUp( begin_[j] ), castUp(
end_[j] ),
5086 [predicate=predicate](
const ElementBase& element ) {
5087 return predicate( element.value() );
5120 template<
typename Type >
5121 template<
typename Pred >
5129 const auto pos = std::remove_if( castUp( first ), castUp( last ),
5130 [predicate=predicate](
const ElementBase& element ) {
5131 return predicate( element.value() );
5134 end_[j] = castDown( std::move( last, end_[j], pos ) );
5163 template<
typename Type >
5167 return const_cast<Iterator>(
const_cast<const This&
>( *this ).find( i, j ) );
5188 template<
typename Type >
5193 if( pos != end_[j] && pos->index_ == i )
5195 else return end_[j];
5215 template<
typename Type >
5219 return const_cast<Iterator>(
const_cast<const This&
>( *this ).lowerBound( i, j ) );
5239 template<
typename Type >
5244 return std::lower_bound( begin_[j], end_[j], i,
5245 [](
const Element& element,
size_t index )
5247 return element.index() < index;
5268 template<
typename Type >
5272 return const_cast<Iterator>(
const_cast<const This&
>( *this ).upperBound( i, j ) );
5292 template<
typename Type >
5297 return std::upper_bound( begin_[j], end_[j], i,
5298 [](
size_t index,
const Element& element )
5300 return index < element.index();
5321 template<
typename Type >
5324 CompressedMatrix tmp(
trans( *
this ) );
5338 template<
typename Type >
5341 CompressedMatrix tmp(
ctrans( *
this ) );
5367 template<
typename Type >
5368 template<
typename Other >
5369 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::scale(
const Other& scalar )
5371 for(
size_t j=0UL; j<
n_; ++j )
5372 for(
Iterator element=begin_[j]; element!=end_[j]; ++element )
5373 element->value_ *= scalar;
5391 template<
typename Type >
5392 template<
typename Other >
5393 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::scaleDiagonal(
const Other& scalar )
5397 for(
size_t j=0UL; j<
size; ++j ) {
5399 if( pos != end_[j] && pos->index_ == j )
5400 pos->value_ *= scalar;
5428 template<
typename Type >
5429 template<
typename Other >
5432 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5449 template<
typename Type >
5450 template<
typename Other >
5453 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5470 template<
typename Type >
5491 template<
typename Type >
5492 template<
typename MT
5499 if(
m_ == 0UL || n_ == 0UL )
5502 size_t nonzeros( 0UL );
5504 for(
size_t j=1UL; j<=
n_; ++j )
5505 begin_[j] = end_[j] = end_[n_];
5507 for(
size_t j=0UL; j<
n_; ++j )
5509 begin_[j] = end_[j] = begin_[0UL]+nonzeros;
5511 const size_t ibegin( ( IsLower<MT>::value )
5512 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5514 const size_t iend ( ( IsUpper<MT>::value )
5515 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5518 for(
size_t i=ibegin; i<iend; ++i )
5521 reserveElements( extendCapacity() );
5522 for(
size_t k=j+1UL; k<=
n_; ++k )
5523 begin_[k] = end_[k] = end_[n_];
5526 end_[j]->value_ = (~rhs)(i,j);
5528 if( !isDefault<strict>( end_[j]->value_ ) ) {
5529 end_[j]->index_ = i;
5536 begin_[
n_] = begin_[0UL]+nonzeros;
5554 template<
typename Type >
5555 template<
typename MT >
5563 if( n_ == 0UL || begin_[0] ==
nullptr )
5566 for(
size_t j=0UL; j<
n_; ++j ) {
5567 end_[j] = castDown( std::copy( (~rhs).
begin(j), (~rhs).
end(j), castUp( begin_[j] ) ) );
5568 begin_[j+1UL] = end_[j];
5587 template<
typename Type >
5588 template<
typename MT >
5598 using RhsIterator = ConstIterator_<MT>;
5601 std::vector<size_t> columnLengths( n_, 0UL );
5602 for(
size_t i=0UL; i<
m_; ++i ) {
5603 for( RhsIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5604 ++columnLengths[element->index()];
5608 for(
size_t j=0UL; j<
n_; ++j ) {
5609 begin_[j+1UL] = end_[j+1UL] = begin_[j] + columnLengths[j];
5613 for(
size_t i=0UL; i<
m_; ++i ) {
5614 for( RhsIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5615 append( i, element->index(), element->value() );
5634 template<
typename Type >
5635 template<
typename MT
5642 CompressedMatrix tmp(
serial( *
this + (~rhs) ) );
5661 template<
typename Type >
5662 template<
typename MT
5669 CompressedMatrix tmp(
serial( *
this + (~rhs) ) );
5688 template<
typename Type >
5689 template<
typename MT
5696 CompressedMatrix tmp(
serial( *
this - (~rhs) ) );
5715 template<
typename Type >
5716 template<
typename MT
5723 CompressedMatrix tmp(
serial( *
this - (~rhs) ) );
5742 template<
typename Type >
5743 template<
typename MT
5752 for(
size_t j=0UL; j<
n_; ++j ) {
5755 element->value_ *= (~rhs)(element->index_,j);
5777 template<
typename Type,
bool SO >
5778 inline void reset( CompressedMatrix<Type,SO>& m );
5780 template<
typename Type,
bool SO >
5781 inline void reset( CompressedMatrix<Type,SO>& m,
size_t i );
5783 template<
typename Type,
bool SO >
5784 inline void clear( CompressedMatrix<Type,SO>& m );
5786 template<
bool RF,
typename Type,
bool SO >
5787 inline bool isDefault(
const CompressedMatrix<Type,SO>& m );
5789 template<
typename Type,
bool SO >
5790 inline bool isIntact(
const CompressedMatrix<Type,SO>& m );
5792 template<
typename Type,
bool SO >
5793 inline void swap( CompressedMatrix<Type,SO>& a, CompressedMatrix<Type,SO>& b ) noexcept;
5805 template<
typename Type
5807 inline void reset( CompressedMatrix<Type,SO>& m )
5827 template<
typename Type
5829 inline void reset( CompressedMatrix<Type,SO>& m,
size_t i )
5843 template<
typename Type
5845 inline void clear( CompressedMatrix<Type,SO>& m )
5882 return ( m.rows() == 0UL && m.columns() == 0UL );
5905 template<
typename Type
5907 inline bool isIntact(
const CompressedMatrix<Type,SO>& m )
5909 return ( m.nonZeros() <= m.capacity() );
5922 template<
typename Type
5924 inline void swap( CompressedMatrix<Type,SO>& a, CompressedMatrix<Type,SO>& b ) noexcept
5941 template<
typename T,
bool SO >
5942 struct IsResizable< CompressedMatrix<T,SO> >
5959 template<
typename T,
bool SO >
5960 struct IsShrinkable< CompressedMatrix<T,SO> >
5977 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5978 struct AddTrait< CompressedMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
5980 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
5983 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5984 struct AddTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5986 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
5989 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5990 struct AddTrait< StaticMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
5992 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
5995 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5996 struct AddTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5998 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
6001 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6002 struct AddTrait< CompressedMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6004 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
6007 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6008 struct AddTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6010 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
6013 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6014 struct AddTrait< HybridMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
6016 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
6019 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6020 struct AddTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6022 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
6025 template<
typename T1,
bool SO,
typename T2 >
6026 struct AddTrait< CompressedMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6028 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
6031 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6032 struct AddTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6034 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
6037 template<
typename T1,
bool SO,
typename T2 >
6038 struct AddTrait< DynamicMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6040 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
6043 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6044 struct AddTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6046 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
6049 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
6050 struct AddTrait< CompressedMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
6052 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
6055 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
6056 struct AddTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
6058 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
6061 template<
typename T1,
bool AF,
bool PF,
bool SO,
typename T2 >
6062 struct AddTrait< CustomMatrix<T1,AF,PF,SO>, CompressedMatrix<T2,SO> >
6064 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
6067 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
6068 struct AddTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
6070 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
6073 template<
typename T1,
bool SO,
typename T2 >
6074 struct AddTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6076 using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
6079 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6080 struct AddTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6082 using Type = CompressedMatrix< AddTrait_<T1,T2>,
false >;
6098 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6099 struct SubTrait< CompressedMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
6101 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6104 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6105 struct SubTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6107 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
6110 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6111 struct SubTrait< StaticMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
6113 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6116 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6117 struct SubTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6119 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
6122 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
6123 struct SubTrait< CompressedMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
6125 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
6128 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6129 struct SubTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6131 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
6134 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6135 struct SubTrait< HybridMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
6137 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
6140 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6141 struct SubTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6143 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
6146 template<
typename T1,
bool SO,
typename T2 >
6147 struct SubTrait< CompressedMatrix<T1,SO>, DynamicMatrix<T2,SO> >
6149 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
6152 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6153 struct SubTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6155 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
6158 template<
typename T1,
bool SO,
typename T2 >
6159 struct SubTrait< DynamicMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6161 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
6164 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6165 struct SubTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6167 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
6170 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
6171 struct SubTrait< CompressedMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
6173 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
6176 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
6177 struct SubTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
6179 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
6182 template<
typename T1,
bool AF,
bool PF,
bool SO,
typename T2 >
6183 struct SubTrait< CustomMatrix<T1,AF,PF,SO>, CompressedMatrix<T2,SO> >
6185 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
6188 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
6189 struct SubTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
6191 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
6194 template<
typename T1,
bool SO,
typename T2 >
6195 struct SubTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6197 using Type = CompressedMatrix< SubTrait_<T1,T2>, SO >;
6200 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6201 struct SubTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6203 using Type = CompressedMatrix< SubTrait_<T1,T2>,
false >;
6219 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6220 struct SchurTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6222 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
6225 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6226 struct SchurTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6228 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
6231 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6232 struct SchurTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6234 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
6237 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6238 struct SchurTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6240 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
6243 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6244 struct SchurTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6246 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
6249 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6250 struct SchurTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6252 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
6255 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
6256 struct SchurTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
6258 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
6261 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
6262 struct SchurTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
6264 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO2 >;
6267 template<
typename T1,
bool SO,
typename T2 >
6268 struct SchurTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6270 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
6273 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6274 struct SchurTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6276 using Type = CompressedMatrix< MultTrait_<T1,T2>,
false >;
6292 template<
typename T1,
bool SO,
typename T2 >
6293 struct MultTrait< CompressedMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
6295 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
6298 template<
typename T1,
typename T2,
bool SO >
6299 struct MultTrait< T1, CompressedMatrix<T2,SO>, EnableIf_< IsNumeric<T1> > >
6301 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
6304 template<
typename T1,
bool SO,
typename T2,
size_t N >
6305 struct MultTrait< CompressedMatrix<T1,SO>, StaticVector<T2,N,false> >
6307 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6310 template<
typename T1,
size_t N,
typename T2,
bool SO >
6311 struct MultTrait< StaticVector<T1,N,true>, CompressedMatrix<T2,SO> >
6313 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6316 template<
typename T1,
bool SO,
typename T2,
size_t N >
6317 struct MultTrait< CompressedMatrix<T1,SO>, HybridVector<T2,N,false> >
6319 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6322 template<
typename T1,
size_t N,
typename T2,
bool SO >
6323 struct MultTrait< HybridVector<T1,N,true>, CompressedMatrix<T2,SO> >
6325 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6328 template<
typename T1,
bool SO,
typename T2 >
6329 struct MultTrait< CompressedMatrix<T1,SO>, DynamicVector<T2,false> >
6331 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6334 template<
typename T1,
typename T2,
bool SO >
6335 struct MultTrait< DynamicVector<T1,true>, CompressedMatrix<T2,SO> >
6337 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6340 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
6341 struct MultTrait< CompressedMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
6343 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
6346 template<
typename T1,
bool AF,
bool PF,
typename T2,
bool SO >
6347 struct MultTrait< CustomVector<T1,AF,PF,true>, CompressedMatrix<T2,SO> >
6349 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
6352 template<
typename T1,
bool SO,
typename T2 >
6353 struct MultTrait< CompressedMatrix<T1,SO>, CompressedVector<T2,false> >
6355 using Type = CompressedVector< MultTrait_<T1,T2>,
false >;
6358 template<
typename T1,
typename T2,
bool SO >
6359 struct MultTrait< CompressedVector<T1,true>, CompressedMatrix<T2,SO> >
6361 using Type = CompressedVector< MultTrait_<T1,T2>,
true >;
6364 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6365 struct MultTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
6367 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6370 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6371 struct MultTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6373 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6376 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
6377 struct MultTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
6379 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6382 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6383 struct MultTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6385 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6388 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6389 struct MultTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6391 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6394 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6395 struct MultTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6397 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6400 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
6401 struct MultTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
6403 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6406 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
6407 struct MultTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
6409 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6412 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6413 struct MultTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6415 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
6431 template<
typename T1,
bool SO,
typename T2 >
6432 struct DivTrait< CompressedMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
6434 using Type = CompressedMatrix< DivTrait_<T1,T2>, SO >;
6450 template<
typename T,
bool SO,
typename OP >
6451 struct UnaryMapTrait< CompressedMatrix<T,SO>, OP >
6453 using Type = CompressedMatrix< UnaryMapTrait_<T,OP>, SO >;
6469 template<
typename T1,
bool SO,
typename T2 >
6470 struct HighType< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6472 using Type = CompressedMatrix< typename HighType<T1,T2>::Type, SO >;
6488 template<
typename T1,
bool SO,
typename T2 >
6489 struct LowType< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6491 using Type = CompressedMatrix< typename LowType<T1,T2>::Type, SO >;
6507 template<
typename T,
bool SO >
6508 struct SubmatrixTrait< CompressedMatrix<T,SO> >
6510 using Type = CompressedMatrix<T,SO>;
6526 template<
typename T,
bool SO >
6527 struct RowTrait< CompressedMatrix<T,SO> >
6529 using Type = CompressedVector<T,true>;
6545 template<
typename T,
bool SO >
6546 struct ColumnTrait< CompressedMatrix<T,SO> >
6548 using Type = CompressedVector<T,false>;
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Pointer difference type of the Blaze library.
void reserveElements(size_t nonzeros)
Reserving the specified number of compressed matrix elements.
Definition: CompressedMatrix.h:1883
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
Iterator * end_
Pointers one past the last non-zero element of each row.
Definition: CompressedMatrix.h:513
Header file for the Schur product trait.
void schurAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the Schur product assignment of a dense matrix.
Definition: CompressedMatrix.h:2957
#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
void shrinkToFit()
Requesting the removal of unused capacity.
Definition: CompressedMatrix.h:1825
Header file for the subtraction trait.
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: CompressedMatrix.h:2691
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: CompressedMatrix.h:2672
Header file for the row trait.
CompressedMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: CompressedMatrix.h:2564
CompressedMatrix()
The default constructor for CompressedMatrix.
Definition: CompressedMatrix.h:557
Header file for the serial shim.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:216
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
Iterator end(size_t i) noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: CompressedMatrix.h:976
Reference operator()(size_t i, size_t j) noexcept
2D-access to the compressed matrix elements.
Definition: CompressedMatrix.h:802
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
MatrixAccessProxy< This > Reference
Reference to a compressed matrix value.
Definition: CompressedMatrix.h:306
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:3287
void clear()
Clearing the compressed matrix.
Definition: CompressedMatrix.h:1566
Header file for the And class template.
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
~CompressedMatrix()
The destructor for CompressedMatrix.
Definition: CompressedMatrix.h:768
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:394
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:101
size_t columns() const noexcept
Returns the current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:1437
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:88
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
Header file for memory allocation and deallocation functionality.
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first non-zero element of row/column i.
Definition: CompressedMatrix.h:954
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1809
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:515
Resize mechanism to obtain a CompressedMatrix with different fixed dimensions.
Definition: CompressedMatrix.h:3104
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:78
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
void swap(CompressedMatrix &sm) noexcept
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:1842
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:3289
Header file for the SparseMatrix base class.
ElementBase * IteratorBase
Iterator over non-constant base elements.
Definition: CompressedMatrix.h:222
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:511
void reserve(size_t nonzeros)
Setting the minimum capacity of the compressed matrix.
Definition: CompressedMatrix.h:1688
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
void reset()
Reset to the default initial values.
Definition: CompressedMatrix.h:1528
Headerfile for the generic max algorithm.
Header file for the ValueIndexPair class.
Header file for the LowType type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the unary map trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5924
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
Header file for the IsShrinkable type trait.
Iterator set(size_t i, size_t j, const Type &value)
Setting an element of the compressed matrix.
Definition: CompressedMatrix.h:1968
Header file for the MatrixAccessProxy class.
Header file for all forward declarations of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Header file for the IsSMPAssignable type trait.
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
void erase(size_t i, size_t j)
Erasing an element from the compressed matrix.
Definition: CompressedMatrix.h:2210
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:3291
size_t rows() const noexcept
Returns the current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:1423
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
#define BLAZE_CONSTRAINT_MUST_HAVE_SAME_SIZE(T1, T2)
Constraint on the size of two data types.In case the types T1 and T2 don't have the same size...
Definition: SameSize.h:60
Header file for the Not class template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
size_t capacity() const noexcept
Returns the maximum capacity of the compressed matrix.
Definition: CompressedMatrix.h:1451
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: CompressedMatrix.h:1020
Constraint on the data type.
CompressedMatrix< Type, SO > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:298
Header file for the IsLower type trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
Header file for the default storage order for all vectors of the Blaze library.
IteratorBase castUp(Iterator it) const noexcept
Performs an up-cast of the given iterator.
Definition: CompressedMatrix.h:1938
Iterator insert(size_t i, size_t j, const Type &value)
Inserting an element into the compressed matrix.
Definition: CompressedMatrix.h:2000
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:304
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:75
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:119
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:548
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
Constraint on the data type.
void subAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the subtraction assignment of a dense matrix.
Definition: CompressedMatrix.h:2905
size_t nonZeros() const
Returns the number of non-zero elements in the compressed matrix.
Definition: CompressedMatrix.h:1488
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:250
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the compressed matrix.
Definition: CompressedMatrix.h:1593
Header file for the IsNumeric type trait.
CompressedMatrix & operator=(const CompressedMatrix &rhs)
Copy assignment operator for CompressedMatrix.
Definition: CompressedMatrix.h:1048
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: CompressedMatrix.h:2652
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Resize mechanism to obtain a CompressedMatrix with different fixed dimensions.
Definition: CompressedMatrix.h:326
CompressedMatrix & transpose()
In-place transpose of the matrix.
Definition: CompressedMatrix.h:2548
Header file for the division trait.
void trim()
Removing all excessive capacity from all rows/columns.
Definition: CompressedMatrix.h:1782
Header file for the submatrix trait.
Constraint on the data type.
typename If< T1, T2, T3 >::Type If_
Auxiliary alias declaration for the If class template.The If_ alias declaration provides a convenient...
Definition: If.h:154
Headerfile for the generic transfer algorithm.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:270
const Type & ConstReference
Reference to a constant compressed matrix value.
Definition: CompressedMatrix.h:307
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Constraint on the data type.
Constraint on the data type.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:309
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:819
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:3290
#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:81
void assign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the assignment of a row-major dense matrix.
Definition: CompressedMatrix.h:2713
void append(size_t i, size_t j, const Type &value, bool check=false)
Appending an element to the specified row/column of the compressed matrix.
Definition: CompressedMatrix.h:2148
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:230
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: CompressedMatrix.h:2180
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Iterator find(size_t i, size_t j)
Searches for a specific matrix element.
Definition: CompressedMatrix.h:2388
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
Iterator * begin_
Pointers to the first non-zero element of each row.
Definition: CompressedMatrix.h:512
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:3288
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:73
Constraint on the size of two data types.
Iterator castDown(IteratorBase it) const noexcept
Performs a down-cast of the given iterator.
Definition: CompressedMatrix.h:1920
void addAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the addition assignment of a dense matrix.
Definition: CompressedMatrix.h:2853
Iterator lowerBound(size_t i, size_t j)
Returns an iterator to the first index not less then the given index.
Definition: CompressedMatrix.h:2441
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:3293
Compile time type check.This class tests whether the given template parameter T is an rvalue referenc...
Definition: IsRValueReference.h:77
Iterator upperBound(size_t i, size_t j)
Returns an iterator to the first index greater then the given index.
Definition: CompressedMatrix.h:2496
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:308
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
size_t extendCapacity() const noexcept
Calculating a new matrix capacity.
Definition: CompressedMatrix.h:1863
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:316
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:3094
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:510
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Transfer.h:70
ValueIndexPair< Type > ElementBase
Base class for the compressed matrix element.
Definition: CompressedMatrix.h:221
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: CompressedMatrix.h:856
Header file for the IsResizable type trait.
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:509
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#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
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:303
Reference value()
Access to the current value of the value-index-pair.
Definition: ValueIndexPair.h:362
Header file for the HighType type trait.
Iterator begin(size_t i) noexcept
Returns an iterator to the first non-zero element of row/column i.
Definition: CompressedMatrix.h:910