35 #ifndef _BLAZE_MATH_VIEWS_SUBMATRIX_SPARSE_H_ 36 #define _BLAZE_MATH_VIEWS_SUBMATRIX_SPARSE_H_ 113 template<
typename MT
116 class Submatrix<MT,AF,false,false,CSAs...>
117 :
public View< SparseMatrix< Submatrix<MT,AF,false,false,CSAs...>, false > >
118 ,
private SubmatrixData<CSAs...>
122 using DataType = SubmatrixData<CSAs...>;
123 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
129 using This = Submatrix<MT,AF,
false,
false,CSAs...>;
131 using BaseType = SparseMatrix<This,false>;
132 using ViewedType = MT;
150 template<
typename MatrixType
151 ,
typename IteratorType >
152 class SubmatrixElement
153 :
private SparseElement
162 inline SubmatrixElement( IteratorType pos,
size_t offset )
174 template<
typename T >
inline SubmatrixElement& operator=(
const T& v ) {
186 template<
typename T >
inline SubmatrixElement&
operator+=(
const T& v ) {
198 template<
typename T >
inline SubmatrixElement&
operator-=(
const T& v ) {
210 template<
typename T >
inline SubmatrixElement&
operator*=(
const T& v ) {
222 template<
typename T >
inline SubmatrixElement&
operator/=(
const T& v ) {
233 inline const SubmatrixElement* operator->()
const {
243 inline decltype(
auto) value()
const {
244 return pos_->value();
253 inline size_t index()
const {
254 return pos_->index() - offset_;
269 template<
typename MatrixType
270 ,
typename IteratorType >
271 class SubmatrixIterator
275 using IteratorCategory = std::forward_iterator_tag;
276 using ValueType = SubmatrixElement<MatrixType,IteratorType>;
277 using PointerType = ValueType;
278 using ReferenceType = ValueType;
279 using DifferenceType = ptrdiff_t;
282 using iterator_category = IteratorCategory;
283 using value_type = ValueType;
284 using pointer = PointerType;
285 using reference = ReferenceType;
286 using difference_type = DifferenceType;
292 inline SubmatrixIterator()
304 inline SubmatrixIterator( IteratorType iterator,
size_t index )
315 template<
typename MatrixType2,
typename IteratorType2 >
316 inline SubmatrixIterator(
const SubmatrixIterator<MatrixType2,IteratorType2>& it )
318 , offset_( it.offset() )
327 inline SubmatrixIterator& operator++() {
338 inline const SubmatrixIterator operator++(
int ) {
339 const SubmatrixIterator tmp( *
this );
351 return ReferenceType( pos_, offset_ );
360 inline PointerType operator->()
const {
361 return PointerType( pos_, offset_ );
371 template<
typename MatrixType2,
typename IteratorType2 >
372 inline bool operator==(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
373 return base() == rhs.base();
383 template<
typename MatrixType2,
typename IteratorType2 >
384 inline bool operator!=(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
385 return !( *
this == rhs );
395 inline DifferenceType
operator-(
const SubmatrixIterator& rhs )
const {
396 return pos_ - rhs.pos_;
405 inline IteratorType base()
const {
415 inline size_t offset() const noexcept {
430 using ConstIterator = SubmatrixIterator< const MT, ConstIterator_t<MT> >;
444 template<
typename... RSAs >
445 explicit inline Submatrix( MT& matrix, RSAs... args );
447 Submatrix(
const Submatrix& ) =
default;
454 ~Submatrix() =
default;
461 inline Reference operator()(
size_t i,
size_t j );
463 inline Reference at(
size_t i,
size_t j );
477 inline Submatrix& operator=( initializer_list< initializer_list<ElementType> > list );
478 inline Submatrix& operator=(
const Submatrix& rhs );
480 template<
typename MT2,
bool SO >
inline Submatrix& operator= (
const Matrix<MT2,SO>& rhs );
481 template<
typename MT2,
bool SO >
inline Submatrix&
operator+=(
const Matrix<MT2,SO>& rhs );
482 template<
typename MT2,
bool SO >
inline Submatrix&
operator-=(
const Matrix<MT2,SO>& rhs );
483 template<
typename MT2,
bool SO >
inline Submatrix& operator%=(
const Matrix<MT2,SO>& rhs );
495 inline MT& operand() noexcept;
496 inline const MT& operand() const noexcept;
498 inline
size_t capacity() const noexcept;
499 inline
size_t capacity(
size_t i ) const noexcept;
501 inline
size_t nonZeros(
size_t i ) const;
503 inline
void reset(
size_t i );
504 inline
void reserve(
size_t nonzeros );
505 void reserve(
size_t i,
size_t nonzeros );
507 inline
void trim(
size_t i );
516 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
517 inline
void finalize(
size_t i );
524 inline
void erase(
size_t i,
size_t j );
528 template< typename Pred >
529 inline
void erase( Pred predicate );
531 template< typename Pred >
532 inline
void erase(
size_t i,
Iterator first,
Iterator last, Pred predicate );
539 inline
Iterator find (
size_t i,
size_t j );
541 inline
Iterator lowerBound(
size_t i,
size_t j );
543 inline
Iterator upperBound(
size_t i,
size_t j );
554 template< typename Other > inline Submatrix& scale( const Other& scalar );
561 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
562 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
564 inline
bool canSMPAssign() const noexcept;
566 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
567 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
568 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
569 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
570 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
571 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
579 inline
bool hasOverlap() const noexcept;
625 template< typename MT
628 template< typename... RSAs >
629 inline Submatrix<MT,AF,false,false,CSAs...>::Submatrix( MT& matrix, RSAs... args )
630 : DataType( args... )
666 template<
typename MT
669 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Reference 670 Submatrix<MT,AF,false,false,CSAs...>::operator()(
size_t i,
size_t j )
692 template<
typename MT
696 Submatrix<MT,AF,false,false,CSAs...>::operator()(
size_t i,
size_t j )
const 701 return const_cast<const MT&
>( matrix_ )(
row()+i,
column()+j);
719 template<
typename MT
722 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Reference 723 Submatrix<MT,AF,false,false,CSAs...>::at(
size_t i,
size_t j )
749 template<
typename MT
753 Submatrix<MT,AF,false,false,CSAs...>::at(
size_t i,
size_t j )
const 779 template<
typename MT
782 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 808 template<
typename MT
837 template<
typename MT
866 template<
typename MT
869 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 895 template<
typename MT
924 template<
typename MT
965 template<
typename MT
968 inline Submatrix<MT,AF,
false,
false,CSAs...>&
969 Submatrix<MT,AF,false,false,CSAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
973 if( list.size() !=
rows() ) {
977 const InitializerMatrix<ElementType> tmp( list,
columns() );
979 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
983 decltype(
auto) left( derestrict( *this ) );
1009 template< typename MT
1012 inline Submatrix<MT,AF,false,false,CSAs...>&
1013 Submatrix<MT,AF,false,false,CSAs...>::operator=( const Submatrix& rhs )
1015 using blaze::assign;
1020 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() &&
column() == rhs.column() ) )
1023 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
1027 if( !tryAssign( matrix_, rhs,
row(),
column() ) ) {
1031 decltype(
auto) left( derestrict( *this ) );
1033 if( rhs.canAlias( &matrix_ ) ) {
1036 assign( left, tmp );
1040 assign( left, rhs );
1066 template<
typename MT
1069 template<
typename MT2
1071 inline Submatrix<MT,AF,
false,
false,CSAs...>&
1072 Submatrix<MT,AF,false,false,CSAs...>::operator=(
const Matrix<MT2,SO>& rhs )
1074 using blaze::assign;
1082 using Right = CompositeType_t<MT2>;
1083 Right right( ~rhs );
1085 if( !tryAssign( matrix_, right,
row(),
column() ) ) {
1089 decltype(
auto) left( derestrict( *this ) );
1092 const ResultType_t<MT2> tmp( right );
1094 assign( left, tmp );
1098 assign( left, right );
1123 template<
typename MT
1126 template<
typename MT2
1128 inline Submatrix<MT,AF,
false,
false,CSAs...>&
1131 using blaze::assign;
1137 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
1145 const AddType tmp( *
this + (~rhs) );
1147 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
1151 decltype(
auto) left( derestrict( *this ) );
1154 assign( left, tmp );
1178 template< typename MT
1181 template< typename MT2
1183 inline Submatrix<MT,AF,false,false,CSAs...>&
1184 Submatrix<MT,AF,false,false,CSAs...>::operator-=( const Matrix<MT2,SO>& rhs )
1186 using blaze::assign;
1192 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
1200 const SubType tmp( *
this - (~rhs) );
1202 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
1206 decltype(
auto) left( derestrict( *this ) );
1209 assign( left, tmp );
1233 template< typename MT
1236 template< typename MT2
1238 inline Submatrix<MT,AF,false,false,CSAs...>&
1239 Submatrix<MT,AF,false,false,CSAs...>::operator%=( const Matrix<MT2,SO>& rhs )
1241 using blaze::assign;
1247 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
1255 const SchurType tmp( *
this % (~rhs) );
1257 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
1261 decltype(
auto) left( derestrict( *this ) );
1264 assign( left, tmp );
1288 template< typename MT
1291 inline MT& Submatrix<MT,AF,false,false,CSAs...>::operand() noexcept
1305 template<
typename MT
1308 inline const MT& Submatrix<MT,AF,false,false,CSAs...>::operand() const noexcept
1322 template<
typename MT
1327 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
1345 template<
typename MT
1351 return nonZeros( i ) + matrix_.capacity(
row()+i ) - matrix_.nonZeros(
row()+i );
1363 template<
typename MT
1368 size_t nonzeros( 0UL );
1370 for(
size_t i=0UL; i<
rows(); ++i )
1391 template<
typename MT
1409 template<
typename MT
1416 const size_t jbegin( ( IsUpper_v<MT> )
1417 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
1421 const size_t jend ( ( IsLower_v<MT> )
1422 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
1427 matrix_.erase( i, matrix_.lowerBound( i, jbegin ), matrix_.lowerBound( i, jend ) );
1446 template<
typename MT
1453 const size_t index(
row() + i );
1455 const size_t jbegin( ( IsUpper_v<MT> )
1456 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
1460 const size_t jend ( ( IsLower_v<MT> )
1461 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
1466 matrix_.erase( index, matrix_.lowerBound( index, jbegin ), matrix_.lowerBound( index, jend ) );
1483 template<
typename MT
1486 inline void Submatrix<MT,AF,false,false,CSAs...>::reserve(
size_t nonzeros )
1488 const size_t current(
capacity() );
1490 if( nonzeros > current ) {
1491 matrix_.reserve( matrix_.capacity() + nonzeros - current );
1514 template<
typename MT
1517 void Submatrix<MT,AF,false,false,CSAs...>::reserve(
size_t i,
size_t nonzeros )
1519 const size_t current(
capacity( i ) );
1520 const size_t index (
row() + i );
1522 if( nonzeros > current ) {
1523 matrix_.reserve( index, matrix_.capacity( index ) + nonzeros - current );
1541 template<
typename MT
1544 void Submatrix<MT,AF,false,false,CSAs...>::trim()
1546 for(
size_t i=0UL; i<
rows(); ++i )
1565 template<
typename MT
1568 void Submatrix<MT,AF,false,false,CSAs...>::trim(
size_t i )
1571 matrix_.trim(
row() + i );
1587 template<
typename MT
1590 inline bool Submatrix<MT,AF,false,false,CSAs...>::hasOverlap() const noexcept
1623 template<
typename MT
1626 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1649 template<
typename MT
1652 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1653 Submatrix<MT,AF,false,false,CSAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
1705 template<
typename MT
1708 inline void Submatrix<MT,AF,false,false,CSAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
1711 matrix_.append(
row() + i,
column() + j, value, check );
1713 else if( !check || !isDefault<strict>( value ) ) {
1714 matrix_.insert(
row() + i,
column() + j, value );
1735 template<
typename MT
1738 inline void Submatrix<MT,AF,false,false,CSAs...>::finalize(
size_t i )
1740 matrix_.trim(
row() + i );
1764 template<
typename MT
1767 inline void Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
size_t j )
1772 matrix_.erase(
row() + i,
column() + j );
1790 template<
typename MT
1793 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1794 Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
Iterator pos )
1817 template<
typename MT
1820 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1821 Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
Iterator first,
Iterator last )
1824 return Iterator( matrix_.erase(
row()+i, first.base(), last.base() ),
column() );
1853 template<
typename MT
1856 template<
typename Pred >
1857 inline void Submatrix<MT,AF,false,false,CSAs...>::erase( Pred predicate )
1859 for(
size_t i=0UL; i<
rows(); ++i ) {
1860 matrix_.erase(
row()+i,
begin(i).base(),
end(i).base(), predicate );
1896 template<
typename MT
1899 template<
typename Pred >
1900 inline void Submatrix<MT,AF,false,false,CSAs...>::erase(
size_t i,
Iterator first,
Iterator last, Pred predicate )
1903 matrix_.erase(
row()+i, first.base(), last.base(), predicate );
1933 template<
typename MT
1936 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 1937 Submatrix<MT,AF,false,false,CSAs...>::find(
size_t i,
size_t j )
1939 const Iterator_t<MT> pos( matrix_.find(
row() + i,
column() + j ) );
1941 if( pos != matrix_.end(
row() + i ) )
1966 template<
typename MT
1970 Submatrix<MT,AF,false,false,CSAs...>::find(
size_t i,
size_t j )
const 1972 const ConstIterator_t<MT> pos( matrix_.find(
row() + i,
column() + j ) );
1974 if( pos != matrix_.end(
row() + i ) )
1999 template<
typename MT
2002 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 2003 Submatrix<MT,AF,false,false,CSAs...>::lowerBound(
size_t i,
size_t j )
2027 template<
typename MT
2031 Submatrix<MT,AF,false,false,CSAs...>::lowerBound(
size_t i,
size_t j )
const 2055 template<
typename MT
2058 inline typename Submatrix<MT,AF,
false,
false,CSAs...>
::Iterator 2059 Submatrix<MT,AF,false,false,CSAs...>::upperBound(
size_t i,
size_t j )
2083 template<
typename MT
2087 Submatrix<MT,AF,false,false,CSAs...>::upperBound(
size_t i,
size_t j )
const 2121 template<
typename MT
2124 inline Submatrix<MT,AF,
false,
false,CSAs...>&
2127 using blaze::assign;
2137 decltype(
auto) left( derestrict( *this ) );
2141 assign( left, tmp );
2167 template< typename MT
2170 inline Submatrix<MT,AF,false,false,CSAs...>&
2171 Submatrix<MT,AF,false,false,CSAs...>::
ctranspose()
2173 using blaze::assign;
2183 decltype(
auto) left( derestrict( *this ) );
2187 assign( left, tmp );
2208 template< typename MT
2211 template< typename Other >
2212 inline Submatrix<MT,AF,false,false,CSAs...>&
2213 Submatrix<MT,AF,false,false,CSAs...>::scale( const Other& scalar )
2217 for(
size_t i=0UL; i<
rows(); ++i ) {
2220 element->value() *= scalar;
2248 template<
typename MT
2251 template<
typename Other >
2252 inline bool Submatrix<MT,AF,false,false,CSAs...>::canAlias(
const Other* alias )
const noexcept
2254 return matrix_.isAliased( alias );
2271 template<
typename MT
2274 template<
typename Other >
2275 inline bool Submatrix<MT,AF,false,false,CSAs...>::isAliased(
const Other* alias )
const noexcept
2277 return matrix_.isAliased( alias );
2294 template<
typename MT
2297 inline bool Submatrix<MT,AF,false,false,CSAs...>::canSMPAssign() const noexcept
2317 template<
typename MT
2320 template<
typename MT2
2322 inline void Submatrix<MT,AF,false,false,CSAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
2329 for(
size_t i=0UL; i<
rows(); ++i ) {
2330 for(
size_t j=0UL; j<
columns(); ++j ) {
2331 if( IsSymmetric_v<MT> || IsHermitian_v<MT> ) {
2333 if( !isDefault<strict>( value ) )
2337 append( i, j, (~rhs)(i,j),
true );
2359 template<
typename MT
2362 template<
typename MT2 >
2363 inline void Submatrix<MT,AF,false,false,CSAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
2370 for(
size_t i=0UL; i<(~rhs).
rows(); ++i ) {
2371 for( ConstIterator_t<MT2> element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element ) {
2372 if( IsSymmetric_v<MT> || IsHermitian_v<MT> ) {
2374 if( !isDefault<strict>( value ) )
2375 set( i, element->index(), value );
2378 append( i, element->index(), element->value(), true );
2400 template<
typename MT
2403 template<
typename MT2 >
2404 inline void Submatrix<MT,AF,false,false,CSAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
2412 std::vector<size_t> rowLengths(
rows(), 0UL );
2413 for(
size_t j=0UL; j<
columns(); ++j ) {
2414 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2415 ++rowLengths[element->index()];
2419 for(
size_t i=0UL; i<
rows(); ++i ) {
2420 reserve( i, rowLengths[i] );
2424 for(
size_t j=0UL; j<
columns(); ++j ) {
2425 for(
auto element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
2426 if( IsSymmetric_v<MT> || IsHermitian_v<MT> ) {
2428 if( !isDefault<strict>( value ) )
2429 set( element->index(), j, value );
2432 append( element->index(), j, element->value(), true );
2452 template<
typename MT
2455 template<
typename MT2
2457 inline void Submatrix<MT,AF,false,false,CSAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
2459 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
2466 const AddType tmp(
serial( *
this + (~rhs) ) );
2486 template<
typename MT
2489 template<
typename MT2
2491 inline void Submatrix<MT,AF,false,false,CSAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
2493 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
2500 const SubType tmp(
serial( *
this - (~rhs) ) );
2520 template<
typename MT
2523 template<
typename MT2
2525 inline void Submatrix<MT,AF,false,false,CSAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
2527 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
2535 const SchurType tmp(
serial( *
this % (~rhs) ) );
2563 template<
typename MT
2566 class Submatrix<MT,AF,true,false,CSAs...>
2567 :
public View< SparseMatrix< Submatrix<MT,AF,true,false,CSAs...>, true > >
2568 ,
private SubmatrixData<CSAs...>
2572 using DataType = SubmatrixData<CSAs...>;
2573 using Operand = If_t< IsExpression_v<MT>, MT, MT& >;
2579 using This = Submatrix<MT,AF,
true,
false,CSAs...>;
2581 using BaseType = SparseMatrix<This,true>;
2582 using ViewedType = MT;
2600 template<
typename MatrixType
2601 ,
typename IteratorType >
2602 class SubmatrixElement
2603 :
private SparseElement
2612 inline SubmatrixElement( IteratorType pos,
size_t offset )
2624 template<
typename T >
inline SubmatrixElement& operator=(
const T& v ) {
2636 template<
typename T >
inline SubmatrixElement&
operator+=(
const T& v ) {
2648 template<
typename T >
inline SubmatrixElement&
operator-=(
const T& v ) {
2660 template<
typename T >
inline SubmatrixElement&
operator*=(
const T& v ) {
2672 template<
typename T >
inline SubmatrixElement&
operator/=(
const T& v ) {
2683 inline const SubmatrixElement* operator->()
const {
2693 inline decltype(
auto) value()
const {
2694 return pos_->value();
2703 inline size_t index()
const {
2704 return pos_->index() - offset_;
2719 template<
typename MatrixType
2720 ,
typename IteratorType >
2721 class SubmatrixIterator
2725 using IteratorCategory = std::forward_iterator_tag;
2726 using ValueType = SubmatrixElement<MatrixType,IteratorType>;
2727 using PointerType = ValueType;
2728 using ReferenceType = ValueType;
2729 using DifferenceType = ptrdiff_t;
2732 using iterator_category = IteratorCategory;
2733 using value_type = ValueType;
2734 using pointer = PointerType;
2735 using reference = ReferenceType;
2736 using difference_type = DifferenceType;
2742 inline SubmatrixIterator()
2754 inline SubmatrixIterator( IteratorType iterator,
size_t index )
2765 template<
typename MatrixType2,
typename IteratorType2 >
2766 inline SubmatrixIterator(
const SubmatrixIterator<MatrixType2,IteratorType2>& it )
2767 : pos_ ( it.base() )
2768 , offset_( it.offset() )
2777 inline SubmatrixIterator& operator++() {
2788 inline const SubmatrixIterator operator++(
int ) {
2789 const SubmatrixIterator tmp( *
this );
2800 inline ReferenceType
operator*()
const {
2801 return ReferenceType( pos_, offset_ );
2810 inline PointerType operator->()
const {
2811 return PointerType( pos_, offset_ );
2821 template<
typename MatrixType2,
typename IteratorType2 >
2822 inline bool operator==(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
2823 return base() == rhs.base();
2833 template<
typename MatrixType2,
typename IteratorType2 >
2834 inline bool operator!=(
const SubmatrixIterator<MatrixType2,IteratorType2>& rhs )
const {
2835 return !( *
this == rhs );
2845 inline DifferenceType
operator-(
const SubmatrixIterator& rhs )
const {
2846 return pos_ - rhs.pos_;
2855 inline IteratorType base()
const {
2865 inline size_t offset() const noexcept {
2880 using ConstIterator = SubmatrixIterator< const MT, ConstIterator_t<MT> >;
2894 template<
typename... RSAs >
2895 explicit inline Submatrix( MT& matrix, RSAs... args );
2897 Submatrix(
const Submatrix& ) =
default;
2904 ~Submatrix() =
default;
2911 inline Reference operator()(
size_t i,
size_t j );
2913 inline Reference at(
size_t i,
size_t j );
2927 inline Submatrix& operator=( initializer_list< initializer_list<ElementType> > list );
2928 inline Submatrix& operator=(
const Submatrix& rhs );
2930 template<
typename MT2,
bool SO >
inline Submatrix& operator= (
const Matrix<MT2,SO>& rhs );
2931 template<
typename MT2,
bool SO >
inline Submatrix&
operator+=(
const Matrix<MT2,SO>& rhs );
2932 template<
typename MT2,
bool SO >
inline Submatrix&
operator-=(
const Matrix<MT2,SO>& rhs );
2933 template<
typename MT2,
bool SO >
inline Submatrix& operator%=(
const Matrix<MT2,SO>& rhs );
2945 inline MT& operand() noexcept;
2946 inline const MT& operand() const noexcept;
2948 inline
size_t capacity() const noexcept;
2949 inline
size_t capacity(
size_t i ) const noexcept;
2951 inline
size_t nonZeros(
size_t i ) const;
2952 inline
void reset();
2953 inline
void reset(
size_t i );
2954 inline
void reserve(
size_t nonzeros );
2955 void reserve(
size_t i,
size_t nonzeros );
2957 inline
void trim(
size_t j );
2966 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
2967 inline
void finalize(
size_t i );
2974 inline
void erase(
size_t i,
size_t j );
2978 template< typename Pred >
2979 inline
void erase( Pred predicate );
2981 template< typename Pred >
2982 inline
void erase(
size_t i,
Iterator first,
Iterator last, Pred predicate );
2989 inline
Iterator find (
size_t i,
size_t j );
2991 inline
Iterator lowerBound(
size_t i,
size_t j );
2992 inline
ConstIterator lowerBound(
size_t i,
size_t j ) const;
2993 inline
Iterator upperBound(
size_t i,
size_t j );
2994 inline
ConstIterator upperBound(
size_t i,
size_t j ) const;
3004 template< typename Other > inline Submatrix& scale( const Other& scalar );
3011 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
3012 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
3014 inline
bool canSMPAssign() const noexcept;
3016 template< typename MT2,
bool SO > inline
void assign ( const DenseMatrix<MT2,SO>& rhs );
3017 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,true>& rhs );
3018 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,false>& rhs );
3019 template< typename MT2,
bool SO > inline
void addAssign ( const Matrix<MT2,SO>& rhs );
3020 template< typename MT2,
bool SO > inline
void subAssign ( const Matrix<MT2,SO>& rhs );
3021 template< typename MT2,
bool SO > inline
void schurAssign( const Matrix<MT2,SO>& rhs );
3029 inline
bool hasOverlap() const noexcept;
3075 template< typename MT
3078 template< typename... RSAs >
3079 inline Submatrix<MT,AF,true,false,CSAs...>::Submatrix( MT& matrix, RSAs... args )
3080 : DataType( args... )
3081 , matrix_ ( matrix )
3116 template<
typename MT
3119 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Reference 3120 Submatrix<MT,AF,true,false,CSAs...>::operator()(
size_t i,
size_t j )
3142 template<
typename MT
3146 Submatrix<MT,AF,true,false,CSAs...>::operator()(
size_t i,
size_t j )
const 3151 return const_cast<const MT&
>( matrix_ )(
row()+i,
column()+j);
3169 template<
typename MT
3172 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Reference 3173 Submatrix<MT,AF,true,false,CSAs...>::at(
size_t i,
size_t j )
3181 return (*
this)(i,j);
3199 template<
typename MT
3203 Submatrix<MT,AF,true,false,CSAs...>::at(
size_t i,
size_t j )
const 3211 return (*
this)(i,j);
3224 template<
typename MT
3227 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 3248 template<
typename MT
3272 template<
typename MT
3296 template<
typename MT
3299 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 3304 if( matrix_.rows() ==
row() +
rows() )
3320 template<
typename MT
3328 if( matrix_.rows() ==
row() +
rows() )
3344 template<
typename MT
3352 if( matrix_.rows() ==
row() +
rows() )
3385 template<
typename MT
3388 inline Submatrix<MT,AF,
true,
false,CSAs...>&
3389 Submatrix<MT,AF,true,false,CSAs...>::operator=( initializer_list< initializer_list<ElementType> > list )
3391 using blaze::assign;
3393 if( list.size() !=
rows() ) {
3397 const InitializerMatrix<ElementType> tmp( list,
columns() );
3399 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3403 decltype(
auto) left( derestrict( *this ) );
3406 assign( left, tmp );
3429 template< typename MT
3432 inline Submatrix<MT,AF,true,false,CSAs...>&
3433 Submatrix<MT,AF,true,false,CSAs...>::operator=( const Submatrix& rhs )
3435 using blaze::assign;
3440 if(
this == &rhs || ( &matrix_ == &rhs.matrix_ &&
row() == rhs.row() &&
column() == rhs.column() ) )
3443 if(
rows() != rhs.rows() ||
columns() != rhs.columns() ) {
3447 if( !tryAssign( matrix_, rhs,
row(),
column() ) ) {
3451 decltype(
auto) left( derestrict( *this ) );
3453 if( rhs.canAlias( &matrix_ ) ) {
3456 assign( left, tmp );
3460 assign( left, rhs );
3486 template<
typename MT
3489 template<
typename MT2
3491 inline Submatrix<MT,AF,
true,
false,CSAs...>&
3492 Submatrix<MT,AF,true,false,CSAs...>::operator=(
const Matrix<MT2,SO>& rhs )
3494 using blaze::assign;
3502 using Right = CompositeType_t<MT2>;
3503 Right right( ~rhs );
3505 if( !tryAssign( matrix_, right,
row(),
column() ) ) {
3509 decltype(
auto) left( derestrict( *this ) );
3512 const ResultType_t<MT2> tmp( right );
3514 assign( left, tmp );
3518 assign( left, right );
3543 template<
typename MT
3546 template<
typename MT2
3548 inline Submatrix<MT,AF,
true,
false,CSAs...>&
3551 using blaze::assign;
3557 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
3565 const AddType tmp( *
this + (~rhs) );
3567 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3571 decltype(
auto) left( derestrict( *this ) );
3574 assign( left, tmp );
3598 template< typename MT
3601 template< typename MT2
3603 inline Submatrix<MT,AF,true,false,CSAs...>&
3604 Submatrix<MT,AF,true,false,CSAs...>::operator-=( const Matrix<MT2,SO>& rhs )
3606 using blaze::assign;
3612 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
3620 const SubType tmp( *
this - (~rhs) );
3622 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3626 decltype(
auto) left( derestrict( *this ) );
3629 assign( left, tmp );
3653 template< typename MT
3656 template< typename MT2
3658 inline Submatrix<MT,AF,true,false,CSAs...>&
3659 Submatrix<MT,AF,true,false,CSAs...>::operator%=( const Matrix<MT2,SO>& rhs )
3661 using blaze::assign;
3667 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
3675 const SchurType tmp( *
this % (~rhs) );
3677 if( !tryAssign( matrix_, tmp,
row(),
column() ) ) {
3681 decltype(
auto) left( derestrict( *this ) );
3684 assign( left, tmp );
3708 template< typename MT
3711 inline MT& Submatrix<MT,AF,true,false,CSAs...>::operand() noexcept
3725 template<
typename MT
3728 inline const MT& Submatrix<MT,AF,true,false,CSAs...>::operand() const noexcept
3742 template<
typename MT
3747 return nonZeros() + matrix_.capacity() - matrix_.nonZeros();
3760 template<
typename MT
3778 template<
typename MT
3783 size_t nonzeros( 0UL );
3785 for(
size_t i=0UL; i<
columns(); ++i )
3801 template<
typename MT
3819 template<
typename MT
3826 const size_t ibegin( ( IsLower_v<MT> )
3827 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3831 const size_t iend ( ( IsUpper_v<MT> )
3832 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3837 matrix_.erase( j, matrix_.lowerBound( ibegin, j ), matrix_.lowerBound( iend, j ) );
3851 template<
typename MT
3858 const size_t index(
column() + j );
3860 const size_t ibegin( ( IsLower_v<MT> )
3861 ?( ( IsUniLower_v<MT> || IsStrictlyLower_v<MT> )
3865 const size_t iend ( ( IsUpper_v<MT> )
3866 ?( ( IsUniUpper_v<MT> || IsStrictlyUpper_v<MT> )
3871 matrix_.erase( index, matrix_.lowerBound( ibegin, index ), matrix_.lowerBound( iend, index ) );
3888 template<
typename MT
3891 inline void Submatrix<MT,AF,true,false,CSAs...>::reserve(
size_t nonzeros )
3893 const size_t current(
capacity() );
3895 if( nonzeros > current ) {
3896 matrix_.reserve( matrix_.capacity() + nonzeros - current );
3915 template<
typename MT
3918 void Submatrix<MT,AF,true,false,CSAs...>::reserve(
size_t j,
size_t nonzeros )
3920 const size_t current(
capacity( j ) );
3921 const size_t index (
column() + j );
3923 if( nonzeros > current ) {
3924 matrix_.reserve( index, matrix_.capacity( index ) + nonzeros - current );
3941 template<
typename MT
3944 void Submatrix<MT,AF,true,false,CSAs...>::trim()
3946 for(
size_t j=0UL; j<
columns(); ++j )
3964 template<
typename MT
3967 void Submatrix<MT,AF,true,false,CSAs...>::trim(
size_t j )
3970 matrix_.trim(
column() + j );
3986 template<
typename MT
3989 inline bool Submatrix<MT,AF,true,false,CSAs...>::hasOverlap() const noexcept
4022 template<
typename MT
4025 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4048 template<
typename MT
4051 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4052 Submatrix<MT,AF,true,false,CSAs...>::insert(
size_t i,
size_t j,
const ElementType& value )
4104 template<
typename MT
4107 inline void Submatrix<MT,AF,true,false,CSAs...>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
4109 if(
row() +
rows() == matrix_.rows() ) {
4110 matrix_.append(
row() + i,
column() + j, value, check );
4112 else if( !check || !isDefault<strict>( value ) ) {
4113 matrix_.insert(
row() + i,
column() + j, value );
4134 template<
typename MT
4137 inline void Submatrix<MT,AF,true,false,CSAs...>::finalize(
size_t j )
4139 matrix_.trim(
column() + j );
4163 template<
typename MT
4166 inline void Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t i,
size_t j )
4171 matrix_.erase(
row() + i,
column() + j );
4187 template<
typename MT
4190 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4191 Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t j,
Iterator pos )
4211 template<
typename MT
4214 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4215 Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t j,
Iterator first,
Iterator last )
4218 return Iterator( matrix_.erase(
column()+j, first.base(), last.base() ),
row() );
4247 template<
typename MT
4250 template<
typename Pred >
4251 inline void Submatrix<MT,AF,true,false,CSAs...>::erase( Pred predicate )
4253 for(
size_t j=0UL; j<
columns(); ++j ) {
4254 matrix_.erase(
column()+j,
begin(j).base(),
end(j).base(), predicate );
4287 template<
typename MT
4290 template<
typename Pred >
4291 inline void Submatrix<MT,AF,true,false,CSAs...>::erase(
size_t j,
Iterator first,
Iterator last, Pred predicate )
4294 matrix_.erase(
column()+j, first.base(), last.base(), predicate );
4324 template<
typename MT
4327 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4328 Submatrix<MT,AF,true,false,CSAs...>::find(
size_t i,
size_t j )
4330 const Iterator_t<MT> pos( matrix_.find(
row() + i,
column() + j ) );
4332 if( pos != matrix_.end(
column() + j ) )
4357 template<
typename MT
4361 Submatrix<MT,AF,true,false,CSAs...>::find(
size_t i,
size_t j )
const 4363 const ConstIterator_t<MT> pos( matrix_.find(
row() + i,
column() + j ) );
4365 if( pos != matrix_.end(
column() + j ) )
4390 template<
typename MT
4393 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4394 Submatrix<MT,AF,true,false,CSAs...>::lowerBound(
size_t i,
size_t j )
4418 template<
typename MT
4422 Submatrix<MT,AF,true,false,CSAs...>::lowerBound(
size_t i,
size_t j )
const 4446 template<
typename MT
4449 inline typename Submatrix<MT,AF,
true,
false,CSAs...>
::Iterator 4450 Submatrix<MT,AF,true,false,CSAs...>::upperBound(
size_t i,
size_t j )
4474 template<
typename MT
4478 Submatrix<MT,AF,true,false,CSAs...>::upperBound(
size_t i,
size_t j )
const 4512 template<
typename MT
4515 inline Submatrix<MT,AF,
true,
false,CSAs...>&
4518 using blaze::assign;
4528 decltype(
auto) left( derestrict( *this ) );
4532 assign( left, tmp );
4558 template< typename MT
4561 inline Submatrix<MT,AF,true,false,CSAs...>&
4562 Submatrix<MT,AF,true,false,CSAs...>::
ctranspose()
4564 using blaze::assign;
4574 decltype(
auto) left( derestrict( *this ) );
4578 assign( left, tmp );
4599 template< typename MT
4602 template< typename Other >
4603 inline Submatrix<MT,AF,true,false,CSAs...>&
4604 Submatrix<MT,AF,true,false,CSAs...>::scale( const Other& scalar )
4608 for(
size_t i=0UL; i<
columns(); ++i ) {
4611 element->value() *= scalar;
4639 template<
typename MT
4642 template<
typename Other >
4643 inline bool Submatrix<MT,AF,true,false,CSAs...>::canAlias(
const Other* alias )
const noexcept
4645 return matrix_.isAliased( alias );
4662 template<
typename MT
4665 template<
typename Other >
4666 inline bool Submatrix<MT,AF,true,false,CSAs...>::isAliased(
const Other* alias )
const noexcept
4668 return matrix_.isAliased( alias );
4685 template<
typename MT
4688 inline bool Submatrix<MT,AF,true,false,CSAs...>::canSMPAssign() const noexcept
4708 template<
typename MT
4711 template<
typename MT2
4713 inline void Submatrix<MT,AF,true,false,CSAs...>::assign(
const DenseMatrix<MT2,SO>& rhs )
4720 for(
size_t j=0UL; j<
columns(); ++j ) {
4721 for(
size_t i=0UL; i<
rows(); ++i ) {
4722 if( IsSymmetric_v<MT> || IsHermitian_v<MT> ) {
4724 if( !isDefault<strict>( value ) )
4728 append( i, j, (~rhs)(i,j),
true );
4750 template<
typename MT
4753 template<
typename MT2 >
4754 inline void Submatrix<MT,AF,true,false,CSAs...>::assign(
const SparseMatrix<MT2,true>& rhs )
4761 for(
size_t j=0UL; j<(~rhs).
columns(); ++j ) {
4762 for( ConstIterator_t<MT2> element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element ) {
4763 if( IsSymmetric_v<MT> || IsHermitian_v<MT> ) {
4765 if( !isDefault<strict>( value ) )
4766 set( element->index(), j, value );
4769 append( element->index(), j, element->value(), true );
4790 template<
typename MT
4793 template<
typename MT2 >
4794 inline void Submatrix<MT,AF,true,false,CSAs...>::assign(
const SparseMatrix<MT2,false>& rhs )
4802 std::vector<size_t> columnLengths(
columns(), 0UL );
4803 for(
size_t i=0UL; i<
rows(); ++i ) {
4804 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
4805 ++columnLengths[element->index()];
4809 for(
size_t j=0UL; j<
columns(); ++j ) {
4810 reserve( j, columnLengths[j] );
4814 for(
size_t i=0UL; i<
rows(); ++i ) {
4815 for(
auto element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
4816 if( IsSymmetric_v<MT> || IsHermitian_v<MT> ) {
4818 if( !isDefault<strict>( value ) )
4819 set( i, element->index(), value );
4822 append( i, element->index(), element->value(), true );
4842 template<
typename MT
4845 template<
typename MT2
4847 inline void Submatrix<MT,AF,true,false,CSAs...>::addAssign(
const Matrix<MT2,SO>& rhs )
4849 using AddType = AddTrait_t< ResultType, ResultType_t<MT2> >;
4856 const AddType tmp(
serial( *
this + (~rhs) ) );
4876 template<
typename MT
4879 template<
typename MT2
4881 inline void Submatrix<MT,AF,true,false,CSAs...>::subAssign(
const Matrix<MT2,SO>& rhs )
4883 using SubType = SubTrait_t< ResultType, ResultType_t<MT2> >;
4890 const SubType tmp(
serial( *
this - (~rhs) ) );
4910 template<
typename MT
4913 template<
typename MT2
4915 inline void Submatrix<MT,AF,true,false,CSAs...>::schurAssign(
const Matrix<MT2,SO>& rhs )
4917 using SchurType = SchurTrait_t< ResultType, ResultType_t<MT2> >;
4924 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:133
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:3078
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
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the alignment flag values.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr 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:750
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:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
#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
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
#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:3084
constexpr bool IsReference_v
Auxiliary variable template for the IsReference type trait.The IsReference_v variable template provid...
Definition: IsReference.h:95
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
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.
Header file for the IsUniLower type trait.
typename SubmatrixTrait< MT, CSAs... >::Type SubmatrixTrait_t
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_t alias declaration ...
Definition: SubmatrixTrait.h:171
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
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 IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
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:1364
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:3076
#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:3080
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
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:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsLower type trait.
Header file for the SparseElement base class.
Constraint on the data type.
Header file for the exception macros of the math module.
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179
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:438
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:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Constraint on the data type.
#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:133
#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.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
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:808
#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.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
#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.
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.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825