Blaze 3.9
Dense.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
36#define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <iterator>
44#include <utility>
47#include <blaze/math/Aliases.h>
68#include <blaze/math/SIMD.h>
78#include <blaze/system/Inline.h>
80#include <blaze/util/Assert.h>
85#include <blaze/util/EnableIf.h>
88#include <blaze/util/mpl/If.h>
90#include <blaze/util/Types.h>
93
94
95namespace blaze {
96
97//=================================================================================================
98//
99// CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
100//
101//=================================================================================================
102
103//*************************************************************************************************
111template< typename MT // Type of the adapted dense matrix
112 , bool SO > // Storage order of the adapted dense matrix
113class HermitianMatrix<MT,SO,true>
114 : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
115{
116 private:
117 //**Type definitions****************************************************************************
118 using OT = OppositeType_t<MT>;
119 using TT = TransposeType_t<MT>;
120 using ET = ElementType_t<MT>;
121 //**********************************************************************************************
122
123 public:
124 //**Type definitions****************************************************************************
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>;
140 //**********************************************************************************************
141
142 //**Rebind struct definition********************************************************************
145 template< typename NewType > // Data type of the other matrix
146 struct Rebind {
148 using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
149 };
150 //**********************************************************************************************
151
152 //**Resize struct definition********************************************************************
155 template< size_t NewM // Number of rows of the other matrix
156 , size_t NewN > // Number of columns of the other matrix
157 struct Resize {
159 using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
160 };
161 //**********************************************************************************************
162
163 //**Iterator class definition*******************************************************************
166 class Iterator
167 {
168 public:
169 //**Type definitions*************************************************************************
170 using IteratorCategory = std::random_access_iterator_tag;
171 using ValueType = ElementType_t<MT>;
172 using PointerType = HermitianProxy<MT>;
173 using ReferenceType = HermitianProxy<MT>;
174 using DifferenceType = ptrdiff_t;
175
176 // STL iterator requirements
177 using iterator_category = IteratorCategory;
178 using value_type = ValueType;
179 using pointer = PointerType;
180 using reference = ReferenceType;
181 using difference_type = DifferenceType;
182 //*******************************************************************************************
183
184 //**Constructor******************************************************************************
187 inline Iterator() noexcept
188 : matrix_( nullptr ) // Reference to the adapted dense matrix
189 , row_ ( 0UL ) // The current row index of the iterator
190 , column_( 0UL ) // The current column index of the iterator
191 {}
192 //*******************************************************************************************
193
194 //**Constructor******************************************************************************
201 inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
202 : matrix_( &matrix ) // Reference to the adapted dense matrix
203 , row_ ( row ) // The current row index of the iterator
204 , column_( column ) // The current column index of the iterator
205 {}
206 //*******************************************************************************************
207
208 //**Addition assignment operator*************************************************************
214 inline Iterator& operator+=( size_t inc ) noexcept {
215 ( SO )?( row_ += inc ):( column_ += inc );
216 return *this;
217 }
218 //*******************************************************************************************
219
220 //**Subtraction assignment operator**********************************************************
226 inline Iterator& operator-=( size_t dec ) noexcept {
227 ( SO )?( row_ -= dec ):( column_ -= dec );
228 return *this;
229 }
230 //*******************************************************************************************
231
232 //**Prefix increment operator****************************************************************
237 inline Iterator& operator++() noexcept {
238 ( SO )?( ++row_ ):( ++column_ );
239 return *this;
240 }
241 //*******************************************************************************************
242
243 //**Postfix increment operator***************************************************************
248 inline const Iterator operator++( int ) noexcept {
249 const Iterator tmp( *this );
250 ++(*this);
251 return tmp;
252 }
253 //*******************************************************************************************
254
255 //**Prefix decrement operator****************************************************************
260 inline Iterator& operator--() noexcept {
261 ( SO )?( --row_ ):( --column_ );
262 return *this;
263 }
264 //*******************************************************************************************
265
266 //**Postfix decrement operator***************************************************************
271 inline const Iterator operator--( int ) noexcept {
272 const Iterator tmp( *this );
273 --(*this);
274 return tmp;
275 }
276 //*******************************************************************************************
277
278 //**Element access operator******************************************************************
283 inline ReferenceType operator*() const {
284 return ReferenceType( *matrix_, row_, column_ );
285 }
286 //*******************************************************************************************
287
288 //**Element access operator******************************************************************
293 inline PointerType operator->() const {
294 return PointerType( *matrix_, row_, column_ );
295 }
296 //*******************************************************************************************
297
298 //**Load function****************************************************************************
308 inline SIMDType load() const {
309 return (*matrix_).load(row_,column_);
310 }
311 //*******************************************************************************************
312
313 //**Loada function***************************************************************************
323 inline SIMDType loada() const {
324 return (*matrix_).loada(row_,column_);
325 }
326 //*******************************************************************************************
327
328 //**Loadu function***************************************************************************
338 inline SIMDType loadu() const {
339 return (*matrix_).loadu(row_,column_);
340 }
341 //*******************************************************************************************
342
343 //**Store function***************************************************************************
354 inline void store( const SIMDType& value ) const {
355 (*matrix_).store( row_, column_, value );
356 sync();
357 }
358 //*******************************************************************************************
359
360 //**Storea function**************************************************************************
371 inline void storea( const SIMDType& value ) const {
372 (*matrix_).storea( row_, column_, value );
373 sync();
374 }
375 //*******************************************************************************************
376
377 //**Storeu function**************************************************************************
388 inline void storeu( const SIMDType& value ) const {
389 (*matrix_).storeu( row_, column_, value );
390 sync();
391 }
392 //*******************************************************************************************
393
394 //**Stream function**************************************************************************
405 inline void stream( const SIMDType& value ) const {
406 (*matrix_).stream( row_, column_, value );
407 sync();
408 }
409 //*******************************************************************************************
410
411 //**Conversion operator**********************************************************************
416 inline operator ConstIterator() const {
417 if( SO )
418 return matrix_->begin( column_ ) + row_;
419 else
420 return matrix_->begin( row_ ) + column_;
421 }
422 //*******************************************************************************************
423
424 //**Equality operator************************************************************************
431 friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
432 return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
433 }
434 //*******************************************************************************************
435
436 //**Equality operator************************************************************************
443 friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
444 return ( ConstIterator( lhs ) == rhs );
445 }
446 //*******************************************************************************************
447
448 //**Equality operator************************************************************************
455 friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
456 return ( lhs == ConstIterator( rhs ) );
457 }
458 //*******************************************************************************************
459
460 //**Inequality operator**********************************************************************
467 friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
468 return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
469 }
470 //*******************************************************************************************
471
472 //**Inequality operator**********************************************************************
479 friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
480 return ( ConstIterator( lhs ) != rhs );
481 }
482 //*******************************************************************************************
483
484 //**Inequality operator**********************************************************************
491 friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
492 return ( lhs != ConstIterator( rhs ) );
493 }
494 //*******************************************************************************************
495
496 //**Less-than operator***********************************************************************
503 friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
504 return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
505 }
506 //*******************************************************************************************
507
508 //**Less-than operator***********************************************************************
515 friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
516 return ( ConstIterator( lhs ) < rhs );
517 }
518 //*******************************************************************************************
519
520 //**Less-than operator***********************************************************************
527 friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
528 return ( lhs < ConstIterator( rhs ) );
529 }
530 //*******************************************************************************************
531
532 //**Greater-than operator********************************************************************
539 friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
540 return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
541 }
542 //*******************************************************************************************
543
544 //**Greater-than operator********************************************************************
551 friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
552 return ( ConstIterator( lhs ) > rhs );
553 }
554 //*******************************************************************************************
555
556 //**Greater-than operator********************************************************************
563 friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
564 return ( lhs > ConstIterator( rhs ) );
565 }
566 //*******************************************************************************************
567
568 //**Less-or-equal-than operator**************************************************************
575 friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
576 return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
577 }
578 //*******************************************************************************************
579
580 //**Less-or-equal-than operator**************************************************************
587 friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
588 return ( ConstIterator( lhs ) <= rhs );
589 }
590 //*******************************************************************************************
591
592 //**Less-or-equal-than operator**************************************************************
599 friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
600 return ( lhs <= ConstIterator( rhs ) );
601 }
602 //*******************************************************************************************
603
604 //**Greater-or-equal-than operator***********************************************************
611 friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
612 return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
613 }
614 //*******************************************************************************************
615
616 //**Greater-or-equal-than operator***********************************************************
623 friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
624 return ( ConstIterator( lhs ) >= rhs );
625 }
626 //*******************************************************************************************
627
628 //**Greater-or-equal-than operator***********************************************************
635 friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
636 return ( lhs >= ConstIterator( rhs ) );
637 }
638 //*******************************************************************************************
639
640 //**Subtraction operator*********************************************************************
646 inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
647 return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
648 }
649 //*******************************************************************************************
650
651 //**Addition operator************************************************************************
658 friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
659 if( SO )
660 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
661 else
662 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
663 }
664 //*******************************************************************************************
665
666 //**Addition operator************************************************************************
673 friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
674 if( SO )
675 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
676 else
677 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
678 }
679 //*******************************************************************************************
680
681 //**Subtraction operator*********************************************************************
688 friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
689 if( SO )
690 return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
691 else
692 return Iterator( *it.matrix_, it.row_, it.column_ - dec );
693 }
694 //*******************************************************************************************
695
696 private:
697 //**Sync function****************************************************************************
702 void sync() const {
703 if( SO ) {
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_) );
707 }
708 else {
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) );
712 }
713 }
714 //*******************************************************************************************
715
716 //**Member variables*************************************************************************
717 MT* matrix_;
718 size_t row_;
719 size_t column_;
720 //*******************************************************************************************
721 };
722 //**********************************************************************************************
723
724 //**Compilation flags***************************************************************************
726 static constexpr bool simdEnabled = MT::simdEnabled;
727
729 static constexpr bool smpAssignable = MT::smpAssignable;
730 //**********************************************************************************************
731
732 //**Constructors********************************************************************************
735 inline HermitianMatrix();
736 explicit inline HermitianMatrix( size_t n );
737 inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
738
739 template< typename Other >
740 inline HermitianMatrix( size_t n, const Other* array );
741
742 template< typename Other, size_t N >
743 inline HermitianMatrix( const Other (&array)[N][N] );
744
745 inline HermitianMatrix( ElementType* ptr, size_t n );
746 inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
747
748 inline HermitianMatrix( const HermitianMatrix& m );
749 inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
750
751 template< typename MT2, bool SO2 >
752 inline HermitianMatrix( const Matrix<MT2,SO2>& m );
754 //**********************************************************************************************
755
756 //**Destructor**********************************************************************************
759 ~HermitianMatrix() = default;
761 //**********************************************************************************************
762
763 //**Data access functions***********************************************************************
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;
779 //**********************************************************************************************
780
781 //**Assignment operators************************************************************************
784 inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
785
786 template< typename Other, size_t N >
787 inline HermitianMatrix& operator=( const Other (&array)[N][N] );
788
789 inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
790 inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
791
792 template< typename MT2, bool SO2 >
793 inline auto operator=( const Matrix<MT2,SO2>& rhs )
794 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
795
796 template< typename MT2, bool SO2 >
797 inline auto operator=( const Matrix<MT2,SO2>& rhs )
798 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
799
800 template< typename MT2 >
801 inline auto operator=( const Matrix<MT2,!SO>& rhs )
802 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
803
804 template< typename MT2, bool SO2 >
805 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
806 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
807
808 template< typename MT2, bool SO2 >
809 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
810 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
811
812 template< typename MT2 >
813 inline auto operator+=( const Matrix<MT2,!SO>& rhs )
814 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
815
816 template< typename MT2, bool SO2 >
817 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
818 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
819
820 template< typename MT2, bool SO2 >
821 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
822 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
823
824 template< typename MT2 >
825 inline auto operator-=( const Matrix<MT2,!SO>& rhs )
826 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
827
828 template< typename MT2, bool SO2 >
829 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
830 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
831
832 template< typename MT2, bool SO2 >
833 inline auto operator%=( const Matrix<MT2,SO2>& rhs )
834 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
835
836 template< typename MT2 >
837 inline auto operator%=( const Matrix<MT2,!SO>& rhs )
838 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
839
840 template< typename ST >
841 inline auto operator*=( ST rhs ) -> EnableIf_t< IsScalar_v<ST>, HermitianMatrix& >;
842
843 template< typename ST >
844 inline auto operator/=( ST rhs ) -> EnableIf_t< IsScalar_v<ST>, HermitianMatrix& >;
846 //**********************************************************************************************
847
848 //**Utility functions***************************************************************************
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;
856 inline size_t nonZeros() const;
857 inline size_t nonZeros( size_t i ) const;
858 inline void reset();
859 inline void reset( size_t i );
860 inline void clear();
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 );
864 inline void shrinkToFit();
865 inline void swap( HermitianMatrix& m ) noexcept;
867 //**********************************************************************************************
868
869 //**Numeric functions***************************************************************************
872 inline HermitianMatrix& transpose();
873 inline HermitianMatrix& ctranspose();
874
875 template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
877 //**********************************************************************************************
878
879 //**Debugging functions*************************************************************************
882 inline bool isIntact() const noexcept;
884 //**********************************************************************************************
885
886 //**Expression template evaluation functions****************************************************
889 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
890 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
891
892 inline bool isAligned () const noexcept;
893 inline bool canSMPAssign() const noexcept;
894
895 BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
896 BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
897 BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
898
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;
904 //**********************************************************************************************
905
906 private:
907 //**Construction functions**********************************************************************
910 template< typename MT2, bool SO2, typename T >
911 inline decltype(auto) construct( const Matrix<MT2,SO2>& m, T );
912
913 template< typename MT2 >
914 inline decltype(auto) construct( const Matrix<MT2,!SO>& m, TrueType );
916 //**********************************************************************************************
917
918 //**SIMD properties*****************************************************************************
920 static constexpr size_t SIMDSIZE = SIMDTrait<ET>::size;
921 //**********************************************************************************************
922
923 //**Member variables****************************************************************************
926 MT matrix_;
928 //**********************************************************************************************
929
930 //**Friend declarations*************************************************************************
931 template< InversionFlag IF, typename MT2, bool SO2 >
932 friend void invert( HermitianMatrix<MT2,SO2,true>& m );
933 //**********************************************************************************************
934
935 //**Compile time checks*************************************************************************
951 BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
952 //**********************************************************************************************
953};
955//*************************************************************************************************
956
957
958
959
960//=================================================================================================
961//
962// CONSTRUCTORS
963//
964//=================================================================================================
965
966//*************************************************************************************************
970template< typename MT // Type of the adapted dense matrix
971 , bool SO > // Storage order of the adapted dense matrix
972inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
973 : matrix_() // The adapted dense matrix
974{
975 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
976 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
977}
979//*************************************************************************************************
980
981
982//*************************************************************************************************
988template< typename MT // Type of the adapted dense matrix
989 , bool SO > // Storage order of the adapted dense matrix
990inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
991 : matrix_( n, n, ElementType() ) // The adapted dense matrix
992{
994
995 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
996 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
997}
999//*************************************************************************************************
1000
1001
1002//*************************************************************************************************
1029template< typename MT // Type of the adapted dense matrix
1030 , bool SO > // Storage order of the adapted dense matrix
1031inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1032 : matrix_( list ) // The adapted dense matrix
1033{
1034 if( !isHermitian( matrix_ ) ) {
1035 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1036 }
1037
1038 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1039}
1041//*************************************************************************************************
1042
1043
1044//*************************************************************************************************
1073template< typename MT // Type of the adapted dense matrix
1074 , bool SO > // Storage order of the adapted dense matrix
1075template< typename Other > // Data type of the initialization array
1076inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n, const Other* array )
1077 : matrix_( n, n, array ) // The adapted dense matrix
1078{
1079 if( !isHermitian( matrix_ ) ) {
1080 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1081 }
1082
1083 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1084}
1086//*************************************************************************************************
1087
1088
1089//*************************************************************************************************
1114template< typename MT // Type of the adapted dense matrix
1115 , bool SO > // Storage order of the adapted dense matrix
1116template< typename Other // Data type of the initialization array
1117 , size_t N > // Number of rows and columns of the initialization array
1118inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Other (&array)[N][N] )
1119 : matrix_( array ) // The adapted dense matrix
1120{
1121 if( !isHermitian( matrix_ ) ) {
1122 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1123 }
1124
1125 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1126}
1128//*************************************************************************************************
1129
1130
1131//*************************************************************************************************
1165template< typename MT // Type of the adapted dense matrix
1166 , bool SO > // Storage order of the adapted dense matrix
1167inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n )
1168 : matrix_( ptr, n, n ) // The adapted dense matrix
1169{
1170 if( !isHermitian( matrix_ ) ) {
1171 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1172 }
1173
1174 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1175}
1177//*************************************************************************************************
1178
1179
1180//*************************************************************************************************
1216template< typename MT // Type of the adapted dense matrix
1217 , bool SO > // Storage order of the adapted dense matrix
1218inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn )
1219 : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1220{
1221 if( !isHermitian( matrix_ ) ) {
1222 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1223 }
1224
1225 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1226}
1228//*************************************************************************************************
1229
1230
1231//*************************************************************************************************
1237template< typename MT // Type of the adapted dense matrix
1238 , bool SO > // Storage order of the adapted dense matrix
1239inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const HermitianMatrix& m )
1240 : matrix_( m.matrix_ ) // The adapted dense matrix
1241{
1242 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1243 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1244}
1246//*************************************************************************************************
1247
1248
1249//*************************************************************************************************
1255template< typename MT // Type of the adapted dense matrix
1256 , bool SO > // Storage order of the adapted dense matrix
1257inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1258 : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1259{
1260 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1261 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1262}
1264//*************************************************************************************************
1265
1266
1267//*************************************************************************************************
1277template< typename MT // Type of the adapted dense matrix
1278 , bool SO > // Storage order of the adapted dense matrix
1279template< typename MT2 // Type of the foreign matrix
1280 , bool SO2 > // Storage order of the foreign matrix
1281inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Matrix<MT2,SO2>& m )
1282 : matrix_( construct( m, typename IsBuiltin< ElementType_t<MT2> >::Type() ) ) // The adapted dense matrix
1283{
1284 if( !IsHermitian_v<MT2> && !isHermitian( matrix_ ) ) {
1285 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1286 }
1287
1288 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1289}
1291//*************************************************************************************************
1292
1293
1294
1295
1296//=================================================================================================
1297//
1298// DATA ACCESS FUNCTIONS
1299//
1300//=================================================================================================
1301
1302//*************************************************************************************************
1318template< typename MT // Type of the adapted dense matrix
1319 , bool SO > // Storage order of the adapted dense matrix
1320inline typename HermitianMatrix<MT,SO,true>::Reference
1321 HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1322{
1323 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1324 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1325
1326 return Reference( matrix_, i, j );
1327}
1329//*************************************************************************************************
1330
1331
1332//*************************************************************************************************
1348template< typename MT // Type of the adapted dense matrix
1349 , bool SO > // Storage order of the adapted dense matrix
1350inline typename HermitianMatrix<MT,SO,true>::ConstReference
1351 HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1352{
1353 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1354 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1355
1356 return matrix_(i,j);
1357}
1359//*************************************************************************************************
1360
1361
1362//*************************************************************************************************
1379template< typename MT // Type of the adapted dense matrix
1380 , bool SO > // Storage order of the adapted dense matrix
1381inline typename HermitianMatrix<MT,SO,true>::Reference
1382 HermitianMatrix<MT,SO,true>::at( size_t i, size_t j )
1383{
1384 if( i >= rows() ) {
1385 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1386 }
1387 if( j >= columns() ) {
1388 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1389 }
1390 return (*this)(i,j);
1391}
1393//*************************************************************************************************
1394
1395
1396//*************************************************************************************************
1413template< typename MT // Type of the adapted dense matrix
1414 , bool SO > // Storage order of the adapted dense matrix
1415inline typename HermitianMatrix<MT,SO,true>::ConstReference
1416 HermitianMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1417{
1418 if( i >= rows() ) {
1419 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1420 }
1421 if( j >= columns() ) {
1422 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1423 }
1424 return (*this)(i,j);
1425}
1427//*************************************************************************************************
1428
1429
1430//*************************************************************************************************
1444template< typename MT // Type of the adapted dense matrix
1445 , bool SO > // Storage order of the adapted dense matrix
1446inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1447 HermitianMatrix<MT,SO,true>::data() const noexcept
1448{
1449 return matrix_.data();
1450}
1452//*************************************************************************************************
1453
1454
1455//*************************************************************************************************
1466template< typename MT // Type of the adapted dense matrix
1467 , bool SO > // Storage order of the adapted dense matrix
1468inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1469 HermitianMatrix<MT,SO,true>::data( size_t i ) const noexcept
1470{
1471 return matrix_.data(i);
1472}
1474//*************************************************************************************************
1475
1476
1477//*************************************************************************************************
1489template< typename MT // Type of the adapted dense matrix
1490 , bool SO > // Storage order of the adapted dense matrix
1491inline typename HermitianMatrix<MT,SO,true>::Iterator
1493{
1494 if( SO )
1495 return Iterator( matrix_, 0UL, i );
1496 else
1497 return Iterator( matrix_, i, 0UL );
1498}
1500//*************************************************************************************************
1501
1502
1503//*************************************************************************************************
1515template< typename MT // Type of the adapted dense matrix
1516 , bool SO > // Storage order of the adapted dense matrix
1517inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1518 HermitianMatrix<MT,SO,true>::begin( size_t i ) const
1519{
1520 return matrix_.begin(i);
1521}
1523//*************************************************************************************************
1524
1525
1526//*************************************************************************************************
1538template< typename MT // Type of the adapted dense matrix
1539 , bool SO > // Storage order of the adapted dense matrix
1540inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1541 HermitianMatrix<MT,SO,true>::cbegin( size_t i ) const
1542{
1543 return matrix_.cbegin(i);
1544}
1546//*************************************************************************************************
1547
1548
1549//*************************************************************************************************
1561template< typename MT // Type of the adapted dense matrix
1562 , bool SO > // Storage order of the adapted dense matrix
1563inline typename HermitianMatrix<MT,SO,true>::Iterator
1565{
1566 if( SO )
1567 return Iterator( matrix_, rows(), i );
1568 else
1569 return Iterator( matrix_, i, columns() );
1570}
1572//*************************************************************************************************
1573
1574
1575//*************************************************************************************************
1587template< typename MT // Type of the adapted dense matrix
1588 , bool SO > // Storage order of the adapted dense matrix
1589inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1590 HermitianMatrix<MT,SO,true>::end( size_t i ) const
1591{
1592 return matrix_.end(i);
1593}
1595//*************************************************************************************************
1596
1597
1598//*************************************************************************************************
1610template< typename MT // Type of the adapted dense matrix
1611 , bool SO > // Storage order of the adapted dense matrix
1612inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1613 HermitianMatrix<MT,SO,true>::cend( size_t i ) const
1614{
1615 return matrix_.cend(i);
1616}
1618//*************************************************************************************************
1619
1620
1621
1622
1623//=================================================================================================
1624//
1625// ASSIGNMENT OPERATORS
1626//
1627//=================================================================================================
1628
1629//*************************************************************************************************
1656template< typename MT // Type of the adapted dense matrix
1657 , bool SO > // Storage order of the adapted dense matrix
1658inline HermitianMatrix<MT,SO,true>&
1659 HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1660{
1661 const InitializerMatrix<ElementType> tmp( list, list.size() );
1662
1663 if( !isHermitian( tmp ) ) {
1664 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1665 }
1666
1667 matrix_ = list;
1668
1669 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1670 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1671
1672 return *this;
1673}
1675//*************************************************************************************************
1676
1677
1678//*************************************************************************************************
1704template< typename MT // Type of the adapted dense matrix
1705 , bool SO > // Storage order of the adapted dense matrix
1706template< typename Other // Data type of the initialization array
1707 , size_t N > // Number of rows and columns of the initialization array
1708inline HermitianMatrix<MT,SO,true>&
1709 HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1710{
1711 MT tmp( array );
1712
1713 if( !isHermitian( tmp ) ) {
1714 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1715 }
1716
1717 matrix_ = std::move( tmp );
1718
1719 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1720 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1721
1722 return *this;
1723}
1725//*************************************************************************************************
1726
1727
1728//*************************************************************************************************
1738template< typename MT // Type of the adapted dense matrix
1739 , bool SO > // Storage order of the adapted dense matrix
1740inline HermitianMatrix<MT,SO,true>&
1741 HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1742{
1743 matrix_ = rhs.matrix_;
1744
1745 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1746 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1747
1748 return *this;
1749}
1751//*************************************************************************************************
1752
1753
1754//*************************************************************************************************
1761template< typename MT // Type of the adapted dense matrix
1762 , bool SO > // Storage order of the adapted dense matrix
1763inline HermitianMatrix<MT,SO,true>&
1764 HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1765{
1766 matrix_ = std::move( rhs.matrix_ );
1767
1768 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1769 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1770
1771 return *this;
1772}
1774//*************************************************************************************************
1775
1776
1777//*************************************************************************************************
1790template< typename MT // Type of the adapted dense matrix
1791 , bool SO > // Storage order of the adapted dense matrix
1792template< typename MT2 // Type of the right-hand side matrix
1793 , bool SO2 > // Storage order of the right-hand side matrix
1794inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1795 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1796{
1797 if( !IsHermitian_v<MT2> && !isHermitian( *rhs ) ) {
1798 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1799 }
1800
1801 matrix_ = *rhs;
1802
1803 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1804 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1805
1806 return *this;
1807}
1809//*************************************************************************************************
1810
1811
1812//*************************************************************************************************
1825template< typename MT // Type of the adapted dense matrix
1826 , bool SO > // Storage order of the adapted dense matrix
1827template< typename MT2 // Type of the right-hand side matrix
1828 , bool SO2 > // Storage order of the right-hand side matrix
1829inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1830 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1831{
1832 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1833 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1834 }
1835
1836 if( IsHermitian_v<MT2> ) {
1837 matrix_ = *rhs;
1838 }
1839 else {
1840 MT tmp( *rhs );
1841
1842 if( !isHermitian( tmp ) ) {
1843 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1844 }
1845
1846 matrix_ = std::move( tmp );
1847 }
1848
1849 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1850 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1851
1852 return *this;
1853}
1855//*************************************************************************************************
1856
1857
1858//*************************************************************************************************
1871template< typename MT // Type of the adapted dense matrix
1872 , bool SO > // Storage order of the adapted dense matrix
1873template< typename MT2 > // Type of the right-hand side matrix
1874inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1875 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1876{
1877 return this->operator=( trans( *rhs ) );
1878}
1880//*************************************************************************************************
1881
1882
1883//*************************************************************************************************
1896template< typename MT // Type of the adapted dense matrix
1897 , bool SO > // Storage order of the adapted dense matrix
1898template< typename MT2 // Type of the right-hand side matrix
1899 , bool SO2 > // Storage order of the right-hand side matrix
1900inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1901 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1902{
1903 if( !IsHermitian_v<MT2> && !isHermitian( *rhs ) ) {
1904 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1905 }
1906
1907 matrix_ += *rhs;
1908
1909 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1910 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1911
1912 return *this;
1913}
1915//*************************************************************************************************
1916
1917
1918//*************************************************************************************************
1931template< typename MT // Type of the adapted dense matrix
1932 , bool SO > // Storage order of the adapted dense matrix
1933template< typename MT2 // Type of the right-hand side matrix
1934 , bool SO2 > // Storage order of the right-hand side matrix
1935inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1936 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1937{
1938 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1939 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1940 }
1941
1942 if( IsHermitian_v<MT2> ) {
1943 matrix_ += *rhs;
1944 }
1945 else {
1946 const ResultType_t<MT2> tmp( *rhs );
1947
1948 if( !isHermitian( tmp ) ) {
1949 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1950 }
1951
1952 matrix_ += tmp;
1953 }
1954
1955 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1956 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1957
1958 return *this;
1959}
1961//*************************************************************************************************
1962
1963
1964//*************************************************************************************************
1978template< typename MT // Type of the adapted dense matrix
1979 , bool SO > // Storage order of the adapted dense matrix
1980template< typename MT2 > // Type of the right-hand side matrix
1981inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1982 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1983{
1984 return this->operator+=( trans( *rhs ) );
1985}
1987//*************************************************************************************************
1988
1989
1990//*************************************************************************************************
2003template< typename MT // Type of the adapted dense matrix
2004 , bool SO > // Storage order of the adapted dense matrix
2005template< typename MT2 // Type of the right-hand side matrix
2006 , bool SO2 > // Storage order of the right-hand side matrix
2007inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2008 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2009{
2010 if( !IsHermitian_v<MT2> && !isHermitian( *rhs ) ) {
2011 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2012 }
2013
2014 matrix_ -= *rhs;
2015
2016 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2017 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2018
2019 return *this;
2020}
2022//*************************************************************************************************
2023
2024
2025//*************************************************************************************************
2038template< typename MT // Type of the adapted dense matrix
2039 , bool SO > // Storage order of the adapted dense matrix
2040template< typename MT2 // Type of the right-hand side matrix
2041 , bool SO2 > // Storage order of the right-hand side matrix
2042inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2043 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2044{
2045 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
2046 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2047 }
2048
2049 if( IsHermitian_v<MT2> ) {
2050 matrix_ -= *rhs;
2051 }
2052 else {
2053 const ResultType_t<MT2> tmp( *rhs );
2054
2055 if( !isHermitian( tmp ) ) {
2056 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2057 }
2058
2059 matrix_ -= tmp;
2060 }
2061
2062 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2063 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2064
2065 return *this;
2066}
2068//*************************************************************************************************
2069
2070
2071//*************************************************************************************************
2085template< typename MT // Type of the adapted dense matrix
2086 , bool SO > // Storage order of the adapted dense matrix
2087template< typename MT2 > // Type of the right-hand side matrix
2088inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2089 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2090{
2091 return this->operator-=( trans( *rhs ) );
2092}
2094//*************************************************************************************************
2095
2096
2097//*************************************************************************************************
2111template< typename MT // Type of the adapted dense matrix
2112 , bool SO > // Storage order of the adapted dense matrix
2113template< typename MT2 // Type of the right-hand side matrix
2114 , bool SO2 > // Storage order of the right-hand side matrix
2115inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2116 -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2117{
2118 if( !IsHermitian_v<MT2> && !isHermitian( *rhs ) ) {
2119 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2120 }
2121
2122 matrix_ %= *rhs;
2123
2124 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2125 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2126
2127 return *this;
2128}
2130//*************************************************************************************************
2131
2132
2133//*************************************************************************************************
2147template< typename MT // Type of the adapted dense matrix
2148 , bool SO > // Storage order of the adapted dense matrix
2149template< typename MT2 // Type of the right-hand side matrix
2150 , bool SO2 > // Storage order of the right-hand side matrix
2151inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2152 -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2153{
2154 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
2155 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2156 }
2157
2158 if( IsHermitian_v<MT2> ) {
2159 matrix_ %= *rhs;
2160 }
2161 else {
2162 const ResultType_t<MT2> tmp( *rhs );
2163
2164 if( !isHermitian( tmp ) ) {
2165 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2166 }
2167
2168 matrix_ %= tmp;
2169 }
2170
2171 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2172 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2173
2174 return *this;
2175}
2177//*************************************************************************************************
2178
2179
2180//*************************************************************************************************
2194template< typename MT // Type of the adapted dense matrix
2195 , bool SO > // Storage order of the adapted dense matrix
2196template< typename MT2 > // Type of the right-hand side matrix
2197inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2198 -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2199{
2200 return this->operator%=( trans( *rhs ) );
2201}
2203//*************************************************************************************************
2204
2205
2206//*************************************************************************************************
2214template< typename MT // Type of the adapted dense matrix
2215 , bool SO > // Storage order of the adapted dense matrix
2216template< typename ST > // Data type of the right-hand side scalar
2217inline auto HermitianMatrix<MT,SO,true>::operator*=( ST rhs )
2218 -> EnableIf_t< IsScalar_v<ST>, HermitianMatrix& >
2219{
2220 matrix_ *= rhs;
2221 return *this;
2222}
2223//*************************************************************************************************
2224
2225
2226//*************************************************************************************************
2234template< typename MT // Type of the adapted dense matrix
2235 , bool SO > // Storage order of the adapted dense matrix
2236template< typename ST > // Data type of the right-hand side scalar
2237inline auto HermitianMatrix<MT,SO,true>::operator/=( ST rhs )
2238 -> EnableIf_t< IsScalar_v<ST>, HermitianMatrix& >
2239{
2240 BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2241
2242 matrix_ /= rhs;
2243 return *this;
2244}
2246//*************************************************************************************************
2247
2248
2249
2250
2251//=================================================================================================
2252//
2253// UTILITY FUNCTIONS
2254//
2255//=================================================================================================
2256
2257//*************************************************************************************************
2263template< typename MT // Type of the adapted dense matrix
2264 , bool SO > // Storage order of the adapted dense matrix
2265inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2266{
2267 return matrix_.rows();
2268}
2270//*************************************************************************************************
2271
2272
2273//*************************************************************************************************
2279template< typename MT // Type of the adapted dense matrix
2280 , bool SO > // Storage order of the adapted dense matrix
2281inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2282{
2283 return matrix_.columns();
2284}
2286//*************************************************************************************************
2287
2288
2289//*************************************************************************************************
2301template< typename MT // Type of the adapted dense matrix
2302 , bool SO > // Storage order of the adapted dense matrix
2303inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2304{
2305 return matrix_.spacing();
2306}
2308//*************************************************************************************************
2309
2310
2311//*************************************************************************************************
2317template< typename MT // Type of the adapted dense matrix
2318 , bool SO > // Storage order of the adapted dense matrix
2319inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2320{
2321 return matrix_.capacity();
2322}
2324//*************************************************************************************************
2325
2326
2327//*************************************************************************************************
2338template< typename MT // Type of the adapted dense matrix
2339 , bool SO > // Storage order of the adapted dense matrix
2340inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2341{
2342 return matrix_.capacity(i);
2343}
2345//*************************************************************************************************
2346
2347
2348//*************************************************************************************************
2354template< typename MT // Type of the adapted dense matrix
2355 , bool SO > // Storage order of the adapted dense matrix
2356inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2357{
2358 return matrix_.nonZeros();
2359}
2361//*************************************************************************************************
2362
2363
2364//*************************************************************************************************
2376template< typename MT // Type of the adapted dense matrix
2377 , bool SO > // Storage order of the adapted dense matrix
2378inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2379{
2380 return matrix_.nonZeros(i);
2381}
2383//*************************************************************************************************
2384
2385
2386//*************************************************************************************************
2392template< typename MT // Type of the adapted dense matrix
2393 , bool SO > // Storage order of the adapted dense matrix
2395{
2396 matrix_.reset();
2397}
2399//*************************************************************************************************
2400
2401
2402//*************************************************************************************************
2438template< typename MT // Type of the adapted dense matrix
2439 , bool SO > // Storage order of the adapted dense matrix
2440inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2441{
2442 row ( matrix_, i, unchecked ).reset();
2443 column( matrix_, i, unchecked ).reset();
2444}
2446//*************************************************************************************************
2447
2448
2449//*************************************************************************************************
2461template< typename MT // Type of the adapted dense matrix
2462 , bool SO > // Storage order of the adapted dense matrix
2464{
2465 matrix_.clear();
2466
2467 BLAZE_INTERNAL_ASSERT( matrix_.rows() == 0UL, "Invalid number of rows" );
2468 BLAZE_INTERNAL_ASSERT( matrix_.columns() == 0UL, "Invalid number of columns" );
2469}
2471//*************************************************************************************************
2472
2473
2474//*************************************************************************************************
2509template< typename MT // Type of the adapted dense matrix
2510 , bool SO > // Storage order of the adapted dense matrix
2511void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2512{
2514
2515 MAYBE_UNUSED( preserve );
2516
2517 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2518
2519 const size_t oldsize( matrix_.rows() );
2520
2521 matrix_.resize( n, n, true );
2522
2523 if( n > oldsize ) {
2524 const size_t increment( n - oldsize );
2525 submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2526 submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2527 }
2528}
2530//*************************************************************************************************
2531
2532
2533//*************************************************************************************************
2546template< typename MT // Type of the adapted dense matrix
2547 , bool SO > // Storage order of the adapted dense matrix
2548inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2549{
2551
2552 MAYBE_UNUSED( preserve );
2553
2554 resize( rows() + n, true );
2555}
2556//*************************************************************************************************
2557
2558
2559//*************************************************************************************************
2569template< typename MT // Type of the adapted dense matrix
2570 , bool SO > // Storage order of the adapted dense matrix
2571inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2572{
2573 matrix_.reserve( elements );
2574}
2576//*************************************************************************************************
2577
2578
2579//*************************************************************************************************
2589template< typename MT // Type of the adapted dense matrix
2590 , bool SO > // Storage order of the adapted dense matrix
2592{
2593 matrix_.shrinkToFit();
2594}
2596//*************************************************************************************************
2597
2598
2599//*************************************************************************************************
2606template< typename MT // Type of the adapted dense matrix
2607 , bool SO > // Storage order of the adapted dense matrix
2608inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2609{
2610 using std::swap;
2611
2612 swap( matrix_, m.matrix_ );
2613}
2615//*************************************************************************************************
2616
2617
2618
2619
2620//=================================================================================================
2621//
2622// NUMERIC FUNCTIONS
2623//
2624//=================================================================================================
2625
2626//*************************************************************************************************
2632template< typename MT // Type of the adapted dense matrix
2633 , bool SO > // Storage order of the adapted dense matrix
2634inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2635{
2636 if( IsComplex_v<ElementType> )
2637 matrix_.transpose();
2638 return *this;
2639}
2641//*************************************************************************************************
2642
2643
2644//*************************************************************************************************
2650template< typename MT // Type of the adapted dense matrix
2651 , bool SO > // Storage order of the adapted dense matrix
2652inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2653{
2654 return *this;
2655}
2657//*************************************************************************************************
2658
2659
2660//*************************************************************************************************
2678template< typename MT // Type of the adapted dense matrix
2679 , bool SO > // Storage order of the adapted dense matrix
2680template< typename Other > // Data type of the scalar value
2681inline HermitianMatrix<MT,SO,true>&
2682 HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2683{
2684 matrix_.scale( scalar );
2685 return *this;
2686}
2688//*************************************************************************************************
2689
2690
2691
2692
2693//=================================================================================================
2694//
2695// DEBUGGING FUNCTIONS
2696//
2697//=================================================================================================
2698
2699//*************************************************************************************************
2709template< typename MT // Type of the adapted dense matrix
2710 , bool SO > // Storage order of the adapted dense matrix
2711inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2712{
2713 using blaze::isIntact;
2714
2715 return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2716}
2718//*************************************************************************************************
2719
2720
2721
2722
2723//=================================================================================================
2724//
2725// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2726//
2727//=================================================================================================
2728
2729//*************************************************************************************************
2740template< typename MT // Type of the adapted dense matrix
2741 , bool SO > // Storage order of the adapted dense matrix
2742template< typename Other > // Data type of the foreign expression
2743inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2744{
2745 return matrix_.canAlias( alias );
2746}
2748//*************************************************************************************************
2749
2750
2751//*************************************************************************************************
2762template< typename MT // Type of the adapted dense matrix
2763 , bool SO > // Storage order of the adapted dense matrix
2764template< typename Other > // Data type of the foreign expression
2765inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2766{
2767 return matrix_.isAliased( alias );
2768}
2770//*************************************************************************************************
2771
2772
2773//*************************************************************************************************
2783template< typename MT // Type of the adapted dense matrix
2784 , bool SO > // Storage order of the adapted dense matrix
2785inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2786{
2787 return matrix_.isAligned();
2788}
2790//*************************************************************************************************
2791
2792
2793//*************************************************************************************************
2804template< typename MT // Type of the adapted dense matrix
2805 , bool SO > // Storage order of the adapted dense matrix
2806inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2807{
2808 return matrix_.canSMPAssign();
2809}
2811//*************************************************************************************************
2812
2813
2814//*************************************************************************************************
2830template< typename MT // Type of the adapted dense matrix
2831 , bool SO > // Storage order of the adapted dense matrix
2832BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2833 HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2834{
2835 return matrix_.load( i, j );
2836}
2838//*************************************************************************************************
2839
2840
2841//*************************************************************************************************
2857template< typename MT // Type of the adapted dense matrix
2858 , bool SO > // Storage order of the adapted dense matrix
2859BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2860 HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2861{
2862 return matrix_.loada( i, j );
2863}
2865//*************************************************************************************************
2866
2867
2868//*************************************************************************************************
2884template< typename MT // Type of the adapted dense matrix
2885 , bool SO > // Storage order of the adapted dense matrix
2886BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2887 HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2888{
2889 return matrix_.loadu( i, j );
2890}
2892//*************************************************************************************************
2893
2894
2895//*************************************************************************************************
2912template< typename MT // Type of the adapted dense matrix
2913 , bool SO > // Storage order of the adapted dense matrix
2914inline void
2915 HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2916{
2917 matrix_.store( i, j, value );
2918
2919 if( SO ) {
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) );
2923 }
2924 else {
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) );
2928 }
2929}
2931//*************************************************************************************************
2932
2933
2934//*************************************************************************************************
2951template< typename MT // Type of the adapted dense matrix
2952 , bool SO > // Storage order of the adapted dense matrix
2953inline void
2954 HermitianMatrix<MT,SO,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2955{
2956 matrix_.storea( i, j, value );
2957
2958 if( SO ) {
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) );
2962 }
2963 else {
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) );
2967 }
2968}
2970//*************************************************************************************************
2971
2972
2973//*************************************************************************************************
2990template< typename MT // Type of the adapted dense matrix
2991 , bool SO > // Storage order of the adapted dense matrix
2992inline void
2993 HermitianMatrix<MT,SO,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2994{
2995 matrix_.storeu( i, j, value );
2996
2997 if( SO ) {
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) );
3001 }
3002 else {
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) );
3006 }
3007}
3009//*************************************************************************************************
3010
3011
3012//*************************************************************************************************
3029template< typename MT // Type of the adapted dense matrix
3030 , bool SO > // Storage order of the adapted dense matrix
3031inline void
3032 HermitianMatrix<MT,SO,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3033{
3034 matrix_.stream( i, j, value );
3035
3036 if( SO ) {
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) );
3040 }
3041 else {
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) );
3045 }
3046}
3048//*************************************************************************************************
3049
3050
3051
3052
3053//=================================================================================================
3054//
3055// CONSTRUCTION FUNCTIONS
3056//
3057//=================================================================================================
3058
3059//*************************************************************************************************
3061template< typename MT // Type of the adapted dense matrix
3062 , bool SO > // Storage order of the adapted dense matrix
3063template< typename MT2 // Type of the foreign matrix
3064 , bool SO2 // Storage order of the foreign matrix
3065 , typename T > // Type of the third argument
3066inline decltype(auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3067{
3068 return *m;
3069}
3071//*************************************************************************************************
3072
3073
3074//*************************************************************************************************
3076template< typename MT // Type of the adapted dense matrix
3077 , bool SO > // Storage order of the adapted dense matrix
3078template< typename MT2 > // Type of the foreign matrix
3079inline decltype(auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
3080{
3081 return trans( *m );
3082}
3084//*************************************************************************************************
3085
3086} // namespace blaze
3087
3088#endif
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.
Compile time assertion.
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.
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.