35 #ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_SPARSE_H_ 36 #define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_SPARSE_H_ 107 template<
typename MT
109 class HermitianMatrix<MT,SO,false>
110 :
public SparseMatrix< HermitianMatrix<MT,SO,false>, SO >
114 using OT = OppositeType_<MT>;
115 using TT = TransposeType_<MT>;
116 using ET = ElementType_<MT>;
121 using This = HermitianMatrix<MT,SO,false>;
122 using BaseType = SparseMatrix<This,SO>;
137 template<
typename NewType >
140 using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
147 template<
size_t NewM
151 using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
162 using IteratorType = Iterator_<MT>;
164 using IteratorCategory = std::forward_iterator_tag;
165 using ValueType = HermitianElement<MT>;
166 using PointerType = ValueType;
167 using ReferenceType = ValueType;
168 using DifferenceType = ptrdiff_t;
171 using iterator_category = IteratorCategory;
172 using value_type = ValueType;
173 using pointer = PointerType;
174 using reference = ReferenceType;
175 using difference_type = DifferenceType;
195 inline Iterator( IteratorType pos, MT& matrix,
size_t index )
218 inline const Iterator operator++(
int ) {
231 return ReferenceType( pos_, matrix_, index_ );
240 inline PointerType operator->()
const {
241 return PointerType( pos_, matrix_, index_ );
262 return pos_ == rhs.pos_;
273 return !( *
this == rhs );
284 return pos_ - rhs.pos_;
293 inline IteratorType base()
const {
309 enum :
bool { smpAssignable =
false };
315 explicit inline HermitianMatrix();
316 explicit inline HermitianMatrix(
size_t n );
317 explicit inline HermitianMatrix(
size_t n,
size_t nonzeros );
318 explicit inline HermitianMatrix(
size_t n,
const std::vector<size_t>& nonzeros );
319 explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
321 inline HermitianMatrix(
const HermitianMatrix& m );
322 inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
324 template<
typename MT2,
bool SO2 >
325 inline HermitianMatrix(
const Matrix<MT2,SO2>& m );
336 inline Reference operator()(
size_t i,
size_t j );
338 inline Reference at(
size_t i,
size_t j );
352 inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
354 inline HermitianMatrix& operator=(
const HermitianMatrix& rhs );
355 inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
357 template<
typename MT2,
bool SO2 >
358 inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator=(
const Matrix<MT2,SO2>& rhs );
360 template<
typename MT2,
bool SO2 >
361 inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator=(
const Matrix<MT2,SO2>& rhs );
363 template<
typename MT2 >
364 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
365 operator=(
const Matrix<MT2,!SO>& rhs );
367 template<
typename MT2,
bool SO2 >
368 inline DisableIf_< IsComputation<MT2>, HermitianMatrix& >
operator+=(
const Matrix<MT2,SO2>& rhs );
370 template<
typename MT2,
bool SO2 >
371 inline EnableIf_< IsComputation<MT2>, HermitianMatrix& >
operator+=(
const Matrix<MT2,SO2>& rhs );
373 template<
typename MT2 >
374 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
377 template<
typename MT2,
bool SO2 >
378 inline DisableIf_< IsComputation<MT2>, HermitianMatrix& >
operator-=(
const Matrix<MT2,SO2>& rhs );
380 template<
typename MT2,
bool SO2 >
381 inline EnableIf_< IsComputation<MT2>, HermitianMatrix& >
operator-=(
const Matrix<MT2,SO2>& rhs );
383 template<
typename MT2 >
384 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
387 template<
typename MT2,
bool SO2 >
388 inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator%=(
const Matrix<MT2,SO2>& rhs );
390 template<
typename MT2,
bool SO2 >
391 inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator%=(
const Matrix<MT2,SO2>& rhs );
393 template<
typename MT2 >
394 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
395 operator%=(
const Matrix<MT2,!SO>& rhs );
397 template<
typename ST >
398 inline EnableIf_< IsNumeric<ST>, HermitianMatrix >&
operator*=( ST rhs );
400 template<
typename ST >
401 inline EnableIf_< IsNumeric<ST>, HermitianMatrix >&
operator/=( ST rhs );
408 inline size_t rows() const noexcept;
409 inline
size_t columns() const noexcept;
410 inline
size_t capacity() const noexcept;
411 inline
size_t capacity(
size_t i ) const noexcept;
413 inline
size_t nonZeros(
size_t i ) const;
415 inline
void reset(
size_t i );
417 inline
void resize (
size_t n,
bool preserve=true );
418 inline
void reserve(
size_t nonzeros );
419 inline
void reserve(
size_t i,
size_t nonzeros );
421 inline
void trim(
size_t i );
423 inline
void swap( HermitianMatrix& m ) noexcept;
432 inline
void append (
size_t i,
size_t j, const
ElementType& value,
bool check=false );
433 inline
void finalize(
size_t i );
440 inline
void erase(
size_t i,
size_t j );
444 template< typename Pred >
445 inline
void erase( Pred predicate );
447 template< typename Pred >
448 inline
void erase(
size_t i,
Iterator first,
Iterator last, Pred predicate );
455 inline
Iterator find (
size_t i,
size_t j );
457 inline
Iterator lowerBound(
size_t i,
size_t j );
459 inline
Iterator upperBound(
size_t i,
size_t j );
470 template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
477 inline
bool isIntact() const noexcept;
484 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
485 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
487 inline
bool canSMPAssign() const noexcept;
495 template< typename MT2,
bool SO2, typename T >
496 inline const MT2& construct( const Matrix<MT2,SO2>& m, T );
498 template< typename MT2 >
511 template<
bool RF, typename MT2,
bool SO2,
bool DF2 >
512 friend
bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
548 template< typename MT
550 inline HermitianMatrix<MT,SO,false>::HermitianMatrix()
567 template<
typename MT
569 inline HermitianMatrix<MT,SO,false>::HermitianMatrix(
size_t n )
589 template<
typename MT
591 inline HermitianMatrix<MT,SO,false>::HermitianMatrix(
size_t n,
size_t nonzeros )
592 : matrix_( n, n, nonzeros )
613 template<
typename MT
615 inline HermitianMatrix<MT,SO,false>::HermitianMatrix(
size_t n,
const std::vector<size_t>& nonzeros )
616 : matrix_( n, n, nonzeros )
653 template<
typename MT
655 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
674 template<
typename MT
676 inline HermitianMatrix<MT,SO,false>::HermitianMatrix(
const HermitianMatrix& m )
677 : matrix_( m.matrix_ )
692 template<
typename MT
694 inline HermitianMatrix<MT,SO,false>::HermitianMatrix( HermitianMatrix&& m ) noexcept
695 : matrix_( std::move( m.matrix_ ) )
714 template<
typename MT
716 template<
typename MT2
718 inline HermitianMatrix<MT,SO,false>::HermitianMatrix(
const Matrix<MT2,SO2>& m )
719 : matrix_( construct( m, typename IsBuiltin<
ElementType_<MT2> >::Type() ) )
721 if( !IsHermitian<MT2>::value && !
isHermitian( matrix_ ) ) {
753 template<
typename MT
756 HermitianMatrix<MT,SO,false>::operator()(
size_t i,
size_t j )
783 template<
typename MT
786 HermitianMatrix<MT,SO,false>::operator()(
size_t i,
size_t j )
const 814 template<
typename MT
817 HermitianMatrix<MT,SO,false>::at(
size_t i,
size_t j )
848 template<
typename MT
851 HermitianMatrix<MT,SO,false>::at(
size_t i,
size_t j )
const 877 template<
typename MT
882 return Iterator( matrix_.begin(i), matrix_, i );
900 template<
typename MT
905 return matrix_.begin(i);
923 template<
typename MT
928 return matrix_.cbegin(i);
946 template<
typename MT
951 return Iterator( matrix_.end(i), matrix_, i );
969 template<
typename MT
974 return matrix_.end(i);
992 template<
typename MT
997 return matrix_.cend(i);
1038 template<
typename MT
1040 inline HermitianMatrix<MT,SO,false>&
1041 HermitianMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
1043 const InitializerMatrix<ElementType> tmp( list, list.size() );
1070 template<
typename MT
1072 inline HermitianMatrix<MT,SO,false>&
1073 HermitianMatrix<MT,SO,false>::operator=(
const HermitianMatrix& rhs )
1075 matrix_ = rhs.matrix_;
1093 template<
typename MT
1095 inline HermitianMatrix<MT,SO,false>&
1096 HermitianMatrix<MT,SO,false>::operator=( HermitianMatrix&& rhs ) noexcept
1098 matrix_ = std::move( rhs.matrix_ );
1122 template<
typename MT
1124 template<
typename MT2
1126 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1127 HermitianMatrix<MT,SO,false>::operator=(
const Matrix<MT2,SO2>& rhs )
1129 if( !IsHermitian<MT2>::value && !
isHermitian( ~rhs ) ) {
1157 template<
typename MT
1159 template<
typename MT2
1161 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1162 HermitianMatrix<MT,SO,false>::operator=(
const Matrix<MT2,SO2>& rhs )
1164 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1168 if( IsHermitian<MT2>::value ) {
1178 matrix_ = std::move( tmp );
1203 template<
typename MT
1205 template<
typename MT2 >
1206 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,false>& >
1207 HermitianMatrix<MT,SO,false>::operator=(
const Matrix<MT2,!SO>& rhs )
1209 return this->operator=(
trans( ~rhs ) );
1228 template<
typename MT
1230 template<
typename MT2
1232 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1235 if( !IsHermitian<MT2>::value && !
isHermitian( ~rhs ) ) {
1263 template<
typename MT
1265 template<
typename MT2
1267 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1270 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1274 if( IsHermitian<MT2>::value ) {
1278 const ResultType_<MT2> tmp( ~rhs );
1310 template<
typename MT
1312 template<
typename MT2 >
1313 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,false>& >
1335 template<
typename MT
1337 template<
typename MT2
1339 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1342 if( !IsHermitian<MT2>::value && !
isHermitian( ~rhs ) ) {
1370 template<
typename MT
1372 template<
typename MT2
1374 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1377 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1381 if( IsHermitian<MT2>::value ) {
1385 const ResultType_<MT2> tmp( ~rhs );
1417 template<
typename MT
1419 template<
typename MT2 >
1420 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,false>& >
1443 template<
typename MT
1445 template<
typename MT2
1447 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1448 HermitianMatrix<MT,SO,false>::operator%=(
const Matrix<MT2,SO2>& rhs )
1450 if( !IsHermitian<MT2>::value && !
isHermitian( ~rhs ) ) {
1479 template<
typename MT
1481 template<
typename MT2
1483 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,false>& >
1484 HermitianMatrix<MT,SO,false>::operator%=(
const Matrix<MT2,SO2>& rhs )
1486 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1490 if( IsHermitian<MT2>::value ) {
1494 const ResultType_<MT2> tmp( ~rhs );
1526 template<
typename MT
1528 template<
typename MT2 >
1529 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,false>& >
1530 HermitianMatrix<MT,SO,false>::operator%=(
const Matrix<MT2,!SO>& rhs )
1532 return this->operator%=(
trans( ~rhs ) );
1546 template<
typename MT
1548 template<
typename ST >
1549 inline EnableIf_< IsNumeric<ST>, HermitianMatrix<MT,SO,false> >&
1566 template<
typename MT
1568 template<
typename ST >
1569 inline EnableIf_< IsNumeric<ST>, HermitianMatrix<MT,SO,false> >&
1595 template<
typename MT
1599 return matrix_.rows();
1611 template<
typename MT
1615 return matrix_.columns();
1627 template<
typename MT
1631 return matrix_.capacity();
1648 template<
typename MT
1652 return matrix_.capacity(i);
1664 template<
typename MT
1668 return matrix_.nonZeros();
1686 template<
typename MT
1690 return matrix_.nonZeros(i);
1702 template<
typename MT
1748 template<
typename MT
1752 for( Iterator_<MT> it=matrix_.begin(i); it!=matrix_.end(i); ++it )
1754 const size_t j( it->index() );
1760 const Iterator_<MT> pos( matrix_.find( i, j ) );
1762 matrix_.erase( j, pos );
1765 const Iterator_<MT> pos( matrix_.find( j, i ) );
1767 matrix_.erase( j, pos );
1785 template<
typename MT
1812 template<
typename MT
1822 matrix_.resize( n, n,
true );
1839 template<
typename MT
1841 inline void HermitianMatrix<MT,SO,false>::reserve(
size_t nonzeros )
1843 matrix_.reserve( nonzeros );
1863 template<
typename MT
1865 inline void HermitianMatrix<MT,SO,false>::reserve(
size_t i,
size_t nonzeros )
1867 matrix_.reserve( i, nonzeros );
1884 template<
typename MT
1886 inline void HermitianMatrix<MT,SO,false>::trim()
1906 template<
typename MT
1908 inline void HermitianMatrix<MT,SO,false>::trim(
size_t i )
1926 template<
typename MT
1930 matrix_.shrinkToFit();
1943 template<
typename MT
1949 swap( matrix_, m.matrix_ );
1978 template<
typename MT
1990 matrix_.set( j, i,
conj( value ) );
1991 return Iterator( matrix_.set( i, j, value ), matrix_, ( SO ? j : i ) );
2013 template<
typename MT
2016 HermitianMatrix<MT,SO,false>::insert(
size_t i,
size_t j,
const ElementType& value )
2025 matrix_.insert( j, i,
conj( value ) );
2026 return Iterator( matrix_.insert( i, j, value ), matrix_, ( SO ? j : i ) );
2091 template<
typename MT
2093 inline void HermitianMatrix<MT,SO,false>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
2101 matrix_.append( i, j, value, check );
2102 if( !
isDiagonal && ( !check || !isDefault<strict>( value ) ) )
2103 matrix_.insert( j, i,
conj( value ) );
2123 template<
typename MT
2125 inline void HermitianMatrix<MT,SO,false>::finalize(
size_t i )
2151 template<
typename MT
2153 inline void HermitianMatrix<MT,SO,false>::erase(
size_t i,
size_t j )
2155 matrix_.erase( i, j );
2157 matrix_.erase( j, i );
2175 template<
typename MT
2178 HermitianMatrix<MT,SO,false>::erase(
size_t i,
Iterator pos )
2180 const Iterator_<MT> base( pos.base() );
2182 if( base == matrix_.end( i ) )
2185 const size_t j( base->index() );
2189 return Iterator( matrix_.erase( i, base ), matrix_, i );
2194 matrix_.erase( j, matrix_.find( i, j ) );
2195 return Iterator( matrix_.erase( i, base ), matrix_, i );
2199 matrix_.erase( j, matrix_.find( j, i ) );
2200 return Iterator( matrix_.erase( i, base ), matrix_, i );
2221 template<
typename MT
2224 HermitianMatrix<MT,SO,false>::erase(
size_t i,
Iterator first,
Iterator last )
2226 for( Iterator_<MT> it=first.base(); it!=last.base(); ++it )
2228 const size_t j( it->index() );
2235 matrix_.erase( i, j );
2239 matrix_.erase( j, i );
2243 return Iterator( matrix_.erase( i, first.base(), last.base() ), matrix_, i );
2271 template<
typename MT
2273 template<
typename Pred >
2274 inline void HermitianMatrix<MT,SO,false>::erase( Pred predicate )
2276 matrix_.erase( [predicate=predicate](
const ElementType& value ) {
2277 return predicate( value ) || predicate(
conj( value ) );
2314 template<
typename MT
2316 template<
typename Pred >
2318 HermitianMatrix<MT,SO,false>::erase(
size_t i,
Iterator first,
Iterator last, Pred predicate )
2320 for(
Iterator it=first; it!=last; ++it ) {
2321 const size_t j( it->index() );
2322 if( i != j && predicate( it->value() ) ) {
2324 matrix_.erase( i, j );
2326 matrix_.erase( j, i );
2330 matrix_.erase( i, first.base(), last.base(), predicate );
2362 template<
typename MT
2365 HermitianMatrix<MT,SO,false>::find(
size_t i,
size_t j )
2367 return Iterator( matrix_.find( i, j ), matrix_, ( SO ? j : i ) );
2389 template<
typename MT
2392 HermitianMatrix<MT,SO,false>::find(
size_t i,
size_t j )
const 2394 return matrix_.find( i, j );
2416 template<
typename MT
2419 HermitianMatrix<MT,SO,false>::lowerBound(
size_t i,
size_t j )
2421 return Iterator( matrix_.lowerBound( i, j ), matrix_, ( SO ? j : i ) );
2443 template<
typename MT
2446 HermitianMatrix<MT,SO,false>::lowerBound(
size_t i,
size_t j )
const 2448 return matrix_.lowerBound( i, j );
2470 template<
typename MT
2473 HermitianMatrix<MT,SO,false>::upperBound(
size_t i,
size_t j )
2475 return Iterator( matrix_.upperBound( i, j ), matrix_, ( SO ? j : i ) );
2497 template<
typename MT
2500 HermitianMatrix<MT,SO,false>::upperBound(
size_t i,
size_t j )
const 2502 return matrix_.upperBound( i, j );
2522 template<
typename MT
2526 if( IsComplex<ElementType>::value )
2527 matrix_.transpose();
2540 template<
typename MT
2568 template<
typename MT
2570 template<
typename Other >
2571 inline HermitianMatrix<MT,SO,false>&
2572 HermitianMatrix<MT,SO,false>::scale(
const Other& scalar )
2574 matrix_.scale( scalar );
2599 template<
typename MT
2630 template<
typename MT
2632 template<
typename Other >
2633 inline bool HermitianMatrix<MT,SO,false>::canAlias(
const Other* alias )
const noexcept
2635 return matrix_.canAlias( alias );
2652 template<
typename MT
2654 template<
typename Other >
2655 inline bool HermitianMatrix<MT,SO,false>::isAliased(
const Other* alias )
const noexcept
2657 return matrix_.isAliased( alias );
2674 template<
typename MT
2676 inline bool HermitianMatrix<MT,SO,false>::canSMPAssign() const noexcept
2678 return matrix_.canSMPAssign();
2694 template<
typename MT
2696 template<
typename MT2
2699 inline const MT2& HermitianMatrix<MT,SO,false>::construct(
const Matrix<MT2,SO2>& m, T )
2709 template<
typename MT
2711 template<
typename MT2 >
2712 inline TransExprTrait_<MT2>
2713 HermitianMatrix<MT,SO,false>::construct(
const Matrix<MT2,!SO>& m, TrueType )
bool isReal(const DiagonalProxy< MT > &proxy)
Returns whether the matrix element represents a real number.
Definition: DiagonalProxy.h:650
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
#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 UNUSED_PARAMETER function template.
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.
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Constraint on the data type.
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
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:775
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5829
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:827
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:1725
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
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Header file for the extended initializer_list functionality.
Constraint on the data type.
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.
Constraint on the data type.
Header file for the SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:670
Header file for the implementation of a matrix representation of an initializer list.
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:112
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5891
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
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
Header file for the isZero shim.
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
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Constraint on the data type.
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
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:714
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
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
Header file for the implementation of the base template of the HeritianMatrix.
Header file for all forward declarations for expression class templates.
Header file for the HermitianElement class.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
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
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.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#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
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:919
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:272
Header file for the TransExprTrait class template.
Constraint on the data type.
Constraint on the data type.
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
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
Header file for the HermitianProxy class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
Header file for the IsComplex type trait.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
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
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
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.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
Header file for the Size type trait.
Header file for the isReal shim.
#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 TrueType type/value trait base class.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:801