Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
58 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Clear.h>
66 #include <blaze/math/SIMD.h>
71 #include <blaze/math/views/Check.h>
73 #include <blaze/math/views/Row.h>
75 #include <blaze/system/Inline.h>
77 #include <blaze/util/Assert.h>
83 #include <blaze/util/DisableIf.h>
84 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/TrueType.h>
88 #include <blaze/util/Types.h>
92 #include <blaze/util/Unused.h>
93 
94 
95 namespace blaze {
96 
97 //=================================================================================================
98 //
99 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
100 //
101 //=================================================================================================
102 
103 //*************************************************************************************************
111 template< typename MT // Type of the adapted dense matrix
112  , bool SO > // Storage order of the adapted dense matrix
113 class HermitianMatrix<MT,SO,true>
114  : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
115 {
116  private:
117  //**Type definitions****************************************************************************
118  using OT = OppositeType_t<MT>;
119  using TT = TransposeType_t<MT>;
120  using ET = ElementType_t<MT>;
121  //**********************************************************************************************
122 
123  public:
124  //**Type definitions****************************************************************************
125  using This = HermitianMatrix<MT,SO,true>;
126  using BaseType = DenseMatrix<This,SO>;
127  using ResultType = This;
128  using OppositeType = HermitianMatrix<OT,!SO,true>;
129  using TransposeType = HermitianMatrix<TT,!SO,true>;
130  using ElementType = ET;
131  using SIMDType = SIMDType_t<MT>;
132  using ReturnType = ReturnType_t<MT>;
133  using CompositeType = const This&;
134  using Reference = HermitianProxy<MT>;
135  using ConstReference = ConstReference_t<MT>;
136  using Pointer = Pointer_t<MT>;
137  using ConstPointer = ConstPointer_t<MT>;
138  using ConstIterator = ConstIterator_t<MT>;
139  //**********************************************************************************************
140 
141  //**Rebind struct definition********************************************************************
144  template< typename NewType > // Data type of the other matrix
145  struct Rebind {
147  using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
148  };
149  //**********************************************************************************************
150 
151  //**Resize struct definition********************************************************************
154  template< size_t NewM // Number of rows of the other matrix
155  , size_t NewN > // Number of columns of the other matrix
156  struct Resize {
158  using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
159  };
160  //**********************************************************************************************
161 
162  //**Iterator class definition*******************************************************************
165  class Iterator
166  {
167  public:
168  //**Type definitions*************************************************************************
169  using IteratorCategory = std::random_access_iterator_tag;
170  using ValueType = ElementType_t<MT>;
171  using PointerType = HermitianProxy<MT>;
172  using ReferenceType = HermitianProxy<MT>;
173  using DifferenceType = ptrdiff_t;
174 
175  // STL iterator requirements
176  using iterator_category = IteratorCategory;
177  using value_type = ValueType;
178  using pointer = PointerType;
179  using reference = ReferenceType;
180  using difference_type = DifferenceType;
181  //*******************************************************************************************
182 
183  //**Constructor******************************************************************************
186  inline Iterator() noexcept
187  : matrix_( nullptr ) // Reference to the adapted dense matrix
188  , row_ ( 0UL ) // The current row index of the iterator
189  , column_( 0UL ) // The current column index of the iterator
190  {}
191  //*******************************************************************************************
192 
193  //**Constructor******************************************************************************
200  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
201  : matrix_( &matrix ) // Reference to the adapted dense matrix
202  , row_ ( row ) // The current row index of the iterator
203  , column_( column ) // The current column index of the iterator
204  {}
205  //*******************************************************************************************
206 
207  //**Addition assignment operator*************************************************************
213  inline Iterator& operator+=( size_t inc ) noexcept {
214  ( SO )?( row_ += inc ):( column_ += inc );
215  return *this;
216  }
217  //*******************************************************************************************
218 
219  //**Subtraction assignment operator**********************************************************
225  inline Iterator& operator-=( size_t dec ) noexcept {
226  ( SO )?( row_ -= dec ):( column_ -= dec );
227  return *this;
228  }
229  //*******************************************************************************************
230 
231  //**Prefix increment operator****************************************************************
236  inline Iterator& operator++() noexcept {
237  ( SO )?( ++row_ ):( ++column_ );
238  return *this;
239  }
240  //*******************************************************************************************
241 
242  //**Postfix increment operator***************************************************************
247  inline const Iterator operator++( int ) noexcept {
248  const Iterator tmp( *this );
249  ++(*this);
250  return tmp;
251  }
252  //*******************************************************************************************
253 
254  //**Prefix decrement operator****************************************************************
259  inline Iterator& operator--() noexcept {
260  ( SO )?( --row_ ):( --column_ );
261  return *this;
262  }
263  //*******************************************************************************************
264 
265  //**Postfix decrement operator***************************************************************
270  inline const Iterator operator--( int ) noexcept {
271  const Iterator tmp( *this );
272  --(*this);
273  return tmp;
274  }
275  //*******************************************************************************************
276 
277  //**Element access operator******************************************************************
282  inline ReferenceType operator*() const {
283  return ReferenceType( *matrix_, row_, column_ );
284  }
285  //*******************************************************************************************
286 
287  //**Element access operator******************************************************************
292  inline PointerType operator->() const {
293  return PointerType( *matrix_, row_, column_ );
294  }
295  //*******************************************************************************************
296 
297  //**Load function****************************************************************************
307  inline SIMDType load() const {
308  return (*matrix_).load(row_,column_);
309  }
310  //*******************************************************************************************
311 
312  //**Loada function***************************************************************************
322  inline SIMDType loada() const {
323  return (*matrix_).loada(row_,column_);
324  }
325  //*******************************************************************************************
326 
327  //**Loadu function***************************************************************************
337  inline SIMDType loadu() const {
338  return (*matrix_).loadu(row_,column_);
339  }
340  //*******************************************************************************************
341 
342  //**Store function***************************************************************************
353  inline void store( const SIMDType& value ) const {
354  (*matrix_).store( row_, column_, value );
355  sync();
356  }
357  //*******************************************************************************************
358 
359  //**Storea function**************************************************************************
370  inline void storea( const SIMDType& value ) const {
371  (*matrix_).storea( row_, column_, value );
372  sync();
373  }
374  //*******************************************************************************************
375 
376  //**Storeu function**************************************************************************
387  inline void storeu( const SIMDType& value ) const {
388  (*matrix_).storeu( row_, column_, value );
389  sync();
390  }
391  //*******************************************************************************************
392 
393  //**Stream function**************************************************************************
404  inline void stream( const SIMDType& value ) const {
405  (*matrix_).stream( row_, column_, value );
406  sync();
407  }
408  //*******************************************************************************************
409 
410  //**Conversion operator**********************************************************************
415  inline operator ConstIterator() const {
416  if( SO )
417  return matrix_->begin( column_ ) + row_;
418  else
419  return matrix_->begin( row_ ) + column_;
420  }
421  //*******************************************************************************************
422 
423  //**Equality operator************************************************************************
430  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
431  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
432  }
433  //*******************************************************************************************
434 
435  //**Equality operator************************************************************************
442  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
443  return ( ConstIterator( lhs ) == rhs );
444  }
445  //*******************************************************************************************
446 
447  //**Equality operator************************************************************************
454  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
455  return ( lhs == ConstIterator( rhs ) );
456  }
457  //*******************************************************************************************
458 
459  //**Inequality operator**********************************************************************
466  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
467  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
468  }
469  //*******************************************************************************************
470 
471  //**Inequality operator**********************************************************************
478  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
479  return ( ConstIterator( lhs ) != rhs );
480  }
481  //*******************************************************************************************
482 
483  //**Inequality operator**********************************************************************
490  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
491  return ( lhs != ConstIterator( rhs ) );
492  }
493  //*******************************************************************************************
494 
495  //**Less-than operator***********************************************************************
502  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
503  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
504  }
505  //*******************************************************************************************
506 
507  //**Less-than operator***********************************************************************
514  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
515  return ( ConstIterator( lhs ) < rhs );
516  }
517  //*******************************************************************************************
518 
519  //**Less-than operator***********************************************************************
526  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
527  return ( lhs < ConstIterator( rhs ) );
528  }
529  //*******************************************************************************************
530 
531  //**Greater-than operator********************************************************************
538  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
539  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
540  }
541  //*******************************************************************************************
542 
543  //**Greater-than operator********************************************************************
550  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
551  return ( ConstIterator( lhs ) > rhs );
552  }
553  //*******************************************************************************************
554 
555  //**Greater-than operator********************************************************************
562  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
563  return ( lhs > ConstIterator( rhs ) );
564  }
565  //*******************************************************************************************
566 
567  //**Less-or-equal-than operator**************************************************************
574  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
575  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
576  }
577  //*******************************************************************************************
578 
579  //**Less-or-equal-than operator**************************************************************
586  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
587  return ( ConstIterator( lhs ) <= rhs );
588  }
589  //*******************************************************************************************
590 
591  //**Less-or-equal-than operator**************************************************************
598  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
599  return ( lhs <= ConstIterator( rhs ) );
600  }
601  //*******************************************************************************************
602 
603  //**Greater-or-equal-than operator***********************************************************
610  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
611  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
612  }
613  //*******************************************************************************************
614 
615  //**Greater-or-equal-than operator***********************************************************
622  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
623  return ( ConstIterator( lhs ) >= rhs );
624  }
625  //*******************************************************************************************
626 
627  //**Greater-or-equal-than operator***********************************************************
634  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
635  return ( lhs >= ConstIterator( rhs ) );
636  }
637  //*******************************************************************************************
638 
639  //**Subtraction operator*********************************************************************
645  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
646  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
647  }
648  //*******************************************************************************************
649 
650  //**Addition operator************************************************************************
657  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
658  if( SO )
659  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
660  else
661  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
662  }
663  //*******************************************************************************************
664 
665  //**Addition operator************************************************************************
672  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
673  if( SO )
674  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
675  else
676  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
677  }
678  //*******************************************************************************************
679 
680  //**Subtraction operator*********************************************************************
687  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
688  if( SO )
689  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
690  else
691  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
692  }
693  //*******************************************************************************************
694 
695  private:
696  //**Sync function****************************************************************************
701  void sync() const {
702  if( SO ) {
703  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
704  for( size_t k=row_; k<kend; ++k )
705  (*matrix_)(column_,k) = conj( (*matrix_)(k,column_) );
706  }
707  else {
708  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
709  for( size_t k=column_; k<kend; ++k )
710  (*matrix_)(k,row_) = conj( (*matrix_)(row_,k) );
711  }
712  }
713  //*******************************************************************************************
714 
715  //**Member variables*************************************************************************
716  MT* matrix_;
717  size_t row_;
718  size_t column_;
719  //*******************************************************************************************
720  };
721  //**********************************************************************************************
722 
723  //**Compilation flags***************************************************************************
725  static constexpr bool simdEnabled = MT::simdEnabled;
726 
728  static constexpr bool smpAssignable = MT::smpAssignable;
729  //**********************************************************************************************
730 
731  //**Constructors********************************************************************************
734  explicit inline HermitianMatrix();
735  explicit inline HermitianMatrix( size_t n );
736  explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
737 
738  template< typename Other >
739  explicit inline HermitianMatrix( size_t n, const Other* array );
740 
741  template< typename Other, size_t N >
742  explicit inline HermitianMatrix( const Other (&array)[N][N] );
743 
744  explicit inline HermitianMatrix( ElementType* ptr, size_t n );
745  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
746 
747  inline HermitianMatrix( const HermitianMatrix& m );
748  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
749 
750  template< typename MT2, bool SO2 >
751  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
753  //**********************************************************************************************
754 
755  //**Destructor**********************************************************************************
758  ~HermitianMatrix() = default;
760  //**********************************************************************************************
761 
762  //**Data access functions***********************************************************************
765  inline Reference operator()( size_t i, size_t j );
766  inline ConstReference operator()( size_t i, size_t j ) const;
767  inline Reference at( size_t i, size_t j );
768  inline ConstReference at( size_t i, size_t j ) const;
769  inline ConstPointer data () const noexcept;
770  inline ConstPointer data ( size_t i ) const noexcept;
771  inline Iterator begin ( size_t i );
772  inline ConstIterator begin ( size_t i ) const;
773  inline ConstIterator cbegin( size_t i ) const;
774  inline Iterator end ( size_t i );
775  inline ConstIterator end ( size_t i ) const;
776  inline ConstIterator cend ( size_t i ) const;
778  //**********************************************************************************************
779 
780  //**Assignment operators************************************************************************
783  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
784 
785  template< typename Other, size_t N >
786  inline HermitianMatrix& operator=( const Other (&array)[N][N] );
787 
788  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
789  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
790 
791  template< typename MT2, bool SO2 >
792  inline auto operator=( const Matrix<MT2,SO2>& rhs )
793  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
794 
795  template< typename MT2, bool SO2 >
796  inline auto operator=( const Matrix<MT2,SO2>& rhs )
797  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
798 
799  template< typename MT2 >
800  inline auto operator=( const Matrix<MT2,!SO>& rhs )
801  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
802 
803  template< typename MT2, bool SO2 >
804  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
805  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
806 
807  template< typename MT2, bool SO2 >
808  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
809  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
810 
811  template< typename MT2 >
812  inline auto operator+=( const Matrix<MT2,!SO>& rhs )
813  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
814 
815  template< typename MT2, bool SO2 >
816  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
817  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
818 
819  template< typename MT2, bool SO2 >
820  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
821  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
822 
823  template< typename MT2 >
824  inline auto operator-=( const Matrix<MT2,!SO>& rhs )
825  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
826 
827  template< typename MT2, bool SO2 >
828  inline auto operator%=( const Matrix<MT2,SO2>& rhs )
829  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
830 
831  template< typename MT2, bool SO2 >
832  inline auto operator%=( const Matrix<MT2,SO2>& rhs )
833  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
834 
835  template< typename MT2 >
836  inline auto operator%=( const Matrix<MT2,!SO>& rhs )
837  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
838 
839  template< typename ST >
840  inline auto operator*=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >;
841 
842  template< typename ST >
843  inline auto operator/=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >;
845  //**********************************************************************************************
846 
847  //**Utility functions***************************************************************************
850  inline size_t rows() const noexcept;
851  inline size_t columns() const noexcept;
852  inline size_t spacing() const noexcept;
853  inline size_t capacity() const noexcept;
854  inline size_t capacity( size_t i ) const noexcept;
855  inline size_t nonZeros() const;
856  inline size_t nonZeros( size_t i ) const;
857  inline void reset();
858  inline void reset( size_t i );
859  inline void clear();
860  void resize ( size_t n, bool preserve=true );
861  inline void extend ( size_t n, bool preserve=true );
862  inline void reserve( size_t elements );
863  inline void shrinkToFit();
864  inline void swap( HermitianMatrix& m ) noexcept;
866  //**********************************************************************************************
867 
868  //**Numeric functions***************************************************************************
871  inline HermitianMatrix& transpose();
872  inline HermitianMatrix& ctranspose();
873 
874  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
876  //**********************************************************************************************
877 
878  //**Debugging functions*************************************************************************
881  inline bool isIntact() const noexcept;
883  //**********************************************************************************************
884 
885  //**Expression template evaluation functions****************************************************
888  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
889  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
890 
891  inline bool isAligned () const noexcept;
892  inline bool canSMPAssign() const noexcept;
893 
894  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
895  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
896  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
897 
898  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
899  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
900  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
901  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
903  //**********************************************************************************************
904 
905  private:
906  //**Construction functions**********************************************************************
909  template< typename MT2, bool SO2, typename T >
910  inline decltype(auto) construct( const Matrix<MT2,SO2>& m, T );
911 
912  template< typename MT2 >
913  inline decltype(auto) construct( const Matrix<MT2,!SO>& m, TrueType );
915  //**********************************************************************************************
916 
917  //**SIMD properties*****************************************************************************
919  static constexpr size_t SIMDSIZE = SIMDTrait<ET>::size;
920  //**********************************************************************************************
921 
922  //**Member variables****************************************************************************
925  MT matrix_;
926 
927  //**********************************************************************************************
928 
929  //**Friend declarations*************************************************************************
930  template< bool RF, typename MT2, bool SO2, bool DF2 >
931  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
932 
933 
934  template< InversionFlag IF, typename MT2, bool SO2 >
935  friend void invert( HermitianMatrix<MT2,SO2,true>& m );
936  //**********************************************************************************************
937 
938  //**Compile time checks*************************************************************************
952  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
953  //**********************************************************************************************
954 };
956 //*************************************************************************************************
957 
958 
959 
960 
961 //=================================================================================================
962 //
963 // CONSTRUCTORS
964 //
965 //=================================================================================================
966 
967 //*************************************************************************************************
971 template< typename MT // Type of the adapted dense matrix
972  , bool SO > // Storage order of the adapted dense matrix
973 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
974  : matrix_() // The adapted dense matrix
975 {
976  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
977  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
978 }
980 //*************************************************************************************************
981 
982 
983 //*************************************************************************************************
989 template< typename MT // Type of the adapted dense matrix
990  , bool SO > // Storage order of the adapted dense matrix
991 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
992  : matrix_( n, n, ElementType() ) // The adapted dense matrix
993 {
995 
996  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
997  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
998 }
1000 //*************************************************************************************************
1001 
1002 
1003 //*************************************************************************************************
1030 template< typename MT // Type of the adapted dense matrix
1031  , bool SO > // Storage order of the adapted dense matrix
1032 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1033  : matrix_( list ) // The adapted dense matrix
1034 {
1035  if( !isHermitian( matrix_ ) ) {
1036  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1037  }
1038 
1039  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1040 }
1042 //*************************************************************************************************
1043 
1044 
1045 //*************************************************************************************************
1074 template< typename MT // Type of the adapted dense matrix
1075  , bool SO > // Storage order of the adapted dense matrix
1076 template< typename Other > // Data type of the initialization array
1077 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n, const Other* array )
1078  : matrix_( n, n, array ) // The adapted dense matrix
1079 {
1080  if( !isHermitian( matrix_ ) ) {
1081  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1082  }
1083 
1084  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1085 }
1087 //*************************************************************************************************
1088 
1089 
1090 //*************************************************************************************************
1115 template< typename MT // Type of the adapted dense matrix
1116  , bool SO > // Storage order of the adapted dense matrix
1117 template< typename Other // Data type of the initialization array
1118  , size_t N > // Number of rows and columns of the initialization array
1119 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Other (&array)[N][N] )
1120  : matrix_( array ) // The adapted dense matrix
1121 {
1122  if( !isHermitian( matrix_ ) ) {
1123  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1124  }
1125 
1126  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1127 }
1129 //*************************************************************************************************
1130 
1131 
1132 //*************************************************************************************************
1166 template< typename MT // Type of the adapted dense matrix
1167  , bool SO > // Storage order of the adapted dense matrix
1168 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n )
1169  : matrix_( ptr, n, n ) // The adapted dense matrix
1170 {
1171  if( !isHermitian( matrix_ ) ) {
1172  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1173  }
1174 
1175  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1176 }
1178 //*************************************************************************************************
1179 
1180 
1181 //*************************************************************************************************
1217 template< typename MT // Type of the adapted dense matrix
1218  , bool SO > // Storage order of the adapted dense matrix
1219 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn )
1220  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1221 {
1222  if( !isHermitian( matrix_ ) ) {
1223  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1224  }
1225 
1226  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1227 }
1229 //*************************************************************************************************
1230 
1231 
1232 //*************************************************************************************************
1238 template< typename MT // Type of the adapted dense matrix
1239  , bool SO > // Storage order of the adapted dense matrix
1240 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const HermitianMatrix& m )
1241  : matrix_( m.matrix_ ) // The adapted dense matrix
1242 {
1243  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1244  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1245 }
1247 //*************************************************************************************************
1248 
1249 
1250 //*************************************************************************************************
1256 template< typename MT // Type of the adapted dense matrix
1257  , bool SO > // Storage order of the adapted dense matrix
1258 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1259  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1260 {
1261  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1262  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1263 }
1265 //*************************************************************************************************
1266 
1267 
1268 //*************************************************************************************************
1278 template< typename MT // Type of the adapted dense matrix
1279  , bool SO > // Storage order of the adapted dense matrix
1280 template< typename MT2 // Type of the foreign matrix
1281  , bool SO2 > // Storage order of the foreign matrix
1282 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Matrix<MT2,SO2>& m )
1283  : matrix_( construct( m, typename IsBuiltin< ElementType_t<MT2> >::Type() ) ) // The adapted dense matrix
1284 {
1285  if( !IsHermitian_v<MT2> && !isHermitian( matrix_ ) ) {
1286  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1287  }
1288 
1289  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1290 }
1292 //*************************************************************************************************
1293 
1294 
1295 
1296 
1297 //=================================================================================================
1298 //
1299 // DATA ACCESS FUNCTIONS
1300 //
1301 //=================================================================================================
1302 
1303 //*************************************************************************************************
1319 template< typename MT // Type of the adapted dense matrix
1320  , bool SO > // Storage order of the adapted dense matrix
1322  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1323 {
1324  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1325  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1326 
1327  return Reference( matrix_, i, j );
1328 }
1330 //*************************************************************************************************
1331 
1332 
1333 //*************************************************************************************************
1349 template< typename MT // Type of the adapted dense matrix
1350  , bool SO > // Storage order of the adapted dense matrix
1352  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1353 {
1354  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1355  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1356 
1357  return matrix_(i,j);
1358 }
1360 //*************************************************************************************************
1361 
1362 
1363 //*************************************************************************************************
1380 template< typename MT // Type of the adapted dense matrix
1381  , bool SO > // Storage order of the adapted dense matrix
1383  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j )
1384 {
1385  if( i >= rows() ) {
1386  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1387  }
1388  if( j >= columns() ) {
1389  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1390  }
1391  return (*this)(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 ) const
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 //*************************************************************************************************
1445 template< typename MT // Type of the adapted dense matrix
1446  , bool SO > // Storage order of the adapted dense matrix
1447 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1448  HermitianMatrix<MT,SO,true>::data() const noexcept
1449 {
1450  return matrix_.data();
1451 }
1453 //*************************************************************************************************
1454 
1455 
1456 //*************************************************************************************************
1467 template< typename MT // Type of the adapted dense matrix
1468  , bool SO > // Storage order of the adapted dense matrix
1469 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1470  HermitianMatrix<MT,SO,true>::data( size_t i ) const noexcept
1471 {
1472  return matrix_.data(i);
1473 }
1475 //*************************************************************************************************
1476 
1477 
1478 //*************************************************************************************************
1490 template< typename MT // Type of the adapted dense matrix
1491  , bool SO > // Storage order of the adapted dense matrix
1494 {
1495  if( SO )
1496  return Iterator( matrix_, 0UL, i );
1497  else
1498  return Iterator( matrix_, i, 0UL );
1499 }
1501 //*************************************************************************************************
1502 
1503 
1504 //*************************************************************************************************
1516 template< typename MT // Type of the adapted dense matrix
1517  , bool SO > // Storage order of the adapted dense matrix
1519  HermitianMatrix<MT,SO,true>::begin( size_t i ) const
1520 {
1521  return matrix_.begin(i);
1522 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1539 template< typename MT // Type of the adapted dense matrix
1540  , bool SO > // Storage order of the adapted dense matrix
1542  HermitianMatrix<MT,SO,true>::cbegin( size_t i ) const
1543 {
1544  return matrix_.cbegin(i);
1545 }
1547 //*************************************************************************************************
1548 
1549 
1550 //*************************************************************************************************
1562 template< typename MT // Type of the adapted dense matrix
1563  , bool SO > // Storage order of the adapted dense matrix
1566 {
1567  if( SO )
1568  return Iterator( matrix_, rows(), i );
1569  else
1570  return Iterator( matrix_, i, columns() );
1571 }
1573 //*************************************************************************************************
1574 
1575 
1576 //*************************************************************************************************
1588 template< typename MT // Type of the adapted dense matrix
1589  , bool SO > // Storage order of the adapted dense matrix
1591  HermitianMatrix<MT,SO,true>::end( size_t i ) const
1592 {
1593  return matrix_.end(i);
1594 }
1596 //*************************************************************************************************
1597 
1598 
1599 //*************************************************************************************************
1611 template< typename MT // Type of the adapted dense matrix
1612  , bool SO > // Storage order of the adapted dense matrix
1614  HermitianMatrix<MT,SO,true>::cend( size_t i ) const
1615 {
1616  return matrix_.cend(i);
1617 }
1619 //*************************************************************************************************
1620 
1621 
1622 
1623 
1624 //=================================================================================================
1625 //
1626 // ASSIGNMENT OPERATORS
1627 //
1628 //=================================================================================================
1629 
1630 //*************************************************************************************************
1657 template< typename MT // Type of the adapted dense matrix
1658  , bool SO > // Storage order of the adapted dense matrix
1659 inline HermitianMatrix<MT,SO,true>&
1660  HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1661 {
1662  const InitializerMatrix<ElementType> tmp( list, list.size() );
1663 
1664  if( !isHermitian( tmp ) ) {
1665  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1666  }
1667 
1668  matrix_ = list;
1669 
1670  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1671  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1672 
1673  return *this;
1674 }
1676 //*************************************************************************************************
1677 
1678 
1679 //*************************************************************************************************
1705 template< typename MT // Type of the adapted dense matrix
1706  , bool SO > // Storage order of the adapted dense matrix
1707 template< typename Other // Data type of the initialization array
1708  , size_t N > // Number of rows and columns of the initialization array
1709 inline HermitianMatrix<MT,SO,true>&
1710  HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1711 {
1712  MT tmp( array );
1713 
1714  if( !isHermitian( tmp ) ) {
1715  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1716  }
1717 
1718  matrix_ = std::move( tmp );
1719 
1720  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1721  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1722 
1723  return *this;
1724 }
1726 //*************************************************************************************************
1727 
1728 
1729 //*************************************************************************************************
1739 template< typename MT // Type of the adapted dense matrix
1740  , bool SO > // Storage order of the adapted dense matrix
1741 inline HermitianMatrix<MT,SO,true>&
1742  HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1743 {
1744  matrix_ = rhs.matrix_;
1745 
1746  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1747  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1748 
1749  return *this;
1750 }
1752 //*************************************************************************************************
1753 
1754 
1755 //*************************************************************************************************
1762 template< typename MT // Type of the adapted dense matrix
1763  , bool SO > // Storage order of the adapted dense matrix
1764 inline HermitianMatrix<MT,SO,true>&
1765  HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1766 {
1767  matrix_ = std::move( rhs.matrix_ );
1768 
1769  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1770  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1771 
1772  return *this;
1773 }
1775 //*************************************************************************************************
1776 
1777 
1778 //*************************************************************************************************
1791 template< typename MT // Type of the adapted dense matrix
1792  , bool SO > // Storage order of the adapted dense matrix
1793 template< typename MT2 // Type of the right-hand side matrix
1794  , bool SO2 > // Storage order of the right-hand side matrix
1795 inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1796  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1797 {
1798  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1799  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1800  }
1801 
1802  matrix_ = ~rhs;
1803 
1804  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1805  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1806 
1807  return *this;
1808 }
1810 //*************************************************************************************************
1811 
1812 
1813 //*************************************************************************************************
1826 template< typename MT // Type of the adapted dense matrix
1827  , bool SO > // Storage order of the adapted dense matrix
1828 template< typename MT2 // Type of the right-hand side matrix
1829  , bool SO2 > // Storage order of the right-hand side matrix
1830 inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1831  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1832 {
1833  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1834  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1835  }
1836 
1837  if( IsHermitian_v<MT2> ) {
1838  matrix_ = ~rhs;
1839  }
1840  else {
1841  MT tmp( ~rhs );
1842 
1843  if( !isHermitian( tmp ) ) {
1844  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1845  }
1846 
1847  matrix_ = std::move( tmp );
1848  }
1849 
1850  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1851  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1852 
1853  return *this;
1854 }
1856 //*************************************************************************************************
1857 
1858 
1859 //*************************************************************************************************
1872 template< typename MT // Type of the adapted dense matrix
1873  , bool SO > // Storage order of the adapted dense matrix
1874 template< typename MT2 > // Type of the right-hand side matrix
1875 inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1876  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1877 {
1878  return this->operator=( trans( ~rhs ) );
1879 }
1881 //*************************************************************************************************
1882 
1883 
1884 //*************************************************************************************************
1897 template< typename MT // Type of the adapted dense matrix
1898  , bool SO > // Storage order of the adapted dense matrix
1899 template< typename MT2 // Type of the right-hand side matrix
1900  , bool SO2 > // Storage order of the right-hand side matrix
1901 inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1902  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1903 {
1904  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1905  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1906  }
1907 
1908  matrix_ += ~rhs;
1909 
1910  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1911  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1912 
1913  return *this;
1914 }
1916 //*************************************************************************************************
1917 
1918 
1919 //*************************************************************************************************
1932 template< typename MT // Type of the adapted dense matrix
1933  , bool SO > // Storage order of the adapted dense matrix
1934 template< typename MT2 // Type of the right-hand side matrix
1935  , bool SO2 > // Storage order of the right-hand side matrix
1936 inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1937  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1938 {
1939  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1940  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1941  }
1942 
1943  if( IsHermitian_v<MT2> ) {
1944  matrix_ += ~rhs;
1945  }
1946  else {
1947  const ResultType_t<MT2> tmp( ~rhs );
1948 
1949  if( !isHermitian( tmp ) ) {
1950  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1951  }
1952 
1953  matrix_ += tmp;
1954  }
1955 
1956  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1957  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1958 
1959  return *this;
1960 }
1962 //*************************************************************************************************
1963 
1964 
1965 //*************************************************************************************************
1979 template< typename MT // Type of the adapted dense matrix
1980  , bool SO > // Storage order of the adapted dense matrix
1981 template< typename MT2 > // Type of the right-hand side matrix
1982 inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1983  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1984 {
1985  return this->operator+=( trans( ~rhs ) );
1986 }
1988 //*************************************************************************************************
1989 
1990 
1991 //*************************************************************************************************
2004 template< typename MT // Type of the adapted dense matrix
2005  , bool SO > // Storage order of the adapted dense matrix
2006 template< typename MT2 // Type of the right-hand side matrix
2007  , bool SO2 > // Storage order of the right-hand side matrix
2008 inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2009  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2010 {
2011  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
2012  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2013  }
2014 
2015  matrix_ -= ~rhs;
2016 
2017  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2018  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2019 
2020  return *this;
2021 }
2023 //*************************************************************************************************
2024 
2025 
2026 //*************************************************************************************************
2039 template< typename MT // Type of the adapted dense matrix
2040  , bool SO > // Storage order of the adapted dense matrix
2041 template< typename MT2 // Type of the right-hand side matrix
2042  , bool SO2 > // Storage order of the right-hand side matrix
2043 inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2044  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2045 {
2046  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2047  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2048  }
2049 
2050  if( IsHermitian_v<MT2> ) {
2051  matrix_ -= ~rhs;
2052  }
2053  else {
2054  const ResultType_t<MT2> tmp( ~rhs );
2055 
2056  if( !isHermitian( tmp ) ) {
2057  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2058  }
2059 
2060  matrix_ -= tmp;
2061  }
2062 
2063  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2064  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2065 
2066  return *this;
2067 }
2069 //*************************************************************************************************
2070 
2071 
2072 //*************************************************************************************************
2086 template< typename MT // Type of the adapted dense matrix
2087  , bool SO > // Storage order of the adapted dense matrix
2088 template< typename MT2 > // Type of the right-hand side matrix
2089 inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2090  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2091 {
2092  return this->operator-=( trans( ~rhs ) );
2093 }
2095 //*************************************************************************************************
2096 
2097 
2098 //*************************************************************************************************
2112 template< typename MT // Type of the adapted dense matrix
2113  , bool SO > // Storage order of the adapted dense matrix
2114 template< typename MT2 // Type of the right-hand side matrix
2115  , bool SO2 > // Storage order of the right-hand side matrix
2116 inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2117  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2118 {
2119  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
2120  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2121  }
2122 
2123  matrix_ %= ~rhs;
2124 
2125  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2126  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2127 
2128  return *this;
2129 }
2131 //*************************************************************************************************
2132 
2133 
2134 //*************************************************************************************************
2148 template< typename MT // Type of the adapted dense matrix
2149  , bool SO > // Storage order of the adapted dense matrix
2150 template< typename MT2 // Type of the right-hand side matrix
2151  , bool SO2 > // Storage order of the right-hand side matrix
2152 inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2153  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2154 {
2155  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2156  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2157  }
2158 
2159  if( IsHermitian_v<MT2> ) {
2160  matrix_ %= ~rhs;
2161  }
2162  else {
2163  const ResultType_t<MT2> tmp( ~rhs );
2164 
2165  if( !isHermitian( tmp ) ) {
2166  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2167  }
2168 
2169  matrix_ %= tmp;
2170  }
2171 
2172  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2173  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2174 
2175  return *this;
2176 }
2178 //*************************************************************************************************
2179 
2180 
2181 //*************************************************************************************************
2195 template< typename MT // Type of the adapted dense matrix
2196  , bool SO > // Storage order of the adapted dense matrix
2197 template< typename MT2 > // Type of the right-hand side matrix
2198 inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2199  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2200 {
2201  return this->operator%=( trans( ~rhs ) );
2202 }
2204 //*************************************************************************************************
2205 
2206 
2207 //*************************************************************************************************
2215 template< typename MT // Type of the adapted dense matrix
2216  , bool SO > // Storage order of the adapted dense matrix
2217 template< typename ST > // Data type of the right-hand side scalar
2218 inline auto HermitianMatrix<MT,SO,true>::operator*=( ST rhs )
2219  -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
2220 {
2221  matrix_ *= rhs;
2222  return *this;
2223 }
2224 //*************************************************************************************************
2225 
2226 
2227 //*************************************************************************************************
2235 template< typename MT // Type of the adapted dense matrix
2236  , bool SO > // Storage order of the adapted dense matrix
2237 template< typename ST > // Data type of the right-hand side scalar
2238 inline auto HermitianMatrix<MT,SO,true>::operator/=( ST rhs )
2239  -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
2240 {
2241  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2242 
2243  matrix_ /= rhs;
2244  return *this;
2245 }
2247 //*************************************************************************************************
2248 
2249 
2250 
2251 
2252 //=================================================================================================
2253 //
2254 // UTILITY FUNCTIONS
2255 //
2256 //=================================================================================================
2257 
2258 //*************************************************************************************************
2264 template< typename MT // Type of the adapted dense matrix
2265  , bool SO > // Storage order of the adapted dense matrix
2266 inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2267 {
2268  return matrix_.rows();
2269 }
2271 //*************************************************************************************************
2272 
2273 
2274 //*************************************************************************************************
2280 template< typename MT // Type of the adapted dense matrix
2281  , bool SO > // Storage order of the adapted dense matrix
2282 inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2283 {
2284  return matrix_.columns();
2285 }
2287 //*************************************************************************************************
2288 
2289 
2290 //*************************************************************************************************
2302 template< typename MT // Type of the adapted dense matrix
2303  , bool SO > // Storage order of the adapted dense matrix
2304 inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2305 {
2306  return matrix_.spacing();
2307 }
2309 //*************************************************************************************************
2310 
2311 
2312 //*************************************************************************************************
2318 template< typename MT // Type of the adapted dense matrix
2319  , bool SO > // Storage order of the adapted dense matrix
2320 inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2321 {
2322  return matrix_.capacity();
2323 }
2325 //*************************************************************************************************
2326 
2327 
2328 //*************************************************************************************************
2339 template< typename MT // Type of the adapted dense matrix
2340  , bool SO > // Storage order of the adapted dense matrix
2341 inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2342 {
2343  return matrix_.capacity(i);
2344 }
2346 //*************************************************************************************************
2347 
2348 
2349 //*************************************************************************************************
2355 template< typename MT // Type of the adapted dense matrix
2356  , bool SO > // Storage order of the adapted dense matrix
2357 inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2358 {
2359  return matrix_.nonZeros();
2360 }
2362 //*************************************************************************************************
2363 
2364 
2365 //*************************************************************************************************
2377 template< typename MT // Type of the adapted dense matrix
2378  , bool SO > // Storage order of the adapted dense matrix
2379 inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2380 {
2381  return matrix_.nonZeros(i);
2382 }
2384 //*************************************************************************************************
2385 
2386 
2387 //*************************************************************************************************
2393 template< typename MT // Type of the adapted dense matrix
2394  , bool SO > // Storage order of the adapted dense matrix
2396 {
2397  matrix_.reset();
2398 }
2400 //*************************************************************************************************
2401 
2402 
2403 //*************************************************************************************************
2439 template< typename MT // Type of the adapted dense matrix
2440  , bool SO > // Storage order of the adapted dense matrix
2441 inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2442 {
2443  row ( matrix_, i, unchecked ).reset();
2444  column( matrix_, i, unchecked ).reset();
2445 }
2447 //*************************************************************************************************
2448 
2449 
2450 //*************************************************************************************************
2462 template< typename MT // Type of the adapted dense matrix
2463  , bool SO > // Storage order of the adapted dense matrix
2465 {
2466  using blaze::clear;
2467 
2468  clear( matrix_ );
2469 }
2471 //*************************************************************************************************
2472 
2473 
2474 //*************************************************************************************************
2509 template< typename MT // Type of the adapted dense matrix
2510  , bool SO > // Storage order of the adapted dense matrix
2511 void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2512 {
2514 
2515  UNUSED_PARAMETER( preserve );
2516 
2517  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2518 
2519  const size_t oldsize( matrix_.rows() );
2520 
2521  matrix_.resize( n, n, true );
2522 
2523  if( n > oldsize ) {
2524  const size_t increment( n - oldsize );
2525  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2526  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2527  }
2528 }
2530 //*************************************************************************************************
2531 
2532 
2533 //*************************************************************************************************
2546 template< typename MT // Type of the adapted dense matrix
2547  , bool SO > // Storage order of the adapted dense matrix
2548 inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2549 {
2551 
2552  UNUSED_PARAMETER( preserve );
2553 
2554  resize( rows() + n, true );
2555 }
2556 //*************************************************************************************************
2557 
2558 
2559 //*************************************************************************************************
2569 template< typename MT // Type of the adapted dense matrix
2570  , bool SO > // Storage order of the adapted dense matrix
2571 inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2572 {
2573  matrix_.reserve( elements );
2574 }
2576 //*************************************************************************************************
2577 
2578 
2579 //*************************************************************************************************
2589 template< typename MT // Type of the adapted dense matrix
2590  , bool SO > // Storage order of the adapted dense matrix
2592 {
2593  matrix_.shrinkToFit();
2594 }
2596 //*************************************************************************************************
2597 
2598 
2599 //*************************************************************************************************
2606 template< typename MT // Type of the adapted dense matrix
2607  , bool SO > // Storage order of the adapted dense matrix
2608 inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2609 {
2610  using std::swap;
2611 
2612  swap( matrix_, m.matrix_ );
2613 }
2615 //*************************************************************************************************
2616 
2617 
2618 
2619 
2620 //=================================================================================================
2621 //
2622 // NUMERIC FUNCTIONS
2623 //
2624 //=================================================================================================
2625 
2626 //*************************************************************************************************
2632 template< typename MT // Type of the adapted dense matrix
2633  , bool SO > // Storage order of the adapted dense matrix
2634 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2635 {
2636  if( IsComplex_v<ElementType> )
2637  matrix_.transpose();
2638  return *this;
2639 }
2641 //*************************************************************************************************
2642 
2643 
2644 //*************************************************************************************************
2650 template< typename MT // Type of the adapted dense matrix
2651  , bool SO > // Storage order of the adapted dense matrix
2652 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2653 {
2654  return *this;
2655 }
2657 //*************************************************************************************************
2658 
2659 
2660 //*************************************************************************************************
2678 template< typename MT // Type of the adapted dense matrix
2679  , bool SO > // Storage order of the adapted dense matrix
2680 template< typename Other > // Data type of the scalar value
2681 inline HermitianMatrix<MT,SO,true>&
2682  HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2683 {
2684  matrix_.scale( scalar );
2685  return *this;
2686 }
2688 //*************************************************************************************************
2689 
2690 
2691 
2692 
2693 //=================================================================================================
2694 //
2695 // DEBUGGING FUNCTIONS
2696 //
2697 //=================================================================================================
2698 
2699 //*************************************************************************************************
2709 template< typename MT // Type of the adapted dense matrix
2710  , bool SO > // Storage order of the adapted dense matrix
2711 inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2712 {
2713  using blaze::isIntact;
2714 
2715  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2716 }
2718 //*************************************************************************************************
2719 
2720 
2721 
2722 
2723 //=================================================================================================
2724 //
2725 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2726 //
2727 //=================================================================================================
2728 
2729 //*************************************************************************************************
2740 template< typename MT // Type of the adapted dense matrix
2741  , bool SO > // Storage order of the adapted dense matrix
2742 template< typename Other > // Data type of the foreign expression
2743 inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2744 {
2745  return matrix_.canAlias( alias );
2746 }
2748 //*************************************************************************************************
2749 
2750 
2751 //*************************************************************************************************
2762 template< typename MT // Type of the adapted dense matrix
2763  , bool SO > // Storage order of the adapted dense matrix
2764 template< typename Other > // Data type of the foreign expression
2765 inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2766 {
2767  return matrix_.isAliased( alias );
2768 }
2770 //*************************************************************************************************
2771 
2772 
2773 //*************************************************************************************************
2783 template< typename MT // Type of the adapted dense matrix
2784  , bool SO > // Storage order of the adapted dense matrix
2785 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2786 {
2787  return matrix_.isAligned();
2788 }
2790 //*************************************************************************************************
2791 
2792 
2793 //*************************************************************************************************
2804 template< typename MT // Type of the adapted dense matrix
2805  , bool SO > // Storage order of the adapted dense matrix
2806 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2807 {
2808  return matrix_.canSMPAssign();
2809 }
2811 //*************************************************************************************************
2812 
2813 
2814 //*************************************************************************************************
2830 template< typename MT // Type of the adapted dense matrix
2831  , bool SO > // Storage order of the adapted dense matrix
2832 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2833  HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2834 {
2835  return matrix_.load( i, j );
2836 }
2838 //*************************************************************************************************
2839 
2840 
2841 //*************************************************************************************************
2857 template< typename MT // Type of the adapted dense matrix
2858  , bool SO > // Storage order of the adapted dense matrix
2859 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2860  HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2861 {
2862  return matrix_.loada( i, j );
2863 }
2865 //*************************************************************************************************
2866 
2867 
2868 //*************************************************************************************************
2884 template< typename MT // Type of the adapted dense matrix
2885  , bool SO > // Storage order of the adapted dense matrix
2886 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2887  HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2888 {
2889  return matrix_.loadu( i, j );
2890 }
2892 //*************************************************************************************************
2893 
2894 
2895 //*************************************************************************************************
2912 template< typename MT // Type of the adapted dense matrix
2913  , bool SO > // Storage order of the adapted dense matrix
2914 inline void
2915  HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2916 {
2917  matrix_.store( i, j, value );
2918 
2919  if( SO ) {
2920  const size_t kend( min( i+SIMDSIZE, rows() ) );
2921  for( size_t k=i; k<kend; ++k )
2922  matrix_(j,k) = conj( matrix_(k,j) );
2923  }
2924  else {
2925  const size_t kend( min( j+SIMDSIZE, columns() ) );
2926  for( size_t k=j; k<kend; ++k )
2927  matrix_(k,i) = conj( matrix_(i,k) );
2928  }
2929 }
2931 //*************************************************************************************************
2932 
2933 
2934 //*************************************************************************************************
2951 template< typename MT // Type of the adapted dense matrix
2952  , bool SO > // Storage order of the adapted dense matrix
2953 inline void
2954  HermitianMatrix<MT,SO,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2955 {
2956  matrix_.storea( i, j, value );
2957 
2958  if( SO ) {
2959  const size_t kend( min( i+SIMDSIZE, rows() ) );
2960  for( size_t k=i; k<kend; ++k )
2961  matrix_(j,k) = conj( matrix_(k,j) );
2962  }
2963  else {
2964  const size_t kend( min( j+SIMDSIZE, columns() ) );
2965  for( size_t k=j; k<kend; ++k )
2966  matrix_(k,i) = conj( matrix_(i,k) );
2967  }
2968 }
2970 //*************************************************************************************************
2971 
2972 
2973 //*************************************************************************************************
2990 template< typename MT // Type of the adapted dense matrix
2991  , bool SO > // Storage order of the adapted dense matrix
2992 inline void
2993  HermitianMatrix<MT,SO,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2994 {
2995  matrix_.storeu( i, j, value );
2996 
2997  if( SO ) {
2998  const size_t kend( min( i+SIMDSIZE, rows() ) );
2999  for( size_t k=i; k<kend; ++k )
3000  matrix_(j,k) = conj( matrix_(k,j) );
3001  }
3002  else {
3003  const size_t kend( min( j+SIMDSIZE, columns() ) );
3004  for( size_t k=j; k<kend; ++k )
3005  matrix_(k,i) = conj( matrix_(i,k) );
3006  }
3007 }
3009 //*************************************************************************************************
3010 
3011 
3012 //*************************************************************************************************
3029 template< typename MT // Type of the adapted dense matrix
3030  , bool SO > // Storage order of the adapted dense matrix
3031 inline void
3032  HermitianMatrix<MT,SO,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3033 {
3034  matrix_.stream( i, j, value );
3035 
3036  if( SO ) {
3037  const size_t kend( min( i+SIMDSIZE, rows() ) );
3038  for( size_t k=i; k<kend; ++k )
3039  matrix_(j,k) = conj( matrix_(k,j) );
3040  }
3041  else {
3042  const size_t kend( min( j+SIMDSIZE, columns() ) );
3043  for( size_t k=j; k<kend; ++k )
3044  matrix_(k,i) = conj( matrix_(i,k) );
3045  }
3046 }
3048 //*************************************************************************************************
3049 
3050 
3051 
3052 
3053 //=================================================================================================
3054 //
3055 // CONSTRUCTION FUNCTIONS
3056 //
3057 //=================================================================================================
3058 
3059 //*************************************************************************************************
3061 template< typename MT // Type of the adapted dense matrix
3062  , bool SO > // Storage order of the adapted dense matrix
3063 template< typename MT2 // Type of the foreign matrix
3064  , bool SO2 // Storage order of the foreign matrix
3065  , typename T > // Type of the third argument
3066 inline decltype(auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3067 {
3068  return ~m;
3069 }
3071 //*************************************************************************************************
3072 
3073 
3074 //*************************************************************************************************
3076 template< typename MT // Type of the adapted dense matrix
3077  , bool SO > // Storage order of the adapted dense matrix
3078 template< typename MT2 > // Type of the foreign matrix
3079 inline decltype(auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
3080 {
3081  return trans( ~m );
3082 }
3084 //*************************************************************************************************
3085 
3086 } // namespace blaze
3087 
3088 #endif
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3078
#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
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Header file for the isZero shim.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
Constraint on the data type.
Header file for the dense matrix inversion flags.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5828
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
#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
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Constraint on the data type.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Constraint on the data type.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:673
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:775
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
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:5890
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:446
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
Constraints on the storage order of matrix types.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:135
constexpr bool IsBuiltin_v
Auxiliary variable template for the IsBuiltin type trait.The IsBuiltin_v variable template provides a...
Definition: IsBuiltin.h:95
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Header file for the implementation of the base template of the HeritianMatrix.
Header file for all forward declarations for expression class templates.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the implementation of the Column view.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#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:617
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
Constraint on the data type.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:408
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
#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.
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
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:631
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
decltype(auto) conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatMapExpr.h:1326
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
Header file for the IsHermitian type trait.
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
System settings for the inline keywords.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, 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.
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
Header file for the TrueType type/value trait base class.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825