Blaze  3.6
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>
60 #include <blaze/math/Exception.h>
65 #include <blaze/math/shims/Clear.h>
68 #include <blaze/math/SIMD.h>
73 #include <blaze/math/views/Check.h>
75 #include <blaze/math/views/Row.h>
77 #include <blaze/system/Inline.h>
79 #include <blaze/util/Assert.h>
85 #include <blaze/util/DisableIf.h>
86 #include <blaze/util/EnableIf.h>
88 #include <blaze/util/MaybeUnused.h>
89 #include <blaze/util/mpl/If.h>
91 #include <blaze/util/Types.h>
95 
96 
97 namespace blaze {
98 
99 //=================================================================================================
100 //
101 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
102 //
103 //=================================================================================================
104 
105 //*************************************************************************************************
113 template< typename MT // Type of the adapted dense matrix
114  , bool SO > // Storage order of the adapted dense matrix
115 class HermitianMatrix<MT,SO,true>
116  : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
117 {
118  private:
119  //**Type definitions****************************************************************************
120  using OT = OppositeType_t<MT>;
121  using TT = TransposeType_t<MT>;
122  using ET = ElementType_t<MT>;
123  //**********************************************************************************************
124 
125  public:
126  //**Type definitions****************************************************************************
127  using This = HermitianMatrix<MT,SO,true>;
128  using BaseType = DenseMatrix<This,SO>;
129  using ResultType = This;
130  using OppositeType = HermitianMatrix<OT,!SO,true>;
131  using TransposeType = HermitianMatrix<TT,!SO,true>;
132  using ElementType = ET;
133  using SIMDType = SIMDType_t<MT>;
134  using ReturnType = ReturnType_t<MT>;
135  using CompositeType = const This&;
136  using Reference = HermitianProxy<MT>;
137  using ConstReference = ConstReference_t<MT>;
138  using Pointer = Pointer_t<MT>;
139  using ConstPointer = ConstPointer_t<MT>;
140  using ConstIterator = ConstIterator_t<MT>;
141  //**********************************************************************************************
142 
143  //**Rebind struct definition********************************************************************
146  template< typename NewType > // Data type of the other matrix
147  struct Rebind {
149  using Other = HermitianMatrix< typename MT::template Rebind<NewType>::Other >;
150  };
151  //**********************************************************************************************
152 
153  //**Resize struct definition********************************************************************
156  template< size_t NewM // Number of rows of the other matrix
157  , size_t NewN > // Number of columns of the other matrix
158  struct Resize {
160  using Other = HermitianMatrix< typename MT::template Resize<NewM,NewN>::Other >;
161  };
162  //**********************************************************************************************
163 
164  //**Iterator class definition*******************************************************************
167  class Iterator
168  {
169  public:
170  //**Type definitions*************************************************************************
171  using IteratorCategory = std::random_access_iterator_tag;
172  using ValueType = ElementType_t<MT>;
173  using PointerType = HermitianProxy<MT>;
174  using ReferenceType = HermitianProxy<MT>;
175  using DifferenceType = ptrdiff_t;
176 
177  // STL iterator requirements
178  using iterator_category = IteratorCategory;
179  using value_type = ValueType;
180  using pointer = PointerType;
181  using reference = ReferenceType;
182  using difference_type = DifferenceType;
183  //*******************************************************************************************
184 
185  //**Constructor******************************************************************************
188  inline Iterator() noexcept
189  : matrix_( nullptr ) // Reference to the adapted dense matrix
190  , row_ ( 0UL ) // The current row index of the iterator
191  , column_( 0UL ) // The current column index of the iterator
192  {}
193  //*******************************************************************************************
194 
195  //**Constructor******************************************************************************
202  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
203  : matrix_( &matrix ) // Reference to the adapted dense matrix
204  , row_ ( row ) // The current row index of the iterator
205  , column_( column ) // The current column index of the iterator
206  {}
207  //*******************************************************************************************
208 
209  //**Addition assignment operator*************************************************************
215  inline Iterator& operator+=( size_t inc ) noexcept {
216  ( SO )?( row_ += inc ):( column_ += inc );
217  return *this;
218  }
219  //*******************************************************************************************
220 
221  //**Subtraction assignment operator**********************************************************
227  inline Iterator& operator-=( size_t dec ) noexcept {
228  ( SO )?( row_ -= dec ):( column_ -= dec );
229  return *this;
230  }
231  //*******************************************************************************************
232 
233  //**Prefix increment operator****************************************************************
238  inline Iterator& operator++() noexcept {
239  ( SO )?( ++row_ ):( ++column_ );
240  return *this;
241  }
242  //*******************************************************************************************
243 
244  //**Postfix increment operator***************************************************************
249  inline const Iterator operator++( int ) noexcept {
250  const Iterator tmp( *this );
251  ++(*this);
252  return tmp;
253  }
254  //*******************************************************************************************
255 
256  //**Prefix decrement operator****************************************************************
261  inline Iterator& operator--() noexcept {
262  ( SO )?( --row_ ):( --column_ );
263  return *this;
264  }
265  //*******************************************************************************************
266 
267  //**Postfix decrement operator***************************************************************
272  inline const Iterator operator--( int ) noexcept {
273  const Iterator tmp( *this );
274  --(*this);
275  return tmp;
276  }
277  //*******************************************************************************************
278 
279  //**Element access operator******************************************************************
284  inline ReferenceType operator*() const {
285  return ReferenceType( *matrix_, row_, column_ );
286  }
287  //*******************************************************************************************
288 
289  //**Element access operator******************************************************************
294  inline PointerType operator->() const {
295  return PointerType( *matrix_, row_, column_ );
296  }
297  //*******************************************************************************************
298 
299  //**Load function****************************************************************************
309  inline SIMDType load() const {
310  return (*matrix_).load(row_,column_);
311  }
312  //*******************************************************************************************
313 
314  //**Loada function***************************************************************************
324  inline SIMDType loada() const {
325  return (*matrix_).loada(row_,column_);
326  }
327  //*******************************************************************************************
328 
329  //**Loadu function***************************************************************************
339  inline SIMDType loadu() const {
340  return (*matrix_).loadu(row_,column_);
341  }
342  //*******************************************************************************************
343 
344  //**Store function***************************************************************************
355  inline void store( const SIMDType& value ) const {
356  (*matrix_).store( row_, column_, value );
357  sync();
358  }
359  //*******************************************************************************************
360 
361  //**Storea function**************************************************************************
372  inline void storea( const SIMDType& value ) const {
373  (*matrix_).storea( row_, column_, value );
374  sync();
375  }
376  //*******************************************************************************************
377 
378  //**Storeu function**************************************************************************
389  inline void storeu( const SIMDType& value ) const {
390  (*matrix_).storeu( row_, column_, value );
391  sync();
392  }
393  //*******************************************************************************************
394 
395  //**Stream function**************************************************************************
406  inline void stream( const SIMDType& value ) const {
407  (*matrix_).stream( row_, column_, value );
408  sync();
409  }
410  //*******************************************************************************************
411 
412  //**Conversion operator**********************************************************************
417  inline operator ConstIterator() const {
418  if( SO )
419  return matrix_->begin( column_ ) + row_;
420  else
421  return matrix_->begin( row_ ) + column_;
422  }
423  //*******************************************************************************************
424 
425  //**Equality operator************************************************************************
432  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
433  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
434  }
435  //*******************************************************************************************
436 
437  //**Equality operator************************************************************************
444  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
445  return ( ConstIterator( lhs ) == rhs );
446  }
447  //*******************************************************************************************
448 
449  //**Equality operator************************************************************************
456  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
457  return ( lhs == ConstIterator( rhs ) );
458  }
459  //*******************************************************************************************
460 
461  //**Inequality operator**********************************************************************
468  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
469  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
470  }
471  //*******************************************************************************************
472 
473  //**Inequality operator**********************************************************************
480  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
481  return ( ConstIterator( lhs ) != rhs );
482  }
483  //*******************************************************************************************
484 
485  //**Inequality operator**********************************************************************
492  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
493  return ( lhs != ConstIterator( rhs ) );
494  }
495  //*******************************************************************************************
496 
497  //**Less-than operator***********************************************************************
504  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
505  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
506  }
507  //*******************************************************************************************
508 
509  //**Less-than operator***********************************************************************
516  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
517  return ( ConstIterator( lhs ) < rhs );
518  }
519  //*******************************************************************************************
520 
521  //**Less-than operator***********************************************************************
528  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
529  return ( lhs < ConstIterator( rhs ) );
530  }
531  //*******************************************************************************************
532 
533  //**Greater-than operator********************************************************************
540  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
541  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
542  }
543  //*******************************************************************************************
544 
545  //**Greater-than operator********************************************************************
552  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
553  return ( ConstIterator( lhs ) > rhs );
554  }
555  //*******************************************************************************************
556 
557  //**Greater-than operator********************************************************************
564  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
565  return ( lhs > ConstIterator( rhs ) );
566  }
567  //*******************************************************************************************
568 
569  //**Less-or-equal-than operator**************************************************************
576  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
577  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
578  }
579  //*******************************************************************************************
580 
581  //**Less-or-equal-than operator**************************************************************
588  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
589  return ( ConstIterator( lhs ) <= rhs );
590  }
591  //*******************************************************************************************
592 
593  //**Less-or-equal-than operator**************************************************************
600  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
601  return ( lhs <= ConstIterator( rhs ) );
602  }
603  //*******************************************************************************************
604 
605  //**Greater-or-equal-than operator***********************************************************
612  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
613  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
614  }
615  //*******************************************************************************************
616 
617  //**Greater-or-equal-than operator***********************************************************
624  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
625  return ( ConstIterator( lhs ) >= rhs );
626  }
627  //*******************************************************************************************
628 
629  //**Greater-or-equal-than operator***********************************************************
636  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
637  return ( lhs >= ConstIterator( rhs ) );
638  }
639  //*******************************************************************************************
640 
641  //**Subtraction operator*********************************************************************
647  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
648  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
649  }
650  //*******************************************************************************************
651 
652  //**Addition operator************************************************************************
659  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
660  if( SO )
661  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
662  else
663  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
664  }
665  //*******************************************************************************************
666 
667  //**Addition operator************************************************************************
674  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
675  if( SO )
676  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
677  else
678  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
679  }
680  //*******************************************************************************************
681 
682  //**Subtraction operator*********************************************************************
689  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
690  if( SO )
691  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
692  else
693  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
694  }
695  //*******************************************************************************************
696 
697  private:
698  //**Sync function****************************************************************************
703  void sync() const {
704  if( SO ) {
705  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
706  for( size_t k=row_; k<kend; ++k )
707  (*matrix_)(column_,k) = conj( (*matrix_)(k,column_) );
708  }
709  else {
710  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
711  for( size_t k=column_; k<kend; ++k )
712  (*matrix_)(k,row_) = conj( (*matrix_)(row_,k) );
713  }
714  }
715  //*******************************************************************************************
716 
717  //**Member variables*************************************************************************
718  MT* matrix_;
719  size_t row_;
720  size_t column_;
721  //*******************************************************************************************
722  };
723  //**********************************************************************************************
724 
725  //**Compilation flags***************************************************************************
727  static constexpr bool simdEnabled = MT::simdEnabled;
728 
730  static constexpr bool smpAssignable = MT::smpAssignable;
731  //**********************************************************************************************
732 
733  //**Constructors********************************************************************************
736  explicit inline HermitianMatrix();
737  explicit inline HermitianMatrix( size_t n );
738  inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
739 
740  template< typename Other >
741  explicit inline HermitianMatrix( size_t n, const Other* array );
742 
743  template< typename Other, size_t N >
744  explicit inline HermitianMatrix( const Other (&array)[N][N] );
745 
746  explicit inline HermitianMatrix( ElementType* ptr, size_t n );
747  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
748 
749  inline HermitianMatrix( const HermitianMatrix& m );
750  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
751 
752  template< typename MT2, bool SO2 >
753  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
755  //**********************************************************************************************
756 
757  //**Destructor**********************************************************************************
760  ~HermitianMatrix() = default;
762  //**********************************************************************************************
763 
764  //**Data access functions***********************************************************************
767  inline Reference operator()( size_t i, size_t j );
768  inline ConstReference operator()( size_t i, size_t j ) const;
769  inline Reference at( size_t i, size_t j );
770  inline ConstReference at( size_t i, size_t j ) const;
771  inline ConstPointer data () const noexcept;
772  inline ConstPointer data ( size_t i ) const noexcept;
773  inline Iterator begin ( size_t i );
774  inline ConstIterator begin ( size_t i ) const;
775  inline ConstIterator cbegin( size_t i ) const;
776  inline Iterator end ( size_t i );
777  inline ConstIterator end ( size_t i ) const;
778  inline ConstIterator cend ( size_t i ) const;
780  //**********************************************************************************************
781 
782  //**Assignment operators************************************************************************
785  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
786 
787  template< typename Other, size_t N >
788  inline HermitianMatrix& operator=( const Other (&array)[N][N] );
789 
790  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
791  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
792 
793  template< typename MT2, bool SO2 >
794  inline auto operator=( const Matrix<MT2,SO2>& rhs )
795  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
796 
797  template< typename MT2, bool SO2 >
798  inline auto operator=( const Matrix<MT2,SO2>& rhs )
799  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
800 
801  template< typename MT2 >
802  inline auto operator=( const Matrix<MT2,!SO>& rhs )
803  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
804 
805  template< typename MT2, bool SO2 >
806  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
807  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
808 
809  template< typename MT2, bool SO2 >
810  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
811  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
812 
813  template< typename MT2 >
814  inline auto operator+=( const Matrix<MT2,!SO>& rhs )
815  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
816 
817  template< typename MT2, bool SO2 >
818  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
819  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
820 
821  template< typename MT2, bool SO2 >
822  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
823  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
824 
825  template< typename MT2 >
826  inline auto operator-=( const Matrix<MT2,!SO>& rhs )
827  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
828 
829  template< typename MT2, bool SO2 >
830  inline auto operator%=( const Matrix<MT2,SO2>& rhs )
831  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
832 
833  template< typename MT2, bool SO2 >
834  inline auto operator%=( const Matrix<MT2,SO2>& rhs )
835  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >;
836 
837  template< typename MT2 >
838  inline auto operator%=( const Matrix<MT2,!SO>& rhs )
839  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >;
840 
841  template< typename ST >
842  inline auto operator*=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >;
843 
844  template< typename ST >
845  inline auto operator/=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >;
847  //**********************************************************************************************
848 
849  //**Utility functions***************************************************************************
852  inline size_t rows() const noexcept;
853  inline size_t columns() const noexcept;
854  inline size_t spacing() const noexcept;
855  inline size_t capacity() const noexcept;
856  inline size_t capacity( size_t i ) const noexcept;
857  inline size_t nonZeros() const;
858  inline size_t nonZeros( size_t i ) const;
859  inline void reset();
860  inline void reset( size_t i );
861  inline void clear();
862  void resize ( size_t n, bool preserve=true );
863  inline void extend ( size_t n, bool preserve=true );
864  inline void reserve( size_t elements );
865  inline void shrinkToFit();
866  inline void swap( HermitianMatrix& m ) noexcept;
868  //**********************************************************************************************
869 
870  //**Numeric functions***************************************************************************
873  inline HermitianMatrix& transpose();
874  inline HermitianMatrix& ctranspose();
875 
876  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
878  //**********************************************************************************************
879 
880  //**Debugging functions*************************************************************************
883  inline bool isIntact() const noexcept;
885  //**********************************************************************************************
886 
887  //**Expression template evaluation functions****************************************************
890  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
891  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
892 
893  inline bool isAligned () const noexcept;
894  inline bool canSMPAssign() const noexcept;
895 
896  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
897  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
898  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
899 
900  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
901  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
902  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
903  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
905  //**********************************************************************************************
906 
907  private:
908  //**Construction functions**********************************************************************
911  template< typename MT2, bool SO2, typename T >
912  inline decltype(auto) construct( const Matrix<MT2,SO2>& m, T );
913 
914  template< typename MT2 >
915  inline decltype(auto) construct( const Matrix<MT2,!SO>& m, TrueType );
917  //**********************************************************************************************
918 
919  //**SIMD properties*****************************************************************************
921  static constexpr size_t SIMDSIZE = SIMDTrait<ET>::size;
922  //**********************************************************************************************
923 
924  //**Member variables****************************************************************************
927  MT matrix_;
928 
929  //**********************************************************************************************
930 
931  //**Friend declarations*************************************************************************
932  template< bool RF, typename MT2, bool SO2, bool DF2 >
933  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
934 
935 
936  template< InversionFlag IF, typename MT2, bool SO2 >
937  friend void invert( HermitianMatrix<MT2,SO2,true>& m );
938  //**********************************************************************************************
939 
940  //**Compile time checks*************************************************************************
956  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
957  //**********************************************************************************************
958 };
960 //*************************************************************************************************
961 
962 
963 
964 
965 //=================================================================================================
966 //
967 // CONSTRUCTORS
968 //
969 //=================================================================================================
970 
971 //*************************************************************************************************
975 template< typename MT // Type of the adapted dense matrix
976  , bool SO > // Storage order of the adapted dense matrix
977 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
978  : matrix_() // The adapted dense matrix
979 {
980  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
981  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
982 }
984 //*************************************************************************************************
985 
986 
987 //*************************************************************************************************
993 template< typename MT // Type of the adapted dense matrix
994  , bool SO > // Storage order of the adapted dense matrix
995 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
996  : matrix_( n, n, ElementType() ) // The adapted dense matrix
997 {
999 
1000  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1001  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1002 }
1004 //*************************************************************************************************
1005 
1006 
1007 //*************************************************************************************************
1034 template< typename MT // Type of the adapted dense matrix
1035  , bool SO > // Storage order of the adapted dense matrix
1036 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1037  : matrix_( list ) // The adapted dense matrix
1038 {
1039  if( !isHermitian( matrix_ ) ) {
1040  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1041  }
1042 
1043  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1044 }
1046 //*************************************************************************************************
1047 
1048 
1049 //*************************************************************************************************
1078 template< typename MT // Type of the adapted dense matrix
1079  , bool SO > // Storage order of the adapted dense matrix
1080 template< typename Other > // Data type of the initialization array
1081 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n, const Other* array )
1082  : matrix_( n, n, array ) // The adapted dense matrix
1083 {
1084  if( !isHermitian( matrix_ ) ) {
1085  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1086  }
1087 
1088  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1089 }
1091 //*************************************************************************************************
1092 
1093 
1094 //*************************************************************************************************
1119 template< typename MT // Type of the adapted dense matrix
1120  , bool SO > // Storage order of the adapted dense matrix
1121 template< typename Other // Data type of the initialization array
1122  , size_t N > // Number of rows and columns of the initialization array
1123 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Other (&array)[N][N] )
1124  : matrix_( array ) // The adapted dense matrix
1125 {
1126  if( !isHermitian( matrix_ ) ) {
1127  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1128  }
1129 
1130  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1131 }
1133 //*************************************************************************************************
1134 
1135 
1136 //*************************************************************************************************
1170 template< typename MT // Type of the adapted dense matrix
1171  , bool SO > // Storage order of the adapted dense matrix
1172 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n )
1173  : matrix_( ptr, n, n ) // The adapted dense matrix
1174 {
1175  if( !isHermitian( matrix_ ) ) {
1176  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1177  }
1178 
1179  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1180 }
1182 //*************************************************************************************************
1183 
1184 
1185 //*************************************************************************************************
1221 template< typename MT // Type of the adapted dense matrix
1222  , bool SO > // Storage order of the adapted dense matrix
1223 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn )
1224  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1225 {
1226  if( !isHermitian( matrix_ ) ) {
1227  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1228  }
1229 
1230  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1231 }
1233 //*************************************************************************************************
1234 
1235 
1236 //*************************************************************************************************
1242 template< typename MT // Type of the adapted dense matrix
1243  , bool SO > // Storage order of the adapted dense matrix
1244 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const HermitianMatrix& m )
1245  : matrix_( m.matrix_ ) // The adapted dense matrix
1246 {
1247  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1248  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1249 }
1251 //*************************************************************************************************
1252 
1253 
1254 //*************************************************************************************************
1260 template< typename MT // Type of the adapted dense matrix
1261  , bool SO > // Storage order of the adapted dense matrix
1262 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1263  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1264 {
1265  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1266  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1267 }
1269 //*************************************************************************************************
1270 
1271 
1272 //*************************************************************************************************
1282 template< typename MT // Type of the adapted dense matrix
1283  , bool SO > // Storage order of the adapted dense matrix
1284 template< typename MT2 // Type of the foreign matrix
1285  , bool SO2 > // Storage order of the foreign matrix
1286 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Matrix<MT2,SO2>& m )
1287  : matrix_( construct( m, typename IsBuiltin< ElementType_t<MT2> >::Type() ) ) // The adapted dense matrix
1288 {
1289  if( !IsHermitian_v<MT2> && !isHermitian( matrix_ ) ) {
1290  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1291  }
1292 
1293  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1294 }
1296 //*************************************************************************************************
1297 
1298 
1299 
1300 
1301 //=================================================================================================
1302 //
1303 // DATA ACCESS FUNCTIONS
1304 //
1305 //=================================================================================================
1306 
1307 //*************************************************************************************************
1323 template< typename MT // Type of the adapted dense matrix
1324  , bool SO > // Storage order of the adapted dense matrix
1325 inline typename HermitianMatrix<MT,SO,true>::Reference
1326  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1327 {
1328  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1329  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1330 
1331  return Reference( matrix_, i, j );
1332 }
1334 //*************************************************************************************************
1335 
1336 
1337 //*************************************************************************************************
1353 template< typename MT // Type of the adapted dense matrix
1354  , bool SO > // Storage order of the adapted dense matrix
1355 inline typename HermitianMatrix<MT,SO,true>::ConstReference
1356  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1357 {
1358  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1359  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1360 
1361  return matrix_(i,j);
1362 }
1364 //*************************************************************************************************
1365 
1366 
1367 //*************************************************************************************************
1384 template< typename MT // Type of the adapted dense matrix
1385  , bool SO > // Storage order of the adapted dense matrix
1386 inline typename HermitianMatrix<MT,SO,true>::Reference
1387  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j )
1388 {
1389  if( i >= rows() ) {
1390  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1391  }
1392  if( j >= columns() ) {
1393  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1394  }
1395  return (*this)(i,j);
1396 }
1398 //*************************************************************************************************
1399 
1400 
1401 //*************************************************************************************************
1418 template< typename MT // Type of the adapted dense matrix
1419  , bool SO > // Storage order of the adapted dense matrix
1420 inline typename HermitianMatrix<MT,SO,true>::ConstReference
1421  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1422 {
1423  if( i >= rows() ) {
1424  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1425  }
1426  if( j >= columns() ) {
1427  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1428  }
1429  return (*this)(i,j);
1430 }
1432 //*************************************************************************************************
1433 
1434 
1435 //*************************************************************************************************
1449 template< typename MT // Type of the adapted dense matrix
1450  , bool SO > // Storage order of the adapted dense matrix
1451 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1452  HermitianMatrix<MT,SO,true>::data() const noexcept
1453 {
1454  return matrix_.data();
1455 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1471 template< typename MT // Type of the adapted dense matrix
1472  , bool SO > // Storage order of the adapted dense matrix
1473 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1474  HermitianMatrix<MT,SO,true>::data( size_t i ) const noexcept
1475 {
1476  return matrix_.data(i);
1477 }
1479 //*************************************************************************************************
1480 
1481 
1482 //*************************************************************************************************
1494 template< typename MT // Type of the adapted dense matrix
1495  , bool SO > // Storage order of the adapted dense matrix
1496 inline typename HermitianMatrix<MT,SO,true>::Iterator
1498 {
1499  if( SO )
1500  return Iterator( matrix_, 0UL, i );
1501  else
1502  return Iterator( matrix_, i, 0UL );
1503 }
1505 //*************************************************************************************************
1506 
1507 
1508 //*************************************************************************************************
1520 template< typename MT // Type of the adapted dense matrix
1521  , bool SO > // Storage order of the adapted dense matrix
1522 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1523  HermitianMatrix<MT,SO,true>::begin( size_t i ) const
1524 {
1525  return matrix_.begin(i);
1526 }
1528 //*************************************************************************************************
1529 
1530 
1531 //*************************************************************************************************
1543 template< typename MT // Type of the adapted dense matrix
1544  , bool SO > // Storage order of the adapted dense matrix
1545 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1546  HermitianMatrix<MT,SO,true>::cbegin( size_t i ) const
1547 {
1548  return matrix_.cbegin(i);
1549 }
1551 //*************************************************************************************************
1552 
1553 
1554 //*************************************************************************************************
1566 template< typename MT // Type of the adapted dense matrix
1567  , bool SO > // Storage order of the adapted dense matrix
1568 inline typename HermitianMatrix<MT,SO,true>::Iterator
1570 {
1571  if( SO )
1572  return Iterator( matrix_, rows(), i );
1573  else
1574  return Iterator( matrix_, i, columns() );
1575 }
1577 //*************************************************************************************************
1578 
1579 
1580 //*************************************************************************************************
1592 template< typename MT // Type of the adapted dense matrix
1593  , bool SO > // Storage order of the adapted dense matrix
1594 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1595  HermitianMatrix<MT,SO,true>::end( size_t i ) const
1596 {
1597  return matrix_.end(i);
1598 }
1600 //*************************************************************************************************
1601 
1602 
1603 //*************************************************************************************************
1615 template< typename MT // Type of the adapted dense matrix
1616  , bool SO > // Storage order of the adapted dense matrix
1617 inline typename HermitianMatrix<MT,SO,true>::ConstIterator
1618  HermitianMatrix<MT,SO,true>::cend( size_t i ) const
1619 {
1620  return matrix_.cend(i);
1621 }
1623 //*************************************************************************************************
1624 
1625 
1626 
1627 
1628 //=================================================================================================
1629 //
1630 // ASSIGNMENT OPERATORS
1631 //
1632 //=================================================================================================
1633 
1634 //*************************************************************************************************
1661 template< typename MT // Type of the adapted dense matrix
1662  , bool SO > // Storage order of the adapted dense matrix
1663 inline HermitianMatrix<MT,SO,true>&
1664  HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1665 {
1666  const InitializerMatrix<ElementType> tmp( list, list.size() );
1667 
1668  if( !isHermitian( tmp ) ) {
1669  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1670  }
1671 
1672  matrix_ = list;
1673 
1674  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1675  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1676 
1677  return *this;
1678 }
1680 //*************************************************************************************************
1681 
1682 
1683 //*************************************************************************************************
1709 template< typename MT // Type of the adapted dense matrix
1710  , bool SO > // Storage order of the adapted dense matrix
1711 template< typename Other // Data type of the initialization array
1712  , size_t N > // Number of rows and columns of the initialization array
1713 inline HermitianMatrix<MT,SO,true>&
1714  HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1715 {
1716  MT tmp( array );
1717 
1718  if( !isHermitian( tmp ) ) {
1719  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1720  }
1721 
1722  matrix_ = std::move( tmp );
1723 
1724  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1725  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1726 
1727  return *this;
1728 }
1730 //*************************************************************************************************
1731 
1732 
1733 //*************************************************************************************************
1743 template< typename MT // Type of the adapted dense matrix
1744  , bool SO > // Storage order of the adapted dense matrix
1745 inline HermitianMatrix<MT,SO,true>&
1746  HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1747 {
1748  matrix_ = rhs.matrix_;
1749 
1750  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1751  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1752 
1753  return *this;
1754 }
1756 //*************************************************************************************************
1757 
1758 
1759 //*************************************************************************************************
1766 template< typename MT // Type of the adapted dense matrix
1767  , bool SO > // Storage order of the adapted dense matrix
1768 inline HermitianMatrix<MT,SO,true>&
1769  HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1770 {
1771  matrix_ = std::move( rhs.matrix_ );
1772 
1773  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1774  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1775 
1776  return *this;
1777 }
1779 //*************************************************************************************************
1780 
1781 
1782 //*************************************************************************************************
1795 template< typename MT // Type of the adapted dense matrix
1796  , bool SO > // Storage order of the adapted dense matrix
1797 template< typename MT2 // Type of the right-hand side matrix
1798  , bool SO2 > // Storage order of the right-hand side matrix
1799 inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1800  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1801 {
1802  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1803  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1804  }
1805 
1806  matrix_ = ~rhs;
1807 
1808  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1809  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1810 
1811  return *this;
1812 }
1814 //*************************************************************************************************
1815 
1816 
1817 //*************************************************************************************************
1830 template< typename MT // Type of the adapted dense matrix
1831  , bool SO > // Storage order of the adapted dense matrix
1832 template< typename MT2 // Type of the right-hand side matrix
1833  , bool SO2 > // Storage order of the right-hand side matrix
1834 inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1835  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1836 {
1837  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1838  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1839  }
1840 
1841  if( IsHermitian_v<MT2> ) {
1842  matrix_ = ~rhs;
1843  }
1844  else {
1845  MT tmp( ~rhs );
1846 
1847  if( !isHermitian( tmp ) ) {
1848  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1849  }
1850 
1851  matrix_ = std::move( tmp );
1852  }
1853 
1854  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1855  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1856 
1857  return *this;
1858 }
1860 //*************************************************************************************************
1861 
1862 
1863 //*************************************************************************************************
1876 template< typename MT // Type of the adapted dense matrix
1877  , bool SO > // Storage order of the adapted dense matrix
1878 template< typename MT2 > // Type of the right-hand side matrix
1879 inline auto HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1880  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1881 {
1882  return this->operator=( trans( ~rhs ) );
1883 }
1885 //*************************************************************************************************
1886 
1887 
1888 //*************************************************************************************************
1901 template< typename MT // Type of the adapted dense matrix
1902  , bool SO > // Storage order of the adapted dense matrix
1903 template< typename MT2 // Type of the right-hand side matrix
1904  , bool SO2 > // Storage order of the right-hand side matrix
1905 inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1906  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1907 {
1908  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
1909  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1910  }
1911 
1912  matrix_ += ~rhs;
1913 
1914  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1915  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1916 
1917  return *this;
1918 }
1920 //*************************************************************************************************
1921 
1922 
1923 //*************************************************************************************************
1936 template< typename MT // Type of the adapted dense matrix
1937  , bool SO > // Storage order of the adapted dense matrix
1938 template< typename MT2 // Type of the right-hand side matrix
1939  , bool SO2 > // Storage order of the right-hand side matrix
1940 inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1941  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
1942 {
1943  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1944  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1945  }
1946 
1947  if( IsHermitian_v<MT2> ) {
1948  matrix_ += ~rhs;
1949  }
1950  else {
1951  const ResultType_t<MT2> tmp( ~rhs );
1952 
1953  if( !isHermitian( tmp ) ) {
1954  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1955  }
1956 
1957  matrix_ += tmp;
1958  }
1959 
1960  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1961  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1962 
1963  return *this;
1964 }
1966 //*************************************************************************************************
1967 
1968 
1969 //*************************************************************************************************
1983 template< typename MT // Type of the adapted dense matrix
1984  , bool SO > // Storage order of the adapted dense matrix
1985 template< typename MT2 > // Type of the right-hand side matrix
1986 inline auto HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1987  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
1988 {
1989  return this->operator+=( trans( ~rhs ) );
1990 }
1992 //*************************************************************************************************
1993 
1994 
1995 //*************************************************************************************************
2008 template< typename MT // Type of the adapted dense matrix
2009  , bool SO > // Storage order of the adapted dense matrix
2010 template< typename MT2 // Type of the right-hand side matrix
2011  , bool SO2 > // Storage order of the right-hand side matrix
2012 inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2013  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2014 {
2015  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
2016  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2017  }
2018 
2019  matrix_ -= ~rhs;
2020 
2021  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2022  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2023 
2024  return *this;
2025 }
2027 //*************************************************************************************************
2028 
2029 
2030 //*************************************************************************************************
2043 template< typename MT // Type of the adapted dense matrix
2044  , bool SO > // Storage order of the adapted dense matrix
2045 template< typename MT2 // Type of the right-hand side matrix
2046  , bool SO2 > // Storage order of the right-hand side matrix
2047 inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2048  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2049 {
2050  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2051  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2052  }
2053 
2054  if( IsHermitian_v<MT2> ) {
2055  matrix_ -= ~rhs;
2056  }
2057  else {
2058  const ResultType_t<MT2> tmp( ~rhs );
2059 
2060  if( !isHermitian( tmp ) ) {
2061  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2062  }
2063 
2064  matrix_ -= tmp;
2065  }
2066 
2067  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2068  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2069 
2070  return *this;
2071 }
2073 //*************************************************************************************************
2074 
2075 
2076 //*************************************************************************************************
2090 template< typename MT // Type of the adapted dense matrix
2091  , bool SO > // Storage order of the adapted dense matrix
2092 template< typename MT2 > // Type of the right-hand side matrix
2093 inline auto HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2094  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2095 {
2096  return this->operator-=( trans( ~rhs ) );
2097 }
2099 //*************************************************************************************************
2100 
2101 
2102 //*************************************************************************************************
2116 template< typename MT // Type of the adapted dense matrix
2117  , bool SO > // Storage order of the adapted dense matrix
2118 template< typename MT2 // Type of the right-hand side matrix
2119  , bool SO2 > // Storage order of the right-hand side matrix
2120 inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2121  -> DisableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2122 {
2123  if( !IsHermitian_v<MT2> && !isHermitian( ~rhs ) ) {
2124  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2125  }
2126 
2127  matrix_ %= ~rhs;
2128 
2129  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2130  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2131 
2132  return *this;
2133 }
2135 //*************************************************************************************************
2136 
2137 
2138 //*************************************************************************************************
2152 template< typename MT // Type of the adapted dense matrix
2153  , bool SO > // Storage order of the adapted dense matrix
2154 template< typename MT2 // Type of the right-hand side matrix
2155  , bool SO2 > // Storage order of the right-hand side matrix
2156 inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
2157  -> EnableIf_t< IsComputation_v<MT2>, HermitianMatrix& >
2158 {
2159  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2160  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2161  }
2162 
2163  if( IsHermitian_v<MT2> ) {
2164  matrix_ %= ~rhs;
2165  }
2166  else {
2167  const ResultType_t<MT2> tmp( ~rhs );
2168 
2169  if( !isHermitian( tmp ) ) {
2170  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2171  }
2172 
2173  matrix_ %= tmp;
2174  }
2175 
2176  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2177  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2178 
2179  return *this;
2180 }
2182 //*************************************************************************************************
2183 
2184 
2185 //*************************************************************************************************
2199 template< typename MT // Type of the adapted dense matrix
2200  , bool SO > // Storage order of the adapted dense matrix
2201 template< typename MT2 > // Type of the right-hand side matrix
2202 inline auto HermitianMatrix<MT,SO,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2203  -> EnableIf_t< IsBuiltin_v< ElementType_t<MT2> >, HermitianMatrix& >
2204 {
2205  return this->operator%=( trans( ~rhs ) );
2206 }
2208 //*************************************************************************************************
2209 
2210 
2211 //*************************************************************************************************
2219 template< typename MT // Type of the adapted dense matrix
2220  , bool SO > // Storage order of the adapted dense matrix
2221 template< typename ST > // Data type of the right-hand side scalar
2222 inline auto HermitianMatrix<MT,SO,true>::operator*=( ST rhs )
2223  -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
2224 {
2225  matrix_ *= rhs;
2226  return *this;
2227 }
2228 //*************************************************************************************************
2229 
2230 
2231 //*************************************************************************************************
2239 template< typename MT // Type of the adapted dense matrix
2240  , bool SO > // Storage order of the adapted dense matrix
2241 template< typename ST > // Data type of the right-hand side scalar
2242 inline auto HermitianMatrix<MT,SO,true>::operator/=( ST rhs )
2243  -> EnableIf_t< IsNumeric_v<ST>, HermitianMatrix& >
2244 {
2245  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2246 
2247  matrix_ /= rhs;
2248  return *this;
2249 }
2251 //*************************************************************************************************
2252 
2253 
2254 
2255 
2256 //=================================================================================================
2257 //
2258 // UTILITY FUNCTIONS
2259 //
2260 //=================================================================================================
2261 
2262 //*************************************************************************************************
2268 template< typename MT // Type of the adapted dense matrix
2269  , bool SO > // Storage order of the adapted dense matrix
2270 inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2271 {
2272  return matrix_.rows();
2273 }
2275 //*************************************************************************************************
2276 
2277 
2278 //*************************************************************************************************
2284 template< typename MT // Type of the adapted dense matrix
2285  , bool SO > // Storage order of the adapted dense matrix
2286 inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2287 {
2288  return matrix_.columns();
2289 }
2291 //*************************************************************************************************
2292 
2293 
2294 //*************************************************************************************************
2306 template< typename MT // Type of the adapted dense matrix
2307  , bool SO > // Storage order of the adapted dense matrix
2308 inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2309 {
2310  return matrix_.spacing();
2311 }
2313 //*************************************************************************************************
2314 
2315 
2316 //*************************************************************************************************
2322 template< typename MT // Type of the adapted dense matrix
2323  , bool SO > // Storage order of the adapted dense matrix
2324 inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2325 {
2326  return matrix_.capacity();
2327 }
2329 //*************************************************************************************************
2330 
2331 
2332 //*************************************************************************************************
2343 template< typename MT // Type of the adapted dense matrix
2344  , bool SO > // Storage order of the adapted dense matrix
2345 inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2346 {
2347  return matrix_.capacity(i);
2348 }
2350 //*************************************************************************************************
2351 
2352 
2353 //*************************************************************************************************
2359 template< typename MT // Type of the adapted dense matrix
2360  , bool SO > // Storage order of the adapted dense matrix
2361 inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2362 {
2363  return matrix_.nonZeros();
2364 }
2366 //*************************************************************************************************
2367 
2368 
2369 //*************************************************************************************************
2381 template< typename MT // Type of the adapted dense matrix
2382  , bool SO > // Storage order of the adapted dense matrix
2383 inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2384 {
2385  return matrix_.nonZeros(i);
2386 }
2388 //*************************************************************************************************
2389 
2390 
2391 //*************************************************************************************************
2397 template< typename MT // Type of the adapted dense matrix
2398  , bool SO > // Storage order of the adapted dense matrix
2400 {
2401  matrix_.reset();
2402 }
2404 //*************************************************************************************************
2405 
2406 
2407 //*************************************************************************************************
2443 template< typename MT // Type of the adapted dense matrix
2444  , bool SO > // Storage order of the adapted dense matrix
2445 inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2446 {
2447  row ( matrix_, i, unchecked ).reset();
2448  column( matrix_, i, unchecked ).reset();
2449 }
2451 //*************************************************************************************************
2452 
2453 
2454 //*************************************************************************************************
2466 template< typename MT // Type of the adapted dense matrix
2467  , bool SO > // Storage order of the adapted dense matrix
2469 {
2470  using blaze::clear;
2471 
2472  clear( matrix_ );
2473 }
2475 //*************************************************************************************************
2476 
2477 
2478 //*************************************************************************************************
2513 template< typename MT // Type of the adapted dense matrix
2514  , bool SO > // Storage order of the adapted dense matrix
2515 void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2516 {
2518 
2519  MAYBE_UNUSED( preserve );
2520 
2521  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2522 
2523  const size_t oldsize( matrix_.rows() );
2524 
2525  matrix_.resize( n, n, true );
2526 
2527  if( n > oldsize ) {
2528  const size_t increment( n - oldsize );
2529  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2530  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2531  }
2532 }
2534 //*************************************************************************************************
2535 
2536 
2537 //*************************************************************************************************
2550 template< typename MT // Type of the adapted dense matrix
2551  , bool SO > // Storage order of the adapted dense matrix
2552 inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2553 {
2555 
2556  MAYBE_UNUSED( preserve );
2557 
2558  resize( rows() + n, true );
2559 }
2560 //*************************************************************************************************
2561 
2562 
2563 //*************************************************************************************************
2573 template< typename MT // Type of the adapted dense matrix
2574  , bool SO > // Storage order of the adapted dense matrix
2575 inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2576 {
2577  matrix_.reserve( elements );
2578 }
2580 //*************************************************************************************************
2581 
2582 
2583 //*************************************************************************************************
2593 template< typename MT // Type of the adapted dense matrix
2594  , bool SO > // Storage order of the adapted dense matrix
2596 {
2597  matrix_.shrinkToFit();
2598 }
2600 //*************************************************************************************************
2601 
2602 
2603 //*************************************************************************************************
2610 template< typename MT // Type of the adapted dense matrix
2611  , bool SO > // Storage order of the adapted dense matrix
2612 inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2613 {
2614  using std::swap;
2615 
2616  swap( matrix_, m.matrix_ );
2617 }
2619 //*************************************************************************************************
2620 
2621 
2622 
2623 
2624 //=================================================================================================
2625 //
2626 // NUMERIC FUNCTIONS
2627 //
2628 //=================================================================================================
2629 
2630 //*************************************************************************************************
2636 template< typename MT // Type of the adapted dense matrix
2637  , bool SO > // Storage order of the adapted dense matrix
2638 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2639 {
2640  if( IsComplex_v<ElementType> )
2641  matrix_.transpose();
2642  return *this;
2643 }
2645 //*************************************************************************************************
2646 
2647 
2648 //*************************************************************************************************
2654 template< typename MT // Type of the adapted dense matrix
2655  , bool SO > // Storage order of the adapted dense matrix
2656 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2657 {
2658  return *this;
2659 }
2661 //*************************************************************************************************
2662 
2663 
2664 //*************************************************************************************************
2682 template< typename MT // Type of the adapted dense matrix
2683  , bool SO > // Storage order of the adapted dense matrix
2684 template< typename Other > // Data type of the scalar value
2685 inline HermitianMatrix<MT,SO,true>&
2686  HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2687 {
2688  matrix_.scale( scalar );
2689  return *this;
2690 }
2692 //*************************************************************************************************
2693 
2694 
2695 
2696 
2697 //=================================================================================================
2698 //
2699 // DEBUGGING FUNCTIONS
2700 //
2701 //=================================================================================================
2702 
2703 //*************************************************************************************************
2713 template< typename MT // Type of the adapted dense matrix
2714  , bool SO > // Storage order of the adapted dense matrix
2715 inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2716 {
2717  using blaze::isIntact;
2718 
2719  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2720 }
2722 //*************************************************************************************************
2723 
2724 
2725 
2726 
2727 //=================================================================================================
2728 //
2729 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2730 //
2731 //=================================================================================================
2732 
2733 //*************************************************************************************************
2744 template< typename MT // Type of the adapted dense matrix
2745  , bool SO > // Storage order of the adapted dense matrix
2746 template< typename Other > // Data type of the foreign expression
2747 inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2748 {
2749  return matrix_.canAlias( alias );
2750 }
2752 //*************************************************************************************************
2753 
2754 
2755 //*************************************************************************************************
2766 template< typename MT // Type of the adapted dense matrix
2767  , bool SO > // Storage order of the adapted dense matrix
2768 template< typename Other > // Data type of the foreign expression
2769 inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2770 {
2771  return matrix_.isAliased( alias );
2772 }
2774 //*************************************************************************************************
2775 
2776 
2777 //*************************************************************************************************
2787 template< typename MT // Type of the adapted dense matrix
2788  , bool SO > // Storage order of the adapted dense matrix
2789 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2790 {
2791  return matrix_.isAligned();
2792 }
2794 //*************************************************************************************************
2795 
2796 
2797 //*************************************************************************************************
2808 template< typename MT // Type of the adapted dense matrix
2809  , bool SO > // Storage order of the adapted dense matrix
2810 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2811 {
2812  return matrix_.canSMPAssign();
2813 }
2815 //*************************************************************************************************
2816 
2817 
2818 //*************************************************************************************************
2834 template< typename MT // Type of the adapted dense matrix
2835  , bool SO > // Storage order of the adapted dense matrix
2836 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2837  HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2838 {
2839  return matrix_.load( i, j );
2840 }
2842 //*************************************************************************************************
2843 
2844 
2845 //*************************************************************************************************
2861 template< typename MT // Type of the adapted dense matrix
2862  , bool SO > // Storage order of the adapted dense matrix
2863 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2864  HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2865 {
2866  return matrix_.loada( i, j );
2867 }
2869 //*************************************************************************************************
2870 
2871 
2872 //*************************************************************************************************
2888 template< typename MT // Type of the adapted dense matrix
2889  , bool SO > // Storage order of the adapted dense matrix
2890 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2891  HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2892 {
2893  return matrix_.loadu( i, j );
2894 }
2896 //*************************************************************************************************
2897 
2898 
2899 //*************************************************************************************************
2916 template< typename MT // Type of the adapted dense matrix
2917  , bool SO > // Storage order of the adapted dense matrix
2918 inline void
2919  HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2920 {
2921  matrix_.store( i, j, value );
2922 
2923  if( SO ) {
2924  const size_t kend( min( i+SIMDSIZE, rows() ) );
2925  for( size_t k=i; k<kend; ++k )
2926  matrix_(j,k) = conj( matrix_(k,j) );
2927  }
2928  else {
2929  const size_t kend( min( j+SIMDSIZE, columns() ) );
2930  for( size_t k=j; k<kend; ++k )
2931  matrix_(k,i) = conj( matrix_(i,k) );
2932  }
2933 }
2935 //*************************************************************************************************
2936 
2937 
2938 //*************************************************************************************************
2955 template< typename MT // Type of the adapted dense matrix
2956  , bool SO > // Storage order of the adapted dense matrix
2957 inline void
2958  HermitianMatrix<MT,SO,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2959 {
2960  matrix_.storea( i, j, value );
2961 
2962  if( SO ) {
2963  const size_t kend( min( i+SIMDSIZE, rows() ) );
2964  for( size_t k=i; k<kend; ++k )
2965  matrix_(j,k) = conj( matrix_(k,j) );
2966  }
2967  else {
2968  const size_t kend( min( j+SIMDSIZE, columns() ) );
2969  for( size_t k=j; k<kend; ++k )
2970  matrix_(k,i) = conj( matrix_(i,k) );
2971  }
2972 }
2974 //*************************************************************************************************
2975 
2976 
2977 //*************************************************************************************************
2994 template< typename MT // Type of the adapted dense matrix
2995  , bool SO > // Storage order of the adapted dense matrix
2996 inline void
2997  HermitianMatrix<MT,SO,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2998 {
2999  matrix_.storeu( i, j, value );
3000 
3001  if( SO ) {
3002  const size_t kend( min( i+SIMDSIZE, rows() ) );
3003  for( size_t k=i; k<kend; ++k )
3004  matrix_(j,k) = conj( matrix_(k,j) );
3005  }
3006  else {
3007  const size_t kend( min( j+SIMDSIZE, columns() ) );
3008  for( size_t k=j; k<kend; ++k )
3009  matrix_(k,i) = conj( matrix_(i,k) );
3010  }
3011 }
3013 //*************************************************************************************************
3014 
3015 
3016 //*************************************************************************************************
3033 template< typename MT // Type of the adapted dense matrix
3034  , bool SO > // Storage order of the adapted dense matrix
3035 inline void
3036  HermitianMatrix<MT,SO,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3037 {
3038  matrix_.stream( i, j, value );
3039 
3040  if( SO ) {
3041  const size_t kend( min( i+SIMDSIZE, rows() ) );
3042  for( size_t k=i; k<kend; ++k )
3043  matrix_(j,k) = conj( matrix_(k,j) );
3044  }
3045  else {
3046  const size_t kend( min( j+SIMDSIZE, columns() ) );
3047  for( size_t k=j; k<kend; ++k )
3048  matrix_(k,i) = conj( matrix_(i,k) );
3049  }
3050 }
3052 //*************************************************************************************************
3053 
3054 
3055 
3056 
3057 //=================================================================================================
3058 //
3059 // CONSTRUCTION FUNCTIONS
3060 //
3061 //=================================================================================================
3062 
3063 //*************************************************************************************************
3065 template< typename MT // Type of the adapted dense matrix
3066  , bool SO > // Storage order of the adapted dense matrix
3067 template< typename MT2 // Type of the foreign matrix
3068  , bool SO2 // Storage order of the foreign matrix
3069  , typename T > // Type of the third argument
3070 inline decltype(auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
3071 {
3072  return ~m;
3073 }
3075 //*************************************************************************************************
3076 
3077 
3078 //*************************************************************************************************
3080 template< typename MT // Type of the adapted dense matrix
3081  , bool SO > // Storage order of the adapted dense matrix
3082 template< typename MT2 > // Type of the foreign matrix
3083 inline decltype(auto) HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
3084 {
3085  return trans( ~m );
3086 }
3088 //*************************************************************************************************
3089 
3090 } // namespace blaze
3091 
3092 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.In case the given data type T is a transformation expression (i....
Definition: Transformation.h:81
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,...
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
Constraint on the data type.
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.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
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
Constraint on the data type.
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
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:170
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
#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_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i....
Definition: Computation.h:81
#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.
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
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
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 ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
Header file for the MAYBE_UNUSED function template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
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: IntegralConstant.h:132
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.
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:253
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:677
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:779
Header file for the DisableIf class template.
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
Header file for the If class template.
Compile time assertion.
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:9091
#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
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:1162
#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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
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.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
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:139
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
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 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:615
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
Header file for the implementation of the Column view.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
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:558
#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,...
Definition: Symmetric.h:79
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
Header file for all forward declarations for expression class templates.
#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,...
Definition: Reference.h:79
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:1406
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.In case the given data type T is a view type (i.e. a subvector,...
Definition: View.h:81
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
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 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
Header file for the HermitianProxy class.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
Header file for the IsComplex type trait.
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:494
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#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,...
Definition: Hermitian.h:79
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:1324
#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
Constraint on the data type.
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,...
Definition: Assert.h:101
Header file for the implementation of the Row view.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825