35#ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
36#define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
113class HermitianMatrix<MT,SO,true>
114 :
public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
118 using OT = OppositeType_t<MT>;
119 using TT = TransposeType_t<MT>;
120 using ET = ElementType_t<MT>;
125 using This = HermitianMatrix<MT,SO,true>;
126 using BaseType = DenseMatrix<This,SO>;
127 using ResultType = This;
128 using OppositeType = HermitianMatrix<OT,!SO,true>;
129 using TransposeType = HermitianMatrix<TT,!SO,true>;
130 using ElementType = ET;
131 using SIMDType = SIMDType_t<MT>;
132 using TagType = TagType_t<MT>;
133 using ReturnType = ReturnType_t<MT>;
134 using CompositeType =
const This&;
135 using Reference = HermitianProxy<MT>;
136 using ConstReference = ConstReference_t<MT>;
137 using Pointer = Pointer_t<MT>;
138 using ConstPointer = ConstPointer_t<MT>;
139 using ConstIterator = ConstIterator_t<MT>;
145 template<
typename NewType >
148 using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
155 template<
size_t NewM
159 using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
170 using IteratorCategory = std::random_access_iterator_tag;
171 using ValueType = ElementType_t<MT>;
172 using PointerType = HermitianProxy<MT>;
173 using ReferenceType = HermitianProxy<MT>;
177 using iterator_category = IteratorCategory;
178 using value_type = ValueType;
179 using pointer = PointerType;
180 using reference = ReferenceType;
181 using difference_type = DifferenceType;
187 inline Iterator() noexcept
201 inline Iterator( MT& matrix,
size_t row,
size_t column ) noexcept
214 inline Iterator&
operator+=(
size_t inc )
noexcept {
215 ( SO )?( row_ += inc ):( column_ += inc );
226 inline Iterator&
operator-=(
size_t dec )
noexcept {
227 ( SO )?( row_ -= dec ):( column_ -= dec );
237 inline Iterator& operator++() noexcept {
238 ( SO )?( ++row_ ):( ++column_ );
248 inline const Iterator operator++(
int )
noexcept {
249 const Iterator tmp( *
this );
260 inline Iterator& operator--() noexcept {
261 ( SO )?( --row_ ):( --column_ );
271 inline const Iterator operator--(
int )
noexcept {
272 const Iterator tmp( *
this );
284 return ReferenceType( *matrix_, row_, column_ );
293 inline PointerType operator->()
const {
294 return PointerType( *matrix_, row_, column_ );
308 inline SIMDType load()
const {
309 return (*matrix_).load(row_,column_);
323 inline SIMDType
loada()
const {
324 return (*matrix_).loada(row_,column_);
338 inline SIMDType
loadu()
const {
339 return (*matrix_).loadu(row_,column_);
354 inline void store(
const SIMDType& value )
const {
355 (*matrix_).store( row_, column_, value );
371 inline void storea(
const SIMDType& value )
const {
372 (*matrix_).storea( row_, column_, value );
388 inline void storeu(
const SIMDType& value )
const {
389 (*matrix_).storeu( row_, column_, value );
405 inline void stream(
const SIMDType& value )
const {
406 (*matrix_).stream( row_, column_, value );
416 inline operator ConstIterator()
const {
418 return matrix_->begin( column_ ) + row_;
420 return matrix_->begin( row_ ) + column_;
431 friend inline bool operator==(
const Iterator& lhs,
const Iterator& rhs )
noexcept {
432 return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
443 friend inline bool operator==(
const Iterator& lhs,
const ConstIterator& rhs ) {
444 return ( ConstIterator( lhs ) == rhs );
455 friend inline bool operator==(
const ConstIterator& lhs,
const Iterator& rhs ) {
456 return ( lhs == ConstIterator( rhs ) );
467 friend inline bool operator!=(
const Iterator& lhs,
const Iterator& rhs )
noexcept {
468 return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
479 friend inline bool operator!=(
const Iterator& lhs,
const ConstIterator& rhs ) {
480 return ( ConstIterator( lhs ) != rhs );
491 friend inline bool operator!=(
const ConstIterator& lhs,
const Iterator& rhs ) {
492 return ( lhs != ConstIterator( rhs ) );
503 friend inline bool operator<(
const Iterator& lhs,
const Iterator& rhs )
noexcept {
504 return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
515 friend inline bool operator<(
const Iterator& lhs,
const ConstIterator& rhs ) {
516 return ( ConstIterator( lhs ) < rhs );
527 friend inline bool operator<(
const ConstIterator& lhs,
const Iterator& rhs ) {
528 return ( lhs < ConstIterator( rhs ) );
539 friend inline bool operator>(
const Iterator& lhs,
const Iterator& rhs )
noexcept {
540 return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
551 friend inline bool operator>(
const Iterator& lhs,
const ConstIterator& rhs ) {
552 return ( ConstIterator( lhs ) > rhs );
563 friend inline bool operator>(
const ConstIterator& lhs,
const Iterator& rhs ) {
564 return ( lhs > ConstIterator( rhs ) );
575 friend inline bool operator<=(
const Iterator& lhs,
const Iterator& rhs )
noexcept {
576 return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
587 friend inline bool operator<=(
const Iterator& lhs,
const ConstIterator& rhs ) {
588 return ( ConstIterator( lhs ) <= rhs );
599 friend inline bool operator<=(
const ConstIterator& lhs,
const Iterator& rhs ) {
600 return ( lhs <= ConstIterator( rhs ) );
611 friend inline bool operator>=(
const Iterator& lhs,
const Iterator& rhs )
noexcept {
612 return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
623 friend inline bool operator>=(
const Iterator& lhs,
const ConstIterator& rhs ) {
624 return ( ConstIterator( lhs ) >= rhs );
635 friend inline bool operator>=(
const ConstIterator& lhs,
const Iterator& rhs ) {
636 return ( lhs >= ConstIterator( rhs ) );
646 inline DifferenceType
operator-(
const Iterator& rhs )
const noexcept {
647 return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
658 friend inline const Iterator
operator+(
const Iterator& it,
size_t inc )
noexcept {
660 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
662 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
673 friend inline const Iterator
operator+(
size_t inc,
const Iterator& it )
noexcept {
675 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
677 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
688 friend inline const Iterator
operator-(
const Iterator& it,
size_t dec )
noexcept {
690 return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
692 return Iterator( *it.matrix_, it.row_, it.column_ - dec );
704 const size_t kend(
min( row_+SIMDSIZE, (*matrix_).rows() ) );
705 for(
size_t k=row_; k<kend; ++k )
706 (*matrix_)(column_,k) =
conj( (*matrix_)(k,column_) );
709 const size_t kend(
min( column_+SIMDSIZE, (*matrix_).columns() ) );
710 for(
size_t k=column_; k<kend; ++k )
711 (*matrix_)(k,row_) =
conj( (*matrix_)(row_,k) );
726 static constexpr bool simdEnabled = MT::simdEnabled;
729 static constexpr bool smpAssignable = MT::smpAssignable;
735 inline HermitianMatrix();
736 explicit inline HermitianMatrix(
size_t n );
739 template<
typename Other >
740 inline HermitianMatrix(
size_t n,
const Other* array );
742 template<
typename Other,
size_t N >
743 inline HermitianMatrix(
const Other (&array)[N][N] );
745 inline HermitianMatrix( ElementType* ptr,
size_t n );
746 inline HermitianMatrix( ElementType* ptr,
size_t n,
size_t nn );
748 inline HermitianMatrix(
const HermitianMatrix& m );
749 inline HermitianMatrix( HermitianMatrix&& m )
noexcept;
751 template<
typename MT2,
bool SO2 >
752 inline HermitianMatrix(
const Matrix<MT2,SO2>& m );
759 ~HermitianMatrix() =
default;
766 inline Reference operator()(
size_t i,
size_t j );
767 inline ConstReference operator()(
size_t i,
size_t j )
const;
768 inline Reference at(
size_t i,
size_t j );
769 inline ConstReference at(
size_t i,
size_t j )
const;
770 inline ConstPointer
data () const noexcept;
771 inline ConstPointer
data (
size_t i ) const noexcept;
772 inline Iterator
begin (
size_t i );
773 inline ConstIterator
begin (
size_t i ) const;
774 inline ConstIterator
cbegin(
size_t i ) const;
775 inline Iterator
end (
size_t i );
776 inline ConstIterator
end (
size_t i ) const;
777 inline ConstIterator
cend (
size_t i ) const;
786 template< typename Other,
size_t N >
787 inline HermitianMatrix& operator=( const Other (&array)[N][N] );
789 inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
790 inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
792 template< typename MT2,
bool SO2 >
793 inline auto operator=( const Matrix<MT2,SO2>& rhs )
796 template< typename MT2,
bool SO2 >
797 inline auto operator=( const Matrix<MT2,SO2>& rhs )
800 template< typename MT2 >
801 inline auto operator=( const Matrix<MT2,!SO>& rhs )
804 template< typename MT2,
bool SO2 >
805 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
808 template< typename MT2,
bool SO2 >
809 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
812 template< typename MT2 >
813 inline auto operator+=( const Matrix<MT2,!SO>& rhs )
816 template< typename MT2,
bool SO2 >
817 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
820 template< typename MT2,
bool SO2 >
821 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
824 template< typename MT2 >
825 inline auto operator-=( const Matrix<MT2,!SO>& rhs )
828 template< typename MT2,
bool SO2 >
829 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
832 template< typename MT2,
bool SO2 >
833 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
836 template< typename MT2 >
837 inline auto operator%=( const Matrix<MT2,!SO>& rhs )
840 template< typename ST >
843 template< typename ST >
851 inline
size_t rows() const noexcept;
852 inline
size_t columns() const noexcept;
853 inline
size_t spacing() const noexcept;
854 inline
size_t capacity() const noexcept;
855 inline
size_t capacity(
size_t i ) const noexcept;
857 inline
size_t nonZeros(
size_t i ) const;
859 inline
void reset(
size_t i );
861 void resize (
size_t n,
bool preserve=true );
862 inline
void extend (
size_t n,
bool preserve=true );
863 inline
void reserve(
size_t elements );
865 inline
void swap( HermitianMatrix& m ) noexcept;
875 template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
882 inline
bool isIntact() const noexcept;
889 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
890 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
892 inline
bool isAligned () const noexcept;
893 inline
bool canSMPAssign() const noexcept;
899 inline
void store (
size_t i,
size_t j, const SIMDType& value ) noexcept;
900 inline
void storea(
size_t i,
size_t j, const SIMDType& value ) noexcept;
901 inline
void storeu(
size_t i,
size_t j, const SIMDType& value ) noexcept;
902 inline
void stream(
size_t i,
size_t j, const SIMDType& value ) noexcept;
910 template< typename MT2,
bool SO2, typename T >
911 inline decltype(auto) construct( const Matrix<MT2,SO2>& m, T );
913 template< typename MT2 >
914 inline decltype(auto) construct( const Matrix<MT2,!SO>& m,
TrueType );
920 static constexpr
size_t SIMDSIZE = SIMDTrait<ET>::
size;
932 friend
void invert( HermitianMatrix<MT2,SO2,true>& m );
972inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
990inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
size_t n )
991 : matrix_( n, n, ElementType() )
1029template<
typename MT
1073template<
typename MT
1075template<
typename Other >
1076inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
size_t n,
const Other* array )
1077 : matrix_( n, n, array )
1114template<
typename MT
1116template<
typename Other
1118inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
const Other (&array)[N][N] )
1165template<
typename MT
1167inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr,
size_t n )
1168 : matrix_( ptr, n, n )
1216template<
typename MT
1218inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr,
size_t n,
size_t nn )
1219 : matrix_( ptr, n, n, nn )
1237template<
typename MT
1239inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
const HermitianMatrix& m )
1240 : matrix_( m.matrix_ )
1255template<
typename MT
1257inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1258 : matrix_( std::move( m.matrix_ ) )
1277template<
typename MT
1279template<
typename MT2
1281inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
const Matrix<MT2,SO2>& m )
1282 : matrix_( construct( m, typename IsBuiltin<
ElementType_t<MT2> >::Type() ) )
1284 if( !IsHermitian_v<MT2> && !
isHermitian( matrix_ ) ) {
1318template<
typename MT
1320inline typename HermitianMatrix<MT,SO,true>::Reference
1321 HermitianMatrix<MT,SO,true>::operator()(
size_t i,
size_t j )
1326 return Reference( matrix_, i, j );
1348template<
typename MT
1350inline typename HermitianMatrix<MT,SO,true>::ConstReference
1351 HermitianMatrix<MT,SO,true>::operator()(
size_t i,
size_t j )
const
1356 return matrix_(i,j);
1379template<
typename MT
1381inline typename HermitianMatrix<MT,SO,true>::Reference
1382 HermitianMatrix<MT,SO,true>::at(
size_t i,
size_t j )
1390 return (*
this)(i,j);
1413template<
typename MT
1415inline typename HermitianMatrix<MT,SO,true>::ConstReference
1416 HermitianMatrix<MT,SO,true>::at(
size_t i,
size_t j )
const
1424 return (*
this)(i,j);
1444template<
typename MT
1446inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1449 return matrix_.data();
1466template<
typename MT
1468inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1471 return matrix_.data(i);
1489template<
typename MT
1491inline typename HermitianMatrix<MT,SO,true>::Iterator
1495 return Iterator( matrix_, 0UL, i );
1497 return Iterator( matrix_, i, 0UL );
1515template<
typename MT
1517inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1520 return matrix_.begin(i);
1538template<
typename MT
1540inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1543 return matrix_.cbegin(i);
1561template<
typename MT
1563inline typename HermitianMatrix<MT,SO,true>::Iterator
1567 return Iterator( matrix_,
rows(), i );
1569 return Iterator( matrix_, i,
columns() );
1587template<
typename MT
1589inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1592 return matrix_.end(i);
1610template<
typename MT
1612inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1615 return matrix_.cend(i);
1656template<
typename MT
1658inline HermitianMatrix<MT,SO,true>&
1661 const InitializerMatrix<ElementType> tmp( list, list.size() );
1704template<
typename MT
1706template<
typename Other
1708inline HermitianMatrix<MT,SO,true>&
1709 HermitianMatrix<MT,SO,true>::operator=(
const Other (&array)[N][N] )
1717 matrix_ = std::move( tmp );
1738template<
typename MT
1740inline HermitianMatrix<MT,SO,true>&
1741 HermitianMatrix<MT,SO,true>::operator=(
const HermitianMatrix& rhs )
1743 matrix_ = rhs.matrix_;
1761template<
typename MT
1763inline HermitianMatrix<MT,SO,true>&
1764 HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs )
noexcept
1766 matrix_ = std::move( rhs.matrix_ );
1790template<
typename MT
1792template<
typename MT2
1794inline auto HermitianMatrix<MT,SO,true>::operator=(
const Matrix<MT2,SO2>& rhs )
1795 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1797 if( !IsHermitian_v<MT2> && !
isHermitian( *rhs ) ) {
1825template<
typename MT
1827template<
typename MT2
1829inline auto HermitianMatrix<MT,SO,true>::operator=(
const Matrix<MT2,SO2>& rhs )
1830 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1832 if( !IsSquare_v<MT2> && !
isSquare( *rhs ) ) {
1836 if( IsHermitian_v<MT2> ) {
1846 matrix_ = std::move( tmp );
1871template<
typename MT
1873template<
typename MT2 >
1874inline auto HermitianMatrix<MT,SO,true>::operator=(
const Matrix<MT2,!SO>& rhs )
1875 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1877 return this->operator=(
trans( *rhs ) );
1896template<
typename MT
1898template<
typename MT2
1901 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1903 if( !IsHermitian_v<MT2> && !
isHermitian( *rhs ) ) {
1931template<
typename MT
1933template<
typename MT2
1936 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1938 if( !IsSquare_v<MT2> && !
isSquare( *rhs ) ) {
1942 if( IsHermitian_v<MT2> ) {
1946 const ResultType_t<MT2> tmp( *rhs );
1978template<
typename MT
1980template<
typename MT2 >
1982 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2003template<
typename MT
2005template<
typename MT2
2008 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2010 if( !IsHermitian_v<MT2> && !
isHermitian( *rhs ) ) {
2038template<
typename MT
2040template<
typename MT2
2043 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2045 if( !IsSquare_v<MT2> && !
isSquare( *rhs ) ) {
2049 if( IsHermitian_v<MT2> ) {
2053 const ResultType_t<MT2> tmp( *rhs );
2085template<
typename MT
2087template<
typename MT2 >
2089 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2111template<
typename MT
2113template<
typename MT2
2115inline auto HermitianMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,SO2>& rhs )
2116 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2118 if( !IsHermitian_v<MT2> && !
isHermitian( *rhs ) ) {
2147template<
typename MT
2149template<
typename MT2
2151inline auto HermitianMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,SO2>& rhs )
2152 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2154 if( !IsSquare_v<MT2> && !
isSquare( *rhs ) ) {
2158 if( IsHermitian_v<MT2> ) {
2162 const ResultType_t<MT2> tmp( *rhs );
2194template<
typename MT
2196template<
typename MT2 >
2197inline auto HermitianMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,!SO>& rhs )
2198 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2200 return this->operator%=(
trans( *rhs ) );
2214template<
typename MT
2216template<
typename ST >
2218 -> EnableIf_t< IsScalar_v<ST>, HermitianMatrix& >
2234template<
typename MT
2236template<
typename ST >
2238 -> EnableIf_t< IsScalar_v<ST>, HermitianMatrix& >
2263template<
typename MT
2267 return matrix_.rows();
2279template<
typename MT
2283 return matrix_.columns();
2301template<
typename MT
2305 return matrix_.spacing();
2317template<
typename MT
2321 return matrix_.capacity();
2338template<
typename MT
2342 return matrix_.capacity(i);
2354template<
typename MT
2358 return matrix_.nonZeros();
2376template<
typename MT
2380 return matrix_.nonZeros(i);
2392template<
typename MT
2438template<
typename MT
2461template<
typename MT
2509template<
typename MT
2519 const size_t oldsize( matrix_.rows() );
2521 matrix_.resize( n, n,
true );
2524 const size_t increment( n - oldsize );
2525 submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2526 submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2546template<
typename MT
2548inline void HermitianMatrix<MT,SO,true>::extend(
size_t n,
bool preserve )
2569template<
typename MT
2571inline void HermitianMatrix<MT,SO,true>::reserve(
size_t elements )
2589template<
typename MT
2593 matrix_.shrinkToFit();
2606template<
typename MT
2612 swap( matrix_, m.matrix_ );
2632template<
typename MT
2636 if( IsComplex_v<ElementType> )
2637 matrix_.transpose();
2650template<
typename MT
2678template<
typename MT
2680template<
typename Other >
2681inline HermitianMatrix<MT,SO,true>&
2682 HermitianMatrix<MT,SO,true>::scale(
const Other& scalar )
2684 matrix_.scale( scalar );
2709template<
typename MT
2740template<
typename MT
2742template<
typename Other >
2743inline bool HermitianMatrix<MT,SO,true>::canAlias(
const Other* alias )
const noexcept
2745 return matrix_.canAlias( alias );
2762template<
typename MT
2764template<
typename Other >
2765inline bool HermitianMatrix<MT,SO,true>::isAliased(
const Other* alias )
const noexcept
2767 return matrix_.isAliased( alias );
2783template<
typename MT
2785inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2787 return matrix_.isAligned();
2804template<
typename MT
2806inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2808 return matrix_.canSMPAssign();
2830template<
typename MT
2833 HermitianMatrix<MT,SO,true>::load(
size_t i,
size_t j )
const noexcept
2835 return matrix_.load( i, j );
2857template<
typename MT
2862 return matrix_.loada( i, j );
2884template<
typename MT
2889 return matrix_.loadu( i, j );
2912template<
typename MT
2915 HermitianMatrix<MT,SO,true>::store(
size_t i,
size_t j,
const SIMDType& value )
noexcept
2917 matrix_.store( i, j, value );
2920 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2921 for(
size_t k=i; k<kend; ++k )
2922 matrix_(j,k) =
conj( matrix_(k,j) );
2925 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2926 for(
size_t k=j; k<kend; ++k )
2927 matrix_(k,i) =
conj( matrix_(i,k) );
2951template<
typename MT
2956 matrix_.storea( i, j, value );
2959 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2960 for(
size_t k=i; k<kend; ++k )
2961 matrix_(j,k) =
conj( matrix_(k,j) );
2964 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2965 for(
size_t k=j; k<kend; ++k )
2966 matrix_(k,i) =
conj( matrix_(i,k) );
2990template<
typename MT
2995 matrix_.storeu( i, j, value );
2998 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2999 for(
size_t k=i; k<kend; ++k )
3000 matrix_(j,k) =
conj( matrix_(k,j) );
3003 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
3004 for(
size_t k=j; k<kend; ++k )
3005 matrix_(k,i) =
conj( matrix_(i,k) );
3029template<
typename MT
3034 matrix_.stream( i, j, value );
3037 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
3038 for(
size_t k=i; k<kend; ++k )
3039 matrix_(j,k) =
conj( matrix_(k,j) );
3042 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
3043 for(
size_t k=j; k<kend; ++k )
3044 matrix_(k,i) =
conj( matrix_(i,k) );
3061template<
typename MT
3063template<
typename MT2
3066inline decltype(
auto) HermitianMatrix<MT,SO,true>::construct(
const Matrix<MT2,SO2>& m, T )
3076template<
typename MT
3078template<
typename MT2 >
3079inline decltype(
auto) HermitianMatrix<MT,SO,true>::construct(
const Matrix<MT2,!SO>& m,
TrueType )
Header file for auxiliary alias declarations.
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
Header file for run time assertion macros.
Header file for the blaze::checked and blaze::unchecked instances.
Header file for the conjugate shim.
Constraint on the data type.
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:751
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:719
Header file for the EnableIf class template.
Header file for the HermitianProxy class.
Constraint on the data type.
Header file for the If class template.
Header file for the IntegralConstant class template.
Header file for the dense matrix inversion flags.
Header file for the IsBuiltin type trait.
Header file for the IsComplex type trait.
Header file for the IsComputation type trait class.
Header file for the IsHermitian type trait.
Header file for the IsScalar type trait.
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the MAYBE_UNUSED function template.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for all SIMD functionality.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of the base template of the HeritianMatrix.
Initializer list type of the Blaze library.
Pointer difference type of the Blaze library.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for utility functions for dense matrices.
Header file for the implementation of a matrix representation of an initializer list.
Header file for the DenseMatrix base class.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition: Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition: Const.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:574
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:1339
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1464
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:182
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:386
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:1534
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:510
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:265
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:9640
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:448
bool isZero(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a zero matrix.
Definition: DenseMatrix.h:1819
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:225
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:143
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:693
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.
Definition: View.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Hermitian.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Upper.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: DenseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.
Definition: Resizable.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition: Scalar.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.
Definition: Transformation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.
Definition: Size.h:176
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.
Definition: IsComputation.h:90
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
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
InversionFlag
Inversion flag.
Definition: InversionFlag.h:102
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:446
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
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition: Matrix.h:960
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:628
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:730
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:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:660
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108
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:584
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:1221
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:1195
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:1169
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:181
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr bool IsBuiltin_v
Auxiliary variable template for the IsBuiltin type trait.
Definition: IsBuiltin.h:95
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
constexpr Unchecked unchecked
Global Unchecked instance.
Definition: Check.h:146
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Constraints on the storage order of matrix types.
Header file for all forward declarations for expression class templates.
Header file for the Size type trait.
Header file for the isZero shim.
System settings for the inline keywords.
Header file for basic type definitions.
Header file for the generic min algorithm.
Header file for the implementation of the Column view.
Header file for the implementation of the Row view.
Header file for the implementation of the Submatrix view.