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>
58 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Clear.h>
66 #include <blaze/math/SIMD.h>
72 #include <blaze/math/views/Check.h>
74 #include <blaze/math/views/Row.h>
76 #include <blaze/system/Inline.h>
78 #include <blaze/util/Assert.h>
84 #include <blaze/util/DisableIf.h>
85 #include <blaze/util/EnableIf.h>
86 #include <blaze/util/mpl/If.h>
88 #include <blaze/util/TrueType.h>
89 #include <blaze/util/Types.h>
93 #include <blaze/util/Unused.h>
94 
95 
96 namespace blaze {
97 
98 //=================================================================================================
99 //
100 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
101 //
102 //=================================================================================================
103 
104 //*************************************************************************************************
112 template< typename MT // Type of the adapted dense matrix
113  , bool SO > // Storage order of the adapted dense matrix
114 class HermitianMatrix<MT,SO,true>
115  : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
116 {
117  private:
118  //**Type definitions****************************************************************************
119  using OT = OppositeType_<MT>;
120  using TT = TransposeType_<MT>;
121  using ET = ElementType_<MT>;
122  //**********************************************************************************************
123 
124  public:
125  //**Type definitions****************************************************************************
126  using This = HermitianMatrix<MT,SO,true>;
127  using BaseType = DenseMatrix<This,SO>;
128  using ResultType = This;
129  using OppositeType = HermitianMatrix<OT,!SO,true>;
130  using TransposeType = HermitianMatrix<TT,!SO,true>;
131  using ElementType = ET;
132  using SIMDType = SIMDType_<MT>;
133  using ReturnType = ReturnType_<MT>;
134  using CompositeType = const This&;
135  using Reference = HermitianProxy<MT>;
136  using ConstReference = ConstReference_<MT>;
137  using Pointer = Pointer_<MT>;
138  using ConstPointer = ConstPointer_<MT>;
139  using ConstIterator = ConstIterator_<MT>;
140  //**********************************************************************************************
141 
142  //**Rebind struct definition********************************************************************
145  template< typename NewType > // Data type of the other matrix
146  struct Rebind {
148  using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
149  };
150  //**********************************************************************************************
151 
152  //**Resize struct definition********************************************************************
155  template< size_t NewM // Number of rows of the other matrix
156  , size_t NewN > // Number of columns of the other matrix
157  struct Resize {
159  using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
160  };
161  //**********************************************************************************************
162 
163  //**Iterator class definition*******************************************************************
166  class Iterator
167  {
168  public:
169  //**Type definitions*************************************************************************
170  using IteratorCategory = std::random_access_iterator_tag;
171  using ValueType = ElementType_<MT>;
172  using PointerType = HermitianProxy<MT>;
173  using ReferenceType = HermitianProxy<MT>;
174  using DifferenceType = ptrdiff_t;
175 
176  // STL iterator requirements
177  using iterator_category = IteratorCategory;
178  using value_type = ValueType;
179  using pointer = PointerType;
180  using reference = ReferenceType;
181  using difference_type = DifferenceType;
182  //*******************************************************************************************
183 
184  //**Constructor******************************************************************************
187  inline Iterator() noexcept
188  : matrix_( nullptr ) // Reference to the adapted dense matrix
189  , row_ ( 0UL ) // The current row index of the iterator
190  , column_( 0UL ) // The current column index of the iterator
191  {}
192  //*******************************************************************************************
193 
194  //**Constructor******************************************************************************
201  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
202  : matrix_( &matrix ) // Reference to the adapted dense matrix
203  , row_ ( row ) // The current row index of the iterator
204  , column_( column ) // The current column index of the iterator
205  {}
206  //*******************************************************************************************
207 
208  //**Addition assignment operator*************************************************************
214  inline Iterator& operator+=( size_t inc ) noexcept {
215  ( SO )?( row_ += inc ):( column_ += inc );
216  return *this;
217  }
218  //*******************************************************************************************
219 
220  //**Subtraction assignment operator**********************************************************
226  inline Iterator& operator-=( size_t dec ) noexcept {
227  ( SO )?( row_ -= dec ):( column_ -= dec );
228  return *this;
229  }
230  //*******************************************************************************************
231 
232  //**Prefix increment operator****************************************************************
237  inline Iterator& operator++() noexcept {
238  ( SO )?( ++row_ ):( ++column_ );
239  return *this;
240  }
241  //*******************************************************************************************
242 
243  //**Postfix increment operator***************************************************************
248  inline const Iterator operator++( int ) noexcept {
249  const Iterator tmp( *this );
250  ++(*this);
251  return tmp;
252  }
253  //*******************************************************************************************
254 
255  //**Prefix decrement operator****************************************************************
260  inline Iterator& operator--() noexcept {
261  ( SO )?( --row_ ):( --column_ );
262  return *this;
263  }
264  //*******************************************************************************************
265 
266  //**Postfix decrement operator***************************************************************
271  inline const Iterator operator--( int ) noexcept {
272  const Iterator tmp( *this );
273  --(*this);
274  return tmp;
275  }
276  //*******************************************************************************************
277 
278  //**Element access operator******************************************************************
283  inline ReferenceType operator*() const {
284  return ReferenceType( *matrix_, row_, column_ );
285  }
286  //*******************************************************************************************
287 
288  //**Element access operator******************************************************************
293  inline PointerType operator->() const {
294  return PointerType( *matrix_, row_, column_ );
295  }
296  //*******************************************************************************************
297 
298  //**Load function****************************************************************************
308  inline SIMDType load() const {
309  return (*matrix_).load(row_,column_);
310  }
311  //*******************************************************************************************
312 
313  //**Loada function***************************************************************************
323  inline SIMDType loada() const {
324  return (*matrix_).loada(row_,column_);
325  }
326  //*******************************************************************************************
327 
328  //**Loadu function***************************************************************************
338  inline SIMDType loadu() const {
339  return (*matrix_).loadu(row_,column_);
340  }
341  //*******************************************************************************************
342 
343  //**Store function***************************************************************************
354  inline void store( const SIMDType& value ) const {
355  (*matrix_).store( row_, column_, value );
356  sync();
357  }
358  //*******************************************************************************************
359 
360  //**Storea function**************************************************************************
371  inline void storea( const SIMDType& value ) const {
372  (*matrix_).storea( row_, column_, value );
373  sync();
374  }
375  //*******************************************************************************************
376 
377  //**Storeu function**************************************************************************
388  inline void storeu( const SIMDType& value ) const {
389  (*matrix_).storeu( row_, column_, value );
390  sync();
391  }
392  //*******************************************************************************************
393 
394  //**Stream function**************************************************************************
405  inline void stream( const SIMDType& value ) const {
406  (*matrix_).stream( row_, column_, value );
407  sync();
408  }
409  //*******************************************************************************************
410 
411  //**Conversion operator**********************************************************************
416  inline operator ConstIterator() const {
417  if( SO )
418  return matrix_->begin( column_ ) + row_;
419  else
420  return matrix_->begin( row_ ) + column_;
421  }
422  //*******************************************************************************************
423 
424  //**Equality operator************************************************************************
431  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
432  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
433  }
434  //*******************************************************************************************
435 
436  //**Equality operator************************************************************************
443  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
444  return ( ConstIterator( lhs ) == rhs );
445  }
446  //*******************************************************************************************
447 
448  //**Equality operator************************************************************************
455  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
456  return ( lhs == ConstIterator( rhs ) );
457  }
458  //*******************************************************************************************
459 
460  //**Inequality operator**********************************************************************
467  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
468  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
469  }
470  //*******************************************************************************************
471 
472  //**Inequality operator**********************************************************************
479  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
480  return ( ConstIterator( lhs ) != rhs );
481  }
482  //*******************************************************************************************
483 
484  //**Inequality operator**********************************************************************
491  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
492  return ( lhs != ConstIterator( rhs ) );
493  }
494  //*******************************************************************************************
495 
496  //**Less-than operator***********************************************************************
503  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
504  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
505  }
506  //*******************************************************************************************
507 
508  //**Less-than operator***********************************************************************
515  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
516  return ( ConstIterator( lhs ) < rhs );
517  }
518  //*******************************************************************************************
519 
520  //**Less-than operator***********************************************************************
527  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
528  return ( lhs < ConstIterator( rhs ) );
529  }
530  //*******************************************************************************************
531 
532  //**Greater-than operator********************************************************************
539  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
540  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
541  }
542  //*******************************************************************************************
543 
544  //**Greater-than operator********************************************************************
551  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
552  return ( ConstIterator( lhs ) > rhs );
553  }
554  //*******************************************************************************************
555 
556  //**Greater-than operator********************************************************************
563  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
564  return ( lhs > ConstIterator( rhs ) );
565  }
566  //*******************************************************************************************
567 
568  //**Less-or-equal-than operator**************************************************************
575  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
576  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
577  }
578  //*******************************************************************************************
579 
580  //**Less-or-equal-than operator**************************************************************
587  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
588  return ( ConstIterator( lhs ) <= rhs );
589  }
590  //*******************************************************************************************
591 
592  //**Less-or-equal-than operator**************************************************************
599  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
600  return ( lhs <= ConstIterator( rhs ) );
601  }
602  //*******************************************************************************************
603 
604  //**Greater-or-equal-than operator***********************************************************
611  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
612  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
613  }
614  //*******************************************************************************************
615 
616  //**Greater-or-equal-than operator***********************************************************
623  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
624  return ( ConstIterator( lhs ) >= rhs );
625  }
626  //*******************************************************************************************
627 
628  //**Greater-or-equal-than operator***********************************************************
635  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
636  return ( lhs >= ConstIterator( rhs ) );
637  }
638  //*******************************************************************************************
639 
640  //**Subtraction operator*********************************************************************
646  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
647  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
648  }
649  //*******************************************************************************************
650 
651  //**Addition operator************************************************************************
658  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
659  if( SO )
660  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
661  else
662  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
663  }
664  //*******************************************************************************************
665 
666  //**Addition operator************************************************************************
673  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
674  if( SO )
675  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
676  else
677  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
678  }
679  //*******************************************************************************************
680 
681  //**Subtraction operator*********************************************************************
688  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
689  if( SO )
690  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
691  else
692  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
693  }
694  //*******************************************************************************************
695 
696  private:
697  //**Sync function****************************************************************************
702  void sync() const {
703  if( SO ) {
704  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
705  for( size_t k=row_; k<kend; ++k )
706  (*matrix_)(column_,k) = conj( (*matrix_)(k,column_) );
707  }
708  else {
709  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
710  for( size_t k=column_; k<kend; ++k )
711  (*matrix_)(k,row_) = conj( (*matrix_)(row_,k) );
712  }
713  }
714  //*******************************************************************************************
715 
716  //**Member variables*************************************************************************
717  MT* matrix_;
718  size_t row_;
719  size_t column_;
720  //*******************************************************************************************
721  };
722  //**********************************************************************************************
723 
724  //**Compilation flags***************************************************************************
726  enum : bool { simdEnabled = MT::simdEnabled };
727 
729  enum : bool { smpAssignable = MT::smpAssignable };
730  //**********************************************************************************************
731 
732  //**Constructors********************************************************************************
735  explicit inline HermitianMatrix();
736  explicit inline HermitianMatrix( size_t n );
737  explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
738 
739  template< typename Other >
740  explicit inline HermitianMatrix( size_t n, const Other* array );
741 
742  template< typename Other, size_t N >
743  explicit inline HermitianMatrix( const Other (&array)[N][N] );
744 
745  explicit inline HermitianMatrix( ElementType* ptr, size_t n );
746  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
747 
748  inline HermitianMatrix( const HermitianMatrix& m );
749  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
750 
751  template< typename MT2, bool SO2 >
752  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
754  //**********************************************************************************************
755 
756  //**Destructor**********************************************************************************
757  // No explicitly declared destructor.
758  //**********************************************************************************************
759 
760  //**Data access functions***********************************************************************
763  inline Reference operator()( size_t i, size_t j );
764  inline ConstReference operator()( size_t i, size_t j ) const;
765  inline Reference at( size_t i, size_t j );
766  inline ConstReference at( size_t i, size_t j ) const;
767  inline ConstPointer data () const noexcept;
768  inline ConstPointer data ( size_t i ) const noexcept;
769  inline Iterator begin ( size_t i );
770  inline ConstIterator begin ( size_t i ) const;
771  inline ConstIterator cbegin( size_t i ) const;
772  inline Iterator end ( size_t i );
773  inline ConstIterator end ( size_t i ) const;
774  inline ConstIterator cend ( size_t i ) const;
776  //**********************************************************************************************
777 
778  //**Assignment operators************************************************************************
781  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
782 
783  template< typename Other, size_t N >
784  inline HermitianMatrix& operator=( const Other (&array)[N][N] );
785 
786  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
787  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
788 
789  template< typename MT2, bool SO2 >
790  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
791 
792  template< typename MT2, bool SO2 >
793  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
794 
795  template< typename MT2 >
796  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
797  operator=( const Matrix<MT2,!SO>& rhs );
798 
799  template< typename MT2, bool SO2 >
800  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
801 
802  template< typename MT2, bool SO2 >
803  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
804 
805  template< typename MT2 >
806  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
807  operator+=( const Matrix<MT2,!SO>& rhs );
808 
809  template< typename MT2, bool SO2 >
810  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
811 
812  template< typename MT2, bool SO2 >
813  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
814 
815  template< typename MT2 >
816  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
817  operator-=( const Matrix<MT2,!SO>& rhs );
818 
819  template< typename MT2, bool SO2 >
820  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator%=( const Matrix<MT2,SO2>& rhs );
821 
822  template< typename MT2, bool SO2 >
823  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator%=( const Matrix<MT2,SO2>& rhs );
824 
825  template< typename MT2 >
826  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
827  operator%=( const Matrix<MT2,!SO>& rhs );
828 
829  template< typename ST >
830  inline EnableIf_< IsNumeric<ST>, HermitianMatrix >& operator*=( ST rhs );
831 
832  template< typename ST >
833  inline EnableIf_< IsNumeric<ST>, HermitianMatrix >& operator/=( ST rhs );
835  //**********************************************************************************************
836 
837  //**Utility functions***************************************************************************
840  inline size_t rows() const noexcept;
841  inline size_t columns() const noexcept;
842  inline size_t spacing() const noexcept;
843  inline size_t capacity() const noexcept;
844  inline size_t capacity( size_t i ) const noexcept;
845  inline size_t nonZeros() const;
846  inline size_t nonZeros( size_t i ) const;
847  inline void reset();
848  inline void reset( size_t i );
849  inline void clear();
850  void resize ( size_t n, bool preserve=true );
851  inline void extend ( size_t n, bool preserve=true );
852  inline void reserve( size_t elements );
853  inline void shrinkToFit();
854  inline void swap( HermitianMatrix& m ) noexcept;
856  //**********************************************************************************************
857 
858  //**Numeric functions***************************************************************************
861  inline HermitianMatrix& transpose();
862  inline HermitianMatrix& ctranspose();
863 
864  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
866  //**********************************************************************************************
867 
868  //**Debugging functions*************************************************************************
871  inline bool isIntact() const noexcept;
873  //**********************************************************************************************
874 
875  //**Expression template evaluation functions****************************************************
878  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
879  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
880 
881  inline bool isAligned () const noexcept;
882  inline bool canSMPAssign() const noexcept;
883 
884  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
885  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
886  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
887 
888  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
889  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
890  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
891  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
893  //**********************************************************************************************
894 
895  private:
896  //**Construction functions**********************************************************************
899  template< typename MT2, bool SO2, typename T >
900  inline const MT2& construct( const Matrix<MT2,SO2>& m, T );
901 
902  template< typename MT2 >
903  inline TransExprTrait_<MT2> construct( const Matrix<MT2,!SO>& m, TrueType );
905  //**********************************************************************************************
906 
907  //**SIMD properties*****************************************************************************
909  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
910  //**********************************************************************************************
911 
912  //**Member variables****************************************************************************
915  MT matrix_;
916 
917  //**********************************************************************************************
918 
919  //**Friend declarations*************************************************************************
920  template< bool RF, typename MT2, bool SO2, bool DF2 >
921  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
922 
923 
924  template< InversionFlag IF, typename MT2, bool SO2 >
925  friend void invert( HermitianMatrix<MT2,SO2,true>& m );
926  //**********************************************************************************************
927 
928  //**Compile time checks*************************************************************************
942  BLAZE_STATIC_ASSERT( ( Size<MT,0UL>::value == Size<MT,1UL>::value ) );
943  //**********************************************************************************************
944 };
946 //*************************************************************************************************
947 
948 
949 
950 
951 //=================================================================================================
952 //
953 // CONSTRUCTORS
954 //
955 //=================================================================================================
956 
957 //*************************************************************************************************
961 template< typename MT // Type of the adapted dense matrix
962  , bool SO > // Storage order of the adapted dense matrix
963 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
964  : matrix_() // The adapted dense matrix
965 {
966  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
967  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
968 }
970 //*************************************************************************************************
971 
972 
973 //*************************************************************************************************
979 template< typename MT // Type of the adapted dense matrix
980  , bool SO > // Storage order of the adapted dense matrix
981 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
982  : matrix_( n, n, ElementType() ) // The adapted dense matrix
983 {
985 
986  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
987  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
988 }
990 //*************************************************************************************************
991 
992 
993 //*************************************************************************************************
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 //*************************************************************************************************
1647 template< typename MT // Type of the adapted dense matrix
1648  , bool SO > // Storage order of the adapted dense matrix
1649 inline HermitianMatrix<MT,SO,true>&
1650  HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1651 {
1652  const InitializerMatrix<ElementType> tmp( list, list.size() );
1653 
1654  if( !isHermitian( tmp ) ) {
1655  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1656  }
1657 
1658  matrix_ = list;
1659 
1660  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1661  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1662 
1663  return *this;
1664 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1695 template< typename MT // Type of the adapted dense matrix
1696  , bool SO > // Storage order of the adapted dense matrix
1697 template< typename Other // Data type of the initialization array
1698  , size_t N > // Number of rows and columns of the initialization array
1699 inline HermitianMatrix<MT,SO,true>&
1700  HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1701 {
1702  MT tmp( array );
1703 
1704  if( !isHermitian( tmp ) ) {
1705  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1706  }
1707 
1708  matrix_ = std::move( tmp );
1709 
1710  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1711  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1712 
1713  return *this;
1714 }
1716 //*************************************************************************************************
1717 
1718 
1719 //*************************************************************************************************
1729 template< typename MT // Type of the adapted dense matrix
1730  , bool SO > // Storage order of the adapted dense matrix
1731 inline HermitianMatrix<MT,SO,true>&
1732  HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1733 {
1734  matrix_ = rhs.matrix_;
1735 
1736  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1737  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1738 
1739  return *this;
1740 }
1742 //*************************************************************************************************
1743 
1744 
1745 //*************************************************************************************************
1752 template< typename MT // Type of the adapted dense matrix
1753  , bool SO > // Storage order of the adapted dense matrix
1754 inline HermitianMatrix<MT,SO,true>&
1755  HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1756 {
1757  matrix_ = std::move( rhs.matrix_ );
1758 
1759  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1760  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1761 
1762  return *this;
1763 }
1765 //*************************************************************************************************
1766 
1767 
1768 //*************************************************************************************************
1781 template< typename MT // Type of the adapted dense matrix
1782  , bool SO > // Storage order of the adapted dense matrix
1783 template< typename MT2 // Type of the right-hand side matrix
1784  , bool SO2 > // Storage order of the right-hand side matrix
1785 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1786  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1787 {
1788  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1789  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1790  }
1791 
1792  matrix_ = ~rhs;
1793 
1794  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1795  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1796 
1797  return *this;
1798 }
1800 //*************************************************************************************************
1801 
1802 
1803 //*************************************************************************************************
1816 template< typename MT // Type of the adapted dense matrix
1817  , bool SO > // Storage order of the adapted dense matrix
1818 template< typename MT2 // Type of the right-hand side matrix
1819  , bool SO2 > // Storage order of the right-hand side matrix
1820 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1821  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1822 {
1823  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1824  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1825  }
1826 
1827  if( IsHermitian<MT2>::value ) {
1828  matrix_ = ~rhs;
1829  }
1830  else {
1831  MT tmp( ~rhs );
1832 
1833  if( !isHermitian( tmp ) ) {
1834  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1835  }
1836 
1837  matrix_ = std::move( tmp );
1838  }
1839 
1840  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1841  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1842 
1843  return *this;
1844 }
1846 //*************************************************************************************************
1847 
1848 
1849 //*************************************************************************************************
1862 template< typename MT // Type of the adapted dense matrix
1863  , bool SO > // Storage order of the adapted dense matrix
1864 template< typename MT2 > // Type of the right-hand side matrix
1865 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1866  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1867 {
1868  return this->operator=( trans( ~rhs ) );
1869 }
1871 //*************************************************************************************************
1872 
1873 
1874 //*************************************************************************************************
1887 template< typename MT // Type of the adapted dense matrix
1888  , bool SO > // Storage order of the adapted dense matrix
1889 template< typename MT2 // Type of the right-hand side matrix
1890  , bool SO2 > // Storage order of the right-hand side matrix
1891 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1892  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1893 {
1894  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1895  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1896  }
1897 
1898  matrix_ += ~rhs;
1899 
1900  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1901  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1902 
1903  return *this;
1904 }
1906 //*************************************************************************************************
1907 
1908 
1909 //*************************************************************************************************
1922 template< typename MT // Type of the adapted dense matrix
1923  , bool SO > // Storage order of the adapted dense matrix
1924 template< typename MT2 // Type of the right-hand side matrix
1925  , bool SO2 > // Storage order of the right-hand side matrix
1926 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1927  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1928 {
1929  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1930  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1931  }
1932 
1933  if( IsHermitian<MT2>::value ) {
1934  matrix_ += ~rhs;
1935  }
1936  else {
1937  const ResultType_<MT2> tmp( ~rhs );
1938 
1939  if( !isHermitian( tmp ) ) {
1940  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1941  }
1942 
1943  matrix_ += tmp;
1944  }
1945 
1946  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1947  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1948 
1949  return *this;
1950 }
1952 //*************************************************************************************************
1953 
1954 
1955 //*************************************************************************************************
1969 template< typename MT // Type of the adapted dense matrix
1970  , bool SO > // Storage order of the adapted dense matrix
1971 template< typename MT2 > // Type of the right-hand side matrix
1972 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1973  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1974 {
1975  return this->operator+=( trans( ~rhs ) );
1976 }
1978 //*************************************************************************************************
1979 
1980 
1981 //*************************************************************************************************
1994 template< typename MT // Type of the adapted dense matrix
1995  , bool SO > // Storage order of the adapted dense matrix
1996 template< typename MT2 // Type of the right-hand side matrix
1997  , bool SO2 > // Storage order of the right-hand side matrix
1998 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1999  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2000 {
2001  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
2002  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2003  }
2004 
2005  matrix_ -= ~rhs;
2006 
2007  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2008  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2009 
2010  return *this;
2011 }
2013 //*************************************************************************************************
2014 
2015 
2016 //*************************************************************************************************
2029 template< typename MT // Type of the adapted dense matrix
2030  , bool SO > // Storage order of the adapted dense matrix
2031 template< typename MT2 // Type of the right-hand side matrix
2032  , bool SO2 > // Storage order of the right-hand side matrix
2033 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2034  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2035 {
2036  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2037  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2038  }
2039 
2040  if( IsHermitian<MT2>::value ) {
2041  matrix_ -= ~rhs;
2042  }
2043  else {
2044  const ResultType_<MT2> tmp( ~rhs );
2045 
2046  if( !isHermitian( tmp ) ) {
2047  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2048  }
2049 
2050  matrix_ -= tmp;
2051  }
2052 
2053  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2054  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2055 
2056  return *this;
2057 }
2059 //*************************************************************************************************
2060 
2061 
2062 //*************************************************************************************************
2076 template< typename MT // Type of the adapted dense matrix
2077  , bool SO > // Storage order of the adapted dense matrix
2078 template< typename MT2 > // Type of the right-hand side matrix
2079 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2080  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2081 {
2082  return this->operator-=( trans( ~rhs ) );
2083 }
2085 //*************************************************************************************************
2086 
2087 
2088 //*************************************************************************************************
2102 template< typename MT // Type of the adapted dense matrix
2103  , bool SO > // Storage order of the adapted dense matrix
2104 template< typename MT2 // Type of the right-hand side matrix
2105  , bool SO2 > // Storage order of the right-hand side matrix
2106 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2107  HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2108 {
2109  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
2110  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2111  }
2112 
2113  matrix_ %= ~rhs;
2114 
2115  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2116  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2117 
2118  return *this;
2119 }
2121 //*************************************************************************************************
2122 
2123 
2124 //*************************************************************************************************
2138 template< typename MT // Type of the adapted dense matrix
2139  , bool SO > // Storage order of the adapted dense matrix
2140 template< typename MT2 // Type of the right-hand side matrix
2141  , bool SO2 > // Storage order of the right-hand side matrix
2142 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2143  HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2144 {
2145  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2146  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2147  }
2148 
2149  if( IsHermitian<MT2>::value ) {
2150  matrix_ %= ~rhs;
2151  }
2152  else {
2153  const ResultType_<MT2> tmp( ~rhs );
2154 
2155  if( !isHermitian( tmp ) ) {
2156  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2157  }
2158 
2159  matrix_ %= tmp;
2160  }
2161 
2162  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2163  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2164 
2165  return *this;
2166 }
2168 //*************************************************************************************************
2169 
2170 
2171 //*************************************************************************************************
2185 template< typename MT // Type of the adapted dense matrix
2186  , bool SO > // Storage order of the adapted dense matrix
2187 template< typename MT2 > // Type of the right-hand side matrix
2188 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2189  HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2190 {
2191  return this->operator%=( trans( ~rhs ) );
2192 }
2194 //*************************************************************************************************
2195 
2196 
2197 //*************************************************************************************************
2205 template< typename MT // Type of the adapted dense matrix
2206  , bool SO > // Storage order of the adapted dense matrix
2207 template< typename ST > // Data type of the right-hand side scalar
2208 inline EnableIf_< IsNumeric<ST>, HermitianMatrix<MT,SO,true> >&
2210 {
2211  matrix_ *= rhs;
2212  return *this;
2213 }
2214 //*************************************************************************************************
2215 
2216 
2217 //*************************************************************************************************
2225 template< typename MT // Type of the adapted dense matrix
2226  , bool SO > // Storage order of the adapted dense matrix
2227 template< typename ST > // Data type of the right-hand side scalar
2228 inline EnableIf_< IsNumeric<ST>, HermitianMatrix<MT,SO,true> >&
2230 {
2231  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2232 
2233  matrix_ /= rhs;
2234  return *this;
2235 }
2237 //*************************************************************************************************
2238 
2239 
2240 
2241 
2242 //=================================================================================================
2243 //
2244 // UTILITY FUNCTIONS
2245 //
2246 //=================================================================================================
2247 
2248 //*************************************************************************************************
2254 template< typename MT // Type of the adapted dense matrix
2255  , bool SO > // Storage order of the adapted dense matrix
2256 inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2257 {
2258  return matrix_.rows();
2259 }
2261 //*************************************************************************************************
2262 
2263 
2264 //*************************************************************************************************
2270 template< typename MT // Type of the adapted dense matrix
2271  , bool SO > // Storage order of the adapted dense matrix
2272 inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2273 {
2274  return matrix_.columns();
2275 }
2277 //*************************************************************************************************
2278 
2279 
2280 //*************************************************************************************************
2292 template< typename MT // Type of the adapted dense matrix
2293  , bool SO > // Storage order of the adapted dense matrix
2294 inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2295 {
2296  return matrix_.spacing();
2297 }
2299 //*************************************************************************************************
2300 
2301 
2302 //*************************************************************************************************
2308 template< typename MT // Type of the adapted dense matrix
2309  , bool SO > // Storage order of the adapted dense matrix
2310 inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2311 {
2312  return matrix_.capacity();
2313 }
2315 //*************************************************************************************************
2316 
2317 
2318 //*************************************************************************************************
2329 template< typename MT // Type of the adapted dense matrix
2330  , bool SO > // Storage order of the adapted dense matrix
2331 inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2332 {
2333  return matrix_.capacity(i);
2334 }
2336 //*************************************************************************************************
2337 
2338 
2339 //*************************************************************************************************
2345 template< typename MT // Type of the adapted dense matrix
2346  , bool SO > // Storage order of the adapted dense matrix
2347 inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2348 {
2349  return matrix_.nonZeros();
2350 }
2352 //*************************************************************************************************
2353 
2354 
2355 //*************************************************************************************************
2367 template< typename MT // Type of the adapted dense matrix
2368  , bool SO > // Storage order of the adapted dense matrix
2369 inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2370 {
2371  return matrix_.nonZeros(i);
2372 }
2374 //*************************************************************************************************
2375 
2376 
2377 //*************************************************************************************************
2383 template< typename MT // Type of the adapted dense matrix
2384  , bool SO > // Storage order of the adapted dense matrix
2386 {
2387  matrix_.reset();
2388 }
2390 //*************************************************************************************************
2391 
2392 
2393 //*************************************************************************************************
2429 template< typename MT // Type of the adapted dense matrix
2430  , bool SO > // Storage order of the adapted dense matrix
2431 inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2432 {
2433  row ( matrix_, i, unchecked ).reset();
2434  column( matrix_, i, unchecked ).reset();
2435 }
2437 //*************************************************************************************************
2438 
2439 
2440 //*************************************************************************************************
2452 template< typename MT // Type of the adapted dense matrix
2453  , bool SO > // Storage order of the adapted dense matrix
2455 {
2456  using blaze::clear;
2457 
2458  clear( matrix_ );
2459 }
2461 //*************************************************************************************************
2462 
2463 
2464 //*************************************************************************************************
2499 template< typename MT // Type of the adapted dense matrix
2500  , bool SO > // Storage order of the adapted dense matrix
2501 void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2502 {
2504 
2505  UNUSED_PARAMETER( preserve );
2506 
2507  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2508 
2509  const size_t oldsize( matrix_.rows() );
2510 
2511  matrix_.resize( n, n, true );
2512 
2513  if( n > oldsize ) {
2514  const size_t increment( n - oldsize );
2515  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2516  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2517  }
2518 }
2520 //*************************************************************************************************
2521 
2522 
2523 //*************************************************************************************************
2536 template< typename MT // Type of the adapted dense matrix
2537  , bool SO > // Storage order of the adapted dense matrix
2538 inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2539 {
2541 
2542  UNUSED_PARAMETER( preserve );
2543 
2544  resize( rows() + n, true );
2545 }
2546 //*************************************************************************************************
2547 
2548 
2549 //*************************************************************************************************
2559 template< typename MT // Type of the adapted dense matrix
2560  , bool SO > // Storage order of the adapted dense matrix
2561 inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2562 {
2563  matrix_.reserve( elements );
2564 }
2566 //*************************************************************************************************
2567 
2568 
2569 //*************************************************************************************************
2579 template< typename MT // Type of the adapted dense matrix
2580  , bool SO > // Storage order of the adapted dense matrix
2582 {
2583  matrix_.shrinkToFit();
2584 }
2586 //*************************************************************************************************
2587 
2588 
2589 //*************************************************************************************************
2596 template< typename MT // Type of the adapted dense matrix
2597  , bool SO > // Storage order of the adapted dense matrix
2598 inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2599 {
2600  using std::swap;
2601 
2602  swap( matrix_, m.matrix_ );
2603 }
2605 //*************************************************************************************************
2606 
2607 
2608 
2609 
2610 //=================================================================================================
2611 //
2612 // NUMERIC FUNCTIONS
2613 //
2614 //=================================================================================================
2615 
2616 //*************************************************************************************************
2622 template< typename MT // Type of the adapted dense matrix
2623  , bool SO > // Storage order of the adapted dense matrix
2624 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2625 {
2626  if( IsComplex<ElementType>::value )
2627  matrix_.transpose();
2628  return *this;
2629 }
2631 //*************************************************************************************************
2632 
2633 
2634 //*************************************************************************************************
2640 template< typename MT // Type of the adapted dense matrix
2641  , bool SO > // Storage order of the adapted dense matrix
2642 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2643 {
2644  return *this;
2645 }
2647 //*************************************************************************************************
2648 
2649 
2650 //*************************************************************************************************
2668 template< typename MT // Type of the adapted dense matrix
2669  , bool SO > // Storage order of the adapted dense matrix
2670 template< typename Other > // Data type of the scalar value
2671 inline HermitianMatrix<MT,SO,true>&
2672  HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2673 {
2674  matrix_.scale( scalar );
2675  return *this;
2676 }
2678 //*************************************************************************************************
2679 
2680 
2681 
2682 
2683 //=================================================================================================
2684 //
2685 // DEBUGGING FUNCTIONS
2686 //
2687 //=================================================================================================
2688 
2689 //*************************************************************************************************
2699 template< typename MT // Type of the adapted dense matrix
2700  , bool SO > // Storage order of the adapted dense matrix
2701 inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2702 {
2703  using blaze::isIntact;
2704 
2705  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2706 }
2708 //*************************************************************************************************
2709 
2710 
2711 
2712 
2713 //=================================================================================================
2714 //
2715 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2716 //
2717 //=================================================================================================
2718 
2719 //*************************************************************************************************
2730 template< typename MT // Type of the adapted dense matrix
2731  , bool SO > // Storage order of the adapted dense matrix
2732 template< typename Other > // Data type of the foreign expression
2733 inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2734 {
2735  return matrix_.canAlias( alias );
2736 }
2738 //*************************************************************************************************
2739 
2740 
2741 //*************************************************************************************************
2752 template< typename MT // Type of the adapted dense matrix
2753  , bool SO > // Storage order of the adapted dense matrix
2754 template< typename Other > // Data type of the foreign expression
2755 inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2756 {
2757  return matrix_.isAliased( alias );
2758 }
2760 //*************************************************************************************************
2761 
2762 
2763 //*************************************************************************************************
2773 template< typename MT // Type of the adapted dense matrix
2774  , bool SO > // Storage order of the adapted dense matrix
2775 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2776 {
2777  return matrix_.isAligned();
2778 }
2780 //*************************************************************************************************
2781 
2782 
2783 //*************************************************************************************************
2794 template< typename MT // Type of the adapted dense matrix
2795  , bool SO > // Storage order of the adapted dense matrix
2796 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2797 {
2798  return matrix_.canSMPAssign();
2799 }
2801 //*************************************************************************************************
2802 
2803 
2804 //*************************************************************************************************
2820 template< typename MT // Type of the adapted dense matrix
2821  , bool SO > // Storage order of the adapted dense matrix
2822 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2823  HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2824 {
2825  return matrix_.load( i, j );
2826 }
2828 //*************************************************************************************************
2829 
2830 
2831 //*************************************************************************************************
2847 template< typename MT // Type of the adapted dense matrix
2848  , bool SO > // Storage order of the adapted dense matrix
2849 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2850  HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2851 {
2852  return matrix_.loada( i, j );
2853 }
2855 //*************************************************************************************************
2856 
2857 
2858 //*************************************************************************************************
2874 template< typename MT // Type of the adapted dense matrix
2875  , bool SO > // Storage order of the adapted dense matrix
2876 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2877  HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2878 {
2879  return matrix_.loadu( i, j );
2880 }
2882 //*************************************************************************************************
2883 
2884 
2885 //*************************************************************************************************
2902 template< typename MT // Type of the adapted dense matrix
2903  , bool SO > // Storage order of the adapted dense matrix
2904 inline void
2905  HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2906 {
2907  matrix_.store( i, j, value );
2908 
2909  if( SO ) {
2910  const size_t kend( min( i+SIMDSIZE, rows() ) );
2911  for( size_t k=i; k<kend; ++k )
2912  matrix_(j,k) = conj( matrix_(k,j) );
2913  }
2914  else {
2915  const size_t kend( min( j+SIMDSIZE, columns() ) );
2916  for( size_t k=j; k<kend; ++k )
2917  matrix_(k,i) = conj( matrix_(i,k) );
2918  }
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>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2945 {
2946  matrix_.storea( 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>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2984 {
2985  matrix_.storeu( 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>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3023 {
3024  matrix_.stream( 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 
3042 
3043 //=================================================================================================
3044 //
3045 // CONSTRUCTION FUNCTIONS
3046 //
3047 //=================================================================================================
3048 
3049 //*************************************************************************************************
3051 template< typename MT // Type of the adapted dense matrix
3052  , bool SO > // Storage order of the adapted dense matrix
3053 template< typename MT2 // Type of the foreign matrix
3054  , bool SO2 // Storage order of the foreign matrix
3055  , typename T > // Type of the third argument
3056 inline const MT2& HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3057 {
3058  return ~m;
3059 }
3061 //*************************************************************************************************
3062 
3063 
3064 //*************************************************************************************************
3066 template< typename MT // Type of the adapted dense matrix
3067  , bool SO > // Storage order of the adapted dense matrix
3068 template< typename MT2 > // Type of the foreign matrix
3069 inline TransExprTrait_<MT2>
3070  HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
3071 {
3072  return trans( ~m );
3073 }
3075 //*************************************************************************************************
3076 
3077 } // namespace blaze
3078 
3079 #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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
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
Constraint on the data type.
Header file for the dense matrix inversion flags.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
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:701
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:775
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
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:5829
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:827
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:733
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Header file for the extended initializer_list functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE 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:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Constraint on the data type.
Constraint on the data type.
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:252
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:670
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
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:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
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:5891
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h: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:3085
Header file for the isZero shim.
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
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:506
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.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:134
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:714
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for the implementation of the base template of the HeritianMatrix.
Header file for all forward declarations for expression class templates.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
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:608
Header file for the implementation of the Column view.
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.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:919
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:272
Header file for the TransExprTrait class template.
Constraint on the data type.
Constraint on the data type.
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:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#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:3081
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
Header file for the HermitianProxy class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
Header file for the IsComplex type trait.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1321
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
Header file for the IsHermitian type trait.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
System settings for the inline keywords.
Header file for the Size type trait.
#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:801