35 #ifndef _BLAZE_MATH_SPARSE_COMPRESSEDMATRIX_H_
36 #define _BLAZE_MATH_SPARSE_COMPRESSEDMATRIX_H_
207 template<
typename Type
220 struct Element :
public ElementBase
224 template<
typename Other >
225 inline Element&
operator=(
const Other& rhs )
227 ElementBase::operator=( rhs );
240 struct FindIndex :
public std::binary_function<Element,size_t,bool>
242 inline bool operator()(
const Element& element,
size_t index )
const {
243 return element.index() < index;
245 inline bool operator()(
size_t index,
const Element& element )
const {
246 return index < element.index();
248 inline bool operator()(
const Element& element1,
const Element& element2 )
const {
249 return element1.index() < element2.index();
273 template<
typename ET >
293 explicit CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros );
310 inline Reference
operator()(
size_t i,
size_t j );
311 inline ConstReference
operator()(
size_t i,
size_t j )
const;
312 inline Iterator
begin (
size_t i );
313 inline ConstIterator
begin (
size_t i )
const;
314 inline ConstIterator
cbegin(
size_t i )
const;
315 inline Iterator
end (
size_t i );
316 inline ConstIterator
end (
size_t i )
const;
317 inline ConstIterator
cend (
size_t i )
const;
331 template<
typename Other >
333 operator*=( Other rhs );
335 template<
typename Other >
337 operator/=( Other rhs );
344 inline size_t rows()
const;
347 inline size_t capacity(
size_t i )
const;
349 inline size_t nonZeros(
size_t i )
const;
351 inline void reset(
size_t i );
353 inline Iterator
set (
size_t i,
size_t j,
const Type& value );
354 inline Iterator
insert (
size_t i,
size_t j,
const Type& value );
355 inline void erase (
size_t i,
size_t j );
356 inline Iterator
erase (
size_t i, Iterator pos );
357 inline Iterator
erase (
size_t i, Iterator first, Iterator last );
358 void resize (
size_t m,
size_t n,
bool preserve=
true );
359 inline void reserve(
size_t nonzeros );
360 void reserve(
size_t i,
size_t nonzeros );
362 inline void trim (
size_t i );
364 template<
typename Other >
inline CompressedMatrix& scale(
const Other& scalar );
365 template<
typename Other >
inline CompressedMatrix& scaleDiagonal( Other scalar );
373 inline Iterator
find (
size_t i,
size_t j );
374 inline ConstIterator
find (
size_t i,
size_t j )
const;
375 inline Iterator
lowerBound(
size_t i,
size_t j );
376 inline ConstIterator
lowerBound(
size_t i,
size_t j )
const;
377 inline Iterator
upperBound(
size_t i,
size_t j );
378 inline ConstIterator
upperBound(
size_t i,
size_t j )
const;
385 inline void append (
size_t i,
size_t j,
const Type& value,
bool check=
false );
393 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
394 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
412 Iterator
insert( Iterator pos,
size_t i,
size_t j,
const Type& value );
452 template<
typename Type,
bool SO >
467 template<
typename Type
489 template<
typename Type
498 for(
size_t i=0UL; i<2UL*
m_+2UL; ++i )
513 template<
typename Type
522 begin_[0UL] = allocate<Element>( nonzeros );
523 for(
size_t i=1UL; i<(2UL*
m_+1UL); ++i )
541 template<
typename Type
550 BLAZE_USER_ASSERT( nonzeros.size() == m,
"Size of capacity vector and number of rows don't match" );
552 size_t newCapacity( 0UL );
553 for( std::vector<size_t>::const_iterator it=nonzeros.begin(); it!=nonzeros.end(); ++it )
556 begin_[0UL] =
end_[0UL] = allocate<Element>( newCapacity );
557 for(
size_t i=0UL; i<
m_; ++i ) {
569 template<
typename Type
578 const size_t nonzeros( sm.
nonZeros() );
580 begin_[0UL] = allocate<Element>( nonzeros );
581 for(
size_t i=0UL; i<
m_; ++i )
582 begin_[i+1UL] =
end_[i] = std::copy( sm.
begin(i), sm.
end(i), begin_[i] );
583 end_[
m_] = begin_[0UL]+nonzeros;
593 template<
typename Type
595 template<
typename MT
606 for(
size_t i=0UL; i<2UL*
m_+2UL; ++i )
619 template<
typename Type
621 template<
typename MT
632 const size_t nonzeros( (~sm).
nonZeros() );
634 begin_[0UL] = allocate<Element>( nonzeros );
635 for(
size_t i=0UL; i<
m_; ++i )
655 template<
typename Type
680 template<
typename Type
700 template<
typename Type
710 if( pos ==
end_[i] || pos->index_ != j )
729 template<
typename Type
751 template<
typename Type
773 template<
typename Type
795 template<
typename Type
817 template<
typename Type
839 template<
typename Type
867 template<
typename Type
872 if( &rhs ==
this )
return *
this;
874 const size_t nonzeros( rhs.
nonZeros() );
881 newBegin[0UL] = allocate<Element>( nonzeros );
882 for(
size_t i=0UL; i<rhs.
m_; ++i ) {
883 newBegin[i+1UL] = newEnd[i] = std::copy( rhs.
begin_[i], rhs.
end_[i], newBegin[i] );
885 newEnd[rhs.
m_] = newBegin[0UL]+nonzeros;
894 for(
size_t i=0UL; i<rhs.
m_; ++i ) {
916 template<
typename Type
918 template<
typename MT
925 if( (~rhs).canAlias(
this ) ) {
948 template<
typename Type
950 template<
typename MT
957 if( (~rhs).canAlias(
this ) ||
984 template<
typename Type
986 template<
typename MT
994 throw std::invalid_argument(
"Matrix sizes do not match" );
1012 template<
typename Type
1014 template<
typename MT
1021 throw std::invalid_argument(
"Matrix sizes do not match" );
1039 template<
typename Type
1041 template<
typename MT
1046 if( (~rhs).
rows() !=
n_ )
1047 throw std::invalid_argument(
"Matrix sizes do not match" );
1064 template<
typename Type
1066 template<
typename Other >
1070 for(
size_t i=0UL; i<
m_; ++i ) {
1073 element->value_ *= rhs;
1087 template<
typename Type
1089 template<
typename Other >
1101 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
1102 for(
size_t i=0UL; i<
m_; ++i ) {
1105 element->value_ *= tmp;
1109 for(
size_t i=0UL; i<
m_; ++i ) {
1112 element->value_ /= rhs;
1134 template<
typename Type
1148 template<
typename Type
1162 template<
typename Type
1182 template<
typename Type
1197 template<
typename Type
1201 size_t nonzeros( 0UL );
1203 for(
size_t i=0UL; i<
m_; ++i )
1222 template<
typename Type
1237 template<
typename Type
1241 for(
size_t i=0UL; i<
m_; ++i )
1258 template<
typename Type
1275 template<
typename Type
1298 template<
typename Type
1306 const Iterator pos( lowerBound( i, j ) );
1308 if( pos !=
end_[i] && pos->index_ == j ) {
1309 pos->value() = value;
1312 else return insert( pos, i, j, value );
1330 template<
typename Type
1338 const Iterator pos( lowerBound( i, j ) );
1340 if( pos !=
end_[i] && pos->index_ == j )
1341 throw std::invalid_argument(
"Bad access index" );
1343 return insert( pos, i, j, value );
1358 template<
typename Type
1364 std::copy_backward( pos,
end_[i],
end_[i]+1 );
1365 pos->value_ = value;
1372 std::copy_backward( pos,
end_[
m_-1UL],
end_[
m_-1UL]+1 );
1374 pos->value_ = value;
1377 for(
size_t k=i+1UL; k<
m_+1UL; ++k ) {
1385 size_t newCapacity( extendCapacity() );
1390 newBegin[0UL] = allocate<Element>( newCapacity );
1392 for(
size_t k=0UL; k<i; ++k ) {
1393 const size_t nonzeros(
end_[k] -
begin_[k] );
1395 newEnd [k] = newBegin[k] + nonzeros;
1396 newBegin[k+1UL] = newBegin[k] + total;
1398 newEnd [i] = newBegin[i] + (
end_[i] -
begin_[i] ) + 1;
1399 newBegin[i+1UL] = newBegin[i] + (
begin_[i+1] -
begin_[i] ) + 1;
1400 for(
size_t k=i+1UL; k<
m_; ++k ) {
1401 const size_t nonzeros(
end_[k] -
begin_[k] );
1403 newEnd [k] = newBegin[k] + nonzeros;
1404 newBegin[k+1UL] = newBegin[k] + total;
1407 newEnd[
m_] = newEnd[
capacity_] = newBegin[0UL]+newCapacity;
1410 tmp->value_ = value;
1412 std::copy( pos,
end_[m_-1UL], tmp+1UL );
1434 template<
typename Type
1441 const Iterator pos( find( i, j ) );
1442 if( pos !=
end_[i] )
1443 end_[i] = std::copy( pos+1,
end_[i], pos );
1459 template<
typename Type
1467 if( pos !=
end_[i] )
1468 end_[i] = std::copy( pos+1,
end_[i], pos );
1487 template<
typename Type
1498 end_[i] = std::copy( last,
end_[i], first );
1520 template<
typename Type
1527 if( m ==
m_ && n ==
n_ )
return;
1532 Iterator* newEnd ( newBegin+m+1UL );
1534 newBegin[0UL] =
begin_[0UL];
1537 for(
size_t i=0UL; i<
m_; ++i ) {
1538 newEnd [i] =
end_ [i];
1539 newBegin[i+1UL] =
begin_[i+1UL];
1541 for(
size_t i=m_; i<m; ++i ) {
1542 newBegin[i+1UL] = newEnd[i] =
begin_[
m_];
1546 for(
size_t i=0UL; i<m; ++i ) {
1547 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 )
1574 for(
size_t i=0UL; i<m; ++i )
1575 end_[i] = lowerBound( i, n );
1578 for(
size_t i=0UL; i<m; ++i )
1604 template<
typename Type
1609 reserveElements( nonzeros );
1628 template<
typename Type
1637 const size_t current(
capacity(i) );
1639 if( current >= nonzeros )
return;
1641 const ptrdiff_t additional( nonzeros - current );
1645 const size_t newCapacity(
begin_[
m_] -
begin_[0UL] + additional );
1651 newBegin[0UL] = allocate<Element>( newCapacity );
1652 newEnd [
m_ ] = newBegin[0UL]+newCapacity;
1654 for(
size_t k=0UL; k<i; ++k ) {
1655 newEnd [k ] = std::copy(
begin_[k],
end_[k], newBegin[k] );
1656 newBegin[k+1UL] = newBegin[k] +
capacity(k);
1658 newEnd [i ] = std::copy(
begin_[i],
end_[i], newBegin[i] );
1659 newBegin[i+1UL] = newBegin[i] + nonzeros;
1660 for(
size_t k=i+1UL; k<
m_; ++k ) {
1661 newEnd [k ] = std::copy(
begin_[k],
end_[k], newBegin[k] );
1662 newBegin[k+1UL] = newBegin[k] +
capacity(k);
1676 for(
size_t j=
m_-1UL; j>i; --j ) {
1678 end_ [j] += additional;
1698 template<
typename Type
1702 for(
size_t i=0UL; i<
m_; ++i )
1719 template<
typename Type
1725 if( i < (
m_ - 1UL ) )
1737 template<
typename Type
1754 template<
typename Type
1756 template<
typename Other >
1759 for(
size_t i=0UL; i<
m_; ++i )
1761 element->value_ *= scalar;
1774 template<
typename Type
1776 template<
typename Other >
1781 for(
size_t i=0UL; i<
size; ++i ) {
1783 if( pos !=
end_[i] && pos->index_ == i )
1784 pos->value_ *= scalar;
1799 template<
typename Type
1820 template<
typename Type
1824 size_t nonzeros( 2UL*
capacity()+1UL );
1840 template<
typename Type
1847 newBegin[0UL] = allocate<Element>( nonzeros );
1849 for(
size_t k=0UL; k<
m_; ++k ) {
1851 newEnd [k] = std::copy(
begin_[k],
end_[k], newBegin[k] );
1852 newBegin[k+1UL] = newBegin[k] + (
begin_[k+1UL] -
begin_[k] );
1855 newEnd[
m_] = newBegin[0UL]+nonzeros;
1888 template<
typename Type
1893 return const_cast<Iterator>(
const_cast<const This&
>( *this ).
find( i, j ) );
1913 template<
typename Type
1919 if( pos !=
end_[i] && pos->index_ == j )
1921 else return end_[i];
1941 template<
typename Type
1966 template<
typename Type
1972 return std::lower_bound(
begin_[i],
end_[i], j, FindIndex() );
1992 template<
typename Type
2017 template<
typename Type
2023 return std::upper_bound(
begin_[i],
end_[i], j, FindIndex() );
2080 template<
typename Type
2089 end_[i]->value_ = value;
2092 end_[i]->index_ = j;
2112 template<
typename Type
2143 template<
typename Type
2145 template<
typename Other >
2148 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2163 template<
typename Type
2165 template<
typename Other >
2168 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2183 template<
typename Type
2203 template<
typename Type
2205 template<
typename MT
2212 size_t nonzeros( 0UL );
2214 for(
size_t i=1UL; i<=
m_; ++i )
2217 for(
size_t i=0UL; i<
m_; ++i )
2228 for(
size_t j=jbegin; j<jend; ++j )
2231 reserveElements( extendCapacity() );
2232 for(
size_t k=i+1UL; k<=
m_; ++k )
2236 end_[i]->value_ = (~rhs)(i,j);
2239 end_[i]->index_ = j;
2262 template<
typename Type
2264 template<
typename MT >
2272 if(
m_ == 0UL ||
begin_[0] == NULL )
2275 for(
size_t i=0UL; i<
m_; ++i ) {
2293 template<
typename Type
2295 template<
typename MT >
2308 std::vector<size_t> rowLengths(
m_, 0UL );
2309 for(
size_t j=0UL; j<
n_; ++j ) {
2310 for( RhsIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2311 ++rowLengths[element->index()];
2315 for(
size_t i=0UL; i<
m_; ++i ) {
2320 for(
size_t j=0UL; j<
n_; ++j ) {
2321 for( RhsIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2322 append( element->index(), j, element->value() );
2339 template<
typename Type
2341 template<
typename MT
2365 template<
typename Type
2367 template<
typename MT
2391 template<
typename Type
2393 template<
typename MT
2417 template<
typename Type
2419 template<
typename MT
2452 template<
typename Type >
2464 struct Element :
public ElementBase
2468 template<
typename Other >
2469 inline Element&
operator=(
const Other& rhs )
2471 ElementBase::operator=( rhs );
2484 struct FindIndex :
public std::binary_function<Element,size_t,bool>
2486 inline bool operator()(
const Element& element,
size_t index )
const {
2487 return element.index() < index;
2489 inline bool operator()(
size_t index,
const Element& element )
const {
2490 return index < element.index();
2492 inline bool operator()(
const Element& element1,
const Element& element2 )
const {
2493 return element1.index() < element2.index();
2517 template<
typename ET >
2537 explicit CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros );
2539 template<
typename MT,
bool SO >
inline CompressedMatrix(
const DenseMatrix<MT,SO>& dm );
2540 template<
typename MT,
bool SO >
inline CompressedMatrix(
const SparseMatrix<MT,SO>& sm );
2554 inline Reference
operator()(
size_t i,
size_t j );
2555 inline ConstReference
operator()(
size_t i,
size_t j )
const;
2556 inline Iterator
begin (
size_t i );
2557 inline ConstIterator
begin (
size_t i )
const;
2558 inline ConstIterator
cbegin(
size_t i )
const;
2559 inline Iterator
end (
size_t i );
2560 inline ConstIterator
end (
size_t i )
const;
2561 inline ConstIterator
cend (
size_t i )
const;
2571 template<
typename MT,
bool SO >
inline CompressedMatrix& operator+=(
const Matrix<MT,SO>& rhs );
2572 template<
typename MT,
bool SO >
inline CompressedMatrix& operator-=(
const Matrix<MT,SO>& rhs );
2573 template<
typename MT,
bool SO >
inline CompressedMatrix& operator*=(
const Matrix<MT,SO>& rhs );
2575 template<
typename Other >
2577 operator*=( Other rhs );
2579 template<
typename Other >
2581 operator/=( Other rhs );
2588 inline size_t rows()
const;
2589 inline size_t columns()
const;
2591 inline size_t capacity(
size_t j )
const;
2593 inline size_t nonZeros(
size_t j )
const;
2594 inline void reset();
2595 inline void reset(
size_t j );
2596 inline void clear();
2597 inline Iterator
set (
size_t i,
size_t j,
const Type& value );
2598 inline Iterator
insert (
size_t i,
size_t j,
const Type& value );
2599 inline void erase (
size_t i,
size_t j );
2600 inline Iterator
erase (
size_t j, Iterator pos );
2601 inline Iterator
erase (
size_t j, Iterator first, Iterator last );
2602 void resize (
size_t m,
size_t n,
bool preserve=
true );
2603 inline void reserve(
size_t nonzeros );
2604 void reserve(
size_t j,
size_t nonzeros );
2605 inline void trim ();
2606 inline void trim (
size_t j );
2608 template<
typename Other >
inline CompressedMatrix& scale(
const Other& scalar );
2609 template<
typename Other >
inline CompressedMatrix& scaleDiagonal( Other scalar );
2617 inline Iterator
find (
size_t i,
size_t j );
2618 inline ConstIterator
find (
size_t i,
size_t j )
const;
2619 inline Iterator
lowerBound(
size_t i,
size_t j );
2620 inline ConstIterator
lowerBound(
size_t i,
size_t j )
const;
2621 inline Iterator
upperBound(
size_t i,
size_t j );
2622 inline ConstIterator
upperBound(
size_t i,
size_t j )
const;
2629 inline void append (
size_t i,
size_t j,
const Type& value,
bool check=
false );
2637 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2638 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
2642 template<
typename MT,
bool SO >
inline void assign (
const DenseMatrix<MT,SO>& rhs );
2643 template<
typename MT >
inline void assign (
const SparseMatrix<MT,true>& rhs );
2644 template<
typename MT >
inline void assign (
const SparseMatrix<MT,false>& rhs );
2645 template<
typename MT,
bool SO >
inline void addAssign(
const DenseMatrix<MT,SO>& rhs );
2646 template<
typename MT,
bool SO >
inline void addAssign(
const SparseMatrix<MT,SO>& rhs );
2647 template<
typename MT,
bool SO >
inline void subAssign(
const DenseMatrix<MT,SO>& rhs );
2648 template<
typename MT,
bool SO >
inline void subAssign(
const SparseMatrix<MT,SO>& rhs );
2656 Iterator
insert( Iterator pos,
size_t i,
size_t j,
const Type& value );
2697 template<
typename Type >
2713 template<
typename Type >
2736 template<
typename Type >
2737 inline CompressedMatrix<Type,true>::CompressedMatrix(
size_t m,
size_t n )
2744 for(
size_t j=0UL; j<2UL*
n_+2UL; ++j )
2761 template<
typename Type >
2762 inline CompressedMatrix<Type,true>::CompressedMatrix(
size_t m,
size_t n,
size_t nonzeros )
2769 begin_[0UL] = allocate<Element>( nonzeros );
2770 for(
size_t j=1UL; j<(2UL*
n_+1UL); ++j )
2789 template<
typename Type >
2790 CompressedMatrix<Type,true>::CompressedMatrix(
size_t m,
size_t n,
const std::vector<size_t>& nonzeros )
2797 BLAZE_USER_ASSERT( nonzeros.size() == n,
"Size of capacity vector and number of columns don't match" );
2799 size_t newCapacity( 0UL );
2800 for( std::vector<size_t>::const_iterator it=nonzeros.begin(); it!=nonzeros.end(); ++it )
2803 begin_[0UL] =
end_[0UL] = allocate<Element>( newCapacity );
2804 for(
size_t j=0UL; j<
n_; ++j ) {
2818 template<
typename Type >
2819 inline CompressedMatrix<Type,true>::CompressedMatrix(
const CompressedMatrix& sm )
2826 const size_t nonzeros( sm.nonZeros() );
2828 begin_[0UL] = allocate<Element>( nonzeros );
2829 for(
size_t j=0UL; j<
n_; ++j )
2830 begin_[j+1UL] =
end_[j] = std::copy( sm.begin(j), sm.end(j), begin_[j] );
2831 end_[
n_] = begin_[0UL]+nonzeros;
2843 template<
typename Type >
2844 template<
typename MT
2846 inline CompressedMatrix<Type,true>::CompressedMatrix(
const DenseMatrix<MT,SO>& dm )
2850 , begin_ ( new
Iterator[2UL*n_+2UL] )
2851 ,
end_ ( begin_+(n_+1UL) )
2855 for(
size_t j=0UL; j<2UL*n_+2UL; ++j )
2870 template<
typename Type >
2871 template<
typename MT
2873 inline CompressedMatrix<Type,true>::CompressedMatrix(
const SparseMatrix<MT,SO>& sm )
2877 , begin_ ( new
Iterator[2UL*n_+2UL] )
2878 ,
end_ ( begin_+(n_+1UL) )
2882 const size_t nonzeros( (~sm).
nonZeros() );
2884 begin_[0UL] = allocate<Element>( nonzeros );
2885 for(
size_t j=0UL; j<
n_; ++j )
2886 begin_[j+1UL] =
end_[j] = begin_[0UL];
2887 end_[
n_] = begin_[0UL]+nonzeros;
2907 template<
typename Type >
2908 inline CompressedMatrix<Type,true>::~CompressedMatrix()
2933 template<
typename Type >
2935 CompressedMatrix<Type,true>::operator()(
size_t i,
size_t j )
2954 template<
typename Type >
2956 CompressedMatrix<Type,true>::operator()(
size_t i,
size_t j )
const
2963 if( pos ==
end_[j] || pos->index_ != i )
2979 template<
typename Type >
2981 CompressedMatrix<Type,true>::begin(
size_t j )
2997 template<
typename Type >
2999 CompressedMatrix<Type,true>::begin(
size_t j )
const
3015 template<
typename Type >
3017 CompressedMatrix<Type,true>::cbegin(
size_t j )
const
3033 template<
typename Type >
3035 CompressedMatrix<Type,true>::end(
size_t j )
3051 template<
typename Type >
3053 CompressedMatrix<Type,true>::end(
size_t j )
const
3069 template<
typename Type >
3071 CompressedMatrix<Type,true>::cend(
size_t j )
const
3098 template<
typename Type >
3099 inline CompressedMatrix<Type,true>&
3100 CompressedMatrix<Type,true>::operator=(
const CompressedMatrix& rhs )
3102 if( &rhs ==
this )
return *
this;
3104 const size_t nonzeros( rhs.nonZeros() );
3109 Iterator* newEnd ( newBegin+(rhs.n_+1UL) );
3111 newBegin[0UL] = allocate<Element>( nonzeros );
3112 for(
size_t j=0UL; j<rhs.n_; ++j ) {
3113 newBegin[j+1UL] = newEnd[j] = std::copy( rhs.begin_[j], rhs.end_[j], newBegin[j] );
3115 newEnd[rhs.n_] = newBegin[0UL]+nonzeros;
3124 for(
size_t j=0UL; j<rhs.n_; ++j ) {
3125 begin_[j+1UL] =
end_[j] = std::copy( rhs.begin_[j], rhs.end_[j], begin_[j] );
3148 template<
typename Type >
3149 template<
typename MT
3151 inline CompressedMatrix<Type,true>&
3152 CompressedMatrix<Type,true>::operator=(
const DenseMatrix<MT,SO>& rhs )
3156 if( (~rhs).canAlias(
this ) ) {
3157 CompressedMatrix tmp( ~rhs );
3181 template<
typename Type >
3182 template<
typename MT
3184 inline CompressedMatrix<Type,true>&
3185 CompressedMatrix<Type,true>::operator=(
const SparseMatrix<MT,SO>& rhs )
3189 if( (~rhs).canAlias(
this ) ||
3192 CompressedMatrix tmp( ~rhs );
3218 template<
typename Type >
3219 template<
typename MT
3221 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::operator+=(
const Matrix<MT,SO>& rhs )
3226 throw std::invalid_argument(
"Matrix sizes do not match" );
3246 template<
typename Type >
3247 template<
typename MT
3249 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::operator-=(
const Matrix<MT,SO>& rhs )
3254 throw std::invalid_argument(
"Matrix sizes do not match" );
3274 template<
typename Type >
3275 template<
typename MT
3277 inline CompressedMatrix<Type,true>&
3278 CompressedMatrix<Type,true>::operator*=(
const Matrix<MT,SO>& rhs )
3280 if( (~rhs).
rows() != n_ )
3281 throw std::invalid_argument(
"Matrix sizes do not match" );
3283 CompressedMatrix tmp( *
this * (~rhs) );
3300 template<
typename Type >
3301 template<
typename Other >
3302 inline typename EnableIf< IsNumeric<Other>, CompressedMatrix<Type,true> >::Type&
3303 CompressedMatrix<Type,true>::operator*=( Other rhs )
3305 for(
size_t j=0UL; j<
n_; ++j ) {
3308 element->value_ *= rhs;
3324 template<
typename Type >
3325 template<
typename Other >
3326 inline typename EnableIf< IsNumeric<Other>, CompressedMatrix<Type,true> >::Type&
3327 CompressedMatrix<Type,true>::operator/=( Other rhs )
3331 typedef typename DivTrait<Type,Other>::Type DT;
3332 typedef typename If< IsNumeric<DT>, DT, Other >::Type Tmp;
3336 if( IsNumeric<DT>::value && IsFloatingPoint<DT>::value ) {
3337 const Tmp tmp( Tmp(1)/static_cast<Tmp>( rhs ) );
3338 for(
size_t j=0UL; j<
n_; ++j ) {
3341 element->value_ *= tmp;
3345 for(
size_t j=0UL; j<
n_; ++j ) {
3348 element->value_ /= rhs;
3372 template<
typename Type >
3373 inline size_t CompressedMatrix<Type,true>::rows()
const
3387 template<
typename Type >
3388 inline size_t CompressedMatrix<Type,true>::columns()
const
3402 template<
typename Type >
3403 inline size_t CompressedMatrix<Type,true>::capacity()
const
3405 return end_[
n_] - begin_[0UL];
3418 template<
typename Type >
3419 inline size_t CompressedMatrix<Type,true>::capacity(
size_t j )
const
3422 return begin_[j+1UL] - begin_[j];
3434 template<
typename Type >
3435 inline size_t CompressedMatrix<Type,true>::nonZeros()
const
3437 size_t nonzeros( 0UL );
3439 for(
size_t j=0UL; j<
n_; ++j )
3455 template<
typename Type >
3456 inline size_t CompressedMatrix<Type,true>::nonZeros(
size_t j )
const
3459 return end_[j] - begin_[j];
3471 template<
typename Type >
3474 for(
size_t j=0UL; j<
n_; ++j )
3475 end_[j] = begin_[j];
3491 template<
typename Type >
3495 end_[j] = begin_[j];
3509 template<
typename Type >
3533 template<
typename Type >
3535 CompressedMatrix<Type,true>::set(
size_t i,
size_t j,
const Type& value )
3540 const Iterator pos( lowerBound( i, j ) );
3542 if( pos !=
end_[j] && pos->index_ == i ) {
3543 pos->value() = value;
3546 else return insert( pos, i, j, value );
3566 template<
typename Type >
3568 CompressedMatrix<Type,true>::insert(
size_t i,
size_t j,
const Type& value )
3573 const Iterator pos( lowerBound( i, j ) );
3575 if( pos !=
end_[j] && pos->index_ == i )
3576 throw std::invalid_argument(
"Bad access index" );
3578 return insert( pos, i, j, value );
3595 template<
typename Type >
3597 CompressedMatrix<Type,true>::insert(
Iterator pos,
size_t i,
size_t j,
const Type& value )
3599 if( begin_[j+1UL] -
end_[j] != 0 ) {
3600 std::copy_backward( pos,
end_[j],
end_[j]+1 );
3601 pos->value_ = value;
3607 else if(
end_[n_] - begin_[n_] != 0 ) {
3608 std::copy_backward( pos,
end_[n_-1UL],
end_[n_-1]+1 );
3610 pos->value_ = value;
3613 for(
size_t k=j+1UL; k<n_+1UL; ++k ) {
3621 size_t newCapacity( extendCapacity() );
3626 newBegin[0UL] = allocate<Element>( newCapacity );
3628 for(
size_t k=0UL; k<j; ++k ) {
3629 const size_t nonzeros(
end_[k] - begin_[k] );
3630 const size_t total( begin_[k+1UL] - begin_[k] );
3631 newEnd [k] = newBegin[k] + nonzeros;
3632 newBegin[k+1UL] = newBegin[k] + total;
3634 newEnd [j] = newBegin[j] + (
end_[j] - begin_[j] ) + 1;
3635 newBegin[j+1UL] = newBegin[j] + ( begin_[j+1UL] - begin_[j] ) + 1;
3636 for(
size_t k=j+1UL; k<
n_; ++k ) {
3637 const size_t nonzeros(
end_[k] - begin_[k] );
3638 const size_t total( begin_[k+1UL] - begin_[k] );
3639 newEnd [k] = newBegin[k] + nonzeros;
3640 newBegin[k+1UL] = newBegin[k] + total;
3643 newEnd[
n_] = newEnd[
capacity_] = newBegin[0UL]+newCapacity;
3645 Iterator tmp = std::copy( begin_[0UL], pos, newBegin[0UL] );
3646 tmp->value_ = value;
3648 std::copy( pos,
end_[n_-1UL], tmp+1UL );
3672 template<
typename Type >
3673 inline void CompressedMatrix<Type,true>::erase(
size_t i,
size_t j )
3678 const Iterator pos( find( i, j ) );
3679 if( pos !=
end_[j] )
3680 end_[j] = std::copy( pos+1,
end_[j], pos );
3696 template<
typename Type >
3698 CompressedMatrix<Type,true>::erase(
size_t j,
Iterator pos )
3703 if( pos !=
end_[j] )
3704 end_[j] = std::copy( pos+1,
end_[j], pos );
3723 template<
typename Type >
3725 CompressedMatrix<Type,true>::erase(
size_t j,
Iterator first,
Iterator last )
3733 end_[j] = std::copy( last,
end_[j], first );
3757 template<
typename Type >
3758 void CompressedMatrix<Type,true>::resize(
size_t m,
size_t n,
bool preserve )
3763 if( m ==
m_ && n == n_ )
return;
3768 Iterator* newEnd ( newBegin+n+1UL );
3770 newBegin[0UL] = begin_[0UL];
3773 for(
size_t j=0UL; j<
n_; ++j ) {
3774 newEnd [j] =
end_ [j];
3775 newBegin[j+1UL] = begin_[j+1UL];
3777 for(
size_t j=n_; j<n; ++j ) {
3778 newBegin[j+1UL] = newEnd[j] = begin_[
n_];
3782 for(
size_t j=0UL; j<n; ++j ) {
3783 newBegin[j+1UL] = newEnd[j] = begin_[0UL];
3800 for(
size_t j=0UL; j<
n_; ++j )
3801 end_[j] = begin_[j];
3804 for(
size_t j=n_; j<n; ++j )
3805 begin_[j+1UL] =
end_[j] = begin_[n_];
3810 for(
size_t j=0UL; j<n; ++j )
3811 end_[j] = lowerBound( m, j );
3814 for(
size_t j=0UL; j<n; ++j )
3815 end_[j] = begin_[j];
3842 template<
typename Type >
3843 inline void CompressedMatrix<Type,true>::reserve(
size_t nonzeros )
3846 reserveElements( nonzeros );
3864 template<
typename Type >
3865 void CompressedMatrix<Type,true>::reserve(
size_t j,
size_t nonzeros )
3872 const size_t current(
capacity(j) );
3874 if( current >= nonzeros )
return;
3876 const ptrdiff_t additional( nonzeros - current );
3878 if(
end_[n_] - begin_[n_] < additional )
3880 const size_t newCapacity( begin_[n_] - begin_[0UL] + additional );
3884 Iterator* newEnd ( newBegin+n_+1UL );
3886 newBegin[0UL] = allocate<Element>( newCapacity );
3887 newEnd [
n_ ] = newBegin[0UL]+newCapacity;
3889 for(
size_t k=0UL; k<j; ++k ) {
3890 newEnd [k ] = std::copy( begin_[k],
end_[k], newBegin[k] );
3891 newBegin[k+1UL] = newBegin[k] +
capacity(k);
3893 newEnd [j ] = std::copy( begin_[j],
end_[j], newBegin[j] );
3894 newBegin[j+1UL] = newBegin[j] + nonzeros;
3895 for(
size_t k=j+1UL; k<
n_; ++k ) {
3896 newEnd [k ] = std::copy( begin_[k],
end_[k], newBegin[k] );
3897 newBegin[k+1UL] = newBegin[k] +
capacity(k);
3910 begin_[
n_] += additional;
3911 for(
size_t k=n_-1UL; k>j; --k ) {
3912 begin_[k] = std::copy_backward( begin_[k],
end_[k],
end_[k]+additional );
3913 end_ [k] += additional;
3934 template<
typename Type >
3935 void CompressedMatrix<Type,true>::trim()
3937 for(
size_t j=0UL; j<
n_; ++j )
3955 template<
typename Type >
3956 void CompressedMatrix<Type,true>::trim(
size_t j )
3960 if( j < ( n_ - 1UL ) )
3961 end_[j+1] = std::copy( begin_[j+1],
end_[j+1],
end_[j] );
3962 begin_[j+1] =
end_[j];
3974 template<
typename Type >
3975 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::transpose()
3977 CompressedMatrix tmp(
trans( *
this ) );
3992 template<
typename Type >
3993 template<
typename Other >
3994 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::scale(
const Other& scalar )
3996 for(
size_t j=0UL; j<
n_; ++j )
3997 for(
Iterator element=begin_[j]; element!=
end_[j]; ++element )
3998 element->value_ *= scalar;
4013 template<
typename Type >
4014 template<
typename Other >
4015 inline CompressedMatrix<Type,true>& CompressedMatrix<Type,true>::scaleDiagonal( Other scalar )
4019 for(
size_t j=0UL; j<
size; ++j ) {
4021 if( pos !=
end_[j] && pos->index_ == j )
4022 pos->value_ *= scalar;
4039 template<
typename Type >
4061 template<
typename Type >
4062 inline size_t CompressedMatrix<Type,true>::extendCapacity()
const
4064 size_t nonzeros( 2UL*
capacity()+1UL );
4082 template<
typename Type >
4083 void CompressedMatrix<Type,true>::reserveElements(
size_t nonzeros )
4088 newBegin[0UL] = allocate<Element>( nonzeros );
4090 for(
size_t k=0UL; k<
n_; ++k ) {
4092 newEnd [k] = std::copy( begin_[k],
end_[k], newBegin[k] );
4093 newBegin[k+1UL] = newBegin[k] + ( begin_[k+1UL] - begin_[k] );
4096 newEnd[
n_] = newBegin[0UL]+nonzeros;
4130 template<
typename Type >
4132 CompressedMatrix<Type,true>::find(
size_t i,
size_t j )
4134 return const_cast<Iterator>(
const_cast<const This&
>( *this ).find( i, j ) );
4155 template<
typename Type >
4157 CompressedMatrix<Type,true>::find(
size_t i,
size_t j )
const
4160 if( pos !=
end_[j] && pos->index_ == i )
4162 else return end_[j];
4182 template<
typename Type >
4184 CompressedMatrix<Type,true>::lowerBound(
size_t i,
size_t j )
4186 return const_cast<Iterator>(
const_cast<const This&
>( *this ).lowerBound( i, j ) );
4206 template<
typename Type >
4208 CompressedMatrix<Type,true>::lowerBound(
size_t i,
size_t j )
const
4211 return std::lower_bound( begin_[j],
end_[j], i, FindIndex() );
4231 template<
typename Type >
4233 CompressedMatrix<Type,true>::upperBound(
size_t i,
size_t j )
4235 return const_cast<Iterator>(
const_cast<const This&
>( *this ).upperBound( i, j ) );
4255 template<
typename Type >
4257 CompressedMatrix<Type,true>::upperBound(
size_t i,
size_t j )
const
4260 return std::upper_bound( begin_[j],
end_[j], i, FindIndex() );
4316 template<
typename Type >
4317 inline void CompressedMatrix<Type,true>::append(
size_t i,
size_t j,
const Type& value,
bool check )
4324 end_[j]->value_ = value;
4327 end_[j]->index_ = i;
4349 template<
typename Type >
4350 inline void CompressedMatrix<Type,true>::finalize(
size_t j )
4354 begin_[j+1UL] =
end_[j];
4381 template<
typename Type >
4382 template<
typename Other >
4383 inline bool CompressedMatrix<Type,true>::canAlias(
const Other* alias )
const
4385 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4402 template<
typename Type >
4403 template<
typename Other >
4404 inline bool CompressedMatrix<Type,true>::isAliased(
const Other* alias )
const
4406 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4423 template<
typename Type >
4424 inline bool CompressedMatrix<Type,true>::canSMPAssign()
const
4444 template<
typename Type >
4445 template<
typename MT
4447 inline void CompressedMatrix<Type,true>::assign(
const DenseMatrix<MT,SO>& rhs )
4452 size_t nonzeros( 0UL );
4454 for(
size_t j=1UL; j<=
n_; ++j )
4457 for(
size_t j=0UL; j<
n_; ++j )
4459 begin_[j] =
end_[j] = begin_[0UL]+nonzeros;
4461 const size_t ibegin( ( IsLower<MT>::value )
4462 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
4464 const size_t iend ( ( IsUpper<MT>::value )
4465 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
4468 for(
size_t i=ibegin; i<iend; ++i )
4471 reserveElements( extendCapacity() );
4472 for(
size_t k=j+1UL; k<=
n_; ++k )
4476 end_[j]->value_ = (~rhs)(i,j);
4479 end_[j]->index_ = i;
4486 begin_[
n_] = begin_[0UL]+nonzeros;
4504 template<
typename Type >
4505 template<
typename MT >
4506 inline void CompressedMatrix<Type,true>::assign(
const SparseMatrix<MT,true>& rhs )
4513 if( n_ == 0UL || begin_[0] == NULL )
4516 for(
size_t j=0UL; j<
n_; ++j ) {
4517 begin_[j+1UL] =
end_[j] = std::copy( (~rhs).
begin(j), (~rhs).
end(j), begin_[j] );
4536 template<
typename Type >
4537 template<
typename MT >
4538 inline void CompressedMatrix<Type,true>::assign(
const SparseMatrix<MT,false>& rhs )
4550 std::vector<size_t> columnLengths( n_, 0UL );
4551 for(
size_t i=0UL; i<
m_; ++i ) {
4552 for( RhsIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
4553 ++columnLengths[element->index()];
4557 for(
size_t j=0UL; j<
n_; ++j ) {
4558 begin_[j+1UL] =
end_[j+1UL] = begin_[j] + columnLengths[j];
4562 for(
size_t i=0UL; i<
m_; ++i ) {
4563 for( RhsIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
4564 append( i, element->index(), element->value() );
4583 template<
typename Type >
4584 template<
typename MT
4586 inline void CompressedMatrix<Type,true>::addAssign(
const DenseMatrix<MT,SO>& rhs )
4591 CompressedMatrix tmp(
serial( *
this + (~rhs) ) );
4610 template<
typename Type >
4611 template<
typename MT
4613 inline void CompressedMatrix<Type,true>::addAssign(
const SparseMatrix<MT,SO>& rhs )
4618 CompressedMatrix tmp(
serial( *
this + (~rhs) ) );
4637 template<
typename Type >
4638 template<
typename MT
4640 inline void CompressedMatrix<Type,true>::subAssign(
const DenseMatrix<MT,SO>& rhs )
4645 CompressedMatrix tmp(
serial( *
this - (~rhs) ) );
4664 template<
typename Type >
4665 template<
typename MT
4667 inline void CompressedMatrix<Type,true>::subAssign(
const SparseMatrix<MT,SO>& rhs )
4672 CompressedMatrix tmp(
serial( *
this - (~rhs) ) );
4694 template<
typename Type,
bool SO >
4695 inline void reset( CompressedMatrix<Type,SO>& m );
4697 template<
typename Type,
bool SO >
4698 inline void reset( CompressedMatrix<Type,SO>& m,
size_t i );
4700 template<
typename Type,
bool SO >
4701 inline void clear( CompressedMatrix<Type,SO>& m );
4703 template<
typename Type,
bool SO >
4704 inline bool isDefault(
const CompressedMatrix<Type,SO>& m );
4706 template<
typename Type,
bool SO >
4707 inline void swap( CompressedMatrix<Type,SO>& a, CompressedMatrix<Type,SO>& b ) ;
4709 template<
typename Type,
bool SO >
4710 inline void move( CompressedMatrix<Type,SO>& dst, CompressedMatrix<Type,SO>& src ) ;
4722 template<
typename Type
4724 inline void reset( CompressedMatrix<Type,SO>& m )
4744 template<
typename Type
4746 inline void reset( CompressedMatrix<Type,SO>& m,
size_t i )
4760 template<
typename Type
4762 inline void clear( CompressedMatrix<Type,SO>& m )
4787 template<
typename Type
4791 return ( m.rows() == 0UL && m.columns() == 0UL );
4805 template<
typename Type
4807 inline void swap( CompressedMatrix<Type,SO>& a, CompressedMatrix<Type,SO>& b )
4823 template<
typename Type
4825 inline void move( CompressedMatrix<Type,SO>& dst, CompressedMatrix<Type,SO>& src )
4842 template<
typename T,
bool SO >
4843 struct IsResizable< CompressedMatrix<T,SO> > :
public TrueType
4862 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
4863 struct AddTrait< CompressedMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
4865 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
4868 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
4869 struct AddTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
4871 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO2 > Type;
4874 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
4875 struct AddTrait< StaticMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
4877 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
4880 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
4881 struct AddTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
4883 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO1 > Type;
4886 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
4887 struct AddTrait< CompressedMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
4889 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
4892 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
4893 struct AddTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
4895 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N, SO2 > Type;
4898 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
4899 struct AddTrait< HybridMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
4901 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
4904 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
4905 struct AddTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
4907 typedef HybridMatrix< typename AddTrait<T1,T2>::Type, M, N, SO1 > Type;
4910 template<
typename T1,
bool SO,
typename T2 >
4911 struct AddTrait< CompressedMatrix<T1,SO>, DynamicMatrix<T2,SO> >
4913 typedef DynamicMatrix< typename AddTrait<T1,T2>::Type , SO > Type;
4916 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
4917 struct AddTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
4919 typedef DynamicMatrix< typename AddTrait<T1,T2>::Type , SO2 > Type;
4922 template<
typename T1,
bool SO,
typename T2 >
4923 struct AddTrait< DynamicMatrix<T1,SO>, CompressedMatrix<T2,SO> >
4925 typedef DynamicMatrix< typename AddTrait<T1,T2>::Type , SO > Type;
4928 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
4929 struct AddTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
4931 typedef DynamicMatrix< typename AddTrait<T1,T2>::Type , SO1 > Type;
4934 template<
typename T1,
bool SO,
typename T2 >
4935 struct AddTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
4937 typedef CompressedMatrix< typename AddTrait<T1,T2>::Type , SO > Type;
4940 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
4941 struct AddTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
4943 typedef CompressedMatrix< typename AddTrait<T1,T2>::Type ,
false > Type;
4959 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
4960 struct SubTrait< CompressedMatrix<T1,SO>, StaticMatrix<T2,M,N,SO> >
4962 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
4965 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
4966 struct SubTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
4968 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO2 > Type;
4971 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
4972 struct SubTrait< StaticMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
4974 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
4977 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
4978 struct SubTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
4980 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO1 > Type;
4983 template<
typename T1,
bool SO,
typename T2,
size_t M,
size_t N >
4984 struct SubTrait< CompressedMatrix<T1,SO>, HybridMatrix<T2,M,N,SO> >
4986 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
4989 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
4990 struct SubTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
4992 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N, SO2 > Type;
4995 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
4996 struct SubTrait< HybridMatrix<T1,M,N,SO>, CompressedMatrix<T2,SO> >
4998 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
5001 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5002 struct SubTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5004 typedef HybridMatrix< typename SubTrait<T1,T2>::Type, M, N, SO1 > Type;
5007 template<
typename T1,
bool SO,
typename T2 >
5008 struct SubTrait< CompressedMatrix<T1,SO>, DynamicMatrix<T2,SO> >
5010 typedef DynamicMatrix< typename SubTrait<T1,T2>::Type , SO > Type;
5013 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5014 struct SubTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5016 typedef DynamicMatrix< typename SubTrait<T1,T2>::Type , SO2 > Type;
5019 template<
typename T1,
bool SO,
typename T2 >
5020 struct SubTrait< DynamicMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5022 typedef DynamicMatrix< typename SubTrait<T1,T2>::Type , SO > Type;
5025 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5026 struct SubTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5028 typedef DynamicMatrix< typename SubTrait<T1,T2>::Type , SO1 > Type;
5031 template<
typename T1,
bool SO,
typename T2 >
5032 struct SubTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5034 typedef CompressedMatrix< typename SubTrait<T1,T2>::Type , SO > Type;
5037 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5038 struct SubTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5040 typedef CompressedMatrix< typename SubTrait<T1,T2>::Type ,
false > Type;
5056 template<
typename T1,
bool SO,
typename T2 >
5057 struct MultTrait< CompressedMatrix<T1,SO>, T2 >
5059 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type, SO > Type;
5063 template<
typename T1,
typename T2,
bool SO >
5064 struct MultTrait< T1, CompressedMatrix<T2,SO> >
5066 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type, SO > Type;
5070 template<
typename T1,
bool SO,
typename T2,
size_t N >
5071 struct MultTrait< CompressedMatrix<T1,SO>, StaticVector<T2,N,false> >
5073 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5076 template<
typename T1,
size_t N,
typename T2,
bool SO >
5077 struct MultTrait< StaticVector<T1,N,true>, CompressedMatrix<T2,SO> >
5079 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5082 template<
typename T1,
bool SO,
typename T2,
size_t N >
5083 struct MultTrait< CompressedMatrix<T1,SO>, HybridVector<T2,N,false> >
5085 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5088 template<
typename T1,
size_t N,
typename T2,
bool SO >
5089 struct MultTrait< HybridVector<T1,N,true>, CompressedMatrix<T2,SO> >
5091 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5094 template<
typename T1,
bool SO,
typename T2 >
5095 struct MultTrait< CompressedMatrix<T1,SO>, DynamicVector<T2,false> >
5097 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
false > Type;
5100 template<
typename T1,
typename T2,
bool SO >
5101 struct MultTrait< DynamicVector<T1,true>, CompressedMatrix<T2,SO> >
5103 typedef DynamicVector< typename MultTrait<T1,T2>::Type,
true > Type;
5106 template<
typename T1,
bool SO,
typename T2 >
5107 struct MultTrait< CompressedMatrix<T1,SO>, CompressedVector<T2,false> >
5109 typedef CompressedVector< typename MultTrait<T1,T2>::Type,
false > Type;
5112 template<
typename T1,
typename T2,
bool SO >
5113 struct MultTrait< CompressedVector<T1,true>, CompressedMatrix<T2,SO> >
5115 typedef CompressedVector< typename MultTrait<T1,T2>::Type,
true > Type;
5118 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5119 struct MultTrait< CompressedMatrix<T1,SO1>, StaticMatrix<T2,M,N,SO2> >
5121 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5124 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5125 struct MultTrait< StaticMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5127 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5130 template<
typename T1,
bool SO1,
typename T2,
size_t M,
size_t N,
bool SO2 >
5131 struct MultTrait< CompressedMatrix<T1,SO1>, HybridMatrix<T2,M,N,SO2> >
5133 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5136 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5137 struct MultTrait< HybridMatrix<T1,M,N,SO1>, CompressedMatrix<T2,SO2> >
5139 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5142 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5143 struct MultTrait< CompressedMatrix<T1,SO1>, DynamicMatrix<T2,SO2> >
5145 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5148 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5149 struct MultTrait< DynamicMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5151 typedef DynamicMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5154 template<
typename T1,
bool SO1,
typename T2,
bool SO2 >
5155 struct MultTrait< CompressedMatrix<T1,SO1>, CompressedMatrix<T2,SO2> >
5157 typedef CompressedMatrix< typename MultTrait<T1,T2>::Type, SO1 > Type;
5173 template<
typename T1,
bool SO,
typename T2 >
5174 struct DivTrait< CompressedMatrix<T1,SO>, T2 >
5176 typedef CompressedMatrix< typename DivTrait<T1,T2>::Type, SO > Type;
5193 template<
typename T1,
bool SO,
typename T2 >
5194 struct MathTrait< CompressedMatrix<T1,SO>, CompressedMatrix<T2,SO> >
5196 typedef CompressedMatrix< typename MathTrait<T1,T2>::HighType, SO > HighType;
5197 typedef CompressedMatrix< typename MathTrait<T1,T2>::LowType , SO > LowType;
5213 template<
typename T1,
bool SO >
5214 struct SubmatrixTrait< CompressedMatrix<T1,SO> >
5216 typedef CompressedMatrix<T1,SO> Type;
5232 template<
typename T1,
bool SO >
5233 struct RowTrait< CompressedMatrix<T1,SO> >
5235 typedef CompressedVector<T1,true> Type;
5251 template<
typename T1,
bool SO >
5252 struct ColumnTrait< CompressedMatrix<T1,SO> >
5254 typedef CompressedVector<T1,false> Type;
#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:116
Pointer difference type of the Blaze library.
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1649
size_t rows() const
Returns the current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:1136
void reserveElements(size_t nonzeros)
Reserving the specified number of sparse matrix elements.
Definition: CompressedMatrix.h:1842
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
Constraint on the data type.
Iterator * end_
Pointers one past the last non-zero element of each row.
Definition: CompressedMatrix.h:425
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 sparse matrix value.
Definition: CompressedMatrix.h:264
Compile time type selection.The If class template selects one of the two given types T2 and T3 depend...
Definition: If.h:112
Header file for the subtraction trait.
Header file for basic type definitions.
const Type & ConstReference
Reference to a constant sparse matrix value.
Definition: CompressedMatrix.h:265
const bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:4825
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
Header file for the row trait.
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:258
Header file for the IsSparseMatrix type trait.
CompressedMatrix()
The default constructor for CompressedMatrix.
Definition: CompressedMatrix.h:469
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:209
size_t extendCapacity() const
Calculating a new matrix capacity.
Definition: CompressedMatrix.h:1822
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:2665
void clear()
Clearing the sparse matrix.
Definition: CompressedMatrix.h:1277
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:348
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:261
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4762
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
CompressedMatrix< ET, SO > Other
The type of the other CompressedMatrix.
Definition: CompressedMatrix.h:275
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2501
CompressedMatrix< Type,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:259
#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:116
~CompressedMatrix()
The destructor for CompressedMatrix.
Definition: CompressedMatrix.h:657
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:699
void reset(CompressedMatrix< Type, SO > &m)
Resetting the given compressed matrix.
Definition: CompressedMatrix.h:4724
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:386
Access proxy for sparse, matrices.The MatrixAccessProxy provides safe access to the elements of a no...
Definition: MatrixAccessProxy.h:95
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
Header file for memory allocation and deallocation functionality.
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: CompressedMatrix.h:2166
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:427
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:262
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: CompressedMatrix.h:1199
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:2667
Header file for the SparseMatrix base class.
size_t capacity_
The current capacity of the pointer array.
Definition: CompressedMatrix.h:423
void reserve(size_t nonzeros)
Setting the minimum capacity of the sparse matrix.
Definition: CompressedMatrix.h:1606
void reset()
Reset to the default initial values.
Definition: CompressedMatrix.h:1239
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:263
Header file for the ValueIndexPair class.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:4789
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4807
Iterator set(size_t i, size_t j, const Type &value)
Setting an element of the compressed matrix.
Definition: CompressedMatrix.h:1301
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:2511
#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:116
Header file for the IsSMPAssignable type trait.
void erase(size_t i, size_t j)
Erasing an element from the sparse matrix.
Definition: CompressedMatrix.h:1436
Iterator * end_
Pointers one past the last non-zero element of each column.
Definition: CompressedMatrix.h:2669
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1602
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:226
#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:78
ValueIndexPair< Type > ElementBase
Base class for the sparse matrix element.
Definition: CompressedMatrix.h:213
Constraint on the data type.
Header file for the IsLower type trait.
Header file for the equal shim.
Header file for the default storage order for all vectors of the Blaze library.
Iterator insert(size_t i, size_t j, const Type &value)
Inserting an element into the compressed matrix.
Definition: CompressedMatrix.h:1333
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:195
CompressedMatrix< ET, true > Other
The type of the other CompressedMatrix.
Definition: CompressedMatrix.h:2519
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:94
Compile time check for data types.This type trait tests whether or not the given template parameter i...
Definition: IsSMPAssignable.h:120
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:535
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
void subAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the subtraction assignment of a dense matrix.
Definition: CompressedMatrix.h:2395
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the serial shim.
void swap(CompressedMatrix &sm)
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:1801
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:267
bool canSMPAssign() const
Returns whether the matrix can be used in SMP assignments.
Definition: CompressedMatrix.h:2185
size_t capacity() const
Returns the maximum capacity of the sparse matrix.
Definition: CompressedMatrix.h:1164
void resize(size_t m, size_t n, bool preserve=true)
Changing the size of the sparse matrix.
Definition: CompressedMatrix.h:1522
Header file for the IsNumeric type trait.
CompressedMatrix & operator=(const CompressedMatrix &rhs)
Copy assignment operator for CompressedMatrix.
Definition: CompressedMatrix.h:870
#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:116
Reference operator()(size_t i, size_t j)
2D-access to the sparse matrix elements.
Definition: CompressedMatrix.h:683
Header file for run time assertion macros.
Header file for the addition trait.
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: CompressedMatrix.h:798
CompressedMatrix & transpose()
Transposing the matrix.
Definition: CompressedMatrix.h:1739
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Header file for the division trait.
void trim()
Removing all excessive capacity from all rows/columns.
Definition: CompressedMatrix.h:1700
Header file for the submatrix trait.
Constraint on the data type.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
#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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the column trait.
Header file for the isDefault shim.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:87
Constraint on the data type.
size_t columns() const
Returns the current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:1150
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:258
Iterator * begin_
Pointers to the first non-zero element of each column.
Definition: CompressedMatrix.h:2668
void assign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the assignment of a row-major dense matrix.
Definition: CompressedMatrix.h:2207
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:266
void append(size_t i, size_t j, const Type &value, bool check=false)
Appending an element to the specified row/column of the sparse matrix.
Definition: CompressedMatrix.h:2082
void finalize(size_t i)
Finalizing the element insertion of a row/column.
Definition: CompressedMatrix.h:2114
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: CompressedMatrix.h:2146
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:200
Base template for the DivTrait class.
Definition: DivTrait.h:150
CompressedMatrix< Type, SO > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:257
Iterator find(size_t i, size_t j)
Searches for a specific matrix element.
Definition: CompressedMatrix.h:1891
Header file for the mathematical trait.
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:424
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:2666
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
Constraint on the size of two data types.
void addAssign(const DenseMatrix< MT, SO2 > &rhs)
Default implementation of the addition assignment of a dense matrix.
Definition: CompressedMatrix.h:2343
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:937
CompressedMatrix< Type,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:260
Iterator lowerBound(size_t i, size_t j)
Returns an iterator to the first index not less then the given index.
Definition: CompressedMatrix.h:1944
static const Type zero_
Neutral element for accesses to zero elements.
Definition: CompressedMatrix.h:2671
Iterator upperBound(size_t i, size_t j)
Returns an iterator to the first index greater then the given index.
Definition: CompressedMatrix.h:1995
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: CompressedMatrix.h:776
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:274
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2518
Header file for the IsUpper type trait.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
size_t n_
The current number of columns of the sparse matrix.
Definition: CompressedMatrix.h:422
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: CompressedMatrix.h:842
Header file for the IsResizable type trait.
size_t m_
The current number of rows of the sparse matrix.
Definition: CompressedMatrix.h:421
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
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: CompressedMatrix.h:732
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
Header file for a safe C++ NULL pointer implementation.