35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDMATRIX_H_ 36 #define _BLAZE_MATH_SPARSE_COMPRESSEDMATRIX_H_ 207 template<
typename Type
224 struct Element :
public ElementBase
227 explicit Element() =
default;
228 Element(
const Element& rhs ) =
default;
229 Element( Element&& rhs ) =
default;
233 inline Element&
operator=(
const Element& rhs )
235 this->value_ = rhs.value_;
239 inline Element&
operator=( Element&& rhs )
241 this->value_ = std::move( rhs.value_ );
245 template<
typename Other >
249 this->value_ = rhs.value();
253 template<
typename Other >
258 this->value_ = std::move( rhs.value() );
262 template<
typename Other >
270 template<
typename Other >
272 , IsRValueReference<Other&&> >, Element& >
275 this->value_ = std::move( v );
306 template<
typename NewType >
315 template<
size_t NewM
336 explicit CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros );
354 inline Reference
operator()(
size_t i,
size_t j ) noexcept;
355 inline ConstReference
operator()(
size_t i,
size_t j )
const noexcept;
356 inline Reference
at(
size_t i,
size_t j );
357 inline ConstReference
at(
size_t i,
size_t j )
const;
358 inline Iterator
begin (
size_t i ) noexcept;
359 inline ConstIterator
begin (
size_t i )
const noexcept;
360 inline ConstIterator
cbegin(
size_t i )
const noexcept;
361 inline Iterator
end (
size_t i ) noexcept;
362 inline ConstIterator
end (
size_t i )
const noexcept;
363 inline ConstIterator
cend (
size_t i )
const noexcept;
370 inline CompressedMatrix&
operator=(
const CompressedMatrix& rhs );
371 inline CompressedMatrix&
operator=( CompressedMatrix&& rhs ) noexcept;
379 template<
typename Other >
382 template<
typename Other >
390 inline size_t rows()
const noexcept;
391 inline size_t columns()
const noexcept;
392 inline size_t capacity()
const noexcept;
393 inline size_t capacity(
size_t i )
const noexcept;
395 inline size_t nonZeros(
size_t i )
const;
397 inline void reset(
size_t i );
399 void resize (
size_t m,
size_t n,
bool preserve=
true );
400 inline void reserve(
size_t nonzeros );
401 void reserve(
size_t i,
size_t nonzeros );
403 inline void trim (
size_t i );
404 inline void swap( CompressedMatrix& sm ) noexcept;
411 inline Iterator
set (
size_t i,
size_t j,
const Type& value );
412 inline Iterator
insert (
size_t i,
size_t j,
const Type& value );
413 inline void append (
size_t i,
size_t j,
const Type& value,
bool check=
false );
421 inline void erase(
size_t i,
size_t j );
422 inline Iterator
erase(
size_t i, Iterator pos );
423 inline Iterator
erase(
size_t i, Iterator first, Iterator last );
425 template<
typename Pred >
426 inline void erase( Pred predicate );
428 template<
typename Pred >
429 inline void erase(
size_t i, Iterator first, Iterator last, Pred predicate );
436 inline Iterator
find (
size_t i,
size_t j );
437 inline ConstIterator
find (
size_t i,
size_t j )
const;
438 inline Iterator
lowerBound(
size_t i,
size_t j );
439 inline ConstIterator
lowerBound(
size_t i,
size_t j )
const;
440 inline Iterator
upperBound(
size_t i,
size_t j );
441 inline ConstIterator
upperBound(
size_t i,
size_t j )
const;
451 template<
typename Other >
inline CompressedMatrix& scale(
const Other& scalar );
452 template<
typename Other >
inline CompressedMatrix& scaleDiagonal(
const Other& scalar );
459 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
460 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
481 inline Iterator
castDown( IteratorBase it )
const noexcept;
482 inline IteratorBase
castUp ( Iterator it )
const noexcept;
489 Iterator
insert( Iterator pos,
size_t i,
size_t j,
const Type& value );
527 template<
typename Type,
bool SO >
542 template<
typename Type
562 template<
typename Type
571 for(
size_t i=0UL; i<2UL*
m_+2UL; ++i )
586 template<
typename Type
595 begin_[0UL] = allocate<Element>( nonzeros );
596 for(
size_t i=1UL; i<(2UL*
m_+1UL); ++i )
614 template<
typename Type
623 BLAZE_USER_ASSERT( nonzeros.size() == m,
"Size of capacity vector and number of rows don't match" );
625 size_t newCapacity( 0UL );
626 for( std::vector<size_t>::const_iterator it=nonzeros.begin(); it!=nonzeros.end(); ++it )
629 begin_[0UL] =
end_[0UL] = allocate<Element>( newCapacity );
630 for(
size_t i=0UL; i<
m_; ++i ) {
642 template<
typename Type
651 const size_t nonzeros( sm.
nonZeros() );
653 begin_[0UL] = allocate<Element>( nonzeros );
654 for(
size_t i=0UL; i<
m_; ++i ) {
656 begin_[i+1UL] =
end_[i];
658 end_[
m_] = begin_[0UL]+nonzeros;
668 template<
typename Type
691 template<
typename Type
693 template<
typename MT
704 for(
size_t i=0UL; i<2UL*
m_+2UL; ++i )
717 template<
typename Type
719 template<
typename MT
730 const size_t nonzeros( (~sm).
nonZeros() );
732 begin_[0UL] = allocate<Element>( nonzeros );
733 for(
size_t i=0UL; i<
m_; ++i )
753 template<
typename Type
786 template<
typename Type
809 template<
typename Type
819 if( pos ==
end_[i] || pos->index_ != j )
840 template<
typename Type
867 template<
typename Type
894 template<
typename Type
916 template<
typename Type
938 template<
typename Type
960 template<
typename Type
982 template<
typename Type
1004 template<
typename Type
1032 template<
typename Type
1037 if( &rhs ==
this )
return *
this;
1039 const size_t nonzeros( rhs.
nonZeros() );
1046 newBegin[0UL] = allocate<Element>( nonzeros );
1047 for(
size_t i=0UL; i<rhs.
m_; ++i ) {
1049 newBegin[i+1UL] = newEnd[i];
1051 newEnd[rhs.
m_] = newBegin[0UL]+nonzeros;
1057 if( newBegin !=
nullptr ) {
1063 for(
size_t i=0UL; i<rhs.
m_; ++i ) {
1083 template<
typename Type
1088 if(
begin_ !=
nullptr ) {
1101 rhs.capacity_ = 0UL;
1102 rhs.begin_ =
nullptr;
1119 template<
typename Type
1121 template<
typename MT
1126 using blaze::assign;
1151 template<
typename Type
1153 template<
typename MT
1158 using blaze::assign;
1187 template<
typename Type
1189 template<
typename MT
1194 using blaze::addAssign;
1216 template<
typename Type
1218 template<
typename MT
1222 using blaze::subAssign;
1244 template<
typename Type
1246 template<
typename MT
1251 if( (~rhs).
rows() !=
n_ ) {
1270 template<
typename Type
1272 template<
typename Other >
1276 for(
size_t i=0UL; i<
m_; ++i ) {
1279 element->value_ *= rhs;
1293 template<
typename Type
1295 template<
typename Other >
1307 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1308 for(
size_t i=0UL; i<
m_; ++i ) {
1311 element->value_ *= tmp;
1315 for(
size_t i=0UL; i<
m_; ++i ) {
1318 element->value_ /= rhs;
1340 template<
typename Type
1354 template<
typename Type
1368 template<
typename Type
1390 template<
typename Type
1405 template<
typename Type
1409 size_t nonzeros( 0UL );
1411 for(
size_t i=0UL; i<
m_; ++i )
1430 template<
typename Type
1445 template<
typename Type
1449 for(
size_t i=0UL; i<
m_; ++i )
1466 template<
typename Type
1483 template<
typename Type
1487 if(
end_ !=
nullptr )
1510 template<
typename Type
1517 if( m ==
m_ && n ==
n_ )
return;
1524 for(
size_t i=0UL; i<2UL*m+2UL; ++i ) {
1533 Iterator* newEnd ( newBegin+m+1UL );
1535 newBegin[0UL] =
begin_[0UL];
1538 for(
size_t i=0UL; i<
m_; ++i ) {
1539 newEnd [i] =
end_ [i];
1540 newBegin[i+1UL] =
begin_[i+1UL];
1542 for(
size_t i=m_; i<m; ++i ) {
1543 newBegin[i+1UL] = newEnd[i] =
begin_[
m_];
1547 for(
size_t i=0UL; i<m; ++i ) {
1548 newBegin[i+1UL] = newEnd[i] =
begin_[0UL];
1564 for(
size_t i=0UL; i<
m_; ++i )
1568 for(
size_t i=
m_; i<m; ++i ) {
1575 for(
size_t i=0UL; i<m; ++i )
1579 for(
size_t i=0UL; i<m; ++i )
1605 template<
typename Type
1629 template<
typename Type
1638 const size_t current(
capacity(i) );
1640 if( current >= nonzeros )
return;
1642 const ptrdiff_t additional( nonzeros - current );
1646 const size_t newCapacity(
begin_[
m_] -
begin_[0UL] + additional );
1652 newBegin[0UL] = allocate<Element>( newCapacity );
1653 newEnd [
m_ ] = newBegin[0UL]+newCapacity;
1655 for(
size_t k=0UL; k<i; ++k ) {
1657 newBegin[k+1UL] = newBegin[k] +
capacity(k);
1660 newBegin[i+1UL] = newBegin[i] + nonzeros;
1661 for(
size_t k=i+1UL; k<
m_; ++k ) {
1663 newBegin[k+1UL] = newBegin[k] +
capacity(k);
1677 for(
size_t j=
m_-1UL; j>i; --j ) {
1679 end_ [j] += additional;
1699 template<
typename Type
1703 for(
size_t i=0UL; i<
m_; ++i )
1720 template<
typename Type
1726 if( i < (
m_ - 1UL ) )
1739 template<
typename Type
1760 template<
typename Type
1764 size_t nonzeros( 2UL*
capacity()+1UL );
1780 template<
typename Type
1787 newBegin[0UL] = allocate<Element>( nonzeros );
1789 for(
size_t k=0UL; k<
m_; ++k ) {
1792 newBegin[k+1UL] = newBegin[k] + (
begin_[k+1UL] -
begin_[k] );
1795 newEnd[
m_] = newBegin[0UL]+nonzeros;
1800 if( newBegin !=
nullptr ) {
1816 template<
typename Type
1821 return static_cast<Iterator>( it );
1834 template<
typename Type
1864 template<
typename Type
1874 if( pos !=
end_[i] && pos->index_ == j ) {
1875 pos->value() = value;
1878 else return insert( pos, i, j, value );
1896 template<
typename Type
1906 if( pos !=
end_[i] && pos->index_ == j ) {
1910 return insert( pos, i, j, value );
1925 template<
typename Type
1932 pos->value_ = value;
1941 pos->value_ = value;
1944 for(
size_t k=i+1UL; k<
m_+1UL; ++k ) {
1957 newBegin[0UL] = allocate<Element>( newCapacity );
1959 for(
size_t k=0UL; k<i; ++k ) {
1960 const size_t nonzeros(
end_[k] -
begin_[k] );
1962 newEnd [k] = newBegin[k] + nonzeros;
1963 newBegin[k+1UL] = newBegin[k] + total;
1965 newEnd [i] = newBegin[i] + (
end_[i] -
begin_[i] ) + 1;
1966 newBegin[i+1UL] = newBegin[i] + (
begin_[i+1] -
begin_[i] ) + 1;
1967 for(
size_t k=i+1UL; k<
m_; ++k ) {
1968 const size_t nonzeros(
end_[k] -
begin_[k] );
1970 newEnd [k] = newBegin[k] + nonzeros;
1971 newBegin[k+1UL] = newBegin[k] + total;
1974 newEnd[
m_] = newEnd[
capacity_] = newBegin[0UL]+newCapacity;
1977 tmp->value_ = value;
1979 std::move( pos,
end_[m_-1UL],
castUp( tmp+1UL ) );
2045 template<
typename Type
2054 end_[i]->value_ = value;
2056 if( !check || !isDefault<strict>(
end_[i]->value_ ) ) {
2057 end_[i]->index_ = j;
2077 template<
typename Type
2107 template<
typename Type
2115 if( pos !=
end_[i] )
2132 template<
typename Type
2140 if( pos !=
end_[i] )
2160 template<
typename Type
2199 template<
typename Type
2201 template<
typename Pred >
2204 for(
size_t i=0UL; i<
m_; ++i ) {
2206 [predicate=predicate](
const ElementBase& element) {
2207 return predicate( element.
value() );
2241 template<
typename Type
2243 template<
typename Pred >
2251 const auto pos = std::remove_if(
castUp( first ),
castUp( last ),
2252 [predicate=predicate](
const ElementBase& element ) {
2253 return predicate( element.
value() );
2284 template<
typename Type
2289 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( i, j ) );
2309 template<
typename Type
2315 if( pos !=
end_[i] && pos->index_ == j )
2317 else return end_[i];
2337 template<
typename Type
2362 template<
typename Type
2368 return std::lower_bound(
begin_[i],
end_[i], j,
2369 [](
const Element& element,
size_t index )
2371 return element.index() < index;
2392 template<
typename Type
2417 template<
typename Type
2423 return std::upper_bound(
begin_[i],
end_[i], j,
2424 [](
size_t index,
const Element& element )
2426 return index < element.index();
2445 template<
typename Type
2461 template<
typename Type
2478 template<
typename Type
2480 template<
typename Other >
2483 for(
size_t i=0UL; i<
m_; ++i )
2485 element->value_ *= scalar;
2498 template<
typename Type
2500 template<
typename Other >
2505 for(
size_t i=0UL; i<
size; ++i ) {
2507 if( pos !=
end_[i] && pos->index_ == i )
2508 pos->value_ *= scalar;
2534 template<
typename Type
2536 template<
typename Other >
2539 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2554 template<
typename Type
2556 template<
typename Other >
2559 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2574 template<
typename Type
2594 template<
typename Type
2596 template<
typename MT
2603 if(
m_ == 0UL ||
n_ == 0UL )
2606 size_t nonzeros( 0UL );
2608 for(
size_t i=1UL; i<=
m_; ++i )
2611 for(
size_t i=0UL; i<
m_; ++i )
2622 for(
size_t j=jbegin; j<jend; ++j )
2626 for(
size_t k=i+1UL; k<=
m_; ++k )
2630 end_[i]->value_ = (~rhs)(i,j);
2632 if( !isDefault<strict>(
end_[i]->value_ ) ) {
2633 end_[i]->index_ = j;
2656 template<
typename Type
2658 template<
typename MT >
2666 if(
m_ == 0UL ||
begin_[0] ==
nullptr )
2669 for(
size_t i=0UL; i<
m_; ++i ) {
2688 template<
typename Type
2690 template<
typename MT >
2703 std::vector<size_t> rowLengths(
m_, 0UL );
2704 for(
size_t j=0UL; j<
n_; ++j ) {
2705 for( RhsIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2706 ++rowLengths[element->index()];
2710 for(
size_t i=0UL; i<
m_; ++i ) {
2715 for(
size_t j=0UL; j<
n_; ++j ) {
2716 for( RhsIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2717 append( element->index(), j, element->value() );
2734 template<
typename Type
2736 template<
typename MT
2760 template<
typename Type
2762 template<
typename MT
2786 template<
typename Type
2788 template<
typename MT
2812 template<
typename Type
2814 template<
typename MT
2847 template<
typename Type >
2863 struct Element :
public ElementBase
2866 explicit Element() =
default;
2867 Element(
const Element& rhs ) =
default;
2868 Element( Element&& rhs ) =
default;
2872 inline Element&
operator=(
const Element& rhs )
2874 this->value_ = rhs.value_;
2878 inline Element&
operator=( Element&& rhs )
2880 this->value_ = std::move( rhs.value_ );
2884 template<
typename Other >
2888 this->value_ = rhs.value();
2892 template<
typename Other >
2897 this->value_ = std::move( rhs.value() );
2901 template<
typename Other >
2909 template<
typename Other >
2911 , IsRValueReference<Other&&> >, Element& >
2914 this->value_ = std::move( v );
2945 template<
typename NewType >
2954 template<
size_t NewM
2975 explicit CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros );
2993 inline Reference
operator()(
size_t i,
size_t j ) noexcept;
2994 inline ConstReference
operator()(
size_t i,
size_t j )
const noexcept;
2995 inline Reference
at(
size_t i,
size_t j );
2996 inline ConstReference
at(
size_t i,
size_t j )
const;
2997 inline Iterator
begin (
size_t i ) noexcept;
2998 inline ConstIterator
begin (
size_t i )
const noexcept;
2999 inline ConstIterator
cbegin(
size_t i )
const noexcept;
3000 inline Iterator
end (
size_t i ) noexcept;
3001 inline ConstIterator
end (
size_t i )
const noexcept;
3002 inline ConstIterator
cend (
size_t i )
const noexcept;
3009 inline CompressedMatrix&
operator=(
const CompressedMatrix& rhs );
3010 inline CompressedMatrix&
operator=( CompressedMatrix&& rhs ) noexcept;
3018 template<
typename Other >
3019 inline EnableIf_< IsNumeric<Other>, CompressedMatrix >& operator*=(
Other rhs );
3021 template<
typename Other >
3022 inline EnableIf_< IsNumeric<Other>, CompressedMatrix >&
operator/=(
Other rhs );
3029 inline size_t rows()
const noexcept;
3030 inline size_t columns()
const noexcept;
3031 inline size_t capacity()
const noexcept;
3032 inline size_t capacity(
size_t j )
const noexcept;
3034 inline size_t nonZeros(
size_t j )
const;
3035 inline void reset();
3036 inline void reset(
size_t j );
3037 inline void clear();
3038 void resize (
size_t m,
size_t n,
bool preserve=
true );
3039 inline void reserve(
size_t nonzeros );
3040 void reserve(
size_t j,
size_t nonzeros );
3041 inline void trim ();
3042 inline void trim (
size_t j );
3043 inline void swap( CompressedMatrix& sm ) noexcept;
3050 inline Iterator
set (
size_t i,
size_t j,
const Type& value );
3051 inline Iterator
insert (
size_t i,
size_t j,
const Type& value );
3052 inline void append (
size_t i,
size_t j,
const Type& value,
bool check=
false );
3060 inline void erase(
size_t i,
size_t j );
3061 inline Iterator
erase(
size_t j, Iterator pos );
3062 inline Iterator
erase(
size_t j, Iterator first, Iterator last );
3064 template<
typename Pred >
3065 inline void erase( Pred predicate );
3067 template<
typename Pred >
3068 inline void erase(
size_t i, Iterator first, Iterator last, Pred predicate );
3075 inline Iterator
find (
size_t i,
size_t j );
3076 inline ConstIterator
find (
size_t i,
size_t j )
const;
3077 inline Iterator
lowerBound(
size_t i,
size_t j );
3078 inline ConstIterator
lowerBound(
size_t i,
size_t j )
const;
3079 inline Iterator
upperBound(
size_t i,
size_t j );
3080 inline ConstIterator
upperBound(
size_t i,
size_t j )
const;
3090 template<
typename Other >
inline CompressedMatrix& scale(
const Other& scalar );
3091 template<
typename Other >
inline CompressedMatrix& scaleDiagonal(
const Other& scalar );
3098 template<
typename Other >
inline bool canAlias (
const Other* alias )
const noexcept;
3099 template<
typename Other >
inline bool isAliased(
const Other* alias )
const noexcept;
3120 inline Iterator
castDown( IteratorBase it )
const noexcept;
3121 inline IteratorBase
castUp ( Iterator it )
const noexcept;
3128 Iterator
insert( Iterator pos,
size_t i,
size_t j,
const Type& value );
3167 template<
typename Type >
3183 template<
typename Type >
3204 template<
typename Type >
3212 for(
size_t j=0UL; j<2UL*
n_+2UL; ++j )
3229 template<
typename Type >
3237 begin_[0UL] = allocate<Element>( nonzeros );
3238 for(
size_t j=1UL; j<(2UL*
n_+1UL); ++j )
3257 template<
typename Type >
3265 BLAZE_USER_ASSERT( nonzeros.size() == n,
"Size of capacity vector and number of columns don't match" );
3267 size_t newCapacity( 0UL );
3268 for( std::vector<size_t>::const_iterator it=nonzeros.begin(); it!=nonzeros.end(); ++it )
3271 begin_[0UL] =
end_[0UL] = allocate<Element>( newCapacity );
3272 for(
size_t j=0UL; j<
n_; ++j ) {
3286 template<
typename Type >
3294 const size_t nonzeros( sm.
nonZeros() );
3296 begin_[0UL] = allocate<Element>( nonzeros );
3297 for(
size_t j=0UL; j<
n_; ++j ) {
3298 end_[j] = castDown( std::copy( sm.
begin(j), sm.
end(j), castUp( begin_[j] ) ) );
3299 begin_[j+1UL] =
end_[j];
3301 end_[
n_] = begin_[0UL]+nonzeros;
3313 template<
typename Type >
3337 template<
typename Type >
3338 template<
typename MT
3344 , begin_ ( new
Iterator[2UL*n_+2UL] )
3345 ,
end_ ( begin_+(n_+1UL) )
3347 using blaze::assign;
3349 for(
size_t j=0UL; j<2UL*n_+2UL; ++j )
3350 begin_[j] =
nullptr;
3352 assign( *
this, ~dm );
3364 template<
typename Type >
3365 template<
typename MT
3371 , begin_ ( new
Iterator[2UL*n_+2UL] )
3372 ,
end_ ( begin_+(n_+1UL) )
3374 using blaze::assign;
3376 const size_t nonzeros( (~sm).
nonZeros() );
3378 begin_[0UL] = allocate<Element>( nonzeros );
3379 for(
size_t j=0UL; j<
n_; ++j )
3380 begin_[j+1UL] =
end_[j] = begin_[0UL];
3381 end_[
n_] = begin_[0UL]+nonzeros;
3383 assign( *
this, ~sm );
3401 template<
typename Type >
3404 if( begin_ !=
nullptr ) {
3435 template<
typename Type >
3459 template<
typename Type >
3468 if( pos ==
end_[j] || pos->index_ != i )
3491 template<
typename Type >
3501 return (*
this)(i,j);
3519 template<
typename Type >
3529 return (*
this)(i,j);
3542 template<
typename Type >
3560 template<
typename Type >
3578 template<
typename Type >
3596 template<
typename Type >
3614 template<
typename Type >
3632 template<
typename Type >
3661 template<
typename Type >
3665 if( &rhs ==
this )
return *
this;
3667 const size_t nonzeros( rhs.
nonZeros() );
3674 newBegin[0UL] = allocate<Element>( nonzeros );
3675 for(
size_t j=0UL; j<rhs.
n_; ++j ) {
3676 newEnd[j] = castDown( std::copy( rhs.
begin_[j], rhs.
end_[j], castUp( newBegin[j] ) ) );
3677 newBegin[j+1UL] = newEnd[j];
3679 newEnd[rhs.
n_] = newBegin[0UL]+nonzeros;
3685 if( newBegin !=
nullptr ) {
3691 for(
size_t j=0UL; j<rhs.
n_; ++j ) {
3692 end_[j] = castDown( std::copy( rhs.
begin_[j], rhs.
end_[j], castUp( begin_[j] ) ) );
3693 begin_[j+1UL] =
end_[j];
3713 template<
typename Type >
3717 if( begin_ !=
nullptr ) {
3750 template<
typename Type >
3751 template<
typename MT
3756 using blaze::assign;
3758 if( (~rhs).canAlias(
this ) ) {
3764 assign( *
this, ~rhs );
3783 template<
typename Type >
3784 template<
typename MT
3789 using blaze::assign;
3791 if( (~rhs).canAlias(
this ) ||
3800 assign( *
this, ~rhs );
3820 template<
typename Type >
3821 template<
typename MT
3825 using blaze::addAssign;
3831 addAssign( *
this, ~rhs );
3849 template<
typename Type >
3850 template<
typename MT
3854 using blaze::subAssign;
3860 subAssign( *
this, ~rhs );
3878 template<
typename Type >
3879 template<
typename MT
3884 if( (~rhs).
rows() != n_ ) {
3905 template<
typename Type >
3906 template<
typename Other >
3910 for(
size_t j=0UL; j<
n_; ++j ) {
3913 element->value_ *= rhs;
3929 template<
typename Type >
3930 template<
typename Other >
3931 inline EnableIf_< IsNumeric<Other>, CompressedMatrix<Type,true> >&
3932 CompressedMatrix<Type,true>::operator/=( Other rhs )
3936 typedef DivTrait_<Type,Other> DT;
3937 typedef If_< IsNumeric<DT>, DT, Other > Tmp;
3941 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3942 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3943 for(
size_t j=0UL; j<
n_; ++j ) {
3946 element->value_ *= tmp;
3950 for(
size_t j=0UL; j<
n_; ++j ) {
3953 element->value_ /= rhs;
3977 template<
typename Type >
3992 template<
typename Type >
4007 template<
typename Type >
4010 if( begin_ !=
nullptr )
4011 return end_[
n_] - begin_[0UL];
4025 template<
typename Type >
4029 return begin_[j+1UL] - begin_[j];
4041 template<
typename Type >
4044 size_t nonzeros( 0UL );
4046 for(
size_t j=0UL; j<
n_; ++j )
4062 template<
typename Type >
4066 return end_[j] - begin_[j];
4078 template<
typename Type >
4081 for(
size_t j=0UL; j<
n_; ++j )
4082 end_[j] = begin_[j];
4098 template<
typename Type >
4102 end_[j] = begin_[j];
4116 template<
typename Type >
4119 if(
end_ !=
nullptr )
4144 template<
typename Type >
4150 if( m ==
m_ && n == n_ )
return;
4152 if( begin_ ==
nullptr )
4155 end_ = begin_+n+1UL;
4157 for(
size_t j=0UL; j<2UL*n+2UL; ++j ) {
4158 begin_[j] =
nullptr;
4166 Iterator* newEnd ( newBegin+n+1UL );
4168 newBegin[0UL] = begin_[0UL];
4171 for(
size_t j=0UL; j<
n_; ++j ) {
4172 newEnd [j] =
end_ [j];
4173 newBegin[j+1UL] = begin_[j+1UL];
4175 for(
size_t j=n_; j<n; ++j ) {
4176 newBegin[j+1UL] = newEnd[j] = begin_[
n_];
4180 for(
size_t j=0UL; j<n; ++j ) {
4181 newBegin[j+1UL] = newEnd[j] = begin_[0UL];
4197 for(
size_t j=0UL; j<
n_; ++j )
4198 end_[j] = begin_[j];
4201 for(
size_t j=n_; j<n; ++j ) {
4202 begin_[j+1UL] =
end_[j] = begin_[
n_];
4208 for(
size_t j=0UL; j<n; ++j )
4209 end_[j] = lowerBound( m, j );
4212 for(
size_t j=0UL; j<n; ++j )
4213 end_[j] = begin_[j];
4240 template<
typename Type >
4244 reserveElements( nonzeros );
4262 template<
typename Type >
4270 const size_t current(
capacity(j) );
4272 if( current >= nonzeros )
return;
4274 const ptrdiff_t additional( nonzeros - current );
4276 if(
end_[n_] - begin_[n_] < additional )
4278 const size_t newCapacity( begin_[n_] - begin_[0UL] + additional );
4282 Iterator* newEnd ( newBegin+n_+1UL );
4284 newBegin[0UL] = allocate<Element>( newCapacity );
4285 newEnd [
n_ ] = newBegin[0UL]+newCapacity;
4287 for(
size_t k=0UL; k<j; ++k ) {
4288 newEnd [k ] = castDown(
transfer( begin_[k],
end_[k], castUp( newBegin[k] ) ) );
4289 newBegin[k+1UL] = newBegin[k] +
capacity(k);
4291 newEnd [j ] = castDown(
transfer( begin_[j],
end_[j], castUp( newBegin[j] ) ) );
4292 newBegin[j+1UL] = newBegin[j] + nonzeros;
4293 for(
size_t k=j+1UL; k<
n_; ++k ) {
4294 newEnd [k ] = castDown(
transfer( begin_[k],
end_[k], castUp( newBegin[k] ) ) );
4295 newBegin[k+1UL] = newBegin[k] +
capacity(k);
4308 begin_[
n_] += additional;
4309 for(
size_t k=n_-1UL; k>j; --k ) {
4310 begin_[k] = castDown( std::move_backward( begin_[k],
end_[k], castUp(
end_[k]+additional ) ) );
4311 end_ [k] += additional;
4332 template<
typename Type >
4335 for(
size_t j=0UL; j<
n_; ++j )
4353 template<
typename Type >
4358 if( j < ( n_ - 1UL ) )
4359 end_[j+1] = castDown( std::move( begin_[j+1],
end_[j+1], castUp(
end_[j] ) ) );
4360 begin_[j+1] =
end_[j];
4373 template<
typename Type >
4395 template<
typename Type >
4398 size_t nonzeros( 2UL*
capacity()+1UL );
4416 template<
typename Type >
4422 newBegin[0UL] = allocate<Element>( nonzeros );
4424 for(
size_t k=0UL; k<
n_; ++k ) {
4426 newEnd [k] = castDown(
transfer( begin_[k],
end_[k], castUp( newBegin[k] ) ) );
4427 newBegin[k+1UL] = newBegin[k] + ( begin_[k+1UL] - begin_[k] );
4430 newEnd[
n_] = newBegin[0UL]+nonzeros;
4435 if( newBegin !=
nullptr ) {
4452 template<
typename Type >
4456 return static_cast<Iterator>( it );
4469 template<
typename Type >
4473 return static_cast<IteratorBase
>( it );
4499 template<
typename Type >
4506 const Iterator pos( lowerBound( i, j ) );
4508 if( pos !=
end_[j] && pos->index_ == i ) {
4509 pos->value() = value;
4512 else return insert( pos, i, j, value );
4532 template<
typename Type >
4539 const Iterator pos( lowerBound( i, j ) );
4541 if( pos !=
end_[j] && pos->index_ == i ) {
4545 return insert( pos, i, j, value );
4562 template<
typename Type >
4566 if( begin_[j+1UL] -
end_[j] != 0 ) {
4567 std::move_backward( pos,
end_[j], castUp(
end_[j]+1UL ) );
4568 pos->value_ = value;
4574 else if(
end_[n_] - begin_[n_] != 0 ) {
4575 std::move_backward( pos,
end_[n_-1UL], castUp(
end_[n_-1]+1UL ) );
4577 pos->value_ = value;
4580 for(
size_t k=j+1UL; k<n_+1UL; ++k ) {
4588 size_t newCapacity( extendCapacity() );
4593 newBegin[0UL] = allocate<Element>( newCapacity );
4595 for(
size_t k=0UL; k<j; ++k ) {
4596 const size_t nonzeros(
end_[k] - begin_[k] );
4597 const size_t total( begin_[k+1UL] - begin_[k] );
4598 newEnd [k] = newBegin[k] + nonzeros;
4599 newBegin[k+1UL] = newBegin[k] + total;
4601 newEnd [j] = newBegin[j] + (
end_[j] - begin_[j] ) + 1;
4602 newBegin[j+1UL] = newBegin[j] + ( begin_[j+1UL] - begin_[j] ) + 1;
4603 for(
size_t k=j+1UL; k<
n_; ++k ) {
4604 const size_t nonzeros(
end_[k] - begin_[k] );
4605 const size_t total( begin_[k+1UL] - begin_[k] );
4606 newEnd [k] = newBegin[k] + nonzeros;
4607 newBegin[k+1UL] = newBegin[k] + total;
4610 newEnd[
n_] = newEnd[
capacity_] = newBegin[0UL]+newCapacity;
4612 Iterator tmp = castDown( std::move( begin_[0UL], pos, castUp( newBegin[0UL] ) ) );
4613 tmp->value_ = value;
4615 std::move( pos,
end_[n_-1UL], castUp( tmp+1UL ) );
4682 template<
typename Type >
4690 end_[j]->value_ = value;
4692 if( !check || !isDefault<strict>(
end_[j]->value_ ) ) {
4693 end_[j]->index_ = i;
4715 template<
typename Type >
4720 begin_[j+1UL] =
end_[j];
4746 template<
typename Type >
4752 const Iterator pos( find( i, j ) );
4753 if( pos !=
end_[j] )
4754 end_[j] = castDown( std::move( pos+1,
end_[j], castUp( pos ) ) );
4770 template<
typename Type >
4777 if( pos !=
end_[j] )
4778 end_[j] = castDown( std::move( pos+1,
end_[j], castUp( pos ) ) );
4797 template<
typename Type >
4807 end_[j] = castDown( std::move( last,
end_[j], castUp( first ) ) );
4837 template<
typename Type >
4838 template<
typename Pred >
4841 for(
size_t j=0UL; j<
n_; ++j ) {
4842 end_[j] = castDown( std::remove_if( castUp( begin_[j] ), castUp(
end_[j] ),
4843 [predicate=predicate](
const ElementBase& element ) {
4844 return predicate( element.value() );
4877 template<
typename Type >
4878 template<
typename Pred >
4886 const auto pos = std::remove_if( castUp( first ), castUp( last ),
4887 [predicate=predicate](
const ElementBase& element ) {
4888 return predicate( element.value() );
4891 end_[j] = castDown( std::move( last, end_[j], pos ) );
4920 template<
typename Type >
4924 return const_cast<Iterator>(
const_cast<const This&
>( *this ).find( i, j ) );
4945 template<
typename Type >
4950 if( pos != end_[j] && pos->index_ == i )
4952 else return end_[j];
4972 template<
typename Type >
4976 return const_cast<Iterator>(
const_cast<const This&
>( *this ).lowerBound( i, j ) );
4996 template<
typename Type >
5001 return std::lower_bound( begin_[j], end_[j], i,
5002 [](
const Element& element,
size_t index )
5004 return element.index() < index;
5025 template<
typename Type >
5029 return const_cast<Iterator>(
const_cast<const This&
>( *this ).upperBound( i, j ) );
5049 template<
typename Type >
5054 return std::upper_bound( begin_[j], end_[j], i,
5055 [](
size_t index,
const Element& element )
5057 return index < element.index();
5078 template<
typename Type >
5081 CompressedMatrix tmp(
trans( *
this ) );
5095 template<
typename Type >
5098 CompressedMatrix tmp(
ctrans( *
this ) );
5113 template<
typename Type >
5114 template<
typename Other >
5115 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::scale(
const Other& scalar )
5117 for(
size_t j=0UL; j<
n_; ++j )
5118 for(
Iterator element=begin_[j]; element!=end_[j]; ++element )
5119 element->value_ *= scalar;
5134 template<
typename Type >
5135 template<
typename Other >
5136 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::scaleDiagonal(
const Other& scalar )
5140 for(
size_t j=0UL; j<
size; ++j ) {
5142 if( pos != end_[j] && pos->index_ == j )
5143 pos->value_ *= scalar;
5171 template<
typename Type >
5172 template<
typename Other >
5175 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5192 template<
typename Type >
5193 template<
typename Other >
5196 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5213 template<
typename Type >
5234 template<
typename Type >
5235 template<
typename MT
5242 if(
m_ == 0UL || n_ == 0UL )
5245 size_t nonzeros( 0UL );
5247 for(
size_t j=1UL; j<=
n_; ++j )
5248 begin_[j] = end_[j] = end_[n_];
5250 for(
size_t j=0UL; j<
n_; ++j )
5252 begin_[j] = end_[j] = begin_[0UL]+nonzeros;
5254 const size_t ibegin( ( IsLower<MT>::value )
5255 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5257 const size_t iend ( ( IsUpper<MT>::value )
5258 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5261 for(
size_t i=ibegin; i<iend; ++i )
5264 reserveElements( extendCapacity() );
5265 for(
size_t k=j+1UL; k<=
n_; ++k )
5266 begin_[k] = end_[k] = end_[n_];
5269 end_[j]->value_ = (~rhs)(i,j);
5271 if( !isDefault<strict>( end_[j]->value_ ) ) {
5272 end_[j]->index_ = i;
5279 begin_[
n_] = begin_[0UL]+nonzeros;
5297 template<
typename Type >
5298 template<
typename MT >
5306 if( n_ == 0UL || begin_[0] ==
nullptr )
5309 for(
size_t j=0UL; j<
n_; ++j ) {
5310 end_[j] = castDown( std::copy( (~rhs).
begin(j), (~rhs).
end(j), castUp( begin_[j] ) ) );
5311 begin_[j+1UL] = end_[j];
5330 template<
typename Type >
5331 template<
typename MT >
5341 typedef ConstIterator_<MT> RhsIterator;
5344 std::vector<size_t> columnLengths( n_, 0UL );
5345 for(
size_t i=0UL; i<
m_; ++i ) {
5346 for( RhsIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5347 ++columnLengths[element->index()];
5351 for(
size_t j=0UL; j<
n_; ++j ) {
5352 begin_[j+1UL] = end_[j+1UL] = begin_[j] + columnLengths[j];
5356 for(
size_t i=0UL; i<
m_; ++i ) {
5357 for( RhsIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5358 append( i, element->index(), element->value() );
5377 template<
typename Type >
5378 template<
typename MT
5385 CompressedMatrix tmp(
serial( *
this + (~rhs) ) );
5404 template<
typename Type >
5405 template<
typename MT
5412 CompressedMatrix tmp(
serial( *
this + (~rhs) ) );
5431 template<
typename Type >
5432 template<
typename MT
5439 CompressedMatrix tmp(
serial( *
this - (~rhs) ) );
5458 template<
typename Type >
5459 template<
typename MT
5466 CompressedMatrix tmp(
serial( *
this - (~rhs) ) );
5488 template<
typename Type,
bool SO >
5489 inline void reset( CompressedMatrix<Type,SO>& m );
5491 template<
typename Type,
bool SO >
5492 inline void reset( CompressedMatrix<Type,SO>& m,
size_t i );
5494 template<
typename Type,
bool SO >
5495 inline void clear( CompressedMatrix<Type,SO>& m );
5497 template<
bool RF,
typename Type,
bool SO >
5498 inline bool isDefault(
const CompressedMatrix<Type,SO>& m );
5500 template<
typename Type,
bool SO >
5501 inline bool isIntact(
const CompressedMatrix<Type,SO>& m );
5503 template<
typename Type,
bool SO >
5504 inline void swap( CompressedMatrix<Type,SO>& a, CompressedMatrix<Type,SO>& b ) noexcept;
5516 template<
typename Type
5518 inline void reset( CompressedMatrix<Type,SO>& m )
5538 template<
typename Type
5540 inline void reset( CompressedMatrix<Type,SO>& m,
size_t i )
5554 template<
typename Type
5556 inline void clear( CompressedMatrix<Type,SO>& m )
5593 return ( m.rows() == 0UL && m.columns() == 0UL );
5616 template<
typename Type
5618 inline bool isIntact(
const CompressedMatrix<Type,SO>& m )
5620 return ( m.nonZeros() <= m.capacity() );
5633 template<
typename Type
5635 inline void swap( CompressedMatrix<Type,SO>& a, CompressedMatrix<Type,SO>& b ) noexcept
5652 template<
typename T,
bool SO >
5653 struct IsResizable< CompressedMatrix<T,SO> > :
public TrueType 5669 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5670 struct AddTrait< CompressedMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
5672 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
5675 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5676 struct AddTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5678 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
5681 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5682 struct AddTrait< StaticMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
5684 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
5687 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5688 struct AddTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5690 using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
5693 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5694 struct AddTrait< CompressedMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
5696 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
5699 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5700 struct AddTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5702 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO2 >;
5705 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5706 struct AddTrait< HybridMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
5708 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO >;
5711 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5712 struct AddTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5714 using Type = HybridMatrix< AddTrait_<T1,T2>, M, N, SO1 >;
5717 template<
typename T1,
bool SO,
typename T2 >
5718 struct AddTrait< CompressedMatrix<T1,SO>, DynamicMatrix<T2,SO> >
5720 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
5723 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5724 struct AddTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5726 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
5729 template<
typename T1,
bool SO,
typename T2 >
5730 struct AddTrait< DynamicMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5732 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
5735 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5736 struct AddTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5738 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
5741 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
5742 struct AddTrait< CompressedMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
5744 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
5747 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
5748 struct AddTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
5750 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO2 >;
5753 template<
typename T1,
bool AF,
bool PF,
bool SO,
typename T2 >
5754 struct AddTrait< CustomMatrix<T1,AF,PF,SO>, CompressedMatrix<T2,SO> >
5756 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO >;
5759 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
5760 struct AddTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
5762 using Type = DynamicMatrix< AddTrait_<T1,T2>, SO1 >;
5765 template<
typename T1,
bool SO,
typename T2 >
5766 struct AddTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5768 using Type = CompressedMatrix< AddTrait_<T1,T2>, SO >;
5771 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5772 struct AddTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5774 using Type = CompressedMatrix< AddTrait_<T1,T2>,
false >;
5790 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5791 struct SubTrait< CompressedMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
5793 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
5796 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5797 struct SubTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5799 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
5802 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5803 struct SubTrait< StaticMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
5805 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
5808 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5809 struct SubTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5811 using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
5814 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
5815 struct SubTrait< CompressedMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
5817 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
5820 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5821 struct SubTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5823 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO2 >;
5826 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5827 struct SubTrait< HybridMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
5829 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO >;
5832 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5833 struct SubTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5835 using Type = HybridMatrix< SubTrait_<T1,T2>, M, N, SO1 >;
5838 template<
typename T1,
bool SO,
typename T2 >
5839 struct SubTrait< CompressedMatrix<T1,SO>, DynamicMatrix<T2,SO> >
5841 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
5844 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5845 struct SubTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5847 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
5850 template<
typename T1,
bool SO,
typename T2 >
5851 struct SubTrait< DynamicMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5853 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
5856 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5857 struct SubTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5859 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
5862 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
5863 struct SubTrait< CompressedMatrix<T1,SO>, CustomMatrix<T2,AF,PF,SO> >
5865 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
5868 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
5869 struct SubTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
5871 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO2 >;
5874 template<
typename T1,
bool AF,
bool PF,
bool SO,
typename T2 >
5875 struct SubTrait< CustomMatrix<T1,AF,PF,SO>, CompressedMatrix<T2,SO> >
5877 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO >;
5880 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
5881 struct SubTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
5883 using Type = DynamicMatrix< SubTrait_<T1,T2>, SO1 >;
5886 template<
typename T1,
bool SO,
typename T2 >
5887 struct SubTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5889 using Type = CompressedMatrix< SubTrait_<T1,T2> , SO >;
5892 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5893 struct SubTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5895 using Type = CompressedMatrix< SubTrait_<T1,T2> ,
false >;
5911 template<
typename T1,
bool SO,
typename T2 >
5912 struct MultTrait< CompressedMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
5914 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
5917 template<
typename T1,
typename T2,
bool SO >
5918 struct MultTrait< T1, CompressedMatrix<T2,SO>, EnableIf_< IsNumeric<T1> > >
5920 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO >;
5923 template<
typename T1,
bool SO,
typename T2,
size_t N >
5924 struct MultTrait< CompressedMatrix<T1,SO>, StaticVector<T2,N,false> >
5926 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
5929 template<
typename T1,
size_t N,
typename T2,
bool SO >
5930 struct MultTrait< StaticVector<T1,N,true>, CompressedMatrix<T2,SO> >
5932 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
5935 template<
typename T1,
bool SO,
typename T2,
size_t N >
5936 struct MultTrait< CompressedMatrix<T1,SO>, HybridVector<T2,N,false> >
5938 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
5941 template<
typename T1,
size_t N,
typename T2,
bool SO >
5942 struct MultTrait< HybridVector<T1,N,true>, CompressedMatrix<T2,SO> >
5944 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
5947 template<
typename T1,
bool SO,
typename T2 >
5948 struct MultTrait< CompressedMatrix<T1,SO>, DynamicVector<T2,false> >
5950 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
5953 template<
typename T1,
typename T2,
bool SO >
5954 struct MultTrait< DynamicVector<T1,true>, CompressedMatrix<T2,SO> >
5956 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
5959 template<
typename T1,
bool SO,
typename T2,
bool AF,
bool PF >
5960 struct MultTrait< CompressedMatrix<T1,SO>, CustomVector<T2,AF,PF,false> >
5962 using Type = DynamicVector< MultTrait_<T1,T2>,
false >;
5965 template<
typename T1,
bool AF,
bool PF,
typename T2,
bool SO >
5966 struct MultTrait< CustomVector<T1,AF,PF,true>, CompressedMatrix<T2,SO> >
5968 using Type = DynamicVector< MultTrait_<T1,T2>,
true >;
5971 template<
typename T1,
bool SO,
typename T2 >
5972 struct MultTrait< CompressedMatrix<T1,SO>, CompressedVector<T2,false> >
5974 using Type = CompressedVector< MultTrait_<T1,T2>,
false >;
5977 template<
typename T1,
typename T2,
bool SO >
5978 struct MultTrait< CompressedVector<T1,true>, CompressedMatrix<T2,SO> >
5980 using Type = CompressedVector< MultTrait_<T1,T2>,
true >;
5983 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5984 struct MultTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5986 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
5989 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5990 struct MultTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5992 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
5995 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5996 struct MultTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5998 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6001 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6002 struct MultTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
6004 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6007 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6008 struct MultTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
6010 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6013 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6014 struct MultTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6016 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6019 template<
typename T1,
bool SO1,
typename T2,
bool AF,
bool PF,
bool SO2 >
6020 struct MultTrait< CompressedMatrix<T1,SO1>, CustomMatrix<T2,AF,PF,SO2> >
6022 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6025 template<
typename T1,
bool AF,
bool PF,
bool SO1,
typename T2,
bool SO2 >
6026 struct MultTrait< CustomMatrix<T1,AF,PF,SO1>, CompressedMatrix<T2,SO2> >
6028 using Type = DynamicMatrix< MultTrait_<T1,T2>, SO1 >;
6031 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
6032 struct MultTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
6034 using Type = CompressedMatrix< MultTrait_<T1,T2>, SO1 >;
6050 template<
typename T1,
bool SO,
typename T2 >
6051 struct DivTrait< CompressedMatrix<T1,SO>, T2, EnableIf_< IsNumeric<T2> > >
6053 using Type = CompressedMatrix< DivTrait_<T1,T2>, SO >;
6069 template<
typename T1,
bool SO,
typename T2 >
6070 struct HighType< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6072 using Type = CompressedMatrix< typename HighType<T1,T2>::Type, SO >;
6088 template<
typename T1,
bool SO,
typename T2 >
6089 struct LowType< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
6091 using Type = CompressedMatrix< typename LowType<T1,T2>::Type, SO >;
6107 template<
typename T1,
bool SO >
6108 struct SubmatrixTrait< CompressedMatrix<T1,SO> >
6110 using Type = CompressedMatrix<T1,SO>;
6126 template<
typename T1,
bool SO >
6127 struct RowTrait< CompressedMatrix<T1,SO> >
6129 using Type = CompressedVector<T1,true>;
6145 template<
typename T1,
bool SO >
6146 struct ColumnTrait< CompressedMatrix<T1,SO> >
6148 using Type = CompressedVector<T1,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:1782
Header file for auxiliary alias declarations.
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:500
Header file for mathematical functions.
#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
MatrixAccessProxy< This > Reference
Reference to a compressed matrix value.
Definition: CompressedMatrix.h:297
CompressedMatrix< NewType, true > Other
The type of the other CompressedMatrix.
Definition: CompressedMatrix.h:2947
Header file for the subtraction trait.
bool canSMPAssign() const noexcept
Returns whether the matrix can be used in SMP assignments.
Definition: CompressedMatrix.h:2576
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
Header file for basic type definitions.
const Type & ConstReference
Reference to a constant compressed matrix value.
Definition: CompressedMatrix.h:298
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: CompressedMatrix.h:2557
Header file for the row trait.
CompressedMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: CompressedMatrix.h:2463
CompressedMatrix()
The default constructor for CompressedMatrix.
Definition: CompressedMatrix.h:544
Header file for the serial shim.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
const CTransExprTrait_< MT > ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatForEachExpr.h:1251
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:1339
Iterator end(size_t i) noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: CompressedMatrix.h:963
Reference operator()(size_t i, size_t j) noexcept
2D-access to the compressed matrix elements.
Definition: CompressedMatrix.h:789
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:194
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:3135
void clear()
Clearing the compressed matrix.
Definition: CompressedMatrix.h:1485
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:294
OutputIterator transfer(InputIterator first, InputIterator last, OutputIterator dest)
Transfers the elements from the given source range to the destination range.
Definition: Algorithm.h:71
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:88
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
CompressedMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:292
#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:755
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
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:390
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:1356
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
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:1321
ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first non-zero element of row/column i.
Definition: CompressedMatrix.h:941
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:502
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:295
Resize mechanism to obtain a CompressedMatrix with different fixed dimensions.
Definition: CompressedMatrix.h:2956
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:71
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:119
void swap(CompressedMatrix &sm) noexcept
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:1741
Constraint on the data type.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:3137
Header file for the SparseMatrix base class.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:498
void reserve(size_t nonzeros)
Setting the minimum capacity of the compressed matrix.
Definition: CompressedMatrix.h:1607
void reset()
Reset to the default initial values.
Definition: CompressedMatrix.h:1447
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:296
Header file for the ValueIndexPair class.
CompressedMatrix< Type, true > Other
The type of the other CompressedMatrix.
Definition: CompressedMatrix.h:2957
Header file for the LowType type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5635
Header file for the If class template.
CompressedMatrix< NewType, SO > Other
The type of the other CompressedMatrix.
Definition: CompressedMatrix.h:308
Header file for the IsFloatingPoint type trait.
Iterator set(size_t i, size_t j, const Type &value)
Setting an element of the compressed matrix.
Definition: CompressedMatrix.h:1867
Header file for the MatrixAccessProxy class.
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#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.
void erase(size_t i, size_t j)
Erasing an element from the compressed matrix.
Definition: CompressedMatrix.h:2109
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:3139
size_t rows() const noexcept
Returns the current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:1342
#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
ValueIndexPair< Type > ElementBase
Base class for the compressed matrix element.
Definition: CompressedMatrix.h:213
size_t capacity() const noexcept
Returns the maximum capacity of the compressed matrix.
Definition: CompressedMatrix.h:1370
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last non-zero element of row/column i.
Definition: CompressedMatrix.h:1007
Constraint on the data type.
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:336
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:1837
Iterator insert(size_t i, size_t j, const Type &value)
Inserting an element into the compressed matrix.
Definition: CompressedMatrix.h:1899
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:544
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:260
Headerfile for generic algorithms.
void subAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the subtraction assignment of a dense matrix.
Definition: CompressedMatrix.h:2790
size_t nonZeros() const
Returns the number of non-zero elements in the compressed matrix.
Definition: CompressedMatrix.h:1407
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:553
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:300
typename DivTrait< T1, T2 >::Type DivTrait_
Auxiliary alias declaration for the DivTrait class template.The DivTrait_ alias declaration provides ...
Definition: DivTrait.h:245
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the compressed matrix.
Definition: CompressedMatrix.h:1512
Header file for the IsNumeric type trait.
CompressedMatrix & operator=(const CompressedMatrix &rhs)
Copy assignment operator for CompressedMatrix.
Definition: CompressedMatrix.h:1035
#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:2537
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:1285
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:317
CompressedMatrix & transpose()
In-place transpose of the matrix.
Definition: CompressedMatrix.h:2447
Header file for the division trait.
void trim()
Removing all excessive capacity from all rows/columns.
Definition: CompressedMatrix.h:1701
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:160
#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
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
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:267
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
Constraint on the data type.
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:291
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:3138
void assign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the assignment of a row-major dense matrix.
Definition: CompressedMatrix.h:2598
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:299
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:2047
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:225
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: CompressedMatrix.h:2079
CompressedMatrix< Type, SO > Other
The type of the other CompressedMatrix.
Definition: CompressedMatrix.h:318
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
CompressedMatrix< Type, SO > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:289
Iterator find(size_t i, size_t j)
Searches for a specific matrix element.
Definition: CompressedMatrix.h:2287
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:499
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:3136
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:1819
void addAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the addition assignment of a dense matrix.
Definition: CompressedMatrix.h:2738
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:293
SparseMatrix< This, SO > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:290
Iterator lowerBound(size_t i, size_t j)
Returns an iterator to the first index not less then the given index.
Definition: CompressedMatrix.h:2340
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:3141
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:2395
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
ElementBase * IteratorBase
Iterator over non-constant base elements.
Definition: CompressedMatrix.h:214
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
size_t extendCapacity() const noexcept
Calculating a new matrix capacity.
Definition: CompressedMatrix.h:1762
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:307
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2946
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:1303
Header file for the IsUpper type trait.
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:497
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: CompressedMatrix.h:843
Header file for the IsResizable type trait.
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:496
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
Reference value()
Access to the current value of the value-index-pair.
Definition: ValueIndexPair.h:361
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:897
constexpr bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56