Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
57 #include <blaze/math/Exception.h>
60 #include <blaze/math/Functions.h>
63 #include <blaze/math/shims/Clear.h>
65 #include <blaze/math/SIMD.h>
73 #include <blaze/math/views/Row.h>
75 #include <blaze/system/Inline.h>
76 #include <blaze/util/Assert.h>
82 #include <blaze/util/DisableIf.h>
83 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/mpl/If.h>
86 #include <blaze/util/TrueType.h>
87 #include <blaze/util/Types.h>
91 #include <blaze/util/Unused.h>
92 
93 
94 namespace blaze {
95 
96 //=================================================================================================
97 //
98 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
99 //
100 //=================================================================================================
101 
102 //*************************************************************************************************
110 template< typename MT // Type of the adapted dense matrix
111  , bool SO > // Storage order of the adapted dense matrix
112 class HermitianMatrix<MT,SO,true>
113  : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
114 {
115  private:
116  //**Type definitions****************************************************************************
117  typedef OppositeType_<MT> OT;
118  typedef TransposeType_<MT> TT;
119  typedef ElementType_<MT> ET;
120  //**********************************************************************************************
121 
122  public:
123  //**Type definitions****************************************************************************
124  typedef HermitianMatrix<MT,SO,true> This;
125  typedef DenseMatrix<This,SO> BaseType;
126  typedef This ResultType;
127  typedef HermitianMatrix<OT,!SO,true> OppositeType;
128  typedef HermitianMatrix<TT,!SO,true> TransposeType;
129  typedef ET ElementType;
130  typedef SIMDType_<MT> SIMDType;
131  typedef ReturnType_<MT> ReturnType;
132  typedef const This& CompositeType;
133  typedef HermitianProxy<MT> Reference;
134  typedef ConstReference_<MT> ConstReference;
135  typedef Pointer_<MT> Pointer;
136  typedef ConstPointer_<MT> ConstPointer;
137  typedef ConstIterator_<MT> ConstIterator;
138  //**********************************************************************************************
139 
140  //**Rebind struct definition********************************************************************
143  template< typename NewType > // Data type of the other matrix
144  struct Rebind {
146  typedef HermitianMatrix< typename MT::template Rebind<NewType>::Other > Other;
147  };
148  //**********************************************************************************************
149 
150  //**Resize struct definition********************************************************************
153  template< size_t NewM // Number of rows of the other matrix
154  , size_t NewN > // Number of columns of the other matrix
155  struct Resize {
157  typedef HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other > Other;
158  };
159  //**********************************************************************************************
160 
161  //**Iterator class definition*******************************************************************
164  class Iterator
165  {
166  public:
167  //**Type definitions*************************************************************************
168  typedef std::random_access_iterator_tag IteratorCategory;
169  typedef ElementType_<MT> ValueType;
170  typedef HermitianProxy<MT> PointerType;
171  typedef HermitianProxy<MT> ReferenceType;
172  typedef ptrdiff_t DifferenceType;
173 
174  // STL iterator requirements
175  typedef IteratorCategory iterator_category;
176  typedef ValueType value_type;
177  typedef PointerType pointer;
178  typedef ReferenceType reference;
179  typedef DifferenceType difference_type;
180  //*******************************************************************************************
181 
182  //**Constructor******************************************************************************
185  inline Iterator() noexcept
186  : matrix_( nullptr ) // Reference to the adapted dense matrix
187  , row_ ( 0UL ) // The current row index of the iterator
188  , column_( 0UL ) // The current column index of the iterator
189  {}
190  //*******************************************************************************************
191 
192  //**Constructor******************************************************************************
199  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
200  : matrix_( &matrix ) // Reference to the adapted dense matrix
201  , row_ ( row ) // The current row index of the iterator
202  , column_( column ) // The current column index of the iterator
203  {}
204  //*******************************************************************************************
205 
206  //**Addition assignment operator*************************************************************
212  inline Iterator& operator+=( size_t inc ) noexcept {
213  ( SO )?( row_ += inc ):( column_ += inc );
214  return *this;
215  }
216  //*******************************************************************************************
217 
218  //**Subtraction assignment operator**********************************************************
224  inline Iterator& operator-=( size_t dec ) noexcept {
225  ( SO )?( row_ -= dec ):( column_ -= dec );
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Prefix increment operator****************************************************************
235  inline Iterator& operator++() noexcept {
236  ( SO )?( ++row_ ):( ++column_ );
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Postfix increment operator***************************************************************
246  inline const Iterator operator++( int ) noexcept {
247  const Iterator tmp( *this );
248  ++(*this);
249  return tmp;
250  }
251  //*******************************************************************************************
252 
253  //**Prefix decrement operator****************************************************************
258  inline Iterator& operator--() noexcept {
259  ( SO )?( --row_ ):( --column_ );
260  return *this;
261  }
262  //*******************************************************************************************
263 
264  //**Postfix decrement operator***************************************************************
269  inline const Iterator operator--( int ) noexcept {
270  const Iterator tmp( *this );
271  --(*this);
272  return tmp;
273  }
274  //*******************************************************************************************
275 
276  //**Element access operator******************************************************************
281  inline ReferenceType operator*() const {
282  return ReferenceType( *matrix_, row_, column_ );
283  }
284  //*******************************************************************************************
285 
286  //**Element access operator******************************************************************
291  inline PointerType operator->() const {
292  return PointerType( *matrix_, row_, column_ );
293  }
294  //*******************************************************************************************
295 
296  //**Load function****************************************************************************
306  inline SIMDType load() const {
307  return (*matrix_).load(row_,column_);
308  }
309  //*******************************************************************************************
310 
311  //**Loada function***************************************************************************
321  inline SIMDType loada() const {
322  return (*matrix_).loada(row_,column_);
323  }
324  //*******************************************************************************************
325 
326  //**Loadu function***************************************************************************
336  inline SIMDType loadu() const {
337  return (*matrix_).loadu(row_,column_);
338  }
339  //*******************************************************************************************
340 
341  //**Store function***************************************************************************
352  inline void store( const SIMDType& value ) const {
353  (*matrix_).store( row_, column_, value );
354  sync();
355  }
356  //*******************************************************************************************
357 
358  //**Storea function**************************************************************************
369  inline void storea( const SIMDType& value ) const {
370  (*matrix_).storea( row_, column_, value );
371  sync();
372  }
373  //*******************************************************************************************
374 
375  //**Storeu function**************************************************************************
386  inline void storeu( const SIMDType& value ) const {
387  (*matrix_).storeu( row_, column_, value );
388  sync();
389  }
390  //*******************************************************************************************
391 
392  //**Stream function**************************************************************************
403  inline void stream( const SIMDType& value ) const {
404  (*matrix_).stream( row_, column_, value );
405  sync();
406  }
407  //*******************************************************************************************
408 
409  //**Conversion operator**********************************************************************
414  inline operator ConstIterator() const {
415  if( SO )
416  return matrix_->begin( column_ ) + row_;
417  else
418  return matrix_->begin( row_ ) + column_;
419  }
420  //*******************************************************************************************
421 
422  //**Equality operator************************************************************************
429  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
430  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
431  }
432  //*******************************************************************************************
433 
434  //**Equality operator************************************************************************
441  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
442  return ( ConstIterator( lhs ) == rhs );
443  }
444  //*******************************************************************************************
445 
446  //**Equality operator************************************************************************
453  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
454  return ( lhs == ConstIterator( rhs ) );
455  }
456  //*******************************************************************************************
457 
458  //**Inequality operator**********************************************************************
465  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
466  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
467  }
468  //*******************************************************************************************
469 
470  //**Inequality operator**********************************************************************
477  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
478  return ( ConstIterator( lhs ) != rhs );
479  }
480  //*******************************************************************************************
481 
482  //**Inequality operator**********************************************************************
489  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
490  return ( lhs != ConstIterator( rhs ) );
491  }
492  //*******************************************************************************************
493 
494  //**Less-than operator***********************************************************************
501  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
502  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
503  }
504  //*******************************************************************************************
505 
506  //**Less-than operator***********************************************************************
513  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
514  return ( ConstIterator( lhs ) < rhs );
515  }
516  //*******************************************************************************************
517 
518  //**Less-than operator***********************************************************************
525  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
526  return ( lhs < ConstIterator( rhs ) );
527  }
528  //*******************************************************************************************
529 
530  //**Greater-than operator********************************************************************
537  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
538  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
539  }
540  //*******************************************************************************************
541 
542  //**Greater-than operator********************************************************************
549  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
550  return ( ConstIterator( lhs ) > rhs );
551  }
552  //*******************************************************************************************
553 
554  //**Greater-than operator********************************************************************
561  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
562  return ( lhs > ConstIterator( rhs ) );
563  }
564  //*******************************************************************************************
565 
566  //**Less-or-equal-than operator**************************************************************
573  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
574  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
575  }
576  //*******************************************************************************************
577 
578  //**Less-or-equal-than operator**************************************************************
585  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
586  return ( ConstIterator( lhs ) <= rhs );
587  }
588  //*******************************************************************************************
589 
590  //**Less-or-equal-than operator**************************************************************
597  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
598  return ( lhs <= ConstIterator( rhs ) );
599  }
600  //*******************************************************************************************
601 
602  //**Greater-or-equal-than operator***********************************************************
609  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
610  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
611  }
612  //*******************************************************************************************
613 
614  //**Greater-or-equal-than operator***********************************************************
621  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
622  return ( ConstIterator( lhs ) >= rhs );
623  }
624  //*******************************************************************************************
625 
626  //**Greater-or-equal-than operator***********************************************************
633  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
634  return ( lhs >= ConstIterator( rhs ) );
635  }
636  //*******************************************************************************************
637 
638  //**Subtraction operator*********************************************************************
644  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
645  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
646  }
647  //*******************************************************************************************
648 
649  //**Addition operator************************************************************************
656  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
657  if( SO )
658  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
659  else
660  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
661  }
662  //*******************************************************************************************
663 
664  //**Addition operator************************************************************************
671  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
672  if( SO )
673  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
674  else
675  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
676  }
677  //*******************************************************************************************
678 
679  //**Subtraction operator*********************************************************************
686  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
687  if( SO )
688  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
689  else
690  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
691  }
692  //*******************************************************************************************
693 
694  private:
695  //**Sync function****************************************************************************
700  void sync() const {
701  if( SO ) {
702  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
703  for( size_t k=row_; k<kend; ++k )
704  (*matrix_)(column_,k) = conj( (*matrix_)(k,column_) );
705  }
706  else {
707  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
708  for( size_t k=column_; k<kend; ++k )
709  (*matrix_)(k,row_) = conj( (*matrix_)(row_,k) );
710  }
711  }
712  //*******************************************************************************************
713 
714  //**Member variables*************************************************************************
715  MT* matrix_;
716  size_t row_;
717  size_t column_;
718  //*******************************************************************************************
719  };
720  //**********************************************************************************************
721 
722  //**Compilation flags***************************************************************************
724  enum : bool { simdEnabled = MT::simdEnabled };
725 
727  enum : bool { smpAssignable = MT::smpAssignable };
728  //**********************************************************************************************
729 
730  //**Constructors********************************************************************************
733  explicit inline HermitianMatrix();
734  explicit inline HermitianMatrix( size_t n );
735  explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
736 
737  template< typename Other >
738  explicit inline HermitianMatrix( size_t n, const Other* array );
739 
740  template< typename Other, size_t N >
741  explicit inline HermitianMatrix( const Other (&array)[N][N] );
742 
743  explicit inline HermitianMatrix( ElementType* ptr, size_t n );
744  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
745 
746  template< typename Deleter >
747  explicit inline HermitianMatrix( ElementType* ptr, size_t n, Deleter d );
748 
749  template< typename Deleter >
750  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
751 
752  inline HermitianMatrix( const HermitianMatrix& m );
753  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
754 
755  template< typename MT2, bool SO2 >
756  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
758  //**********************************************************************************************
759 
760  //**Destructor**********************************************************************************
761  // No explicitly declared destructor.
762  //**********************************************************************************************
763 
764  //**Data access functions***********************************************************************
767  inline Reference operator()( size_t i, size_t j );
768  inline ConstReference operator()( size_t i, size_t j ) const;
769  inline Reference at( size_t i, size_t j );
770  inline ConstReference at( size_t i, size_t j ) const;
771  inline ConstPointer data () const noexcept;
772  inline ConstPointer data ( size_t i ) const noexcept;
773  inline Iterator begin ( size_t i );
774  inline ConstIterator begin ( size_t i ) const;
775  inline ConstIterator cbegin( size_t i ) const;
776  inline Iterator end ( size_t i );
777  inline ConstIterator end ( size_t i ) const;
778  inline ConstIterator cend ( size_t i ) const;
780  //**********************************************************************************************
781 
782  //**Assignment operators************************************************************************
785  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
786 
787  template< typename Other, size_t N >
788  inline HermitianMatrix& operator=( const Other (&array)[N][N] );
789 
790  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
791  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
792 
793  template< typename MT2, bool SO2 >
794  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
795 
796  template< typename MT2, bool SO2 >
797  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
798 
799  template< typename MT2 >
800  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
801  operator=( const Matrix<MT2,!SO>& rhs );
802 
803  template< typename MT2, bool SO2 >
804  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
805 
806  template< typename MT2, bool SO2 >
807  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
808 
809  template< typename MT2 >
810  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
811  operator+=( const Matrix<MT2,!SO>& rhs );
812 
813  template< typename MT2, bool SO2 >
814  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
815 
816  template< typename MT2, bool SO2 >
817  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
818 
819  template< typename MT2 >
820  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
821  operator-=( const Matrix<MT2,!SO>& rhs );
822 
823  template< typename MT2, bool SO2 >
824  inline HermitianMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
825 
826  template< typename Other >
827  inline EnableIf_< IsNumeric<Other>, HermitianMatrix >& operator*=( Other rhs );
828 
829  template< typename Other >
830  inline EnableIf_< IsNumeric<Other>, HermitianMatrix >& operator/=( Other rhs );
832  //**********************************************************************************************
833 
834  //**Utility functions***************************************************************************
837  inline size_t rows() const noexcept;
838  inline size_t columns() const noexcept;
839  inline size_t spacing() const noexcept;
840  inline size_t capacity() const noexcept;
841  inline size_t capacity( size_t i ) const noexcept;
842  inline size_t nonZeros() const;
843  inline size_t nonZeros( size_t i ) const;
844  inline void reset();
845  inline void reset( size_t i );
846  inline void clear();
847  void resize ( size_t n, bool preserve=true );
848  inline void extend ( size_t n, bool preserve=true );
849  inline void reserve( size_t elements );
850  inline void swap( HermitianMatrix& m ) noexcept;
852  //**********************************************************************************************
853 
854  //**Numeric functions***************************************************************************
857  inline HermitianMatrix& transpose();
858  inline HermitianMatrix& ctranspose();
859 
860  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
862  //**********************************************************************************************
863 
864  //**Debugging functions*************************************************************************
867  inline bool isIntact() const noexcept;
869  //**********************************************************************************************
870 
871  //**Expression template evaluation functions****************************************************
874  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
875  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
876 
877  inline bool isAligned () const noexcept;
878  inline bool canSMPAssign() const noexcept;
879 
880  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
881  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
882  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
883 
884  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
885  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
886  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
887  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
889  //**********************************************************************************************
890 
891  private:
892  //**Construction functions**********************************************************************
895  template< typename MT2, bool SO2, typename T >
896  inline const MT2& construct( const Matrix<MT2,SO2>& m, T );
897 
898  template< typename MT2 >
899  inline TransExprTrait_<MT2> construct( const Matrix<MT2,!SO>& m, TrueType );
901  //**********************************************************************************************
902 
903  //**SIMD properties*****************************************************************************
905  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
906  //**********************************************************************************************
907 
908  //**Member variables****************************************************************************
911  MT matrix_;
912 
913  //**********************************************************************************************
914 
915  //**Friend declarations*************************************************************************
916  template< bool RF, typename MT2, bool SO2, bool DF2 >
917  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
918 
919 
920  template< InversionFlag IF, typename MT2, bool SO2 >
921  friend void invert( HermitianMatrix<MT2,SO2,true>& m );
922  //**********************************************************************************************
923 
924  //**Compile time checks*************************************************************************
938  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
939  //**********************************************************************************************
940 };
942 //*************************************************************************************************
943 
944 
945 
946 
947 //=================================================================================================
948 //
949 // CONSTRUCTORS
950 //
951 //=================================================================================================
952 
953 //*************************************************************************************************
957 template< typename MT // Type of the adapted dense matrix
958  , bool SO > // Storage order of the adapted dense matrix
959 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
960  : matrix_() // The adapted dense matrix
961 {
962  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
963  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
964 }
966 //*************************************************************************************************
967 
968 
969 //*************************************************************************************************
975 template< typename MT // Type of the adapted dense matrix
976  , bool SO > // Storage order of the adapted dense matrix
977 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
978  : matrix_( n, n, ElementType() ) // The adapted dense matrix
979 {
981 
982  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
983  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
984 }
986 //*************************************************************************************************
987 
988 
989 //*************************************************************************************************
1015 template< typename MT // Type of the adapted dense matrix
1016  , bool SO > // Storage order of the adapted dense matrix
1017 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1018  : matrix_( list ) // The adapted dense matrix
1019 {
1020  if( !isHermitian( matrix_ ) ) {
1021  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1022  }
1023 
1024  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1025 }
1027 //*************************************************************************************************
1028 
1029 
1030 //*************************************************************************************************
1059 template< typename MT // Type of the adapted dense matrix
1060  , bool SO > // Storage order of the adapted dense matrix
1061 template< typename Other > // Data type of the initialization array
1062 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n, const Other* array )
1063  : matrix_( n, n, array ) // The adapted dense matrix
1064 {
1065  if( !isHermitian( matrix_ ) ) {
1066  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1067  }
1068 
1069  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1070 }
1072 //*************************************************************************************************
1073 
1074 
1075 //*************************************************************************************************
1100 template< typename MT // Type of the adapted dense matrix
1101  , bool SO > // Storage order of the adapted dense matrix
1102 template< typename Other // Data type of the initialization array
1103  , size_t N > // Number of rows and columns of the initialization array
1104 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Other (&array)[N][N] )
1105  : matrix_( array ) // The adapted dense matrix
1106 {
1107  if( !isHermitian( matrix_ ) ) {
1108  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1109  }
1110 
1111  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1112 }
1114 //*************************************************************************************************
1115 
1116 
1117 //*************************************************************************************************
1138 template< typename MT // Type of the adapted dense matrix
1139  , bool SO > // Storage order of the adapted dense matrix
1140 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n )
1141  : matrix_( ptr, n, n ) // The adapted dense matrix
1142 {
1143  if( !isHermitian( matrix_ ) ) {
1144  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1145  }
1146 
1147  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1148 }
1150 //*************************************************************************************************
1151 
1152 
1153 //*************************************************************************************************
1176 template< typename MT // Type of the adapted dense matrix
1177  , bool SO > // Storage order of the adapted dense matrix
1178 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn )
1179  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1180 {
1181  if( !isHermitian( matrix_ ) ) {
1182  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1183  }
1184 
1185  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1186 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1212 template< typename MT // Type of the adapted dense matrix
1213  , bool SO > // Storage order of the adapted dense matrix
1214 template< typename Deleter > // Type of the custom deleter
1215 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, Deleter d )
1216  : matrix_( ptr, n, n, d ) // The adapted dense matrix
1217 {
1218  if( !isHermitian( matrix_ ) ) {
1219  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1220  }
1221 
1222  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1223 }
1225 //*************************************************************************************************
1226 
1227 
1228 //*************************************************************************************************
1250 template< typename MT // Type of the adapted dense matrix
1251  , bool SO > // Storage order of the adapted dense matrix
1252 template< typename Deleter > // Type of the custom deleter
1253 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
1254  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
1255 {
1256  if( !isHermitian( matrix_ ) ) {
1257  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1258  }
1259 
1260  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1261 }
1263 //*************************************************************************************************
1264 
1265 
1266 //*************************************************************************************************
1272 template< typename MT // Type of the adapted dense matrix
1273  , bool SO > // Storage order of the adapted dense matrix
1274 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const HermitianMatrix& m )
1275  : matrix_( m.matrix_ ) // The adapted dense matrix
1276 {
1277  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1278  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1279 }
1281 //*************************************************************************************************
1282 
1283 
1284 //*************************************************************************************************
1290 template< typename MT // Type of the adapted dense matrix
1291  , bool SO > // Storage order of the adapted dense matrix
1292 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1293  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1294 {
1295  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1296  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1297 }
1299 //*************************************************************************************************
1300 
1301 
1302 //*************************************************************************************************
1312 template< typename MT // Type of the adapted dense matrix
1313  , bool SO > // Storage order of the adapted dense matrix
1314 template< typename MT2 // Type of the foreign matrix
1315  , bool SO2 > // Storage order of the foreign matrix
1316 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Matrix<MT2,SO2>& m )
1317  : matrix_( construct( m, typename IsBuiltin< ElementType_<MT2> >::Type() ) ) // The adapted dense matrix
1318 {
1319  if( !IsHermitian<MT2>::value && !isHermitian( matrix_ ) ) {
1320  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1321  }
1322 
1323  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1324 }
1326 //*************************************************************************************************
1327 
1328 
1329 
1330 
1331 //=================================================================================================
1332 //
1333 // DATA ACCESS FUNCTIONS
1334 //
1335 //=================================================================================================
1336 
1337 //*************************************************************************************************
1353 template< typename MT // Type of the adapted dense matrix
1354  , bool SO > // Storage order of the adapted dense matrix
1356  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1357 {
1358  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1359  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1360 
1361  return Reference( matrix_, i, j );
1362 }
1364 //*************************************************************************************************
1365 
1366 
1367 //*************************************************************************************************
1383 template< typename MT // Type of the adapted dense matrix
1384  , bool SO > // Storage order of the adapted dense matrix
1386  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1387 {
1388  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1389  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1390 
1391  return matrix_(i,j);
1392 }
1394 //*************************************************************************************************
1395 
1396 
1397 //*************************************************************************************************
1414 template< typename MT // Type of the adapted dense matrix
1415  , bool SO > // Storage order of the adapted dense matrix
1417  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j )
1418 {
1419  if( i >= rows() ) {
1420  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1421  }
1422  if( j >= columns() ) {
1423  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1424  }
1425  return (*this)(i,j);
1426 }
1428 //*************************************************************************************************
1429 
1430 
1431 //*************************************************************************************************
1448 template< typename MT // Type of the adapted dense matrix
1449  , bool SO > // Storage order of the adapted dense matrix
1451  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1452 {
1453  if( i >= rows() ) {
1454  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1455  }
1456  if( j >= columns() ) {
1457  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1458  }
1459  return (*this)(i,j);
1460 }
1462 //*************************************************************************************************
1463 
1464 
1465 //*************************************************************************************************
1479 template< typename MT // Type of the adapted dense matrix
1480  , bool SO > // Storage order of the adapted dense matrix
1481 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1482  HermitianMatrix<MT,SO,true>::data() const noexcept
1483 {
1484  return matrix_.data();
1485 }
1487 //*************************************************************************************************
1488 
1489 
1490 //*************************************************************************************************
1501 template< typename MT // Type of the adapted dense matrix
1502  , bool SO > // Storage order of the adapted dense matrix
1503 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1504  HermitianMatrix<MT,SO,true>::data( size_t i ) const noexcept
1505 {
1506  return matrix_.data(i);
1507 }
1509 //*************************************************************************************************
1510 
1511 
1512 //*************************************************************************************************
1524 template< typename MT // Type of the adapted dense matrix
1525  , bool SO > // Storage order of the adapted dense matrix
1528 {
1529  if( SO )
1530  return Iterator( matrix_, 0UL, i );
1531  else
1532  return Iterator( matrix_, i, 0UL );
1533 }
1535 //*************************************************************************************************
1536 
1537 
1538 //*************************************************************************************************
1550 template< typename MT // Type of the adapted dense matrix
1551  , bool SO > // Storage order of the adapted dense matrix
1553  HermitianMatrix<MT,SO,true>::begin( size_t i ) const
1554 {
1555  return matrix_.begin(i);
1556 }
1558 //*************************************************************************************************
1559 
1560 
1561 //*************************************************************************************************
1573 template< typename MT // Type of the adapted dense matrix
1574  , bool SO > // Storage order of the adapted dense matrix
1576  HermitianMatrix<MT,SO,true>::cbegin( size_t i ) const
1577 {
1578  return matrix_.cbegin(i);
1579 }
1581 //*************************************************************************************************
1582 
1583 
1584 //*************************************************************************************************
1596 template< typename MT // Type of the adapted dense matrix
1597  , bool SO > // Storage order of the adapted dense matrix
1600 {
1601  if( SO )
1602  return Iterator( matrix_, rows(), i );
1603  else
1604  return Iterator( matrix_, i, columns() );
1605 }
1607 //*************************************************************************************************
1608 
1609 
1610 //*************************************************************************************************
1622 template< typename MT // Type of the adapted dense matrix
1623  , bool SO > // Storage order of the adapted dense matrix
1625  HermitianMatrix<MT,SO,true>::end( size_t i ) const
1626 {
1627  return matrix_.end(i);
1628 }
1630 //*************************************************************************************************
1631 
1632 
1633 //*************************************************************************************************
1645 template< typename MT // Type of the adapted dense matrix
1646  , bool SO > // Storage order of the adapted dense matrix
1648  HermitianMatrix<MT,SO,true>::cend( size_t i ) const
1649 {
1650  return matrix_.cend(i);
1651 }
1653 //*************************************************************************************************
1654 
1655 
1656 
1657 
1658 //=================================================================================================
1659 //
1660 // ASSIGNMENT OPERATORS
1661 //
1662 //=================================================================================================
1663 
1664 //*************************************************************************************************
1690 template< typename MT // Type of the adapted dense matrix
1691  , bool SO > // Storage order of the adapted dense matrix
1692 inline HermitianMatrix<MT,SO,true>&
1693  HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1694 {
1695  MT tmp( list );
1696 
1697  if( !isHermitian( tmp ) ) {
1698  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1699  }
1700 
1701  matrix_ = std::move( tmp );
1702 
1703  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1704  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1705 
1706  return *this;
1707 }
1709 //*************************************************************************************************
1710 
1711 
1712 //*************************************************************************************************
1738 template< typename MT // Type of the adapted dense matrix
1739  , bool SO > // Storage order of the adapted dense matrix
1740 template< typename Other // Data type of the initialization array
1741  , size_t N > // Number of rows and columns of the initialization array
1742 inline HermitianMatrix<MT,SO,true>&
1743  HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1744 {
1745  MT tmp( array );
1746 
1747  if( !isHermitian( tmp ) ) {
1748  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1749  }
1750 
1751  matrix_ = std::move( tmp );
1752 
1753  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1754  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1755 
1756  return *this;
1757 }
1759 //*************************************************************************************************
1760 
1761 
1762 //*************************************************************************************************
1772 template< typename MT // Type of the adapted dense matrix
1773  , bool SO > // Storage order of the adapted dense matrix
1774 inline HermitianMatrix<MT,SO,true>&
1775  HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1776 {
1777  matrix_ = rhs.matrix_;
1778 
1779  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1780  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1781 
1782  return *this;
1783 }
1785 //*************************************************************************************************
1786 
1787 
1788 //*************************************************************************************************
1795 template< typename MT // Type of the adapted dense matrix
1796  , bool SO > // Storage order of the adapted dense matrix
1797 inline HermitianMatrix<MT,SO,true>&
1798  HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1799 {
1800  matrix_ = std::move( rhs.matrix_ );
1801 
1802  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1803  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1804 
1805  return *this;
1806 }
1808 //*************************************************************************************************
1809 
1810 
1811 //*************************************************************************************************
1824 template< typename MT // Type of the adapted dense matrix
1825  , bool SO > // Storage order of the adapted dense matrix
1826 template< typename MT2 // Type of the right-hand side matrix
1827  , bool SO2 > // Storage order of the right-hand side matrix
1828 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1829  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1830 {
1831  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1832  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1833  }
1834 
1835  matrix_ = ~rhs;
1836 
1837  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1838  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1839 
1840  return *this;
1841 }
1843 //*************************************************************************************************
1844 
1845 
1846 //*************************************************************************************************
1859 template< typename MT // Type of the adapted dense matrix
1860  , bool SO > // Storage order of the adapted dense matrix
1861 template< typename MT2 // Type of the right-hand side matrix
1862  , bool SO2 > // Storage order of the right-hand side matrix
1863 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1864  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1865 {
1866  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1867  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1868  }
1869 
1870  if( IsHermitian<MT2>::value ) {
1871  matrix_ = ~rhs;
1872  }
1873  else {
1874  MT tmp( ~rhs );
1875 
1876  if( !isHermitian( tmp ) ) {
1877  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1878  }
1879 
1880  matrix_ = std::move( tmp );
1881  }
1882 
1883  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1884  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1885 
1886  return *this;
1887 }
1889 //*************************************************************************************************
1890 
1891 
1892 //*************************************************************************************************
1905 template< typename MT // Type of the adapted dense matrix
1906  , bool SO > // Storage order of the adapted dense matrix
1907 template< typename MT2 > // Type of the right-hand side matrix
1908 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1909  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1910 {
1911  return this->operator=( trans( ~rhs ) );
1912 }
1914 //*************************************************************************************************
1915 
1916 
1917 //*************************************************************************************************
1930 template< typename MT // Type of the adapted dense matrix
1931  , bool SO > // Storage order of the adapted dense matrix
1932 template< typename MT2 // Type of the right-hand side matrix
1933  , bool SO2 > // Storage order of the right-hand side matrix
1934 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1935  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1936 {
1937  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1938  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1939  }
1940 
1941  matrix_ += ~rhs;
1942 
1943  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1944  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1945 
1946  return *this;
1947 }
1949 //*************************************************************************************************
1950 
1951 
1952 //*************************************************************************************************
1965 template< typename MT // Type of the adapted dense matrix
1966  , bool SO > // Storage order of the adapted dense matrix
1967 template< typename MT2 // Type of the right-hand side matrix
1968  , bool SO2 > // Storage order of the right-hand side matrix
1969 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1970  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1971 {
1972  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1973  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1974  }
1975 
1976  if( IsHermitian<MT2>::value ) {
1977  matrix_ += ~rhs;
1978  }
1979  else {
1980  const ResultType_<MT2> tmp( ~rhs );
1981 
1982  if( !isHermitian( tmp ) ) {
1983  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1984  }
1985 
1986  matrix_ += tmp;
1987  }
1988 
1989  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1990  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1991 
1992  return *this;
1993 }
1995 //*************************************************************************************************
1996 
1997 
1998 //*************************************************************************************************
2012 template< typename MT // Type of the adapted dense matrix
2013  , bool SO > // Storage order of the adapted dense matrix
2014 template< typename MT2 > // Type of the right-hand side matrix
2015 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2016  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
2017 {
2018  return this->operator+=( trans( ~rhs ) );
2019 }
2021 //*************************************************************************************************
2022 
2023 
2024 //*************************************************************************************************
2037 template< typename MT // Type of the adapted dense matrix
2038  , bool SO > // Storage order of the adapted dense matrix
2039 template< typename MT2 // Type of the right-hand side matrix
2040  , bool SO2 > // Storage order of the right-hand side matrix
2041 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2042  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2043 {
2044  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
2045  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2046  }
2047 
2048  matrix_ -= ~rhs;
2049 
2050  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2051  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2052 
2053  return *this;
2054 }
2056 //*************************************************************************************************
2057 
2058 
2059 //*************************************************************************************************
2072 template< typename MT // Type of the adapted dense matrix
2073  , bool SO > // Storage order of the adapted dense matrix
2074 template< typename MT2 // Type of the right-hand side matrix
2075  , bool SO2 > // Storage order of the right-hand side matrix
2076 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2077  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2078 {
2079  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2080  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2081  }
2082 
2083  if( IsHermitian<MT2>::value ) {
2084  matrix_ -= ~rhs;
2085  }
2086  else {
2087  const ResultType_<MT2> tmp( ~rhs );
2088 
2089  if( !isHermitian( tmp ) ) {
2090  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2091  }
2092 
2093  matrix_ -= tmp;
2094  }
2095 
2096  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2097  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2098 
2099  return *this;
2100 }
2102 //*************************************************************************************************
2103 
2104 
2105 //*************************************************************************************************
2119 template< typename MT // Type of the adapted dense matrix
2120  , bool SO > // Storage order of the adapted dense matrix
2121 template< typename MT2 > // Type of the right-hand side matrix
2122 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2123  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2124 {
2125  return this->operator-=( trans( ~rhs ) );
2126 }
2128 //*************************************************************************************************
2129 
2130 
2131 //*************************************************************************************************
2143 template< typename MT // Type of the adapted dense matrix
2144  , bool SO > // Storage order of the adapted dense matrix
2145 template< typename MT2 // Type of the right-hand side matrix
2146  , bool SO2 > // Storage order of the right-hand side matrix
2147 inline HermitianMatrix<MT,SO,true>&
2148  HermitianMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
2149 {
2150  if( matrix_.rows() != (~rhs).columns() ) {
2151  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2152  }
2153 
2154  MT tmp( matrix_ * ~rhs );
2155 
2156  if( !isHermitian( tmp ) ) {
2157  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2158  }
2159 
2160  matrix_ = std::move( tmp );
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 //*************************************************************************************************
2179 template< typename MT // Type of the adapted dense matrix
2180  , bool SO > // Storage order of the adapted dense matrix
2181 template< typename Other > // Data type of the right-hand side scalar
2182 inline EnableIf_< IsNumeric<Other>, HermitianMatrix<MT,SO,true> >&
2184 {
2185  matrix_ *= rhs;
2186  return *this;
2187 }
2188 //*************************************************************************************************
2189 
2190 
2191 //*************************************************************************************************
2199 template< typename MT // Type of the adapted dense matrix
2200  , bool SO > // Storage order of the adapted dense matrix
2201 template< typename Other > // Data type of the right-hand side scalar
2202 inline EnableIf_< IsNumeric<Other>, HermitianMatrix<MT,SO,true> >&
2204 {
2205  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2206 
2207  matrix_ /= rhs;
2208  return *this;
2209 }
2211 //*************************************************************************************************
2212 
2213 
2214 
2215 
2216 //=================================================================================================
2217 //
2218 // UTILITY FUNCTIONS
2219 //
2220 //=================================================================================================
2221 
2222 //*************************************************************************************************
2228 template< typename MT // Type of the adapted dense matrix
2229  , bool SO > // Storage order of the adapted dense matrix
2230 inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2231 {
2232  return matrix_.rows();
2233 }
2235 //*************************************************************************************************
2236 
2237 
2238 //*************************************************************************************************
2244 template< typename MT // Type of the adapted dense matrix
2245  , bool SO > // Storage order of the adapted dense matrix
2246 inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2247 {
2248  return matrix_.columns();
2249 }
2251 //*************************************************************************************************
2252 
2253 
2254 //*************************************************************************************************
2266 template< typename MT // Type of the adapted dense matrix
2267  , bool SO > // Storage order of the adapted dense matrix
2268 inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2269 {
2270  return matrix_.spacing();
2271 }
2273 //*************************************************************************************************
2274 
2275 
2276 //*************************************************************************************************
2282 template< typename MT // Type of the adapted dense matrix
2283  , bool SO > // Storage order of the adapted dense matrix
2284 inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2285 {
2286  return matrix_.capacity();
2287 }
2289 //*************************************************************************************************
2290 
2291 
2292 //*************************************************************************************************
2303 template< typename MT // Type of the adapted dense matrix
2304  , bool SO > // Storage order of the adapted dense matrix
2305 inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2306 {
2307  return matrix_.capacity(i);
2308 }
2310 //*************************************************************************************************
2311 
2312 
2313 //*************************************************************************************************
2319 template< typename MT // Type of the adapted dense matrix
2320  , bool SO > // Storage order of the adapted dense matrix
2321 inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2322 {
2323  return matrix_.nonZeros();
2324 }
2326 //*************************************************************************************************
2327 
2328 
2329 //*************************************************************************************************
2341 template< typename MT // Type of the adapted dense matrix
2342  , bool SO > // Storage order of the adapted dense matrix
2343 inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2344 {
2345  return matrix_.nonZeros(i);
2346 }
2348 //*************************************************************************************************
2349 
2350 
2351 //*************************************************************************************************
2357 template< typename MT // Type of the adapted dense matrix
2358  , bool SO > // Storage order of the adapted dense matrix
2360 {
2361  matrix_.reset();
2362 }
2364 //*************************************************************************************************
2365 
2366 
2367 //*************************************************************************************************
2403 template< typename MT // Type of the adapted dense matrix
2404  , bool SO > // Storage order of the adapted dense matrix
2405 inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2406 {
2407  row ( matrix_, i ).reset();
2408  column( matrix_, i ).reset();
2409 }
2411 //*************************************************************************************************
2412 
2413 
2414 //*************************************************************************************************
2426 template< typename MT // Type of the adapted dense matrix
2427  , bool SO > // Storage order of the adapted dense matrix
2429 {
2430  using blaze::clear;
2431 
2432  clear( matrix_ );
2433 }
2435 //*************************************************************************************************
2436 
2437 
2438 //*************************************************************************************************
2473 template< typename MT // Type of the adapted dense matrix
2474  , bool SO > // Storage order of the adapted dense matrix
2475 void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2476 {
2478 
2479  UNUSED_PARAMETER( preserve );
2480 
2481  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2482 
2483  const size_t oldsize( matrix_.rows() );
2484 
2485  matrix_.resize( n, n, true );
2486 
2487  if( n > oldsize ) {
2488  const size_t increment( n - oldsize );
2489  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2490  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2491  }
2492 }
2494 //*************************************************************************************************
2495 
2496 
2497 //*************************************************************************************************
2510 template< typename MT // Type of the adapted dense matrix
2511  , bool SO > // Storage order of the adapted dense matrix
2512 inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2513 {
2515 
2516  UNUSED_PARAMETER( preserve );
2517 
2518  resize( rows() + n, true );
2519 }
2520 //*************************************************************************************************
2521 
2522 
2523 //*************************************************************************************************
2533 template< typename MT // Type of the adapted dense matrix
2534  , bool SO > // Storage order of the adapted dense matrix
2535 inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2536 {
2537  matrix_.reserve( elements );
2538 }
2540 //*************************************************************************************************
2541 
2542 
2543 //*************************************************************************************************
2550 template< typename MT // Type of the adapted dense matrix
2551  , bool SO > // Storage order of the adapted dense matrix
2552 inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2553 {
2554  using std::swap;
2555 
2556  swap( matrix_, m.matrix_ );
2557 }
2559 //*************************************************************************************************
2560 
2561 
2562 
2563 
2564 //=================================================================================================
2565 //
2566 // NUMERIC FUNCTIONS
2567 //
2568 //=================================================================================================
2569 
2570 //*************************************************************************************************
2576 template< typename MT // Type of the adapted dense matrix
2577  , bool SO > // Storage order of the adapted dense matrix
2578 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2579 {
2580  if( IsComplex<ElementType>::value )
2581  matrix_.transpose();
2582  return *this;
2583 }
2585 //*************************************************************************************************
2586 
2587 
2588 //*************************************************************************************************
2594 template< typename MT // Type of the adapted dense matrix
2595  , bool SO > // Storage order of the adapted dense matrix
2596 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2597 {
2598  return *this;
2599 }
2601 //*************************************************************************************************
2602 
2603 
2604 //*************************************************************************************************
2611 template< typename MT // Type of the adapted dense matrix
2612  , bool SO > // Storage order of the adapted dense matrix
2613 template< typename Other > // Data type of the scalar value
2614 inline HermitianMatrix<MT,SO,true>&
2615  HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2616 {
2617  matrix_.scale( scalar );
2618  return *this;
2619 }
2621 //*************************************************************************************************
2622 
2623 
2624 
2625 
2626 //=================================================================================================
2627 //
2628 // DEBUGGING FUNCTIONS
2629 //
2630 //=================================================================================================
2631 
2632 //*************************************************************************************************
2642 template< typename MT // Type of the adapted dense matrix
2643  , bool SO > // Storage order of the adapted dense matrix
2644 inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2645 {
2646  using blaze::isIntact;
2647 
2648  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2649 }
2651 //*************************************************************************************************
2652 
2653 
2654 
2655 
2656 //=================================================================================================
2657 //
2658 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2659 //
2660 //=================================================================================================
2661 
2662 //*************************************************************************************************
2673 template< typename MT // Type of the adapted dense matrix
2674  , bool SO > // Storage order of the adapted dense matrix
2675 template< typename Other > // Data type of the foreign expression
2676 inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2677 {
2678  return matrix_.canAlias( alias );
2679 }
2681 //*************************************************************************************************
2682 
2683 
2684 //*************************************************************************************************
2695 template< typename MT // Type of the adapted dense matrix
2696  , bool SO > // Storage order of the adapted dense matrix
2697 template< typename Other > // Data type of the foreign expression
2698 inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2699 {
2700  return matrix_.isAliased( alias );
2701 }
2703 //*************************************************************************************************
2704 
2705 
2706 //*************************************************************************************************
2716 template< typename MT // Type of the adapted dense matrix
2717  , bool SO > // Storage order of the adapted dense matrix
2718 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2719 {
2720  return matrix_.isAligned();
2721 }
2723 //*************************************************************************************************
2724 
2725 
2726 //*************************************************************************************************
2737 template< typename MT // Type of the adapted dense matrix
2738  , bool SO > // Storage order of the adapted dense matrix
2739 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2740 {
2741  return matrix_.canSMPAssign();
2742 }
2744 //*************************************************************************************************
2745 
2746 
2747 //*************************************************************************************************
2763 template< typename MT // Type of the adapted dense matrix
2764  , bool SO > // Storage order of the adapted dense matrix
2765 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2766  HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2767 {
2768  return matrix_.load( i, j );
2769 }
2771 //*************************************************************************************************
2772 
2773 
2774 //*************************************************************************************************
2790 template< typename MT // Type of the adapted dense matrix
2791  , bool SO > // Storage order of the adapted dense matrix
2792 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2793  HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2794 {
2795  return matrix_.loada( i, j );
2796 }
2798 //*************************************************************************************************
2799 
2800 
2801 //*************************************************************************************************
2817 template< typename MT // Type of the adapted dense matrix
2818  , bool SO > // Storage order of the adapted dense matrix
2819 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2820  HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2821 {
2822  return matrix_.loadu( i, j );
2823 }
2825 //*************************************************************************************************
2826 
2827 
2828 //*************************************************************************************************
2845 template< typename MT // Type of the adapted dense matrix
2846  , bool SO > // Storage order of the adapted dense matrix
2847 inline void
2848  HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2849 {
2850  matrix_.store( i, j, value );
2851 
2852  if( SO ) {
2853  const size_t kend( min( i+SIMDSIZE, rows() ) );
2854  for( size_t k=i; k<kend; ++k )
2855  matrix_(j,k) = conj( matrix_(k,j) );
2856  }
2857  else {
2858  const size_t kend( min( j+SIMDSIZE, columns() ) );
2859  for( size_t k=j; k<kend; ++k )
2860  matrix_(k,i) = conj( matrix_(i,k) );
2861  }
2862 }
2864 //*************************************************************************************************
2865 
2866 
2867 //*************************************************************************************************
2884 template< typename MT // Type of the adapted dense matrix
2885  , bool SO > // Storage order of the adapted dense matrix
2886 inline void
2887  HermitianMatrix<MT,SO,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2888 {
2889  matrix_.storea( i, j, value );
2890 
2891  if( SO ) {
2892  const size_t kend( min( i+SIMDSIZE, rows() ) );
2893  for( size_t k=i; k<kend; ++k )
2894  matrix_(j,k) = conj( matrix_(k,j) );
2895  }
2896  else {
2897  const size_t kend( min( j+SIMDSIZE, columns() ) );
2898  for( size_t k=j; k<kend; ++k )
2899  matrix_(k,i) = conj( matrix_(i,k) );
2900  }
2901 }
2903 //*************************************************************************************************
2904 
2905 
2906 //*************************************************************************************************
2923 template< typename MT // Type of the adapted dense matrix
2924  , bool SO > // Storage order of the adapted dense matrix
2925 inline void
2926  HermitianMatrix<MT,SO,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2927 {
2928  matrix_.storeu( i, j, value );
2929 
2930  if( SO ) {
2931  const size_t kend( min( i+SIMDSIZE, rows() ) );
2932  for( size_t k=i; k<kend; ++k )
2933  matrix_(j,k) = conj( matrix_(k,j) );
2934  }
2935  else {
2936  const size_t kend( min( j+SIMDSIZE, columns() ) );
2937  for( size_t k=j; k<kend; ++k )
2938  matrix_(k,i) = conj( matrix_(i,k) );
2939  }
2940 }
2942 //*************************************************************************************************
2943 
2944 
2945 //*************************************************************************************************
2962 template< typename MT // Type of the adapted dense matrix
2963  , bool SO > // Storage order of the adapted dense matrix
2964 inline void
2965  HermitianMatrix<MT,SO,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2966 {
2967  matrix_.stream( i, j, value );
2968 
2969  if( SO ) {
2970  const size_t kend( min( i+SIMDSIZE, rows() ) );
2971  for( size_t k=i; k<kend; ++k )
2972  matrix_(j,k) = conj( matrix_(k,j) );
2973  }
2974  else {
2975  const size_t kend( min( j+SIMDSIZE, columns() ) );
2976  for( size_t k=j; k<kend; ++k )
2977  matrix_(k,i) = conj( matrix_(i,k) );
2978  }
2979 }
2981 //*************************************************************************************************
2982 
2983 
2984 
2985 
2986 //=================================================================================================
2987 //
2988 // CONSTRUCTION FUNCTIONS
2989 //
2990 //=================================================================================================
2991 
2992 //*************************************************************************************************
2994 template< typename MT // Type of the adapted dense matrix
2995  , bool SO > // Storage order of the adapted dense matrix
2996 template< typename MT2 // Type of the foreign matrix
2997  , bool SO2 // Storage order of the foreign matrix
2998  , typename T > // Type of the third argument
2999 inline const MT2& HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3000 {
3001  return ~m;
3002 }
3004 //*************************************************************************************************
3005 
3006 
3007 //*************************************************************************************************
3009 template< typename MT // Type of the adapted dense matrix
3010  , bool SO > // Storage order of the adapted dense matrix
3011 template< typename MT2 > // Type of the foreign matrix
3012 inline TransExprTrait_<MT2>
3013  HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
3014 {
3015  return trans( ~m );
3016 }
3018 //*************************************************************************************************
3019 
3020 } // namespace blaze
3021 
3022 #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
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:102
const DMatForEachExpr< MT, Conj, SO > conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatForEachExpr.h:1214
Header file for auxiliary alias declarations.
Constraint on the data type.
Header file for mathematical functions.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
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:261
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
Header file for the dense matrix inversion flags.
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:194
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5556
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:596
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#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:390
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
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
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2931
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:304
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:238
Constraint on the data type.
Constraint on the data type.
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:143
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5635
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:5618
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
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:336
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
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:544
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:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
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.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
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:553
Header file for all restructuring column functions.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
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:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:775
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:267
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:223
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:320
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(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
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
#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.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
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:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
#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:1303
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#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
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:168
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:677
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
Header file for the TrueType type/value trait base class.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:570