35 #ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_ 36 #define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_ 113 template<
typename MT
115 class HermitianMatrix<MT,SO,true>
116 :
public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
120 using OT = OppositeType_t<MT>;
121 using TT = TransposeType_t<MT>;
122 using ET = ElementType_t<MT>;
127 using This = HermitianMatrix<MT,SO,true>;
128 using BaseType = DenseMatrix<This,SO>;
129 using ResultType = This;
130 using OppositeType = HermitianMatrix<OT,!SO,true>;
131 using TransposeType = HermitianMatrix<TT,!SO,true>;
132 using ElementType = ET;
133 using SIMDType = SIMDType_t<MT>;
134 using ReturnType = ReturnType_t<MT>;
135 using CompositeType =
const This&;
136 using Reference = HermitianProxy<MT>;
137 using ConstReference = ConstReference_t<MT>;
138 using Pointer = Pointer_t<MT>;
139 using ConstPointer = ConstPointer_t<MT>;
140 using ConstIterator = ConstIterator_t<MT>;
146 template<
typename NewType >
149 using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
156 template<
size_t NewM
160 using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
171 using IteratorCategory = std::random_access_iterator_tag;
172 using ValueType = ElementType_t<MT>;
173 using PointerType = HermitianProxy<MT>;
174 using ReferenceType = HermitianProxy<MT>;
175 using DifferenceType = ptrdiff_t;
178 using iterator_category = IteratorCategory;
179 using value_type = ValueType;
180 using pointer = PointerType;
181 using reference = ReferenceType;
182 using difference_type = DifferenceType;
188 inline Iterator() noexcept
202 inline Iterator( MT& matrix,
size_t row,
size_t column ) noexcept
215 inline Iterator&
operator+=(
size_t inc ) noexcept {
216 ( SO )?( row_ += inc ):( column_ += inc );
227 inline Iterator&
operator-=(
size_t dec ) noexcept {
228 ( SO )?( row_ -= dec ):( column_ -= dec );
238 inline Iterator& operator++() noexcept {
239 ( SO )?( ++row_ ):( ++column_ );
249 inline const Iterator operator++(
int ) noexcept {
250 const Iterator tmp( *
this );
261 inline Iterator& operator--() noexcept {
262 ( SO )?( --row_ ):( --column_ );
272 inline const Iterator operator--(
int ) noexcept {
273 const Iterator tmp( *
this );
285 return ReferenceType( *matrix_, row_, column_ );
294 inline PointerType operator->()
const {
295 return PointerType( *matrix_, row_, column_ );
309 inline SIMDType load()
const {
310 return (*matrix_).load(row_,column_);
324 inline SIMDType
loada()
const {
325 return (*matrix_).loada(row_,column_);
339 inline SIMDType
loadu()
const {
340 return (*matrix_).loadu(row_,column_);
355 inline void store(
const SIMDType& value )
const {
356 (*matrix_).store( row_, column_, value );
372 inline void storea(
const SIMDType& value )
const {
373 (*matrix_).storea( row_, column_, value );
389 inline void storeu(
const SIMDType& value )
const {
390 (*matrix_).storeu( row_, column_, value );
406 inline void stream(
const SIMDType& value )
const {
407 (*matrix_).stream( row_, column_, value );
417 inline operator ConstIterator()
const {
419 return matrix_->begin( column_ ) + row_;
421 return matrix_->begin( row_ ) + column_;
432 friend inline bool operator==(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
433 return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
444 friend inline bool operator==(
const Iterator& lhs,
const ConstIterator& rhs ) {
445 return ( ConstIterator( lhs ) == rhs );
456 friend inline bool operator==(
const ConstIterator& lhs,
const Iterator& rhs ) {
457 return ( lhs == ConstIterator( rhs ) );
468 friend inline bool operator!=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
469 return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
480 friend inline bool operator!=(
const Iterator& lhs,
const ConstIterator& rhs ) {
481 return ( ConstIterator( lhs ) != rhs );
492 friend inline bool operator!=(
const ConstIterator& lhs,
const Iterator& rhs ) {
493 return ( lhs != ConstIterator( rhs ) );
504 friend inline bool operator<(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
505 return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
516 friend inline bool operator<(
const Iterator& lhs,
const ConstIterator& rhs ) {
517 return ( ConstIterator( lhs ) < rhs );
528 friend inline bool operator<(
const ConstIterator& lhs,
const Iterator& rhs ) {
529 return ( lhs < ConstIterator( rhs ) );
540 friend inline bool operator>(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
541 return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
552 friend inline bool operator>(
const Iterator& lhs,
const ConstIterator& rhs ) {
553 return ( ConstIterator( lhs ) > rhs );
564 friend inline bool operator>(
const ConstIterator& lhs,
const Iterator& rhs ) {
565 return ( lhs > ConstIterator( rhs ) );
576 friend inline bool operator<=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
577 return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
588 friend inline bool operator<=(
const Iterator& lhs,
const ConstIterator& rhs ) {
589 return ( ConstIterator( lhs ) <= rhs );
600 friend inline bool operator<=(
const ConstIterator& lhs,
const Iterator& rhs ) {
601 return ( lhs <= ConstIterator( rhs ) );
612 friend inline bool operator>=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
613 return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
624 friend inline bool operator>=(
const Iterator& lhs,
const ConstIterator& rhs ) {
625 return ( ConstIterator( lhs ) >= rhs );
636 friend inline bool operator>=(
const ConstIterator& lhs,
const Iterator& rhs ) {
637 return ( lhs >= ConstIterator( rhs ) );
647 inline DifferenceType
operator-(
const Iterator& rhs )
const noexcept {
648 return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
659 friend inline const Iterator
operator+(
const Iterator& it,
size_t inc ) noexcept {
661 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
663 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
674 friend inline const Iterator
operator+(
size_t inc,
const Iterator& it ) noexcept {
676 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
678 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
689 friend inline const Iterator
operator-(
const Iterator& it,
size_t dec ) noexcept {
691 return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
693 return Iterator( *it.matrix_, it.row_, it.column_ - dec );
705 const size_t kend(
min( row_+SIMDSIZE, (*matrix_).rows() ) );
706 for(
size_t k=row_; k<kend; ++k )
707 (*matrix_)(column_,k) =
conj( (*matrix_)(k,column_) );
710 const size_t kend(
min( column_+SIMDSIZE, (*matrix_).columns() ) );
711 for(
size_t k=column_; k<kend; ++k )
712 (*matrix_)(k,row_) =
conj( (*matrix_)(row_,k) );
727 static constexpr
bool simdEnabled = MT::simdEnabled;
730 static constexpr
bool smpAssignable = MT::smpAssignable;
736 explicit inline HermitianMatrix();
737 explicit inline HermitianMatrix(
size_t n );
738 inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
740 template<
typename Other >
741 explicit inline HermitianMatrix(
size_t n,
const Other* array );
743 template<
typename Other,
size_t N >
744 explicit inline HermitianMatrix(
const Other (&array)[N][N] );
746 explicit inline HermitianMatrix( ElementType* ptr,
size_t n );
747 explicit inline HermitianMatrix( ElementType* ptr,
size_t n,
size_t nn );
749 inline HermitianMatrix(
const HermitianMatrix& m );
750 inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
752 template<
typename MT2,
bool SO2 >
753 inline HermitianMatrix(
const Matrix<MT2,SO2>& m );
760 ~HermitianMatrix() =
default;
767 inline Reference operator()(
size_t i,
size_t j );
768 inline ConstReference operator()(
size_t i,
size_t j )
const;
769 inline Reference at(
size_t i,
size_t j );
770 inline ConstReference at(
size_t i,
size_t j )
const;
771 inline ConstPointer
data () const noexcept;
772 inline ConstPointer
data (
size_t i ) const noexcept;
773 inline Iterator
begin (
size_t i );
774 inline ConstIterator
begin (
size_t i ) const;
775 inline ConstIterator
cbegin(
size_t i ) const;
776 inline Iterator
end (
size_t i );
777 inline ConstIterator
end (
size_t i ) const;
778 inline ConstIterator
cend (
size_t i ) const;
785 inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
787 template< typename Other,
size_t N >
788 inline HermitianMatrix& operator=( const Other (&array)[N][N] );
790 inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
791 inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
793 template< typename MT2,
bool SO2 >
794 inline auto operator=( const Matrix<MT2,SO2>& rhs )
797 template< typename MT2,
bool SO2 >
798 inline auto operator=( const Matrix<MT2,SO2>& rhs )
801 template< typename MT2 >
802 inline auto operator=( const Matrix<MT2,!SO>& rhs )
805 template< typename MT2,
bool SO2 >
806 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
809 template< typename MT2,
bool SO2 >
810 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
813 template< typename MT2 >
814 inline auto operator+=( const Matrix<MT2,!SO>& rhs )
817 template< typename MT2,
bool SO2 >
818 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
821 template< typename MT2,
bool SO2 >
822 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
825 template< typename MT2 >
826 inline auto operator-=( const Matrix<MT2,!SO>& rhs )
829 template< typename MT2,
bool SO2 >
830 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
833 template< typename MT2,
bool SO2 >
834 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
837 template< typename MT2 >
838 inline auto operator%=( const Matrix<MT2,!SO>& rhs )
841 template< typename ST >
844 template< typename ST >
852 inline
size_t rows() const noexcept;
853 inline
size_t columns() const noexcept;
854 inline
size_t spacing() const noexcept;
855 inline
size_t capacity() const noexcept;
856 inline
size_t capacity(
size_t i ) const noexcept;
858 inline
size_t nonZeros(
size_t i ) const;
860 inline
void reset(
size_t i );
862 void resize (
size_t n,
bool preserve=true );
863 inline
void extend (
size_t n,
bool preserve=true );
864 inline
void reserve(
size_t elements );
866 inline
void swap( HermitianMatrix& m ) noexcept;
876 template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
883 inline
bool isIntact() const noexcept;
890 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
891 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
893 inline
bool isAligned () const noexcept;
894 inline
bool canSMPAssign() const noexcept;
900 inline
void store (
size_t i,
size_t j, const SIMDType& value ) noexcept;
901 inline
void storea(
size_t i,
size_t j, const SIMDType& value ) noexcept;
902 inline
void storeu(
size_t i,
size_t j, const SIMDType& value ) noexcept;
903 inline
void stream(
size_t i,
size_t j, const SIMDType& value ) noexcept;
911 template< typename MT2,
bool SO2, typename T >
912 inline decltype(auto) construct( const Matrix<MT2,SO2>& m, T );
914 template< typename MT2 >
915 inline decltype(auto) construct( const Matrix<MT2,!SO>& m,
TrueType );
921 static constexpr
size_t SIMDSIZE = SIMDTrait<ET>::
size;
932 template<
bool RF, typename MT2,
bool SO2,
bool DF2 >
933 friend
bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
937 friend
void invert( HermitianMatrix<MT2,SO2,true>& m );
975 template< typename MT
977 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
993 template<
typename MT
995 inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
size_t n )
996 : matrix_( n, n, ElementType() )
1034 template<
typename MT
1036 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1078 template<
typename MT
1080 template<
typename Other >
1081 inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
size_t n,
const Other* array )
1082 : matrix_( n, n, array )
1119 template<
typename MT
1121 template<
typename Other
1123 inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
const Other (&array)[N][N] )
1170 template<
typename MT
1172 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr,
size_t n )
1173 : matrix_( ptr, n, n )
1221 template<
typename MT
1223 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr,
size_t n,
size_t nn )
1224 : matrix_( ptr, n, n, nn )
1242 template<
typename MT
1244 inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
const HermitianMatrix& m )
1245 : matrix_( m.matrix_ )
1260 template<
typename MT
1262 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1263 : matrix_( std::move( m.matrix_ ) )
1282 template<
typename MT
1284 template<
typename MT2
1286 inline HermitianMatrix<MT,SO,true>::HermitianMatrix(
const Matrix<MT2,SO2>& m )
1287 : matrix_( construct( m, typename IsBuiltin<
ElementType_t<MT2> >::Type() ) )
1289 if( !IsHermitian_v<MT2> && !
isHermitian( matrix_ ) ) {
1323 template<
typename MT
1325 inline typename HermitianMatrix<MT,SO,true>::Reference
1326 HermitianMatrix<MT,SO,true>::operator()(
size_t i,
size_t j )
1331 return Reference( matrix_, i, j );
1353 template<
typename MT
1355 inline typename HermitianMatrix<MT,SO,true>::ConstReference
1356 HermitianMatrix<MT,SO,true>::operator()(
size_t i,
size_t j )
const 1361 return matrix_(i,j);
1384 template<
typename MT
1386 inline typename HermitianMatrix<MT,SO,true>::Reference
1387 HermitianMatrix<MT,SO,true>::at(
size_t i,
size_t j )
1395 return (*
this)(i,j);
1418 template<
typename MT
1420 inline typename HermitianMatrix<MT,SO,true>::ConstReference
1421 HermitianMatrix<MT,SO,true>::at(
size_t i,
size_t j )
const 1429 return (*
this)(i,j);
1449 template<
typename MT
1451 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1454 return matrix_.data();
1471 template<
typename MT
1473 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1476 return matrix_.data(i);
1494 template<
typename MT
1496 inline typename HermitianMatrix<MT,SO,true>::Iterator
1500 return Iterator( matrix_, 0UL, i );
1502 return Iterator( matrix_, i, 0UL );
1520 template<
typename MT
1522 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1525 return matrix_.begin(i);
1543 template<
typename MT
1545 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1548 return matrix_.cbegin(i);
1566 template<
typename MT
1568 inline typename HermitianMatrix<MT,SO,true>::Iterator
1572 return Iterator( matrix_,
rows(), i );
1574 return Iterator( matrix_, i,
columns() );
1592 template<
typename MT
1594 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1597 return matrix_.end(i);
1615 template<
typename MT
1617 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1620 return matrix_.cend(i);
1661 template<
typename MT
1663 inline HermitianMatrix<MT,SO,true>&
1664 HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1666 const InitializerMatrix<ElementType> tmp( list, list.size() );
1709 template<
typename MT
1711 template<
typename Other
1713 inline HermitianMatrix<MT,SO,true>&
1714 HermitianMatrix<MT,SO,true>::operator=(
const Other (&array)[N][N] )
1722 matrix_ = std::move( tmp );
1743 template<
typename MT
1745 inline HermitianMatrix<MT,SO,true>&
1746 HermitianMatrix<MT,SO,true>::operator=(
const HermitianMatrix& rhs )
1748 matrix_ = rhs.matrix_;
1766 template<
typename MT
1768 inline HermitianMatrix<MT,SO,true>&
1769 HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1771 matrix_ = std::move( rhs.matrix_ );
1795 template<
typename MT
1797 template<
typename MT2
1799 inline auto HermitianMatrix<MT,SO,true>::operator=(
const Matrix<MT2,SO2>& rhs )
1800 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1802 if( !IsHermitian_v<MT2> && !
isHermitian( ~rhs ) ) {
1830 template<
typename MT
1832 template<
typename MT2
1834 inline auto HermitianMatrix<MT,SO,true>::operator=(
const Matrix<MT2,SO2>& rhs )
1835 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1837 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1841 if( IsHermitian_v<MT2> ) {
1851 matrix_ = std::move( tmp );
1876 template<
typename MT
1878 template<
typename MT2 >
1879 inline auto HermitianMatrix<MT,SO,true>::operator=(
const Matrix<MT2,!SO>& rhs )
1880 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1882 return this->operator=(
trans( ~rhs ) );
1901 template<
typename MT
1903 template<
typename MT2
1906 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1908 if( !IsHermitian_v<MT2> && !
isHermitian( ~rhs ) ) {
1936 template<
typename MT
1938 template<
typename MT2
1941 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1943 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1947 if( IsHermitian_v<MT2> ) {
1951 const ResultType_t<MT2> tmp( ~rhs );
1983 template<
typename MT
1985 template<
typename MT2 >
1987 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2008 template<
typename MT
2010 template<
typename MT2
2013 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2015 if( !IsHermitian_v<MT2> && !
isHermitian( ~rhs ) ) {
2043 template<
typename MT
2045 template<
typename MT2
2048 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2050 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
2054 if( IsHermitian_v<MT2> ) {
2058 const ResultType_t<MT2> tmp( ~rhs );
2090 template<
typename MT
2092 template<
typename MT2 >
2094 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2116 template<
typename MT
2118 template<
typename MT2
2120 inline auto HermitianMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,SO2>& rhs )
2121 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2123 if( !IsHermitian_v<MT2> && !
isHermitian( ~rhs ) ) {
2152 template<
typename MT
2154 template<
typename MT2
2156 inline auto HermitianMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,SO2>& rhs )
2157 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2159 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
2163 if( IsHermitian_v<MT2> ) {
2167 const ResultType_t<MT2> tmp( ~rhs );
2199 template<
typename MT
2201 template<
typename MT2 >
2202 inline auto HermitianMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,!SO>& rhs )
2203 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2205 return this->operator%=(
trans( ~rhs ) );
2219 template<
typename MT
2221 template<
typename ST >
2223 -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
2239 template<
typename MT
2241 template<
typename ST >
2243 -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
2268 template<
typename MT
2272 return matrix_.rows();
2284 template<
typename MT
2288 return matrix_.columns();
2306 template<
typename MT
2310 return matrix_.spacing();
2322 template<
typename MT
2326 return matrix_.capacity();
2343 template<
typename MT
2347 return matrix_.capacity(i);
2359 template<
typename MT
2363 return matrix_.nonZeros();
2381 template<
typename MT
2385 return matrix_.nonZeros(i);
2397 template<
typename MT
2443 template<
typename MT
2466 template<
typename MT
2513 template<
typename MT
2523 const size_t oldsize( matrix_.rows() );
2525 matrix_.resize( n, n,
true );
2528 const size_t increment( n - oldsize );
2529 submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2530 submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2550 template<
typename MT
2552 inline void HermitianMatrix<MT,SO,true>::extend(
size_t n,
bool preserve )
2573 template<
typename MT
2575 inline void HermitianMatrix<MT,SO,true>::reserve(
size_t elements )
2593 template<
typename MT
2597 matrix_.shrinkToFit();
2610 template<
typename MT
2616 swap( matrix_, m.matrix_ );
2636 template<
typename MT
2640 if( IsComplex_v<ElementType> )
2641 matrix_.transpose();
2654 template<
typename MT
2682 template<
typename MT
2684 template<
typename Other >
2685 inline HermitianMatrix<MT,SO,true>&
2686 HermitianMatrix<MT,SO,true>::scale(
const Other& scalar )
2688 matrix_.scale( scalar );
2713 template<
typename MT
2744 template<
typename MT
2746 template<
typename Other >
2747 inline bool HermitianMatrix<MT,SO,true>::canAlias(
const Other* alias )
const noexcept
2749 return matrix_.canAlias( alias );
2766 template<
typename MT
2768 template<
typename Other >
2769 inline bool HermitianMatrix<MT,SO,true>::isAliased(
const Other* alias )
const noexcept
2771 return matrix_.isAliased( alias );
2787 template<
typename MT
2789 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2791 return matrix_.isAligned();
2808 template<
typename MT
2810 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2812 return matrix_.canSMPAssign();
2834 template<
typename MT
2837 HermitianMatrix<MT,SO,true>::load(
size_t i,
size_t j )
const noexcept
2839 return matrix_.load( i, j );
2861 template<
typename MT
2866 return matrix_.loada( i, j );
2888 template<
typename MT
2893 return matrix_.loadu( i, j );
2916 template<
typename MT
2919 HermitianMatrix<MT,SO,true>::store(
size_t i,
size_t j,
const SIMDType& value ) noexcept
2921 matrix_.store( i, j, value );
2924 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2925 for(
size_t k=i; k<kend; ++k )
2926 matrix_(j,k) =
conj( matrix_(k,j) );
2929 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2930 for(
size_t k=j; k<kend; ++k )
2931 matrix_(k,i) =
conj( matrix_(i,k) );
2955 template<
typename MT
2960 matrix_.storea( i, j, value );
2963 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2964 for(
size_t k=i; k<kend; ++k )
2965 matrix_(j,k) =
conj( matrix_(k,j) );
2968 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2969 for(
size_t k=j; k<kend; ++k )
2970 matrix_(k,i) =
conj( matrix_(i,k) );
2994 template<
typename MT
2999 matrix_.storeu( i, j, value );
3002 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
3003 for(
size_t k=i; k<kend; ++k )
3004 matrix_(j,k) =
conj( matrix_(k,j) );
3007 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
3008 for(
size_t k=j; k<kend; ++k )
3009 matrix_(k,i) =
conj( matrix_(i,k) );
3033 template<
typename MT
3038 matrix_.stream( i, j, value );
3041 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
3042 for(
size_t k=i; k<kend; ++k )
3043 matrix_(j,k) =
conj( matrix_(k,j) );
3046 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
3047 for(
size_t k=j; k<kend; ++k )
3048 matrix_(k,i) =
conj( matrix_(i,k) );
3065 template<
typename MT
3067 template<
typename MT2
3070 inline decltype(
auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3080 template<
typename MT
3082 template<
typename MT2 >
3083 inline decltype(
auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m,
TrueType )
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.In case the given data type T is a transformation expression (i....
Definition: Transformation.h:81
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
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
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.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
Constraint on the data type.
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
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
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:170
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
#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
Header file for the isZero 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
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type,...
Definition: DenseMatrix.h:61
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
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
Constraint on the data type.
Header file for the dense matrix inversion flags.
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
Header file for the MAYBE_UNUSED function template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
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
Header file for the extended initializer_list functionality.
Constraint on the data type.
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
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Constraint on the data type.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:253
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:677
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If 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:9091
#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
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:1162
#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 DenseMatrix base class.
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 > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:446
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.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
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
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
Constraints on the storage order of matrix types.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:139
constexpr bool IsBuiltin_v
Auxiliary variable template for the IsBuiltin type trait.The IsBuiltin_v variable template provides a...
Definition: IsBuiltin.h:95
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
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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
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
Header file for the implementation of the base template of the HeritianMatrix.
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
Header file for the implementation of the Column view.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
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:558
#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,...
Definition: Symmetric.h:79
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
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_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
Header file for all forward declarations for expression class templates.
#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,...
Definition: Reference.h:79
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:1406
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
Constraint on the data type.
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.In case the given data type T is a view type (i.e. a subvector,...
Definition: View.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
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:718
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
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
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
#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.
Header file for the HermitianProxy class.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
Header file for the IsComplex type trait.
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:494
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#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,...
Definition: Hermitian.h:79
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1324
#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
Header file for the IsHermitian type trait.
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
System settings for the inline keywords.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Header file for the implementation of the Row view.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825