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>
57 #include <blaze/math/Exception.h>
62 #include <blaze/math/shims/Clear.h>
64 #include <blaze/math/SIMD.h>
72 #include <blaze/math/views/Row.h>
74 #include <blaze/system/Inline.h>
76 #include <blaze/util/Assert.h>
82 #include <blaze/util/DisableIf.h>
83 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/mpl/If.h>
86 #include <blaze/util/TrueType.h>
87 #include <blaze/util/Types.h>
91 #include <blaze/util/Unused.h>
92 
93 
94 namespace blaze {
95 
96 //=================================================================================================
97 //
98 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
99 //
100 //=================================================================================================
101 
102 //*************************************************************************************************
110 template< typename MT // Type of the adapted dense matrix
111  , bool SO > // Storage order of the adapted dense matrix
112 class HermitianMatrix<MT,SO,true>
113  : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
114 {
115  private:
116  //**Type definitions****************************************************************************
117  using OT = OppositeType_<MT>;
118  using TT = TransposeType_<MT>;
119  using ET = ElementType_<MT>;
120  //**********************************************************************************************
121 
122  public:
123  //**Type definitions****************************************************************************
124  using This = HermitianMatrix<MT,SO,true>;
125  using BaseType = DenseMatrix<This,SO>;
126  using ResultType = This;
127  using OppositeType = HermitianMatrix<OT,!SO,true>;
128  using TransposeType = HermitianMatrix<TT,!SO,true>;
129  using ElementType = ET;
130  using SIMDType = SIMDType_<MT>;
131  using ReturnType = ReturnType_<MT>;
132  using CompositeType = const This&;
133  using Reference = HermitianProxy<MT>;
134  using ConstReference = ConstReference_<MT>;
135  using Pointer = Pointer_<MT>;
136  using ConstPointer = ConstPointer_<MT>;
137  using ConstIterator = ConstIterator_<MT>;
138  //**********************************************************************************************
139 
140  //**Rebind struct definition********************************************************************
143  template< typename NewType > // Data type of the other matrix
144  struct Rebind {
146  using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
147  };
148  //**********************************************************************************************
149 
150  //**Resize struct definition********************************************************************
153  template< size_t NewM // Number of rows of the other matrix
154  , size_t NewN > // Number of columns of the other matrix
155  struct Resize {
157  using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
158  };
159  //**********************************************************************************************
160 
161  //**Iterator class definition*******************************************************************
164  class Iterator
165  {
166  public:
167  //**Type definitions*************************************************************************
168  using IteratorCategory = std::random_access_iterator_tag;
169  using ValueType = ElementType_<MT>;
170  using PointerType = HermitianProxy<MT>;
171  using ReferenceType = HermitianProxy<MT>;
172  using DifferenceType = ptrdiff_t;
173 
174  // STL iterator requirements
175  using iterator_category = IteratorCategory;
176  using value_type = ValueType;
177  using pointer = PointerType;
178  using reference = ReferenceType;
179  using difference_type = DifferenceType;
180  //*******************************************************************************************
181 
182  //**Constructor******************************************************************************
185  inline Iterator() noexcept
186  : matrix_( nullptr ) // Reference to the adapted dense matrix
187  , row_ ( 0UL ) // The current row index of the iterator
188  , column_( 0UL ) // The current column index of the iterator
189  {}
190  //*******************************************************************************************
191 
192  //**Constructor******************************************************************************
199  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
200  : matrix_( &matrix ) // Reference to the adapted dense matrix
201  , row_ ( row ) // The current row index of the iterator
202  , column_( column ) // The current column index of the iterator
203  {}
204  //*******************************************************************************************
205 
206  //**Addition assignment operator*************************************************************
212  inline Iterator& operator+=( size_t inc ) noexcept {
213  ( SO )?( row_ += inc ):( column_ += inc );
214  return *this;
215  }
216  //*******************************************************************************************
217 
218  //**Subtraction assignment operator**********************************************************
224  inline Iterator& operator-=( size_t dec ) noexcept {
225  ( SO )?( row_ -= dec ):( column_ -= dec );
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Prefix increment operator****************************************************************
235  inline Iterator& operator++() noexcept {
236  ( SO )?( ++row_ ):( ++column_ );
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Postfix increment operator***************************************************************
246  inline const Iterator operator++( int ) noexcept {
247  const Iterator tmp( *this );
248  ++(*this);
249  return tmp;
250  }
251  //*******************************************************************************************
252 
253  //**Prefix decrement operator****************************************************************
258  inline Iterator& operator--() noexcept {
259  ( SO )?( --row_ ):( --column_ );
260  return *this;
261  }
262  //*******************************************************************************************
263 
264  //**Postfix decrement operator***************************************************************
269  inline const Iterator operator--( int ) noexcept {
270  const Iterator tmp( *this );
271  --(*this);
272  return tmp;
273  }
274  //*******************************************************************************************
275 
276  //**Element access operator******************************************************************
281  inline ReferenceType operator*() const {
282  return ReferenceType( *matrix_, row_, column_ );
283  }
284  //*******************************************************************************************
285 
286  //**Element access operator******************************************************************
291  inline PointerType operator->() const {
292  return PointerType( *matrix_, row_, column_ );
293  }
294  //*******************************************************************************************
295 
296  //**Load function****************************************************************************
306  inline SIMDType load() const {
307  return (*matrix_).load(row_,column_);
308  }
309  //*******************************************************************************************
310 
311  //**Loada function***************************************************************************
321  inline SIMDType loada() const {
322  return (*matrix_).loada(row_,column_);
323  }
324  //*******************************************************************************************
325 
326  //**Loadu function***************************************************************************
336  inline SIMDType loadu() const {
337  return (*matrix_).loadu(row_,column_);
338  }
339  //*******************************************************************************************
340 
341  //**Store function***************************************************************************
352  inline void store( const SIMDType& value ) const {
353  (*matrix_).store( row_, column_, value );
354  sync();
355  }
356  //*******************************************************************************************
357 
358  //**Storea function**************************************************************************
369  inline void storea( const SIMDType& value ) const {
370  (*matrix_).storea( row_, column_, value );
371  sync();
372  }
373  //*******************************************************************************************
374 
375  //**Storeu function**************************************************************************
386  inline void storeu( const SIMDType& value ) const {
387  (*matrix_).storeu( row_, column_, value );
388  sync();
389  }
390  //*******************************************************************************************
391 
392  //**Stream function**************************************************************************
403  inline void stream( const SIMDType& value ) const {
404  (*matrix_).stream( row_, column_, value );
405  sync();
406  }
407  //*******************************************************************************************
408 
409  //**Conversion operator**********************************************************************
414  inline operator ConstIterator() const {
415  if( SO )
416  return matrix_->begin( column_ ) + row_;
417  else
418  return matrix_->begin( row_ ) + column_;
419  }
420  //*******************************************************************************************
421 
422  //**Equality operator************************************************************************
429  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
430  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
431  }
432  //*******************************************************************************************
433 
434  //**Equality operator************************************************************************
441  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
442  return ( ConstIterator( lhs ) == rhs );
443  }
444  //*******************************************************************************************
445 
446  //**Equality operator************************************************************************
453  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
454  return ( lhs == ConstIterator( rhs ) );
455  }
456  //*******************************************************************************************
457 
458  //**Inequality operator**********************************************************************
465  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
466  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
467  }
468  //*******************************************************************************************
469 
470  //**Inequality operator**********************************************************************
477  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
478  return ( ConstIterator( lhs ) != rhs );
479  }
480  //*******************************************************************************************
481 
482  //**Inequality operator**********************************************************************
489  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
490  return ( lhs != ConstIterator( rhs ) );
491  }
492  //*******************************************************************************************
493 
494  //**Less-than operator***********************************************************************
501  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
502  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
503  }
504  //*******************************************************************************************
505 
506  //**Less-than operator***********************************************************************
513  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
514  return ( ConstIterator( lhs ) < rhs );
515  }
516  //*******************************************************************************************
517 
518  //**Less-than operator***********************************************************************
525  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
526  return ( lhs < ConstIterator( rhs ) );
527  }
528  //*******************************************************************************************
529 
530  //**Greater-than operator********************************************************************
537  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
538  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
539  }
540  //*******************************************************************************************
541 
542  //**Greater-than operator********************************************************************
549  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
550  return ( ConstIterator( lhs ) > rhs );
551  }
552  //*******************************************************************************************
553 
554  //**Greater-than operator********************************************************************
561  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
562  return ( lhs > ConstIterator( rhs ) );
563  }
564  //*******************************************************************************************
565 
566  //**Less-or-equal-than operator**************************************************************
573  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
574  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
575  }
576  //*******************************************************************************************
577 
578  //**Less-or-equal-than operator**************************************************************
585  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
586  return ( ConstIterator( lhs ) <= rhs );
587  }
588  //*******************************************************************************************
589 
590  //**Less-or-equal-than operator**************************************************************
597  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
598  return ( lhs <= ConstIterator( rhs ) );
599  }
600  //*******************************************************************************************
601 
602  //**Greater-or-equal-than operator***********************************************************
609  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
610  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
611  }
612  //*******************************************************************************************
613 
614  //**Greater-or-equal-than operator***********************************************************
621  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
622  return ( ConstIterator( lhs ) >= rhs );
623  }
624  //*******************************************************************************************
625 
626  //**Greater-or-equal-than operator***********************************************************
633  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
634  return ( lhs >= ConstIterator( rhs ) );
635  }
636  //*******************************************************************************************
637 
638  //**Subtraction operator*********************************************************************
644  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
645  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
646  }
647  //*******************************************************************************************
648 
649  //**Addition operator************************************************************************
656  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
657  if( SO )
658  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
659  else
660  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
661  }
662  //*******************************************************************************************
663 
664  //**Addition operator************************************************************************
671  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
672  if( SO )
673  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
674  else
675  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
676  }
677  //*******************************************************************************************
678 
679  //**Subtraction operator*********************************************************************
686  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
687  if( SO )
688  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
689  else
690  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
691  }
692  //*******************************************************************************************
693 
694  private:
695  //**Sync function****************************************************************************
700  void sync() const {
701  if( SO ) {
702  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
703  for( size_t k=row_; k<kend; ++k )
704  (*matrix_)(column_,k) = conj( (*matrix_)(k,column_) );
705  }
706  else {
707  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
708  for( size_t k=column_; k<kend; ++k )
709  (*matrix_)(k,row_) = conj( (*matrix_)(row_,k) );
710  }
711  }
712  //*******************************************************************************************
713 
714  //**Member variables*************************************************************************
715  MT* matrix_;
716  size_t row_;
717  size_t column_;
718  //*******************************************************************************************
719  };
720  //**********************************************************************************************
721 
722  //**Compilation flags***************************************************************************
724  enum : bool { simdEnabled = MT::simdEnabled };
725 
727  enum : bool { smpAssignable = MT::smpAssignable };
728  //**********************************************************************************************
729 
730  //**Constructors********************************************************************************
733  explicit inline HermitianMatrix();
734  explicit inline HermitianMatrix( size_t n );
735  explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
736 
737  template< typename Other >
738  explicit inline HermitianMatrix( size_t n, const Other* array );
739 
740  template< typename Other, size_t N >
741  explicit inline HermitianMatrix( const Other (&array)[N][N] );
742 
743  explicit inline HermitianMatrix( ElementType* ptr, size_t n );
744  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
745 
746  inline HermitianMatrix( const HermitianMatrix& m );
747  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
748 
749  template< typename MT2, bool SO2 >
750  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
752  //**********************************************************************************************
753 
754  //**Destructor**********************************************************************************
755  // No explicitly declared destructor.
756  //**********************************************************************************************
757 
758  //**Data access functions***********************************************************************
761  inline Reference operator()( size_t i, size_t j );
762  inline ConstReference operator()( size_t i, size_t j ) const;
763  inline Reference at( size_t i, size_t j );
764  inline ConstReference at( size_t i, size_t j ) const;
765  inline ConstPointer data () const noexcept;
766  inline ConstPointer data ( size_t i ) const noexcept;
767  inline Iterator begin ( size_t i );
768  inline ConstIterator begin ( size_t i ) const;
769  inline ConstIterator cbegin( size_t i ) const;
770  inline Iterator end ( size_t i );
771  inline ConstIterator end ( size_t i ) const;
772  inline ConstIterator cend ( size_t i ) const;
774  //**********************************************************************************************
775 
776  //**Assignment operators************************************************************************
779  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
780 
781  template< typename Other, size_t N >
782  inline HermitianMatrix& operator=( const Other (&array)[N][N] );
783 
784  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
785  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
786 
787  template< typename MT2, bool SO2 >
788  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
789 
790  template< typename MT2, bool SO2 >
791  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
792 
793  template< typename MT2 >
794  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
795  operator=( const Matrix<MT2,!SO>& rhs );
796 
797  template< typename MT2, bool SO2 >
798  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
799 
800  template< typename MT2, bool SO2 >
801  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
802 
803  template< typename MT2 >
804  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
805  operator+=( const Matrix<MT2,!SO>& rhs );
806 
807  template< typename MT2, bool SO2 >
808  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
809 
810  template< typename MT2, bool SO2 >
811  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
812 
813  template< typename MT2 >
814  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
815  operator-=( const Matrix<MT2,!SO>& rhs );
816 
817  template< typename MT2, bool SO2 >
818  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator%=( const Matrix<MT2,SO2>& rhs );
819 
820  template< typename MT2, bool SO2 >
821  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator%=( const Matrix<MT2,SO2>& rhs );
822 
823  template< typename MT2 >
824  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
825  operator%=( const Matrix<MT2,!SO>& rhs );
826 
827  template< typename MT2, bool SO2 >
828  inline HermitianMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
829 
830  template< typename Other >
831  inline EnableIf_< IsNumeric<Other>, HermitianMatrix >& operator*=( Other rhs );
832 
833  template< typename Other >
834  inline EnableIf_< IsNumeric<Other>, HermitianMatrix >& operator/=( Other rhs );
836  //**********************************************************************************************
837 
838  //**Utility functions***************************************************************************
841  inline size_t rows() const noexcept;
842  inline size_t columns() const noexcept;
843  inline size_t spacing() const noexcept;
844  inline size_t capacity() const noexcept;
845  inline size_t capacity( size_t i ) const noexcept;
846  inline size_t nonZeros() const;
847  inline size_t nonZeros( size_t i ) const;
848  inline void reset();
849  inline void reset( size_t i );
850  inline void clear();
851  void resize ( size_t n, bool preserve=true );
852  inline void extend ( size_t n, bool preserve=true );
853  inline void reserve( size_t elements );
854  inline void shrinkToFit();
855  inline void swap( HermitianMatrix& m ) noexcept;
857  //**********************************************************************************************
858 
859  //**Numeric functions***************************************************************************
862  inline HermitianMatrix& transpose();
863  inline HermitianMatrix& ctranspose();
864 
865  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
867  //**********************************************************************************************
868 
869  //**Debugging functions*************************************************************************
872  inline bool isIntact() const noexcept;
874  //**********************************************************************************************
875 
876  //**Expression template evaluation functions****************************************************
879  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
880  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
881 
882  inline bool isAligned () const noexcept;
883  inline bool canSMPAssign() const noexcept;
884 
885  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
886  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
887  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
888 
889  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
890  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
891  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
892  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
894  //**********************************************************************************************
895 
896  private:
897  //**Construction functions**********************************************************************
900  template< typename MT2, bool SO2, typename T >
901  inline const MT2& construct( const Matrix<MT2,SO2>& m, T );
902 
903  template< typename MT2 >
904  inline TransExprTrait_<MT2> construct( const Matrix<MT2,!SO>& m, TrueType );
906  //**********************************************************************************************
907 
908  //**SIMD properties*****************************************************************************
910  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
911  //**********************************************************************************************
912 
913  //**Member variables****************************************************************************
916  MT matrix_;
917 
918  //**********************************************************************************************
919 
920  //**Friend declarations*************************************************************************
921  template< bool RF, typename MT2, bool SO2, bool DF2 >
922  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
923 
924 
925  template< InversionFlag IF, typename MT2, bool SO2 >
926  friend void invert( HermitianMatrix<MT2,SO2,true>& m );
927  //**********************************************************************************************
928 
929  //**Compile time checks*************************************************************************
943  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
944  //**********************************************************************************************
945 };
947 //*************************************************************************************************
948 
949 
950 
951 
952 //=================================================================================================
953 //
954 // CONSTRUCTORS
955 //
956 //=================================================================================================
957 
958 //*************************************************************************************************
962 template< typename MT // Type of the adapted dense matrix
963  , bool SO > // Storage order of the adapted dense matrix
964 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
965  : matrix_() // The adapted dense matrix
966 {
967  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
968  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
969 }
971 //*************************************************************************************************
972 
973 
974 //*************************************************************************************************
980 template< typename MT // Type of the adapted dense matrix
981  , bool SO > // Storage order of the adapted dense matrix
982 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
983  : matrix_( n, n, ElementType() ) // The adapted dense matrix
984 {
986 
987  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
988  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
989 }
991 //*************************************************************************************************
992 
993 
994 //*************************************************************************************************
1020 template< typename MT // Type of the adapted dense matrix
1021  , bool SO > // Storage order of the adapted dense matrix
1022 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1023  : matrix_( list ) // The adapted dense matrix
1024 {
1025  if( !isHermitian( matrix_ ) ) {
1026  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1027  }
1028 
1029  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1030 }
1032 //*************************************************************************************************
1033 
1034 
1035 //*************************************************************************************************
1064 template< typename MT // Type of the adapted dense matrix
1065  , bool SO > // Storage order of the adapted dense matrix
1066 template< typename Other > // Data type of the initialization array
1067 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n, const Other* array )
1068  : matrix_( n, n, array ) // The adapted dense matrix
1069 {
1070  if( !isHermitian( matrix_ ) ) {
1071  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1072  }
1073 
1074  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1075 }
1077 //*************************************************************************************************
1078 
1079 
1080 //*************************************************************************************************
1105 template< typename MT // Type of the adapted dense matrix
1106  , bool SO > // Storage order of the adapted dense matrix
1107 template< typename Other // Data type of the initialization array
1108  , size_t N > // Number of rows and columns of the initialization array
1109 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Other (&array)[N][N] )
1110  : matrix_( array ) // The adapted dense matrix
1111 {
1112  if( !isHermitian( matrix_ ) ) {
1113  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1114  }
1115 
1116  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1117 }
1119 //*************************************************************************************************
1120 
1121 
1122 //*************************************************************************************************
1156 template< typename MT // Type of the adapted dense matrix
1157  , bool SO > // Storage order of the adapted dense matrix
1158 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n )
1159  : matrix_( ptr, n, n ) // The adapted dense matrix
1160 {
1161  if( !isHermitian( matrix_ ) ) {
1162  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1163  }
1164 
1165  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1166 }
1168 //*************************************************************************************************
1169 
1170 
1171 //*************************************************************************************************
1207 template< typename MT // Type of the adapted dense matrix
1208  , bool SO > // Storage order of the adapted dense matrix
1209 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn )
1210  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1211 {
1212  if( !isHermitian( matrix_ ) ) {
1213  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1214  }
1215 
1216  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1217 }
1219 //*************************************************************************************************
1220 
1221 
1222 //*************************************************************************************************
1228 template< typename MT // Type of the adapted dense matrix
1229  , bool SO > // Storage order of the adapted dense matrix
1230 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const HermitianMatrix& m )
1231  : matrix_( m.matrix_ ) // The adapted dense matrix
1232 {
1233  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1234  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1235 }
1237 //*************************************************************************************************
1238 
1239 
1240 //*************************************************************************************************
1246 template< typename MT // Type of the adapted dense matrix
1247  , bool SO > // Storage order of the adapted dense matrix
1248 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1249  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1250 {
1251  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1252  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1253 }
1255 //*************************************************************************************************
1256 
1257 
1258 //*************************************************************************************************
1268 template< typename MT // Type of the adapted dense matrix
1269  , bool SO > // Storage order of the adapted dense matrix
1270 template< typename MT2 // Type of the foreign matrix
1271  , bool SO2 > // Storage order of the foreign matrix
1272 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Matrix<MT2,SO2>& m )
1273  : matrix_( construct( m, typename IsBuiltin< ElementType_<MT2> >::Type() ) ) // The adapted dense matrix
1274 {
1275  if( !IsHermitian<MT2>::value && !isHermitian( matrix_ ) ) {
1276  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1277  }
1278 
1279  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1280 }
1282 //*************************************************************************************************
1283 
1284 
1285 
1286 
1287 //=================================================================================================
1288 //
1289 // DATA ACCESS FUNCTIONS
1290 //
1291 //=================================================================================================
1292 
1293 //*************************************************************************************************
1309 template< typename MT // Type of the adapted dense matrix
1310  , bool SO > // Storage order of the adapted dense matrix
1312  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1313 {
1314  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1315  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1316 
1317  return Reference( matrix_, i, j );
1318 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1339 template< typename MT // Type of the adapted dense matrix
1340  , bool SO > // Storage order of the adapted dense matrix
1342  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1343 {
1344  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1345  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1346 
1347  return matrix_(i,j);
1348 }
1350 //*************************************************************************************************
1351 
1352 
1353 //*************************************************************************************************
1370 template< typename MT // Type of the adapted dense matrix
1371  , bool SO > // Storage order of the adapted dense matrix
1373  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j )
1374 {
1375  if( i >= rows() ) {
1376  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1377  }
1378  if( j >= columns() ) {
1379  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1380  }
1381  return (*this)(i,j);
1382 }
1384 //*************************************************************************************************
1385 
1386 
1387 //*************************************************************************************************
1404 template< typename MT // Type of the adapted dense matrix
1405  , bool SO > // Storage order of the adapted dense matrix
1407  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1408 {
1409  if( i >= rows() ) {
1410  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1411  }
1412  if( j >= columns() ) {
1413  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1414  }
1415  return (*this)(i,j);
1416 }
1418 //*************************************************************************************************
1419 
1420 
1421 //*************************************************************************************************
1435 template< typename MT // Type of the adapted dense matrix
1436  , bool SO > // Storage order of the adapted dense matrix
1437 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1438  HermitianMatrix<MT,SO,true>::data() const noexcept
1439 {
1440  return matrix_.data();
1441 }
1443 //*************************************************************************************************
1444 
1445 
1446 //*************************************************************************************************
1457 template< typename MT // Type of the adapted dense matrix
1458  , bool SO > // Storage order of the adapted dense matrix
1459 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1460  HermitianMatrix<MT,SO,true>::data( size_t i ) const noexcept
1461 {
1462  return matrix_.data(i);
1463 }
1465 //*************************************************************************************************
1466 
1467 
1468 //*************************************************************************************************
1480 template< typename MT // Type of the adapted dense matrix
1481  , bool SO > // Storage order of the adapted dense matrix
1484 {
1485  if( SO )
1486  return Iterator( matrix_, 0UL, i );
1487  else
1488  return Iterator( matrix_, i, 0UL );
1489 }
1491 //*************************************************************************************************
1492 
1493 
1494 //*************************************************************************************************
1506 template< typename MT // Type of the adapted dense matrix
1507  , bool SO > // Storage order of the adapted dense matrix
1509  HermitianMatrix<MT,SO,true>::begin( size_t i ) const
1510 {
1511  return matrix_.begin(i);
1512 }
1514 //*************************************************************************************************
1515 
1516 
1517 //*************************************************************************************************
1529 template< typename MT // Type of the adapted dense matrix
1530  , bool SO > // Storage order of the adapted dense matrix
1532  HermitianMatrix<MT,SO,true>::cbegin( size_t i ) const
1533 {
1534  return matrix_.cbegin(i);
1535 }
1537 //*************************************************************************************************
1538 
1539 
1540 //*************************************************************************************************
1552 template< typename MT // Type of the adapted dense matrix
1553  , bool SO > // Storage order of the adapted dense matrix
1556 {
1557  if( SO )
1558  return Iterator( matrix_, rows(), i );
1559  else
1560  return Iterator( matrix_, i, columns() );
1561 }
1563 //*************************************************************************************************
1564 
1565 
1566 //*************************************************************************************************
1578 template< typename MT // Type of the adapted dense matrix
1579  , bool SO > // Storage order of the adapted dense matrix
1581  HermitianMatrix<MT,SO,true>::end( size_t i ) const
1582 {
1583  return matrix_.end(i);
1584 }
1586 //*************************************************************************************************
1587 
1588 
1589 //*************************************************************************************************
1601 template< typename MT // Type of the adapted dense matrix
1602  , bool SO > // Storage order of the adapted dense matrix
1604  HermitianMatrix<MT,SO,true>::cend( size_t i ) const
1605 {
1606  return matrix_.cend(i);
1607 }
1609 //*************************************************************************************************
1610 
1611 
1612 
1613 
1614 //=================================================================================================
1615 //
1616 // ASSIGNMENT OPERATORS
1617 //
1618 //=================================================================================================
1619 
1620 //*************************************************************************************************
1646 template< typename MT // Type of the adapted dense matrix
1647  , bool SO > // Storage order of the adapted dense matrix
1648 inline HermitianMatrix<MT,SO,true>&
1649  HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1650 {
1651  MT tmp( list );
1652 
1653  if( !isHermitian( tmp ) ) {
1654  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1655  }
1656 
1657  matrix_ = std::move( tmp );
1658 
1659  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1660  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1661 
1662  return *this;
1663 }
1665 //*************************************************************************************************
1666 
1667 
1668 //*************************************************************************************************
1694 template< typename MT // Type of the adapted dense matrix
1695  , bool SO > // Storage order of the adapted dense matrix
1696 template< typename Other // Data type of the initialization array
1697  , size_t N > // Number of rows and columns of the initialization array
1698 inline HermitianMatrix<MT,SO,true>&
1699  HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1700 {
1701  MT tmp( array );
1702 
1703  if( !isHermitian( tmp ) ) {
1704  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1705  }
1706 
1707  matrix_ = std::move( tmp );
1708 
1709  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1710  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1711 
1712  return *this;
1713 }
1715 //*************************************************************************************************
1716 
1717 
1718 //*************************************************************************************************
1728 template< typename MT // Type of the adapted dense matrix
1729  , bool SO > // Storage order of the adapted dense matrix
1730 inline HermitianMatrix<MT,SO,true>&
1731  HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1732 {
1733  matrix_ = rhs.matrix_;
1734 
1735  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1736  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1737 
1738  return *this;
1739 }
1741 //*************************************************************************************************
1742 
1743 
1744 //*************************************************************************************************
1751 template< typename MT // Type of the adapted dense matrix
1752  , bool SO > // Storage order of the adapted dense matrix
1753 inline HermitianMatrix<MT,SO,true>&
1754  HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1755 {
1756  matrix_ = std::move( rhs.matrix_ );
1757 
1758  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1759  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1760 
1761  return *this;
1762 }
1764 //*************************************************************************************************
1765 
1766 
1767 //*************************************************************************************************
1780 template< typename MT // Type of the adapted dense matrix
1781  , bool SO > // Storage order of the adapted dense matrix
1782 template< typename MT2 // Type of the right-hand side matrix
1783  , bool SO2 > // Storage order of the right-hand side matrix
1784 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1785  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1786 {
1787  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1788  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1789  }
1790 
1791  matrix_ = ~rhs;
1792 
1793  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1794  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1795 
1796  return *this;
1797 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1815 template< typename MT // Type of the adapted dense matrix
1816  , bool SO > // Storage order of the adapted dense matrix
1817 template< typename MT2 // Type of the right-hand side matrix
1818  , bool SO2 > // Storage order of the right-hand side matrix
1819 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1820  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1821 {
1822  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1823  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1824  }
1825 
1826  if( IsHermitian<MT2>::value ) {
1827  matrix_ = ~rhs;
1828  }
1829  else {
1830  MT tmp( ~rhs );
1831 
1832  if( !isHermitian( tmp ) ) {
1833  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1834  }
1835 
1836  matrix_ = std::move( tmp );
1837  }
1838 
1839  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1840  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1841 
1842  return *this;
1843 }
1845 //*************************************************************************************************
1846 
1847 
1848 //*************************************************************************************************
1861 template< typename MT // Type of the adapted dense matrix
1862  , bool SO > // Storage order of the adapted dense matrix
1863 template< typename MT2 > // Type of the right-hand side matrix
1864 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1865  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1866 {
1867  return this->operator=( trans( ~rhs ) );
1868 }
1870 //*************************************************************************************************
1871 
1872 
1873 //*************************************************************************************************
1886 template< typename MT // Type of the adapted dense matrix
1887  , bool SO > // Storage order of the adapted dense matrix
1888 template< typename MT2 // Type of the right-hand side matrix
1889  , bool SO2 > // Storage order of the right-hand side matrix
1890 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1891  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1892 {
1893  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1894  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1895  }
1896 
1897  matrix_ += ~rhs;
1898 
1899  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1900  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1901 
1902  return *this;
1903 }
1905 //*************************************************************************************************
1906 
1907 
1908 //*************************************************************************************************
1921 template< typename MT // Type of the adapted dense matrix
1922  , bool SO > // Storage order of the adapted dense matrix
1923 template< typename MT2 // Type of the right-hand side matrix
1924  , bool SO2 > // Storage order of the right-hand side matrix
1925 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1926  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1927 {
1928  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1929  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1930  }
1931 
1932  if( IsHermitian<MT2>::value ) {
1933  matrix_ += ~rhs;
1934  }
1935  else {
1936  const ResultType_<MT2> tmp( ~rhs );
1937 
1938  if( !isHermitian( tmp ) ) {
1939  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1940  }
1941 
1942  matrix_ += tmp;
1943  }
1944 
1945  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1946  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1947 
1948  return *this;
1949 }
1951 //*************************************************************************************************
1952 
1953 
1954 //*************************************************************************************************
1968 template< typename MT // Type of the adapted dense matrix
1969  , bool SO > // Storage order of the adapted dense matrix
1970 template< typename MT2 > // Type of the right-hand side matrix
1971 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1972  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1973 {
1974  return this->operator+=( trans( ~rhs ) );
1975 }
1977 //*************************************************************************************************
1978 
1979 
1980 //*************************************************************************************************
1993 template< typename MT // Type of the adapted dense matrix
1994  , bool SO > // Storage order of the adapted dense matrix
1995 template< typename MT2 // Type of the right-hand side matrix
1996  , bool SO2 > // Storage order of the right-hand side matrix
1997 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1998  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1999 {
2000  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
2001  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2002  }
2003 
2004  matrix_ -= ~rhs;
2005 
2006  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2007  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2008 
2009  return *this;
2010 }
2012 //*************************************************************************************************
2013 
2014 
2015 //*************************************************************************************************
2028 template< typename MT // Type of the adapted dense matrix
2029  , bool SO > // Storage order of the adapted dense matrix
2030 template< typename MT2 // Type of the right-hand side matrix
2031  , bool SO2 > // Storage order of the right-hand side matrix
2032 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2033  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2034 {
2035  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2036  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2037  }
2038 
2039  if( IsHermitian<MT2>::value ) {
2040  matrix_ -= ~rhs;
2041  }
2042  else {
2043  const ResultType_<MT2> tmp( ~rhs );
2044 
2045  if( !isHermitian( tmp ) ) {
2046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2047  }
2048 
2049  matrix_ -= tmp;
2050  }
2051 
2052  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2053  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2054 
2055  return *this;
2056 }
2058 //*************************************************************************************************
2059 
2060 
2061 //*************************************************************************************************
2075 template< typename MT // Type of the adapted dense matrix
2076  , bool SO > // Storage order of the adapted dense matrix
2077 template< typename MT2 > // Type of the right-hand side matrix
2078 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2079  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2080 {
2081  return this->operator-=( trans( ~rhs ) );
2082 }
2084 //*************************************************************************************************
2085 
2086 
2087 //*************************************************************************************************
2101 template< typename MT // Type of the adapted dense matrix
2102  , bool SO > // Storage order of the adapted dense matrix
2103 template< typename MT2 // Type of the right-hand side matrix
2104  , bool SO2 > // Storage order of the right-hand side matrix
2105 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2106  HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2107 {
2108  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
2109  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2110  }
2111 
2112  matrix_ %= ~rhs;
2113 
2114  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2115  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2116 
2117  return *this;
2118 }
2120 //*************************************************************************************************
2121 
2122 
2123 //*************************************************************************************************
2137 template< typename MT // Type of the adapted dense matrix
2138  , bool SO > // Storage order of the adapted dense matrix
2139 template< typename MT2 // Type of the right-hand side matrix
2140  , bool SO2 > // Storage order of the right-hand side matrix
2141 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2142  HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2143 {
2144  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2145  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2146  }
2147 
2148  if( IsHermitian<MT2>::value ) {
2149  matrix_ %= ~rhs;
2150  }
2151  else {
2152  const ResultType_<MT2> tmp( ~rhs );
2153 
2154  if( !isHermitian( tmp ) ) {
2155  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2156  }
2157 
2158  matrix_ %= tmp;
2159  }
2160 
2161  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2162  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2163 
2164  return *this;
2165 }
2167 //*************************************************************************************************
2168 
2169 
2170 //*************************************************************************************************
2184 template< typename MT // Type of the adapted dense matrix
2185  , bool SO > // Storage order of the adapted dense matrix
2186 template< typename MT2 > // Type of the right-hand side matrix
2187 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2188  HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2189 {
2190  return this->operator%=( trans( ~rhs ) );
2191 }
2193 //*************************************************************************************************
2194 
2195 
2196 //*************************************************************************************************
2208 template< typename MT // Type of the adapted dense matrix
2209  , bool SO > // Storage order of the adapted dense matrix
2210 template< typename MT2 // Type of the right-hand side matrix
2211  , bool SO2 > // Storage order of the right-hand side matrix
2212 inline HermitianMatrix<MT,SO,true>&
2213  HermitianMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
2214 {
2215  if( matrix_.rows() != (~rhs).columns() ) {
2216  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2217  }
2218 
2219  MT tmp( matrix_ * ~rhs );
2220 
2221  if( !isHermitian( tmp ) ) {
2222  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2223  }
2224 
2225  matrix_ = std::move( tmp );
2226 
2227  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2228  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2229 
2230  return *this;
2231 }
2233 //*************************************************************************************************
2234 
2235 
2236 //*************************************************************************************************
2244 template< typename MT // Type of the adapted dense matrix
2245  , bool SO > // Storage order of the adapted dense matrix
2246 template< typename Other > // Data type of the right-hand side scalar
2247 inline EnableIf_< IsNumeric<Other>, HermitianMatrix<MT,SO,true> >&
2249 {
2250  matrix_ *= rhs;
2251  return *this;
2252 }
2253 //*************************************************************************************************
2254 
2255 
2256 //*************************************************************************************************
2264 template< typename MT // Type of the adapted dense matrix
2265  , bool SO > // Storage order of the adapted dense matrix
2266 template< typename Other > // Data type of the right-hand side scalar
2267 inline EnableIf_< IsNumeric<Other>, HermitianMatrix<MT,SO,true> >&
2269 {
2270  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2271 
2272  matrix_ /= rhs;
2273  return *this;
2274 }
2276 //*************************************************************************************************
2277 
2278 
2279 
2280 
2281 //=================================================================================================
2282 //
2283 // UTILITY FUNCTIONS
2284 //
2285 //=================================================================================================
2286 
2287 //*************************************************************************************************
2293 template< typename MT // Type of the adapted dense matrix
2294  , bool SO > // Storage order of the adapted dense matrix
2295 inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2296 {
2297  return matrix_.rows();
2298 }
2300 //*************************************************************************************************
2301 
2302 
2303 //*************************************************************************************************
2309 template< typename MT // Type of the adapted dense matrix
2310  , bool SO > // Storage order of the adapted dense matrix
2311 inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2312 {
2313  return matrix_.columns();
2314 }
2316 //*************************************************************************************************
2317 
2318 
2319 //*************************************************************************************************
2331 template< typename MT // Type of the adapted dense matrix
2332  , bool SO > // Storage order of the adapted dense matrix
2333 inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2334 {
2335  return matrix_.spacing();
2336 }
2338 //*************************************************************************************************
2339 
2340 
2341 //*************************************************************************************************
2347 template< typename MT // Type of the adapted dense matrix
2348  , bool SO > // Storage order of the adapted dense matrix
2349 inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2350 {
2351  return matrix_.capacity();
2352 }
2354 //*************************************************************************************************
2355 
2356 
2357 //*************************************************************************************************
2368 template< typename MT // Type of the adapted dense matrix
2369  , bool SO > // Storage order of the adapted dense matrix
2370 inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2371 {
2372  return matrix_.capacity(i);
2373 }
2375 //*************************************************************************************************
2376 
2377 
2378 //*************************************************************************************************
2384 template< typename MT // Type of the adapted dense matrix
2385  , bool SO > // Storage order of the adapted dense matrix
2386 inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2387 {
2388  return matrix_.nonZeros();
2389 }
2391 //*************************************************************************************************
2392 
2393 
2394 //*************************************************************************************************
2406 template< typename MT // Type of the adapted dense matrix
2407  , bool SO > // Storage order of the adapted dense matrix
2408 inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2409 {
2410  return matrix_.nonZeros(i);
2411 }
2413 //*************************************************************************************************
2414 
2415 
2416 //*************************************************************************************************
2422 template< typename MT // Type of the adapted dense matrix
2423  , bool SO > // Storage order of the adapted dense matrix
2425 {
2426  matrix_.reset();
2427 }
2429 //*************************************************************************************************
2430 
2431 
2432 //*************************************************************************************************
2468 template< typename MT // Type of the adapted dense matrix
2469  , bool SO > // Storage order of the adapted dense matrix
2470 inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2471 {
2472  row ( matrix_, i ).reset();
2473  column( matrix_, i ).reset();
2474 }
2476 //*************************************************************************************************
2477 
2478 
2479 //*************************************************************************************************
2491 template< typename MT // Type of the adapted dense matrix
2492  , bool SO > // Storage order of the adapted dense matrix
2494 {
2495  using blaze::clear;
2496 
2497  clear( matrix_ );
2498 }
2500 //*************************************************************************************************
2501 
2502 
2503 //*************************************************************************************************
2538 template< typename MT // Type of the adapted dense matrix
2539  , bool SO > // Storage order of the adapted dense matrix
2540 void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2541 {
2543 
2544  UNUSED_PARAMETER( preserve );
2545 
2546  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2547 
2548  const size_t oldsize( matrix_.rows() );
2549 
2550  matrix_.resize( n, n, true );
2551 
2552  if( n > oldsize ) {
2553  const size_t increment( n - oldsize );
2554  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2555  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2556  }
2557 }
2559 //*************************************************************************************************
2560 
2561 
2562 //*************************************************************************************************
2575 template< typename MT // Type of the adapted dense matrix
2576  , bool SO > // Storage order of the adapted dense matrix
2577 inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2578 {
2580 
2581  UNUSED_PARAMETER( preserve );
2582 
2583  resize( rows() + n, true );
2584 }
2585 //*************************************************************************************************
2586 
2587 
2588 //*************************************************************************************************
2598 template< typename MT // Type of the adapted dense matrix
2599  , bool SO > // Storage order of the adapted dense matrix
2600 inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2601 {
2602  matrix_.reserve( elements );
2603 }
2605 //*************************************************************************************************
2606 
2607 
2608 //*************************************************************************************************
2618 template< typename MT // Type of the adapted dense matrix
2619  , bool SO > // Storage order of the adapted dense matrix
2621 {
2622  matrix_.shrinkToFit();
2623 }
2625 //*************************************************************************************************
2626 
2627 
2628 //*************************************************************************************************
2635 template< typename MT // Type of the adapted dense matrix
2636  , bool SO > // Storage order of the adapted dense matrix
2637 inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2638 {
2639  using std::swap;
2640 
2641  swap( matrix_, m.matrix_ );
2642 }
2644 //*************************************************************************************************
2645 
2646 
2647 
2648 
2649 //=================================================================================================
2650 //
2651 // NUMERIC FUNCTIONS
2652 //
2653 //=================================================================================================
2654 
2655 //*************************************************************************************************
2661 template< typename MT // Type of the adapted dense matrix
2662  , bool SO > // Storage order of the adapted dense matrix
2663 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2664 {
2665  if( IsComplex<ElementType>::value )
2666  matrix_.transpose();
2667  return *this;
2668 }
2670 //*************************************************************************************************
2671 
2672 
2673 //*************************************************************************************************
2679 template< typename MT // Type of the adapted dense matrix
2680  , bool SO > // Storage order of the adapted dense matrix
2681 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2682 {
2683  return *this;
2684 }
2686 //*************************************************************************************************
2687 
2688 
2689 //*************************************************************************************************
2707 template< typename MT // Type of the adapted dense matrix
2708  , bool SO > // Storage order of the adapted dense matrix
2709 template< typename Other > // Data type of the scalar value
2710 inline HermitianMatrix<MT,SO,true>&
2711  HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2712 {
2713  matrix_.scale( scalar );
2714  return *this;
2715 }
2717 //*************************************************************************************************
2718 
2719 
2720 
2721 
2722 //=================================================================================================
2723 //
2724 // DEBUGGING FUNCTIONS
2725 //
2726 //=================================================================================================
2727 
2728 //*************************************************************************************************
2738 template< typename MT // Type of the adapted dense matrix
2739  , bool SO > // Storage order of the adapted dense matrix
2740 inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2741 {
2742  using blaze::isIntact;
2743 
2744  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2745 }
2747 //*************************************************************************************************
2748 
2749 
2750 
2751 
2752 //=================================================================================================
2753 //
2754 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2755 //
2756 //=================================================================================================
2757 
2758 //*************************************************************************************************
2769 template< typename MT // Type of the adapted dense matrix
2770  , bool SO > // Storage order of the adapted dense matrix
2771 template< typename Other > // Data type of the foreign expression
2772 inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2773 {
2774  return matrix_.canAlias( alias );
2775 }
2777 //*************************************************************************************************
2778 
2779 
2780 //*************************************************************************************************
2791 template< typename MT // Type of the adapted dense matrix
2792  , bool SO > // Storage order of the adapted dense matrix
2793 template< typename Other > // Data type of the foreign expression
2794 inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2795 {
2796  return matrix_.isAliased( alias );
2797 }
2799 //*************************************************************************************************
2800 
2801 
2802 //*************************************************************************************************
2812 template< typename MT // Type of the adapted dense matrix
2813  , bool SO > // Storage order of the adapted dense matrix
2814 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2815 {
2816  return matrix_.isAligned();
2817 }
2819 //*************************************************************************************************
2820 
2821 
2822 //*************************************************************************************************
2833 template< typename MT // Type of the adapted dense matrix
2834  , bool SO > // Storage order of the adapted dense matrix
2835 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2836 {
2837  return matrix_.canSMPAssign();
2838 }
2840 //*************************************************************************************************
2841 
2842 
2843 //*************************************************************************************************
2859 template< typename MT // Type of the adapted dense matrix
2860  , bool SO > // Storage order of the adapted dense matrix
2861 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2862  HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2863 {
2864  return matrix_.load( i, j );
2865 }
2867 //*************************************************************************************************
2868 
2869 
2870 //*************************************************************************************************
2886 template< typename MT // Type of the adapted dense matrix
2887  , bool SO > // Storage order of the adapted dense matrix
2888 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2889  HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2890 {
2891  return matrix_.loada( i, j );
2892 }
2894 //*************************************************************************************************
2895 
2896 
2897 //*************************************************************************************************
2913 template< typename MT // Type of the adapted dense matrix
2914  , bool SO > // Storage order of the adapted dense matrix
2915 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2916  HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2917 {
2918  return matrix_.loadu( i, j );
2919 }
2921 //*************************************************************************************************
2922 
2923 
2924 //*************************************************************************************************
2941 template< typename MT // Type of the adapted dense matrix
2942  , bool SO > // Storage order of the adapted dense matrix
2943 inline void
2944  HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2945 {
2946  matrix_.store( i, j, value );
2947 
2948  if( SO ) {
2949  const size_t kend( min( i+SIMDSIZE, rows() ) );
2950  for( size_t k=i; k<kend; ++k )
2951  matrix_(j,k) = conj( matrix_(k,j) );
2952  }
2953  else {
2954  const size_t kend( min( j+SIMDSIZE, columns() ) );
2955  for( size_t k=j; k<kend; ++k )
2956  matrix_(k,i) = conj( matrix_(i,k) );
2957  }
2958 }
2960 //*************************************************************************************************
2961 
2962 
2963 //*************************************************************************************************
2980 template< typename MT // Type of the adapted dense matrix
2981  , bool SO > // Storage order of the adapted dense matrix
2982 inline void
2983  HermitianMatrix<MT,SO,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2984 {
2985  matrix_.storea( i, j, value );
2986 
2987  if( SO ) {
2988  const size_t kend( min( i+SIMDSIZE, rows() ) );
2989  for( size_t k=i; k<kend; ++k )
2990  matrix_(j,k) = conj( matrix_(k,j) );
2991  }
2992  else {
2993  const size_t kend( min( j+SIMDSIZE, columns() ) );
2994  for( size_t k=j; k<kend; ++k )
2995  matrix_(k,i) = conj( matrix_(i,k) );
2996  }
2997 }
2999 //*************************************************************************************************
3000 
3001 
3002 //*************************************************************************************************
3019 template< typename MT // Type of the adapted dense matrix
3020  , bool SO > // Storage order of the adapted dense matrix
3021 inline void
3022  HermitianMatrix<MT,SO,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
3023 {
3024  matrix_.storeu( i, j, value );
3025 
3026  if( SO ) {
3027  const size_t kend( min( i+SIMDSIZE, rows() ) );
3028  for( size_t k=i; k<kend; ++k )
3029  matrix_(j,k) = conj( matrix_(k,j) );
3030  }
3031  else {
3032  const size_t kend( min( j+SIMDSIZE, columns() ) );
3033  for( size_t k=j; k<kend; ++k )
3034  matrix_(k,i) = conj( matrix_(i,k) );
3035  }
3036 }
3038 //*************************************************************************************************
3039 
3040 
3041 //*************************************************************************************************
3058 template< typename MT // Type of the adapted dense matrix
3059  , bool SO > // Storage order of the adapted dense matrix
3060 inline void
3061  HermitianMatrix<MT,SO,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3062 {
3063  matrix_.stream( i, j, value );
3064 
3065  if( SO ) {
3066  const size_t kend( min( i+SIMDSIZE, rows() ) );
3067  for( size_t k=i; k<kend; ++k )
3068  matrix_(j,k) = conj( matrix_(k,j) );
3069  }
3070  else {
3071  const size_t kend( min( j+SIMDSIZE, columns() ) );
3072  for( size_t k=j; k<kend; ++k )
3073  matrix_(k,i) = conj( matrix_(i,k) );
3074  }
3075 }
3077 //*************************************************************************************************
3078 
3079 
3080 
3081 
3082 //=================================================================================================
3083 //
3084 // CONSTRUCTION FUNCTIONS
3085 //
3086 //=================================================================================================
3087 
3088 //*************************************************************************************************
3090 template< typename MT // Type of the adapted dense matrix
3091  , bool SO > // Storage order of the adapted dense matrix
3092 template< typename MT2 // Type of the foreign matrix
3093  , bool SO2 // Storage order of the foreign matrix
3094  , typename T > // Type of the third argument
3095 inline const MT2& HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3096 {
3097  return ~m;
3098 }
3100 //*************************************************************************************************
3101 
3102 
3103 //*************************************************************************************************
3105 template< typename MT // Type of the adapted dense matrix
3106  , bool SO > // Storage order of the adapted dense matrix
3107 template< typename MT2 > // Type of the foreign matrix
3108 inline TransExprTrait_<MT2>
3109  HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
3110 {
3111  return trans( ~m );
3112 }
3114 //*************************************************************************************************
3115 
3116 } // namespace blaze
3117 
3118 #endif
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, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3079
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#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
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#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:329
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
Constraint on the data type.
Header file for the dense matrix inversion flags.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
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:699
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:609
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5845
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Submatrix< MT, AF > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:352
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:661
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
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:731
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:308
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:242
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:110
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:772
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:112
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5924
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5907
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
#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.
Header file for the Columns type trait.
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:367
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:443
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:548
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for the implementation of the base template of the HeritianMatrix.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
Header file for all restructuring column functions.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< 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:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:778
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:270
Header file for the TransExprTrait class template.
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:405
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
#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 &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
Header file for the HermitianProxy class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
Header file for the IsComplex type trait.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
Header file for the IsHermitian type trait.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
Header file for the TrueType type/value trait base class.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:635