35 #ifndef _BLAZE_MATH_VIEWS_SUBMATRIX_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_SUBMATRIX_SPARSE_H_ 114 template<
typename MT
117 class Submatrix<MT,AF,false,false,CSAs...>
118 :
public View< SparseMatrix< Submatrix<MT,AF,false,false,CSAs...>, false > >
119 ,
private SubmatrixData<CSAs...>
123 using DataType = SubmatrixData<CSAs...>;
124 using Operand = If_< IsExpression<MT>, MT, MT& >;
130 using This = Submatrix<MT,AF,
false,
false,CSAs...>;
132 using BaseType = SparseMatrix<This,false>;
133 using ViewedType = MT;
151 template<
typename MatrixType
152 ,
typename IteratorType >
153 class SubmatrixElement
154 :
private SparseElement
163 inline SubmatrixElement( IteratorType pos,
size_t offset )
175 template<
typename T >
inline SubmatrixElement& operator=(
const T& v ) {
187 template<
typename T >
inline SubmatrixElement&
operator+=(
const T& v ) {
199 template<
typename T >
inline SubmatrixElement&
operator-=(
const T& v ) {
211 template<
typename T >
inline SubmatrixElement&
operator*=(
const T& v ) {
223 template<
typename T >
inline SubmatrixElement&
operator/=(
const T& v ) {
234 inline const SubmatrixElement* operator->()
const {
244 inline decltype(
auto) value()
const {
245 return pos_->value();
254 inline size_t index()
const {
255 return pos_->index() - offset_;
270 template<
typename MatrixType
271 ,
typename IteratorType >
272 class SubmatrixIterator
276 using IteratorCategory = std::forward_iterator_tag;
277 using ValueType = SubmatrixElement<MatrixType,IteratorType>;
278 using PointerType = ValueType;
279 using ReferenceType = ValueType;
280 using DifferenceType = ptrdiff_t;
283 using iterator_category = IteratorCategory;
284 using value_type = ValueType;
285 using pointer = PointerType;
286 using reference = ReferenceType;
287 using difference_type = DifferenceType;
293 inline SubmatrixIterator()
305 inline SubmatrixIterator( IteratorType iterator,
size_t index )
316 template<
typename MatrixType2,
typename IteratorType2 >
317 inline SubmatrixIterator(
const SubmatrixIterator<MatrixType2,IteratorType2>& it )
319 , offset_( it.offset() )
328 inline SubmatrixIterator& operator++() {
339 inline const SubmatrixIterator operator++(
int ) {
340 const SubmatrixIterator tmp( *
this );
352 return ReferenceType( pos_, offset_ );
361 inline PointerType operator->()
const {
362 return PointerType( pos_, offset_ );
372 template<
typename MatrixType2,
typename IteratorType2 >
373 inline bool operator==(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
374 return base() == rhs.base();
384 template<
typename MatrixType2,
typename IteratorType2 >
385 inline bool operator!=(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
386 return !( *
this == rhs );
396 inline DifferenceType
operator-(
const SubmatrixIterator& rhs )
const {
397 return pos_ - rhs.pos_;
406 inline IteratorType base()
const {
416 inline size_t offset() const noexcept {
431 using ConstIterator = SubmatrixIterator< const MT, ConstIterator_<MT> >;
439 enum :
bool { smpAssignable = MT::smpAssignable };
445 template<
typename... RSAs >
446 explicit inline Submatrix( MT& matrix, RSAs... args );
458 inline Reference operator()(
size_t i,
size_t j );
459 inline ConstReference operator()(
size_t i,
size_t j )
const;
460 inline Reference at(
size_t i,
size_t j );
461 inline ConstReference at(
size_t i,
size_t j )
const;
463 inline ConstIterator
begin (
size_t i )
const;
464 inline ConstIterator
cbegin(
size_t i )
const;
466 inline ConstIterator
end (
size_t i )
const;
467 inline ConstIterator
cend (
size_t i )
const;
474 inline Submatrix& operator=( initializer_list< initializer_list<ElementType> > list );
475 inline Submatrix& operator=(
const Submatrix& rhs );
477 template<
typename MT2,
bool SO >
inline Submatrix& operator= (
const Matrix<MT2,SO>& rhs );
478 template<
typename MT2,
bool SO >
inline Submatrix&
operator+=(
const Matrix<MT2,SO>& rhs );
479 template<
typename MT2,
bool SO >
inline Submatrix&
operator-=(
const Matrix<MT2,SO>& rhs );
480 template<
typename MT2,
bool SO >
inline Submatrix& operator%=(
const Matrix<MT2,SO>& rhs );
492 inline MT& operand() noexcept;
493 inline const MT& operand() const noexcept;
495 inline
size_t capacity() const noexcept;
496 inline
size_t capacity(
size_t i ) const noexcept;
498 inline
size_t nonZeros(
size_t i ) const;
500 inline
void reset(
size_t i );
501 inline
void reserve(
size_t nonzeros );
502 void reserve(
size_t i,
size_t nonzeros );
504 inline
void trim(
size_t i );
513 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
514 inline
void finalize(
size_t i );
521 inline
void erase(
size_t i,
size_t j );
525 template< typename Pred >
526 inline
void erase( Pred predicate );
528 template< typename Pred >
529 inline
void erase(
size_t i,
Iterator first,
Iterator last, Pred predicate );
536 inline
Iterator find (
size_t i,
size_t j );
537 inline ConstIterator find (
size_t i,
size_t j ) const;
538 inline
Iterator lowerBound(
size_t i,
size_t j );
539 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
540 inline
Iterator upperBound(
size_t i,
size_t j );
541 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
551 template< typename Other > inline Submatrix& scale( const Other& scalar );
558 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
559 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
561 inline
bool canSMPAssign() const noexcept;
563 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
564 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
565 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
566 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
567 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
568 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
576 inline
bool hasOverlap() const noexcept;
622 template< typename MT
625 template< typename... RSAs >
626 inline Submatrix<MT,AF,false,false,CSAs...>::Submatrix( MT& matrix, RSAs... args )
627 : DataType( args... )
630 if( !Contains< TypeList<RSAs...>,
Unchecked >::value ) {
663 template<
typename MT
666 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Reference 667 Submatrix<MT,AF,false,false,CSAs...>::operator()(
size_t i,
size_t j )
689 template<
typename MT
693 Submatrix<MT,AF,false,false,CSAs...>::operator()(
size_t i,
size_t j )
const 698 return const_cast<const MT&
>( matrix_ )(
row()+i,
column()+j);
716 template<
typename MT
719 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Reference 720 Submatrix<MT,AF,false,false,CSAs...>::at(
size_t i,
size_t j )
746 template<
typename MT
750 Submatrix<MT,AF,false,false,CSAs...>::at(
size_t i,
size_t j )
const 776 template<
typename MT
779 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 805 template<
typename MT
834 template<
typename MT
863 template<
typename MT
866 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 892 template<
typename MT
921 template<
typename MT
962 template<
typename MT
965 inline Submatrix<MT,AF,
false,
false,CSAs...>&
966 Submatrix<MT,AF,false,false,CSAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
970 if( list.size() !=
rows() ) {
974 const InitializerMatrix<ElementType> tmp( list,
columns() );
976 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
980 decltype(
auto) left( derestrict( *this ) );
1006 template< typename MT
1009 inline Submatrix<MT,AF,false,false,CSAs...>&
1010 Submatrix<MT,AF,false,false,CSAs...>::operator=( const Submatrix& rhs )
1012 using blaze::assign;
1017 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() &&
column() == rhs.column() ) )
1020 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
1024 if( !tryAssign( matrix_, rhs,
row(),
column() ) ) {
1028 decltype(
auto) left( derestrict( *this ) );
1030 if( rhs.canAlias( &matrix_ ) ) {
1033 assign( left, tmp );
1037 assign( left, rhs );
1063 template<
typename MT
1066 template<
typename MT2
1068 inline Submatrix<MT,AF,
false,
false,CSAs...>&
1069 Submatrix<MT,AF,false,false,CSAs...>::operator=(
const Matrix<MT2,SO>& rhs )
1071 using blaze::assign;
1079 using Right = CompositeType_<MT2>;
1080 Right right( ~rhs );
1082 if( !tryAssign( matrix_, right,
row(),
column() ) ) {
1086 decltype(
auto) left( derestrict( *this ) );
1088 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
1089 const ResultType_<MT2> tmp( right );
1091 assign( left, tmp );
1095 assign( left, right );
1120 template<
typename MT
1123 template<
typename MT2
1125 inline Submatrix<MT,AF,
false,
false,CSAs...>&
1128 using blaze::assign;
1134 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
1142 const AddType tmp( *
this + (~rhs) );
1144 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
1148 decltype(
auto) left( derestrict( *this ) );
1151 assign( left, tmp );
1175 template< typename MT
1178 template< typename MT2
1180 inline Submatrix<MT,AF,false,false,CSAs...>&
1181 Submatrix<MT,AF,false,false,CSAs...>::operator-=( const Matrix<MT2,SO>& rhs )
1183 using blaze::assign;
1189 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
1197 const SubType tmp( *
this - (~rhs) );
1199 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
1203 decltype(
auto) left( derestrict( *this ) );
1206 assign( left, tmp );
1230 template< typename MT
1233 template< typename MT2
1235 inline Submatrix<MT,AF,false,false,CSAs...>&
1236 Submatrix<MT,AF,false,false,CSAs...>::operator%=( const Matrix<MT2,SO>& rhs )
1238 using blaze::assign;
1244 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
1252 const SchurType tmp( *
this % (~rhs) );
1254 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
1258 decltype(
auto) left( derestrict( *this ) );
1261 assign( left, tmp );
1285 template< typename MT
1288 inline MT& Submatrix<MT,AF,false,false,CSAs...>::operand() noexcept
1302 template<
typename MT
1305 inline const MT& Submatrix<MT,AF,false,false,CSAs...>::operand() const noexcept
1319 template<
typename MT
1324 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
1342 template<
typename MT
1348 return nonZeros( i ) + matrix_.capacity(
row()+i ) - matrix_.nonZeros(
row()+i );
1360 template<
typename MT
1365 size_t nonzeros( 0UL );
1367 for(
size_t i=0UL; i<
rows(); ++i )
1388 template<
typename MT
1406 template<
typename MT
1413 const size_t jbegin( ( IsUpper<MT>::value )
1414 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
1418 const size_t jend ( ( IsLower<MT>::value )
1419 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
1424 matrix_.erase( i, matrix_.lowerBound( i, jbegin ), matrix_.lowerBound( i, jend ) );
1443 template<
typename MT
1450 const size_t index(
row() + i );
1452 const size_t jbegin( ( IsUpper<MT>::value )
1453 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
1457 const size_t jend ( ( IsLower<MT>::value )
1458 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
1463 matrix_.erase( index, matrix_.lowerBound( index, jbegin ), matrix_.lowerBound( index, jend ) );
1480 template<
typename MT
1483 inline void Submatrix<MT,AF,false,false,CSAs...>::reserve(
size_t nonzeros )
1485 const size_t current(
capacity() );
1487 if( nonzeros > current ) {
1488 matrix_.reserve( matrix_.capacity() + nonzeros - current );
1511 template<
typename MT
1514 void Submatrix<MT,AF,false,false,CSAs...>::reserve(
size_t i,
size_t nonzeros )
1516 const size_t current(
capacity( i ) );
1517 const size_t index (
row() + i );
1519 if( nonzeros > current ) {
1520 matrix_.reserve( index, matrix_.capacity( index ) + nonzeros - current );
1538 template<
typename MT
1541 void Submatrix<MT,AF,false,false,CSAs...>::trim()
1543 for(
size_t i=0UL; i<
rows(); ++i )
1562 template<
typename MT
1565 void Submatrix<MT,AF,false,false,CSAs...>::trim(
size_t i )
1568 matrix_.trim(
row() + i );
1584 template<
typename MT
1587 inline bool Submatrix<MT,AF,false,false,CSAs...>::hasOverlap() const noexcept
1589 BLAZE_INTERNAL_ASSERT( IsSymmetric<MT>::value || IsHermitian<MT>::value,
"Invalid matrix detected" );
1620 template<
typename MT
1623 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1646 template<
typename MT
1649 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1650 Submatrix<MT,AF,false,false,CSAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
1702 template<
typename MT
1705 inline void Submatrix<MT,AF,false,false,CSAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
1708 matrix_.append(
row() + i,
column() + j, value, check );
1710 else if( !check || !isDefault<strict>( value ) ) {
1711 matrix_.insert(
row() + i,
column() + j, value );
1732 template<
typename MT
1735 inline void Submatrix<MT,AF,false,false,CSAs...>::finalize(
size_t i )
1737 matrix_.trim(
row() + i );
1761 template<
typename MT
1764 inline void Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
size_t j )
1769 matrix_.erase(
row() + i,
column() + j );
1787 template<
typename MT
1790 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1791 Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
Iterator pos )
1814 template<
typename MT
1817 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1818 Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
Iterator first,
Iterator last )
1821 return Iterator( matrix_.erase(
row()+i, first.base(), last.base() ),
column() );
1850 template<
typename MT
1853 template<
typename Pred >
1854 inline void Submatrix<MT,AF,false,false,CSAs...>::erase( Pred predicate )
1856 for(
size_t i=0UL; i<
rows(); ++i ) {
1857 matrix_.erase(
row()+i,
begin(i).base(),
end(i).base(), predicate );
1893 template<
typename MT
1896 template<
typename Pred >
1897 inline void Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
Iterator first,
Iterator last, Pred predicate )
1900 matrix_.erase(
row()+i, first.base(), last.base(), predicate );
1930 template<
typename MT
1933 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1934 Submatrix<MT,AF,false,false,CSAs...>::find(
size_t i,
size_t j )
1936 const Iterator_<MT> pos( matrix_.find(
row() + i,
column() + j ) );
1938 if( pos != matrix_.end(
row() + i ) )
1963 template<
typename MT
1967 Submatrix<MT,AF,false,false,CSAs...>::find(
size_t i,
size_t j )
const 1969 const ConstIterator_<MT> pos( matrix_.find(
row() + i,
column() + j ) );
1971 if( pos != matrix_.end(
row() + i ) )
1996 template<
typename MT
1999 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 2000 Submatrix<MT,AF,false,false,CSAs...>::lowerBound(
size_t i,
size_t j )
2024 template<
typename MT
2028 Submatrix<MT,AF,false,false,CSAs...>::lowerBound(
size_t i,
size_t j )
const 2052 template<
typename MT
2055 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 2056 Submatrix<MT,AF,false,false,CSAs...>::upperBound(
size_t i,
size_t j )
2080 template<
typename MT
2084 Submatrix<MT,AF,false,false,CSAs...>::upperBound(
size_t i,
size_t j )
const 2118 template<
typename MT
2121 inline Submatrix<MT,AF,
false,
false,CSAs...>&
2124 using blaze::assign;
2134 decltype(
auto) left( derestrict( *this ) );
2138 assign( left, tmp );
2164 template< typename MT
2167 inline Submatrix<MT,AF,false,false,CSAs...>&
2168 Submatrix<MT,AF,false,false,CSAs...>::ctranspose()
2170 using blaze::assign;
2180 decltype(
auto) left( derestrict( *this ) );
2184 assign( left, tmp );
2205 template< typename MT
2208 template< typename Other >
2209 inline Submatrix<MT,AF,false,false,CSAs...>&
2210 Submatrix<MT,AF,false,false,CSAs...>::scale( const Other& scalar )
2214 for(
size_t i=0UL; i<
rows(); ++i ) {
2217 element->value() *= scalar;
2245 template<
typename MT
2248 template<
typename Other >
2249 inline bool Submatrix<MT,AF,false,false,CSAs...>::canAlias(
const Other* alias )
const noexcept
2251 return matrix_.isAliased( alias );
2268 template<
typename MT
2271 template<
typename Other >
2272 inline bool Submatrix<MT,AF,false,false,CSAs...>::isAliased(
const Other* alias )
const noexcept
2274 return matrix_.isAliased( alias );
2291 template<
typename MT
2294 inline bool Submatrix<MT,AF,false,false,CSAs...>::canSMPAssign() const noexcept
2314 template<
typename MT
2317 template<
typename MT2
2319 inline void Submatrix<MT,AF,false,false,CSAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
2326 for(
size_t i=0UL; i<
rows(); ++i ) {
2327 for(
size_t j=0UL; j<
columns(); ++j ) {
2328 if( IsSymmetric<MT>::value || IsHermitian<MT>::value ) {
2330 if( !isDefault<strict>( value ) )
2334 append( i, j, (~rhs)(i,j),
true );
2356 template<
typename MT
2359 template<
typename MT2 >
2360 inline void Submatrix<MT,AF,false,false,CSAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2367 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
2368 for( ConstIterator_<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element ) {
2369 if( IsSymmetric<MT>::value || IsHermitian<MT>::value ) {
2371 if( !isDefault<strict>( value ) )
2372 set( i, element->index(), value );
2375 append( i, element->index(), element->value(), true );
2397 template<
typename MT
2400 template<
typename MT2 >
2401 inline void Submatrix<MT,AF,false,false,CSAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2408 using RhsIterator = ConstIterator_<MT2>;
2411 std::vector<size_t> rowLengths(
rows(), 0UL );
2412 for(
size_t j=0UL; j<
columns(); ++j ) {
2413 for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2414 ++rowLengths[element->index()];
2418 for(
size_t i=0UL; i<
rows(); ++i ) {
2419 reserve( i, rowLengths[i] );
2423 for(
size_t j=0UL; j<
columns(); ++j ) {
2424 for( RhsIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2425 if( IsSymmetric<MT>::value || IsHermitian<MT>::value ) {
2427 if( !isDefault<strict>( value ) )
2428 set( element->index(), j, value );
2431 append( element->index(), j, element->value(), true );
2451 template<
typename MT
2454 template<
typename MT2
2456 inline void Submatrix<MT,AF,false,false,CSAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
2458 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
2465 const AddType tmp(
serial( *
this + (~rhs) ) );
2485 template<
typename MT
2488 template<
typename MT2
2490 inline void Submatrix<MT,AF,false,false,CSAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
2492 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
2499 const SubType tmp(
serial( *
this - (~rhs) ) );
2519 template<
typename MT
2522 template<
typename MT2
2524 inline void Submatrix<MT,AF,false,false,CSAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
2526 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
2534 const SchurType tmp(
serial( *
this % (~rhs) ) );
2562 template<
typename MT
2565 class Submatrix<MT,AF,true,false,CSAs...>
2566 :
public View< SparseMatrix< Submatrix<MT,AF,true,false,CSAs...>, true > >
2567 ,
private SubmatrixData<CSAs...>
2571 using DataType = SubmatrixData<CSAs...>;
2572 using Operand = If_< IsExpression<MT>, MT, MT& >;
2578 using This = Submatrix<MT,AF,
true,
false,CSAs...>;
2580 using BaseType = SparseMatrix<This,true>;
2581 using ViewedType = MT;
2590 using ConstReference = ConstReference_<MT>;
2599 template<
typename MatrixType
2600 ,
typename IteratorType >
2601 class SubmatrixElement
2602 :
private SparseElement
2611 inline SubmatrixElement( IteratorType pos,
size_t offset )
2623 template<
typename T >
inline SubmatrixElement& operator=(
const T& v ) {
2635 template<
typename T >
inline SubmatrixElement&
operator+=(
const T& v ) {
2647 template<
typename T >
inline SubmatrixElement&
operator-=(
const T& v ) {
2659 template<
typename T >
inline SubmatrixElement&
operator*=(
const T& v ) {
2671 template<
typename T >
inline SubmatrixElement&
operator/=(
const T& v ) {
2682 inline const SubmatrixElement* operator->()
const {
2692 inline decltype(
auto) value()
const {
2693 return pos_->value();
2702 inline size_t index()
const {
2703 return pos_->index() - offset_;
2718 template<
typename MatrixType
2719 ,
typename IteratorType >
2720 class SubmatrixIterator
2724 using IteratorCategory = std::forward_iterator_tag;
2725 using ValueType = SubmatrixElement<MatrixType,IteratorType>;
2726 using PointerType = ValueType;
2727 using ReferenceType = ValueType;
2728 using DifferenceType = ptrdiff_t;
2731 using iterator_category = IteratorCategory;
2732 using value_type = ValueType;
2733 using pointer = PointerType;
2734 using reference = ReferenceType;
2735 using difference_type = DifferenceType;
2741 inline SubmatrixIterator()
2753 inline SubmatrixIterator( IteratorType iterator,
size_t index )
2764 template<
typename MatrixType2,
typename IteratorType2 >
2765 inline SubmatrixIterator(
const SubmatrixIterator<MatrixType2,IteratorType2>& it )
2766 : pos_ ( it.base() )
2767 , offset_( it.offset() )
2776 inline SubmatrixIterator& operator++() {
2787 inline const SubmatrixIterator operator++(
int ) {
2788 const SubmatrixIterator tmp( *
this );
2799 inline ReferenceType
operator*()
const {
2800 return ReferenceType( pos_, offset_ );
2809 inline PointerType operator->()
const {
2810 return PointerType( pos_, offset_ );
2820 template<
typename MatrixType2,
typename IteratorType2 >
2821 inline bool operator==(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
2822 return base() == rhs.base();
2832 template<
typename MatrixType2,
typename IteratorType2 >
2833 inline bool operator!=(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
2834 return !( *
this == rhs );
2844 inline DifferenceType
operator-(
const SubmatrixIterator& rhs )
const {
2845 return pos_ - rhs.pos_;
2854 inline IteratorType base()
const {
2864 inline size_t offset() const noexcept {
2879 using ConstIterator = SubmatrixIterator< const MT, ConstIterator_<MT> >;
2887 enum :
bool { smpAssignable = MT::smpAssignable };
2893 template<
typename... RSAs >
2894 explicit inline Submatrix( MT& matrix, RSAs... args );
2906 inline Reference operator()(
size_t i,
size_t j );
2907 inline ConstReference operator()(
size_t i,
size_t j )
const;
2908 inline Reference at(
size_t i,
size_t j );
2909 inline ConstReference at(
size_t i,
size_t j )
const;
2911 inline ConstIterator
begin (
size_t i )
const;
2912 inline ConstIterator
cbegin(
size_t i )
const;
2914 inline ConstIterator
end (
size_t i )
const;
2915 inline ConstIterator
cend (
size_t i )
const;
2922 inline Submatrix& operator=( initializer_list< initializer_list<ElementType> > list );
2923 inline Submatrix& operator=(
const Submatrix& rhs );
2925 template<
typename MT2,
bool SO >
inline Submatrix& operator= (
const Matrix<MT2,SO>& rhs );
2926 template<
typename MT2,
bool SO >
inline Submatrix&
operator+=(
const Matrix<MT2,SO>& rhs );
2927 template<
typename MT2,
bool SO >
inline Submatrix&
operator-=(
const Matrix<MT2,SO>& rhs );
2928 template<
typename MT2,
bool SO >
inline Submatrix& operator%=(
const Matrix<MT2,SO>& rhs );
2940 inline MT& operand() noexcept;
2941 inline const MT& operand() const noexcept;
2943 inline
size_t capacity() const noexcept;
2944 inline
size_t capacity(
size_t i ) const noexcept;
2946 inline
size_t nonZeros(
size_t i ) const;
2947 inline
void reset();
2948 inline
void reset(
size_t i );
2949 inline
void reserve(
size_t nonzeros );
2950 void reserve(
size_t i,
size_t nonzeros );
2952 inline
void trim(
size_t j );
2961 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
2962 inline
void finalize(
size_t i );
2969 inline
void erase(
size_t i,
size_t j );
2973 template< typename Pred >
2974 inline
void erase( Pred predicate );
2976 template< typename Pred >
2977 inline
void erase(
size_t i,
Iterator first,
Iterator last, Pred predicate );
2984 inline
Iterator find (
size_t i,
size_t j );
2985 inline ConstIterator find (
size_t i,
size_t j ) const;
2986 inline
Iterator lowerBound(
size_t i,
size_t j );
2987 inline ConstIterator lowerBound(
size_t i,
size_t j ) const;
2988 inline
Iterator upperBound(
size_t i,
size_t j );
2989 inline ConstIterator upperBound(
size_t i,
size_t j ) const;
2996 inline Submatrix& transpose();
2997 inline Submatrix& ctranspose();
2999 template< typename Other > inline Submatrix& scale( const Other& scalar );
3006 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
3007 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
3009 inline
bool canSMPAssign() const noexcept;
3011 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
3012 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
3013 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
3014 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
3015 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
3016 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
3024 inline
bool hasOverlap() const noexcept;
3070 template< typename MT
3073 template< typename... RSAs >
3074 inline Submatrix<MT,AF,true,false,CSAs...>::Submatrix( MT& matrix, RSAs... args )
3075 : DataType( args... )
3076 , matrix_ ( matrix )
3078 if( !Contains< TypeList<RSAs...>,
Unchecked >::value ) {
3111 template<
typename MT
3114 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Reference 3115 Submatrix<MT,AF,true,false,CSAs...>::operator()(
size_t i,
size_t j )
3137 template<
typename MT
3141 Submatrix<MT,AF,true,false,CSAs...>::operator()(
size_t i,
size_t j )
const 3146 return const_cast<const MT&
>( matrix_ )(
row()+i,
column()+j);
3164 template<
typename MT
3167 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Reference 3168 Submatrix<MT,AF,true,false,CSAs...>::at(
size_t i,
size_t j )
3176 return (*
this)(i,j);
3194 template<
typename MT
3198 Submatrix<MT,AF,true,false,CSAs...>::at(
size_t i,
size_t j )
const 3206 return (*
this)(i,j);
3219 template<
typename MT
3222 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 3243 template<
typename MT
3267 template<
typename MT
3291 template<
typename MT
3294 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 3299 if( matrix_.rows() ==
row() +
rows() )
3315 template<
typename MT
3323 if( matrix_.rows() ==
row() +
rows() )
3339 template<
typename MT
3347 if( matrix_.rows() ==
row() +
rows() )
3380 template<
typename MT
3383 inline Submatrix<MT,AF,
true,
false,CSAs...>&
3384 Submatrix<MT,AF,true,false,CSAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
3386 using blaze::assign;
3388 if( list.size() !=
rows() ) {
3392 const InitializerMatrix<ElementType> tmp( list,
columns() );
3394 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3398 decltype(
auto) left( derestrict( *this ) );
3401 assign( left, tmp );
3424 template< typename MT
3427 inline Submatrix<MT,AF,true,false,CSAs...>&
3428 Submatrix<MT,AF,true,false,CSAs...>::operator=( const Submatrix& rhs )
3430 using blaze::assign;
3435 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() &&
column() == rhs.column() ) )
3438 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
3442 if( !tryAssign( matrix_, rhs,
row(),
column() ) ) {
3446 decltype(
auto) left( derestrict( *this ) );
3448 if( rhs.canAlias( &matrix_ ) ) {
3451 assign( left, tmp );
3455 assign( left, rhs );
3481 template<
typename MT
3484 template<
typename MT2
3486 inline Submatrix<MT,AF,
true,
false,CSAs...>&
3487 Submatrix<MT,AF,true,false,CSAs...>::operator=(
const Matrix<MT2,SO>& rhs )
3489 using blaze::assign;
3497 using Right = CompositeType_<MT2>;
3498 Right right( ~rhs );
3500 if( !tryAssign( matrix_, right,
row(),
column() ) ) {
3504 decltype(
auto) left( derestrict( *this ) );
3506 if( IsReference<Right>::value && right.canAlias( &matrix_ ) ) {
3507 const ResultType_<MT2> tmp( right );
3509 assign( left, tmp );
3513 assign( left, right );
3538 template<
typename MT
3541 template<
typename MT2
3543 inline Submatrix<MT,AF,
true,
false,CSAs...>&
3546 using blaze::assign;
3552 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
3560 const AddType tmp( *
this + (~rhs) );
3562 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3566 decltype(
auto) left( derestrict( *this ) );
3569 assign( left, tmp );
3593 template< typename MT
3596 template< typename MT2
3598 inline Submatrix<MT,AF,true,false,CSAs...>&
3599 Submatrix<MT,AF,true,false,CSAs...>::operator-=( const Matrix<MT2,SO>& rhs )
3601 using blaze::assign;
3607 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
3615 const SubType tmp( *
this - (~rhs) );
3617 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3621 decltype(
auto) left( derestrict( *this ) );
3624 assign( left, tmp );
3648 template< typename MT
3651 template< typename MT2
3653 inline Submatrix<MT,AF,true,false,CSAs...>&
3654 Submatrix<MT,AF,true,false,CSAs...>::operator%=( const Matrix<MT2,SO>& rhs )
3656 using blaze::assign;
3662 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
3670 const SchurType tmp( *
this % (~rhs) );
3672 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3676 decltype(
auto) left( derestrict( *this ) );
3679 assign( left, tmp );
3703 template< typename MT
3706 inline MT& Submatrix<MT,AF,true,false,CSAs...>::operand() noexcept
3720 template<
typename MT
3723 inline const MT& Submatrix<MT,AF,true,false,CSAs...>::operand() const noexcept
3737 template<
typename MT
3742 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
3755 template<
typename MT
3773 template<
typename MT
3778 size_t nonzeros( 0UL );
3780 for(
size_t i=0UL; i<
columns(); ++i )
3796 template<
typename MT
3814 template<
typename MT
3821 const size_t ibegin( ( IsLower<MT>::value )
3822 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3826 const size_t iend ( ( IsUpper<MT>::value )
3827 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3832 matrix_.erase( j, matrix_.lowerBound( ibegin, j ), matrix_.lowerBound( iend, j ) );
3846 template<
typename MT
3853 const size_t index(
column() + j );
3855 const size_t ibegin( ( IsLower<MT>::value )
3856 ?( ( IsUniLower<MT>::value || IsStrictlyLower<MT>::value )
3860 const size_t iend ( ( IsUpper<MT>::value )
3861 ?( ( IsUniUpper<MT>::value || IsStrictlyUpper<MT>::value )
3866 matrix_.erase( index, matrix_.lowerBound( ibegin, index ), matrix_.lowerBound( iend, index ) );
3883 template<
typename MT
3886 inline void Submatrix<MT,AF,true,false,CSAs...>::reserve(
size_t nonzeros )
3888 const size_t current(
capacity() );
3890 if( nonzeros > current ) {
3891 matrix_.reserve( matrix_.capacity() + nonzeros - current );
3910 template<
typename MT
3913 void Submatrix<MT,AF,true,false,CSAs...>::reserve(
size_t j,
size_t nonzeros )
3915 const size_t current(
capacity( j ) );
3916 const size_t index (
column() + j );
3918 if( nonzeros > current ) {
3919 matrix_.reserve( index, matrix_.capacity( index ) + nonzeros - current );
3936 template<
typename MT
3939 void Submatrix<MT,AF,true,false,CSAs...>::trim()
3941 for(
size_t j=0UL; j<
columns(); ++j )
3959 template<
typename MT
3962 void Submatrix<MT,AF,true,false,CSAs...>::trim(
size_t j )
3965 matrix_.trim(
column() + j );
3981 template<
typename MT
3984 inline bool Submatrix<MT,AF,true,false,CSAs...>::hasOverlap() const noexcept
3986 BLAZE_INTERNAL_ASSERT( IsSymmetric<MT>::value || IsHermitian<MT>::value,
"Invalid matrix detected" );
4017 template<
typename MT
4020 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4043 template<
typename MT
4046 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4047 Submatrix<MT,AF,true,false,CSAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
4099 template<
typename MT
4102 inline void Submatrix<MT,AF,true,false,CSAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
4104 if(
row() +
rows() == matrix_.rows() ) {
4105 matrix_.append(
row() + i,
column() + j, value, check );
4107 else if( !check || !isDefault<strict>( value ) ) {
4108 matrix_.insert(
row() + i,
column() + j, value );
4129 template<
typename MT
4132 inline void Submatrix<MT,AF,true,false,CSAs...>::finalize(
size_t j )
4134 matrix_.trim(
column() + j );
4158 template<
typename MT
4161 inline void Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t i,
size_t j )
4166 matrix_.erase(
row() + i,
column() + j );
4182 template<
typename MT
4185 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4186 Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t j,
Iterator pos )
4206 template<
typename MT
4209 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4210 Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t j,
Iterator first,
Iterator last )
4213 return Iterator( matrix_.erase(
column()+j, first.base(), last.base() ),
row() );
4242 template<
typename MT
4245 template<
typename Pred >
4246 inline void Submatrix<MT,AF,true,false,CSAs...>::erase( Pred predicate )
4248 for(
size_t j=0UL; j<
columns(); ++j ) {
4249 matrix_.erase(
column()+j,
begin(j).base(),
end(j).base(), predicate );
4282 template<
typename MT
4285 template<
typename Pred >
4286 inline void Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t j,
Iterator first,
Iterator last, Pred predicate )
4289 matrix_.erase(
column()+j, first.base(), last.base(), predicate );
4319 template<
typename MT
4322 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4323 Submatrix<MT,AF,true,false,CSAs...>::find(
size_t i,
size_t j )
4325 const Iterator_<MT> pos( matrix_.find(
row() + i,
column() + j ) );
4327 if( pos != matrix_.end(
column() + j ) )
4352 template<
typename MT
4356 Submatrix<MT,AF,true,false,CSAs...>::find(
size_t i,
size_t j )
const 4358 const ConstIterator_<MT> pos( matrix_.find(
row() + i,
column() + j ) );
4360 if( pos != matrix_.end(
column() + j ) )
4385 template<
typename MT
4388 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4389 Submatrix<MT,AF,true,false,CSAs...>::lowerBound(
size_t i,
size_t j )
4413 template<
typename MT
4417 Submatrix<MT,AF,true,false,CSAs...>::lowerBound(
size_t i,
size_t j )
const 4441 template<
typename MT
4444 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4445 Submatrix<MT,AF,true,false,CSAs...>::upperBound(
size_t i,
size_t j )
4469 template<
typename MT
4473 Submatrix<MT,AF,true,false,CSAs...>::upperBound(
size_t i,
size_t j )
const 4507 template<
typename MT
4510 inline Submatrix<MT,AF,
true,
false,CSAs...>&
4513 using blaze::assign;
4523 decltype(
auto) left( derestrict( *this ) );
4527 assign( left, tmp );
4553 template< typename MT
4556 inline Submatrix<MT,AF,true,false,CSAs...>&
4557 Submatrix<MT,AF,true,false,CSAs...>::ctranspose()
4559 using blaze::assign;
4569 decltype(
auto) left( derestrict( *this ) );
4573 assign( left, tmp );
4594 template< typename MT
4597 template< typename Other >
4598 inline Submatrix<MT,AF,true,false,CSAs...>&
4599 Submatrix<MT,AF,true,false,CSAs...>::scale( const Other& scalar )
4603 for(
size_t i=0UL; i<
columns(); ++i ) {
4606 element->value() *= scalar;
4634 template<
typename MT
4637 template<
typename Other >
4638 inline bool Submatrix<MT,AF,true,false,CSAs...>::canAlias(
const Other* alias )
const noexcept
4640 return matrix_.isAliased( alias );
4657 template<
typename MT
4660 template<
typename Other >
4661 inline bool Submatrix<MT,AF,true,false,CSAs...>::isAliased(
const Other* alias )
const noexcept
4663 return matrix_.isAliased( alias );
4680 template<
typename MT
4683 inline bool Submatrix<MT,AF,true,false,CSAs...>::canSMPAssign() const noexcept
4703 template<
typename MT
4706 template<
typename MT2
4708 inline void Submatrix<MT,AF,true,false,CSAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
4715 for(
size_t j=0UL; j<
columns(); ++j ) {
4716 for(
size_t i=0UL; i<
rows(); ++i ) {
4717 if( IsSymmetric<MT>::value || IsHermitian<MT>::value ) {
4719 if( !isDefault<strict>( value ) )
4723 append( i, j, (~rhs)(i,j),
true );
4745 template<
typename MT
4748 template<
typename MT2 >
4749 inline void Submatrix<MT,AF,true,false,CSAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
4756 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
4757 for( ConstIterator_<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element ) {
4758 if( IsSymmetric<MT>::value || IsHermitian<MT>::value ) {
4760 if( !isDefault<strict>( value ) )
4761 set( element->index(), j, value );
4764 append( element->index(), j, element->value(), true );
4785 template<
typename MT
4788 template<
typename MT2 >
4789 inline void Submatrix<MT,AF,true,false,CSAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
4796 using RhsIterator = ConstIterator_<MT2>;
4799 std::vector<size_t> columnLengths(
columns(), 0UL );
4800 for(
size_t i=0UL; i<
rows(); ++i ) {
4801 for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
4802 ++columnLengths[element->index()];
4806 for(
size_t j=0UL; j<
columns(); ++j ) {
4807 reserve( j, columnLengths[j] );
4811 for(
size_t i=0UL; i<
rows(); ++i ) {
4812 for( RhsIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
4813 if( IsSymmetric<MT>::value || IsHermitian<MT>::value ) {
4815 if( !isDefault<strict>( value ) )
4816 set( i, element->index(), value );
4819 append( i, element->index(), element->value(), true );
4839 template<
typename MT
4842 template<
typename MT2
4844 inline void Submatrix<MT,AF,true,false,CSAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
4846 using AddType = AddTrait_< ResultType, ResultType_<MT2> >;
4853 const AddType tmp(
serial( *
this + (~rhs) ) );
4873 template<
typename MT
4876 template<
typename MT2
4878 inline void Submatrix<MT,AF,true,false,CSAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
4880 using SubType = SubTrait_< ResultType, ResultType_<MT2> >;
4887 const SubType tmp(
serial( *
this - (~rhs) ) );
4907 template<
typename MT
4910 template<
typename MT2
4912 inline void Submatrix<MT,AF,true,false,CSAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
4914 using SchurType = SchurTrait_< ResultType, ResultType_<MT2> >;
4921 const SchurType tmp(
serial( *
this % (~rhs) ) );
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
#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
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
Header file for the Schur product trait.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
Header file for the View base class.
Header file for the serial shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
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:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SUBMATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a submatrix type (i.e. a dense or sparse submatrix), a compilation error is created.
Definition: Submatrix.h:81
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:827
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:81
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
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:560
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Constraints on the storage order of matrix types.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a transposition expression (i...
Definition: TransExpr.h:81
Header file for the extended initializer_list functionality.
typename SubmatrixTrait< MT, CSAs... >::Type SubmatrixTrait_
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_ alias declaration p...
Definition: SubmatrixTrait.h:145
Header file for the IsUniLower type trait.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Constraint on the data type.
Header file for the SparseMatrix base class.
Constraint on the data type.
Header file for the matrix storage order types.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
Headerfile for the generic max algorithm.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1359
Header file for the If class template.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#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
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
Constraint on the data type.
#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
Header file for the implementation of the Submatrix base template.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
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:506
Header file for the SparseElement base class.
Constraint on the data type.
Header file for the exception macros of the math module.
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:430
Header file for the implementation of the SubmatrixData class template.
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#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
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: RowMajorMatrix.h:61
Header file for the IsConst type trait.
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Header file for the relaxation flag types.
Header file for the addition trait.
Header file for the Unique class template.
Header file for the submatrix trait.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
Header file for the reset shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
Header file for the IsReference type trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
#define BLAZE_THROW_LOGIC_ERROR(MESSAGE)
Macro for the emission of a std::logic_error exception.This macro encapsulates the default way of Bla...
Definition: Exception.h:187
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Header file for the IsUpper type trait.
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsHermitian type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:801