Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_HERMITIANMATRIX_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
57 #include <blaze/math/Exception.h>
60 #include <blaze/math/Functions.h>
63 #include <blaze/math/shims/Clear.h>
65 #include <blaze/math/SIMD.h>
73 #include <blaze/math/views/Row.h>
75 #include <blaze/system/Inline.h>
76 #include <blaze/util/Assert.h>
82 #include <blaze/util/DisableIf.h>
83 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/mpl/If.h>
86 #include <blaze/util/TrueType.h>
87 #include <blaze/util/Types.h>
91 #include <blaze/util/Unused.h>
92 
93 
94 namespace blaze {
95 
96 //=================================================================================================
97 //
98 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
99 //
100 //=================================================================================================
101 
102 //*************************************************************************************************
110 template< typename MT // Type of the adapted dense matrix
111  , bool SO > // Storage order of the adapted dense matrix
112 class HermitianMatrix<MT,SO,true>
113  : public DenseMatrix< HermitianMatrix<MT,SO,true>, SO >
114 {
115  private:
116  //**Type definitions****************************************************************************
117  typedef OppositeType_<MT> OT;
118  typedef TransposeType_<MT> TT;
119  typedef ElementType_<MT> ET;
120  //**********************************************************************************************
121 
122  public:
123  //**Type definitions****************************************************************************
124  typedef HermitianMatrix<MT,SO,true> This;
125  typedef DenseMatrix<This,SO> BaseType;
126  typedef This ResultType;
127  typedef HermitianMatrix<OT,!SO,true> OppositeType;
128  typedef HermitianMatrix<TT,!SO,true> TransposeType;
129  typedef ET ElementType;
130  typedef SIMDType_<MT> SIMDType;
131  typedef ReturnType_<MT> ReturnType;
132  typedef const This& CompositeType;
133  typedef HermitianProxy<MT> Reference;
134  typedef ConstReference_<MT> ConstReference;
135  typedef Pointer_<MT> Pointer;
136  typedef ConstPointer_<MT> ConstPointer;
137  typedef ConstIterator_<MT> ConstIterator;
138  //**********************************************************************************************
139 
140  //**Rebind struct definition********************************************************************
143  template< typename ET > // Data type of the other matrix
144  struct Rebind {
146  typedef HermitianMatrix< typename MT::template Rebind<ET>::Other > Other;
147  };
148  //**********************************************************************************************
149 
150  //**Iterator class definition*******************************************************************
153  class Iterator
154  {
155  public:
156  //**Type definitions*************************************************************************
157  typedef std::random_access_iterator_tag IteratorCategory;
158  typedef ElementType_<MT> ValueType;
159  typedef HermitianProxy<MT> PointerType;
160  typedef HermitianProxy<MT> ReferenceType;
161  typedef ptrdiff_t DifferenceType;
162 
163  // STL iterator requirements
164  typedef IteratorCategory iterator_category;
165  typedef ValueType value_type;
166  typedef PointerType pointer;
167  typedef ReferenceType reference;
168  typedef DifferenceType difference_type;
169  //*******************************************************************************************
170 
171  //**Constructor******************************************************************************
174  inline Iterator() noexcept
175  : matrix_( nullptr ) // Reference to the adapted dense matrix
176  , row_ ( 0UL ) // The current row index of the iterator
177  , column_( 0UL ) // The current column index of the iterator
178  {}
179  //*******************************************************************************************
180 
181  //**Constructor******************************************************************************
188  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
189  : matrix_( &matrix ) // Reference to the adapted dense matrix
190  , row_ ( row ) // The current row index of the iterator
191  , column_( column ) // The current column index of the iterator
192  {}
193  //*******************************************************************************************
194 
195  //**Addition assignment operator*************************************************************
201  inline Iterator& operator+=( size_t inc ) noexcept {
202  ( SO )?( row_ += inc ):( column_ += inc );
203  return *this;
204  }
205  //*******************************************************************************************
206 
207  //**Subtraction assignment operator**********************************************************
213  inline Iterator& operator-=( size_t dec ) noexcept {
214  ( SO )?( row_ -= dec ):( column_ -= dec );
215  return *this;
216  }
217  //*******************************************************************************************
218 
219  //**Prefix increment operator****************************************************************
224  inline Iterator& operator++() noexcept {
225  ( SO )?( ++row_ ):( ++column_ );
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Postfix increment operator***************************************************************
235  inline const Iterator operator++( int ) noexcept {
236  const Iterator tmp( *this );
237  ++(*this);
238  return tmp;
239  }
240  //*******************************************************************************************
241 
242  //**Prefix decrement operator****************************************************************
247  inline Iterator& operator--() noexcept {
248  ( SO )?( --row_ ):( --column_ );
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //**Postfix decrement operator***************************************************************
258  inline const Iterator operator--( int ) noexcept {
259  const Iterator tmp( *this );
260  --(*this);
261  return tmp;
262  }
263  //*******************************************************************************************
264 
265  //**Element access operator******************************************************************
270  inline ReferenceType operator*() const {
271  return ReferenceType( *matrix_, row_, column_ );
272  }
273  //*******************************************************************************************
274 
275  //**Element access operator******************************************************************
280  inline PointerType operator->() const {
281  return PointerType( *matrix_, row_, column_ );
282  }
283  //*******************************************************************************************
284 
285  //**Load function****************************************************************************
295  inline SIMDType load() const {
296  return (*matrix_).load(row_,column_);
297  }
298  //*******************************************************************************************
299 
300  //**Loada function***************************************************************************
310  inline SIMDType loada() const {
311  return (*matrix_).loada(row_,column_);
312  }
313  //*******************************************************************************************
314 
315  //**Loadu function***************************************************************************
325  inline SIMDType loadu() const {
326  return (*matrix_).loadu(row_,column_);
327  }
328  //*******************************************************************************************
329 
330  //**Store function***************************************************************************
341  inline void store( const SIMDType& value ) const {
342  (*matrix_).store( row_, column_, value );
343  sync();
344  }
345  //*******************************************************************************************
346 
347  //**Storea function**************************************************************************
358  inline void storea( const SIMDType& value ) const {
359  (*matrix_).storea( row_, column_, value );
360  sync();
361  }
362  //*******************************************************************************************
363 
364  //**Storeu function**************************************************************************
375  inline void storeu( const SIMDType& value ) const {
376  (*matrix_).storeu( row_, column_, value );
377  sync();
378  }
379  //*******************************************************************************************
380 
381  //**Stream function**************************************************************************
392  inline void stream( const SIMDType& value ) const {
393  (*matrix_).stream( row_, column_, value );
394  sync();
395  }
396  //*******************************************************************************************
397 
398  //**Conversion operator**********************************************************************
403  inline operator ConstIterator() const {
404  if( SO )
405  return matrix_->begin( column_ ) + row_;
406  else
407  return matrix_->begin( row_ ) + column_;
408  }
409  //*******************************************************************************************
410 
411  //**Equality operator************************************************************************
418  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
419  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
420  }
421  //*******************************************************************************************
422 
423  //**Equality operator************************************************************************
430  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
431  return ( ConstIterator( lhs ) == rhs );
432  }
433  //*******************************************************************************************
434 
435  //**Equality operator************************************************************************
442  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
443  return ( lhs == ConstIterator( rhs ) );
444  }
445  //*******************************************************************************************
446 
447  //**Inequality operator**********************************************************************
454  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
455  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
456  }
457  //*******************************************************************************************
458 
459  //**Inequality operator**********************************************************************
466  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
467  return ( ConstIterator( lhs ) != rhs );
468  }
469  //*******************************************************************************************
470 
471  //**Inequality operator**********************************************************************
478  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
479  return ( lhs != ConstIterator( rhs ) );
480  }
481  //*******************************************************************************************
482 
483  //**Less-than operator***********************************************************************
490  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
491  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
492  }
493  //*******************************************************************************************
494 
495  //**Less-than operator***********************************************************************
502  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
503  return ( ConstIterator( lhs ) < rhs );
504  }
505  //*******************************************************************************************
506 
507  //**Less-than operator***********************************************************************
514  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
515  return ( lhs < ConstIterator( rhs ) );
516  }
517  //*******************************************************************************************
518 
519  //**Greater-than operator********************************************************************
526  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
527  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
528  }
529  //*******************************************************************************************
530 
531  //**Greater-than operator********************************************************************
538  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
539  return ( ConstIterator( lhs ) > rhs );
540  }
541  //*******************************************************************************************
542 
543  //**Greater-than operator********************************************************************
550  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
551  return ( lhs > ConstIterator( rhs ) );
552  }
553  //*******************************************************************************************
554 
555  //**Less-or-equal-than operator**************************************************************
562  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
563  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
564  }
565  //*******************************************************************************************
566 
567  //**Less-or-equal-than operator**************************************************************
574  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
575  return ( ConstIterator( lhs ) <= rhs );
576  }
577  //*******************************************************************************************
578 
579  //**Less-or-equal-than operator**************************************************************
586  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
587  return ( lhs <= ConstIterator( rhs ) );
588  }
589  //*******************************************************************************************
590 
591  //**Greater-or-equal-than operator***********************************************************
598  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
599  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
600  }
601  //*******************************************************************************************
602 
603  //**Greater-or-equal-than operator***********************************************************
610  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
611  return ( ConstIterator( lhs ) >= rhs );
612  }
613  //*******************************************************************************************
614 
615  //**Greater-or-equal-than operator***********************************************************
622  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
623  return ( lhs >= ConstIterator( rhs ) );
624  }
625  //*******************************************************************************************
626 
627  //**Subtraction operator*********************************************************************
633  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
634  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
635  }
636  //*******************************************************************************************
637 
638  //**Addition operator************************************************************************
645  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
646  if( SO )
647  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
648  else
649  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
650  }
651  //*******************************************************************************************
652 
653  //**Addition operator************************************************************************
660  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
661  if( SO )
662  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
663  else
664  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
665  }
666  //*******************************************************************************************
667 
668  //**Subtraction operator*********************************************************************
675  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
676  if( SO )
677  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
678  else
679  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
680  }
681  //*******************************************************************************************
682 
683  private:
684  //**Sync function****************************************************************************
689  void sync() const {
690  if( SO ) {
691  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
692  for( size_t k=row_; k<kend; ++k )
693  (*matrix_)(column_,k) = conj( (*matrix_)(k,column_) );
694  }
695  else {
696  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
697  for( size_t k=column_; k<kend; ++k )
698  (*matrix_)(k,row_) = conj( (*matrix_)(row_,k) );
699  }
700  }
701  //*******************************************************************************************
702 
703  //**Member variables*************************************************************************
704  MT* matrix_;
705  size_t row_;
706  size_t column_;
707  //*******************************************************************************************
708  };
709  //**********************************************************************************************
710 
711  //**Compilation flags***************************************************************************
713  enum : bool { simdEnabled = MT::simdEnabled };
714 
716  enum : bool { smpAssignable = MT::smpAssignable };
717  //**********************************************************************************************
718 
719  //**Constructors********************************************************************************
722  explicit inline HermitianMatrix();
723  explicit inline HermitianMatrix( size_t n );
724  explicit inline HermitianMatrix( initializer_list< initializer_list<ElementType> > list );
725 
726  template< typename Other >
727  explicit inline HermitianMatrix( size_t n, const Other* array );
728 
729  template< typename Other, size_t N >
730  explicit inline HermitianMatrix( const Other (&array)[N][N] );
731 
732  explicit inline HermitianMatrix( ElementType* ptr, size_t n );
733  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn );
734 
735  template< typename Deleter >
736  explicit inline HermitianMatrix( ElementType* ptr, size_t n, Deleter d );
737 
738  template< typename Deleter >
739  explicit inline HermitianMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
740 
741  inline HermitianMatrix( const HermitianMatrix& m );
742  inline HermitianMatrix( HermitianMatrix&& m ) noexcept;
743 
744  template< typename MT2, bool SO2 >
745  inline HermitianMatrix( const Matrix<MT2,SO2>& m );
747  //**********************************************************************************************
748 
749  //**Destructor**********************************************************************************
750  // No explicitly declared destructor.
751  //**********************************************************************************************
752 
753  //**Data access functions***********************************************************************
756  inline Reference operator()( size_t i, size_t j );
757  inline ConstReference operator()( size_t i, size_t j ) const;
758  inline Reference at( size_t i, size_t j );
759  inline ConstReference at( size_t i, size_t j ) const;
760  inline ConstPointer data () const noexcept;
761  inline ConstPointer data ( size_t i ) const noexcept;
762  inline Iterator begin ( size_t i );
763  inline ConstIterator begin ( size_t i ) const;
764  inline ConstIterator cbegin( size_t i ) const;
765  inline Iterator end ( size_t i );
766  inline ConstIterator end ( size_t i ) const;
767  inline ConstIterator cend ( size_t i ) const;
769  //**********************************************************************************************
770 
771  //**Assignment operators************************************************************************
774  inline HermitianMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
775 
776  template< typename Other, size_t N >
777  inline HermitianMatrix& operator=( const Other (&array)[N][N] );
778 
779  inline HermitianMatrix& operator=( const HermitianMatrix& rhs );
780  inline HermitianMatrix& operator=( HermitianMatrix&& rhs ) noexcept;
781 
782  template< typename MT2, bool SO2 >
783  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
784 
785  template< typename MT2, bool SO2 >
786  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
787 
788  template< typename MT2 >
789  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
790  operator=( const Matrix<MT2,!SO>& rhs );
791 
792  template< typename MT2, bool SO2 >
793  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
794 
795  template< typename MT2, bool SO2 >
796  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
797 
798  template< typename MT2 >
799  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
800  operator+=( const Matrix<MT2,!SO>& rhs );
801 
802  template< typename MT2, bool SO2 >
803  inline DisableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
804 
805  template< typename MT2, bool SO2 >
806  inline EnableIf_< IsComputation<MT2>, HermitianMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
807 
808  template< typename MT2 >
809  inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix& >
810  operator-=( const Matrix<MT2,!SO>& rhs );
811 
812  template< typename MT2, bool SO2 >
813  inline HermitianMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
814 
815  template< typename Other >
816  inline EnableIf_< IsNumeric<Other>, HermitianMatrix >& operator*=( Other rhs );
817 
818  template< typename Other >
819  inline EnableIf_< IsNumeric<Other>, HermitianMatrix >& operator/=( Other rhs );
821  //**********************************************************************************************
822 
823  //**Utility functions***************************************************************************
826  inline size_t rows() const noexcept;
827  inline size_t columns() const noexcept;
828  inline size_t spacing() const noexcept;
829  inline size_t capacity() const noexcept;
830  inline size_t capacity( size_t i ) const noexcept;
831  inline size_t nonZeros() const;
832  inline size_t nonZeros( size_t i ) const;
833  inline void reset();
834  inline void reset( size_t i );
835  inline void clear();
836  void resize ( size_t n, bool preserve=true );
837  inline void extend ( size_t n, bool preserve=true );
838  inline void reserve( size_t elements );
839  inline HermitianMatrix& transpose();
840  inline HermitianMatrix& ctranspose();
841  template< typename Other > inline HermitianMatrix& scale( const Other& scalar );
842  inline void swap( HermitianMatrix& m ) noexcept;
844  //**********************************************************************************************
845 
846  //**Debugging functions*************************************************************************
849  inline bool isIntact() const noexcept;
851  //**********************************************************************************************
852 
853  //**Expression template evaluation functions****************************************************
856  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
857  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
858 
859  inline bool isAligned () const noexcept;
860  inline bool canSMPAssign() const noexcept;
861 
862  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
863  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
864  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
865 
866  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
867  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
868  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
869  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
871  //**********************************************************************************************
872 
873  private:
874  //**Construction functions**********************************************************************
877  template< typename MT2, bool SO2, typename T >
878  inline const MT2& construct( const Matrix<MT2,SO2>& m, T );
879 
880  template< typename MT2 >
881  inline TransExprTrait_<MT2> construct( const Matrix<MT2,!SO>& m, TrueType );
883  //**********************************************************************************************
884 
885  //**SIMD properties*****************************************************************************
887  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
888  //**********************************************************************************************
889 
890  //**Member variables****************************************************************************
893  MT matrix_;
894 
895  //**********************************************************************************************
896 
897  //**Friend declarations*************************************************************************
898  template< typename MT2, bool SO2, bool DF2 >
899  friend bool isDefault( const HermitianMatrix<MT2,SO2,DF2>& m );
900 
901 
902  template< InversionFlag IF, typename MT2, bool SO2 >
903  friend void invert( HermitianMatrix<MT2,SO2,true>& m );
904  //**********************************************************************************************
905 
906  //**Compile time checks*************************************************************************
920  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
921  //**********************************************************************************************
922 };
924 //*************************************************************************************************
925 
926 
927 
928 
929 //=================================================================================================
930 //
931 // CONSTRUCTORS
932 //
933 //=================================================================================================
934 
935 //*************************************************************************************************
939 template< typename MT // Type of the adapted dense matrix
940  , bool SO > // Storage order of the adapted dense matrix
941 inline HermitianMatrix<MT,SO,true>::HermitianMatrix()
942  : matrix_() // The adapted dense matrix
943 {
944  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
945  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
946 }
948 //*************************************************************************************************
949 
950 
951 //*************************************************************************************************
957 template< typename MT // Type of the adapted dense matrix
958  , bool SO > // Storage order of the adapted dense matrix
959 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n )
960  : matrix_( n, n, ElementType() ) // The adapted dense matrix
961 {
963 
964  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
965  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
966 }
968 //*************************************************************************************************
969 
970 
971 //*************************************************************************************************
997 template< typename MT // Type of the adapted dense matrix
998  , bool SO > // Storage order of the adapted dense matrix
999 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( initializer_list< initializer_list<ElementType> > list )
1000  : matrix_( list ) // The adapted dense matrix
1001 {
1002  if( !isHermitian( matrix_ ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1004  }
1005 
1006  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1007 }
1009 //*************************************************************************************************
1010 
1011 
1012 //*************************************************************************************************
1041 template< typename MT // Type of the adapted dense matrix
1042  , bool SO > // Storage order of the adapted dense matrix
1043 template< typename Other > // Data type of the initialization array
1044 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( size_t n, const Other* array )
1045  : matrix_( n, n, array ) // The adapted dense matrix
1046 {
1047  if( !isHermitian( matrix_ ) ) {
1048  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1049  }
1050 
1051  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1052 }
1054 //*************************************************************************************************
1055 
1056 
1057 //*************************************************************************************************
1082 template< typename MT // Type of the adapted dense matrix
1083  , bool SO > // Storage order of the adapted dense matrix
1084 template< typename Other // Data type of the initialization array
1085  , size_t N > // Number of rows and columns of the initialization array
1086 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Other (&array)[N][N] )
1087  : matrix_( array ) // The adapted dense matrix
1088 {
1089  if( !isHermitian( matrix_ ) ) {
1090  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1091  }
1092 
1093  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1094 }
1096 //*************************************************************************************************
1097 
1098 
1099 //*************************************************************************************************
1120 template< typename MT // Type of the adapted dense matrix
1121  , bool SO > // Storage order of the adapted dense matrix
1122 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n )
1123  : matrix_( ptr, n, n ) // The adapted dense matrix
1124 {
1125  if( !isHermitian( matrix_ ) ) {
1126  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1127  }
1128 
1129  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1130 }
1132 //*************************************************************************************************
1133 
1134 
1135 //*************************************************************************************************
1158 template< typename MT // Type of the adapted dense matrix
1159  , bool SO > // Storage order of the adapted dense matrix
1160 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn )
1161  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1162 {
1163  if( !isHermitian( matrix_ ) ) {
1164  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1165  }
1166 
1167  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1168 }
1170 //*************************************************************************************************
1171 
1172 
1173 //*************************************************************************************************
1194 template< typename MT // Type of the adapted dense matrix
1195  , bool SO > // Storage order of the adapted dense matrix
1196 template< typename Deleter > // Type of the custom deleter
1197 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, Deleter d )
1198  : matrix_( ptr, n, n, d ) // The adapted dense matrix
1199 {
1200  if( !isHermitian( matrix_ ) ) {
1201  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1202  }
1203 
1204  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1205 }
1207 //*************************************************************************************************
1208 
1209 
1210 //*************************************************************************************************
1232 template< typename MT // Type of the adapted dense matrix
1233  , bool SO > // Storage order of the adapted dense matrix
1234 template< typename Deleter > // Type of the custom deleter
1235 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
1236  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
1237 {
1238  if( !isHermitian( matrix_ ) ) {
1239  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1240  }
1241 
1242  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1243 }
1245 //*************************************************************************************************
1246 
1247 
1248 //*************************************************************************************************
1254 template< typename MT // Type of the adapted dense matrix
1255  , bool SO > // Storage order of the adapted dense matrix
1256 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const HermitianMatrix& m )
1257  : matrix_( m.matrix_ ) // The adapted dense matrix
1258 {
1259  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1260  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1261 }
1263 //*************************************************************************************************
1264 
1265 
1266 //*************************************************************************************************
1272 template< typename MT // Type of the adapted dense matrix
1273  , bool SO > // Storage order of the adapted dense matrix
1274 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( HermitianMatrix&& m ) noexcept
1275  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1276 {
1277  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1278  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1279 }
1281 //*************************************************************************************************
1282 
1283 
1284 //*************************************************************************************************
1294 template< typename MT // Type of the adapted dense matrix
1295  , bool SO > // Storage order of the adapted dense matrix
1296 template< typename MT2 // Type of the foreign matrix
1297  , bool SO2 > // Storage order of the foreign matrix
1298 inline HermitianMatrix<MT,SO,true>::HermitianMatrix( const Matrix<MT2,SO2>& m )
1299  : matrix_( construct( m, typename IsBuiltin< ElementType_<MT2> >::Type() ) ) // The adapted dense matrix
1300 {
1301  if( !IsHermitian<MT2>::value && !isHermitian( matrix_ ) ) {
1302  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of Hermitian matrix" );
1303  }
1304 
1305  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1306 }
1308 //*************************************************************************************************
1309 
1310 
1311 
1312 
1313 //=================================================================================================
1314 //
1315 // DATA ACCESS FUNCTIONS
1316 //
1317 //=================================================================================================
1318 
1319 //*************************************************************************************************
1335 template< typename MT // Type of the adapted dense matrix
1336  , bool SO > // Storage order of the adapted dense matrix
1338  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1339 {
1340  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1341  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1342 
1343  return Reference( matrix_, i, j );
1344 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1365 template< typename MT // Type of the adapted dense matrix
1366  , bool SO > // Storage order of the adapted dense matrix
1368  HermitianMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1369 {
1370  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1371  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1372 
1373  return matrix_(i,j);
1374 }
1376 //*************************************************************************************************
1377 
1378 
1379 //*************************************************************************************************
1396 template< typename MT // Type of the adapted dense matrix
1397  , bool SO > // Storage order of the adapted dense matrix
1399  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j )
1400 {
1401  if( i >= rows() ) {
1402  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1403  }
1404  if( j >= columns() ) {
1405  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1406  }
1407  return (*this)(i,j);
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1430 template< typename MT // Type of the adapted dense matrix
1431  , bool SO > // Storage order of the adapted dense matrix
1433  HermitianMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1434 {
1435  if( i >= rows() ) {
1436  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1437  }
1438  if( j >= columns() ) {
1439  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1440  }
1441  return (*this)(i,j);
1442 }
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1461 template< typename MT // Type of the adapted dense matrix
1462  , bool SO > // Storage order of the adapted dense matrix
1463 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1464  HermitianMatrix<MT,SO,true>::data() const noexcept
1465 {
1466  return matrix_.data();
1467 }
1469 //*************************************************************************************************
1470 
1471 
1472 //*************************************************************************************************
1483 template< typename MT // Type of the adapted dense matrix
1484  , bool SO > // Storage order of the adapted dense matrix
1485 inline typename HermitianMatrix<MT,SO,true>::ConstPointer
1486  HermitianMatrix<MT,SO,true>::data( size_t i ) const noexcept
1487 {
1488  return matrix_.data(i);
1489 }
1491 //*************************************************************************************************
1492 
1493 
1494 //*************************************************************************************************
1506 template< typename MT // Type of the adapted dense matrix
1507  , bool SO > // Storage order of the adapted dense matrix
1510 {
1511  if( SO )
1512  return Iterator( matrix_, 0UL, i );
1513  else
1514  return Iterator( matrix_, i, 0UL );
1515 }
1517 //*************************************************************************************************
1518 
1519 
1520 //*************************************************************************************************
1532 template< typename MT // Type of the adapted dense matrix
1533  , bool SO > // Storage order of the adapted dense matrix
1535  HermitianMatrix<MT,SO,true>::begin( size_t i ) const
1536 {
1537  return matrix_.begin(i);
1538 }
1540 //*************************************************************************************************
1541 
1542 
1543 //*************************************************************************************************
1555 template< typename MT // Type of the adapted dense matrix
1556  , bool SO > // Storage order of the adapted dense matrix
1558  HermitianMatrix<MT,SO,true>::cbegin( size_t i ) const
1559 {
1560  return matrix_.cbegin(i);
1561 }
1563 //*************************************************************************************************
1564 
1565 
1566 //*************************************************************************************************
1578 template< typename MT // Type of the adapted dense matrix
1579  , bool SO > // Storage order of the adapted dense matrix
1582 {
1583  if( SO )
1584  return Iterator( matrix_, rows(), i );
1585  else
1586  return Iterator( matrix_, i, columns() );
1587 }
1589 //*************************************************************************************************
1590 
1591 
1592 //*************************************************************************************************
1604 template< typename MT // Type of the adapted dense matrix
1605  , bool SO > // Storage order of the adapted dense matrix
1607  HermitianMatrix<MT,SO,true>::end( size_t i ) const
1608 {
1609  return matrix_.end(i);
1610 }
1612 //*************************************************************************************************
1613 
1614 
1615 //*************************************************************************************************
1627 template< typename MT // Type of the adapted dense matrix
1628  , bool SO > // Storage order of the adapted dense matrix
1630  HermitianMatrix<MT,SO,true>::cend( size_t i ) const
1631 {
1632  return matrix_.cend(i);
1633 }
1635 //*************************************************************************************************
1636 
1637 
1638 
1639 
1640 //=================================================================================================
1641 //
1642 // ASSIGNMENT OPERATORS
1643 //
1644 //=================================================================================================
1645 
1646 //*************************************************************************************************
1672 template< typename MT // Type of the adapted dense matrix
1673  , bool SO > // Storage order of the adapted dense matrix
1674 inline HermitianMatrix<MT,SO,true>&
1675  HermitianMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1676 {
1677  MT tmp( list );
1678 
1679  if( !isHermitian( tmp ) ) {
1680  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1681  }
1682 
1683  matrix_ = std::move( tmp );
1684 
1685  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1686  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1687 
1688  return *this;
1689 }
1691 //*************************************************************************************************
1692 
1693 
1694 //*************************************************************************************************
1720 template< typename MT // Type of the adapted dense matrix
1721  , bool SO > // Storage order of the adapted dense matrix
1722 template< typename Other // Data type of the initialization array
1723  , size_t N > // Number of rows and columns of the initialization array
1724 inline HermitianMatrix<MT,SO,true>&
1725  HermitianMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1726 {
1727  MT tmp( array );
1728 
1729  if( !isHermitian( tmp ) ) {
1730  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1731  }
1732 
1733  matrix_ = std::move( tmp );
1734 
1735  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1736  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1737 
1738  return *this;
1739 }
1741 //*************************************************************************************************
1742 
1743 
1744 //*************************************************************************************************
1754 template< typename MT // Type of the adapted dense matrix
1755  , bool SO > // Storage order of the adapted dense matrix
1756 inline HermitianMatrix<MT,SO,true>&
1757  HermitianMatrix<MT,SO,true>::operator=( const HermitianMatrix& rhs )
1758 {
1759  matrix_ = rhs.matrix_;
1760 
1761  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1762  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1763 
1764  return *this;
1765 }
1767 //*************************************************************************************************
1768 
1769 
1770 //*************************************************************************************************
1777 template< typename MT // Type of the adapted dense matrix
1778  , bool SO > // Storage order of the adapted dense matrix
1779 inline HermitianMatrix<MT,SO,true>&
1780  HermitianMatrix<MT,SO,true>::operator=( HermitianMatrix&& rhs ) noexcept
1781 {
1782  matrix_ = std::move( rhs.matrix_ );
1783 
1784  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1785  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1786 
1787  return *this;
1788 }
1790 //*************************************************************************************************
1791 
1792 
1793 //*************************************************************************************************
1806 template< typename MT // Type of the adapted dense matrix
1807  , bool SO > // Storage order of the adapted dense matrix
1808 template< typename MT2 // Type of the right-hand side matrix
1809  , bool SO2 > // Storage order of the right-hand side matrix
1810 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1811  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1812 {
1813  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1814  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1815  }
1816 
1817  matrix_ = ~rhs;
1818 
1819  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1820  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1821 
1822  return *this;
1823 }
1825 //*************************************************************************************************
1826 
1827 
1828 //*************************************************************************************************
1841 template< typename MT // Type of the adapted dense matrix
1842  , bool SO > // Storage order of the adapted dense matrix
1843 template< typename MT2 // Type of the right-hand side matrix
1844  , bool SO2 > // Storage order of the right-hand side matrix
1845 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1846  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1847 {
1848  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1849  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1850  }
1851 
1852  if( IsHermitian<MT2>::value ) {
1853  matrix_ = ~rhs;
1854  }
1855  else {
1856  MT tmp( ~rhs );
1857 
1858  if( !isHermitian( tmp ) ) {
1859  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1860  }
1861 
1862  matrix_ = std::move( tmp );
1863  }
1864 
1865  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1866  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1867 
1868  return *this;
1869 }
1871 //*************************************************************************************************
1872 
1873 
1874 //*************************************************************************************************
1887 template< typename MT // Type of the adapted dense matrix
1888  , bool SO > // Storage order of the adapted dense matrix
1889 template< typename MT2 > // Type of the right-hand side matrix
1890 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1891  HermitianMatrix<MT,SO,true>::operator=( const Matrix<MT2,!SO>& rhs )
1892 {
1893  return this->operator=( trans( ~rhs ) );
1894 }
1896 //*************************************************************************************************
1897 
1898 
1899 //*************************************************************************************************
1912 template< typename MT // Type of the adapted dense matrix
1913  , bool SO > // Storage order of the adapted dense matrix
1914 template< typename MT2 // Type of the right-hand side matrix
1915  , bool SO2 > // Storage order of the right-hand side matrix
1916 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1917  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1918 {
1919  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
1920  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1921  }
1922 
1923  matrix_ += ~rhs;
1924 
1925  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1926  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1927 
1928  return *this;
1929 }
1931 //*************************************************************************************************
1932 
1933 
1934 //*************************************************************************************************
1947 template< typename MT // Type of the adapted dense matrix
1948  , bool SO > // Storage order of the adapted dense matrix
1949 template< typename MT2 // Type of the right-hand side matrix
1950  , bool SO2 > // Storage order of the right-hand side matrix
1951 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
1952  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1953 {
1954  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1955  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1956  }
1957 
1958  if( IsHermitian<MT2>::value ) {
1959  matrix_ += ~rhs;
1960  }
1961  else {
1962  const ResultType_<MT2> tmp( ~rhs );
1963 
1964  if( !isHermitian( tmp ) ) {
1965  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
1966  }
1967 
1968  matrix_ += tmp;
1969  }
1970 
1971  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
1972  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1973 
1974  return *this;
1975 }
1977 //*************************************************************************************************
1978 
1979 
1980 //*************************************************************************************************
1994 template< typename MT // Type of the adapted dense matrix
1995  , bool SO > // Storage order of the adapted dense matrix
1996 template< typename MT2 > // Type of the right-hand side matrix
1997 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
1998  HermitianMatrix<MT,SO,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1999 {
2000  return this->operator+=( trans( ~rhs ) );
2001 }
2003 //*************************************************************************************************
2004 
2005 
2006 //*************************************************************************************************
2019 template< typename MT // Type of the adapted dense matrix
2020  , bool SO > // Storage order of the adapted dense matrix
2021 template< typename MT2 // Type of the right-hand side matrix
2022  , bool SO2 > // Storage order of the right-hand side matrix
2023 inline DisableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2024  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2025 {
2026  if( !IsHermitian<MT2>::value && !isHermitian( ~rhs ) ) {
2027  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2028  }
2029 
2030  matrix_ -= ~rhs;
2031 
2032  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2033  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2034 
2035  return *this;
2036 }
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2054 template< typename MT // Type of the adapted dense matrix
2055  , bool SO > // Storage order of the adapted dense matrix
2056 template< typename MT2 // Type of the right-hand side matrix
2057  , bool SO2 > // Storage order of the right-hand side matrix
2058 inline EnableIf_< IsComputation<MT2>, HermitianMatrix<MT,SO,true>& >
2059  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
2060 {
2061  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2062  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2063  }
2064 
2065  if( IsHermitian<MT2>::value ) {
2066  matrix_ -= ~rhs;
2067  }
2068  else {
2069  const ResultType_<MT2> tmp( ~rhs );
2070 
2071  if( !isHermitian( tmp ) ) {
2072  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2073  }
2074 
2075  matrix_ -= tmp;
2076  }
2077 
2078  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2079  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2080 
2081  return *this;
2082 }
2084 //*************************************************************************************************
2085 
2086 
2087 //*************************************************************************************************
2101 template< typename MT // Type of the adapted dense matrix
2102  , bool SO > // Storage order of the adapted dense matrix
2103 template< typename MT2 > // Type of the right-hand side matrix
2104 inline EnableIf_< IsBuiltin< ElementType_<MT2> >, HermitianMatrix<MT,SO,true>& >
2105  HermitianMatrix<MT,SO,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2106 {
2107  return this->operator-=( trans( ~rhs ) );
2108 }
2110 //*************************************************************************************************
2111 
2112 
2113 //*************************************************************************************************
2125 template< typename MT // Type of the adapted dense matrix
2126  , bool SO > // Storage order of the adapted dense matrix
2127 template< typename MT2 // Type of the right-hand side matrix
2128  , bool SO2 > // Storage order of the right-hand side matrix
2129 inline HermitianMatrix<MT,SO,true>&
2130  HermitianMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
2131 {
2132  if( matrix_.rows() != (~rhs).columns() ) {
2133  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2134  }
2135 
2136  MT tmp( matrix_ * ~rhs );
2137 
2138  if( !isHermitian( tmp ) ) {
2139  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to Hermitian matrix" );
2140  }
2141 
2142  matrix_ = std::move( tmp );
2143 
2144  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2145  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2146 
2147  return *this;
2148 }
2150 //*************************************************************************************************
2151 
2152 
2153 //*************************************************************************************************
2161 template< typename MT // Type of the adapted dense matrix
2162  , bool SO > // Storage order of the adapted dense matrix
2163 template< typename Other > // Data type of the right-hand side scalar
2164 inline EnableIf_< IsNumeric<Other>, HermitianMatrix<MT,SO,true> >&
2166 {
2167  matrix_ *= rhs;
2168  return *this;
2169 }
2170 //*************************************************************************************************
2171 
2172 
2173 //*************************************************************************************************
2181 template< typename MT // Type of the adapted dense matrix
2182  , bool SO > // Storage order of the adapted dense matrix
2183 template< typename Other > // Data type of the right-hand side scalar
2184 inline EnableIf_< IsNumeric<Other>, HermitianMatrix<MT,SO,true> >&
2186 {
2187  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2188 
2189  matrix_ /= rhs;
2190  return *this;
2191 }
2193 //*************************************************************************************************
2194 
2195 
2196 
2197 
2198 //=================================================================================================
2199 //
2200 // UTILITY FUNCTIONS
2201 //
2202 //=================================================================================================
2203 
2204 //*************************************************************************************************
2210 template< typename MT // Type of the adapted dense matrix
2211  , bool SO > // Storage order of the adapted dense matrix
2212 inline size_t HermitianMatrix<MT,SO,true>::rows() const noexcept
2213 {
2214  return matrix_.rows();
2215 }
2217 //*************************************************************************************************
2218 
2219 
2220 //*************************************************************************************************
2226 template< typename MT // Type of the adapted dense matrix
2227  , bool SO > // Storage order of the adapted dense matrix
2228 inline size_t HermitianMatrix<MT,SO,true>::columns() const noexcept
2229 {
2230  return matrix_.columns();
2231 }
2233 //*************************************************************************************************
2234 
2235 
2236 //*************************************************************************************************
2248 template< typename MT // Type of the adapted dense matrix
2249  , bool SO > // Storage order of the adapted dense matrix
2250 inline size_t HermitianMatrix<MT,SO,true>::spacing() const noexcept
2251 {
2252  return matrix_.spacing();
2253 }
2255 //*************************************************************************************************
2256 
2257 
2258 //*************************************************************************************************
2264 template< typename MT // Type of the adapted dense matrix
2265  , bool SO > // Storage order of the adapted dense matrix
2266 inline size_t HermitianMatrix<MT,SO,true>::capacity() const noexcept
2267 {
2268  return matrix_.capacity();
2269 }
2271 //*************************************************************************************************
2272 
2273 
2274 //*************************************************************************************************
2285 template< typename MT // Type of the adapted dense matrix
2286  , bool SO > // Storage order of the adapted dense matrix
2287 inline size_t HermitianMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2288 {
2289  return matrix_.capacity(i);
2290 }
2292 //*************************************************************************************************
2293 
2294 
2295 //*************************************************************************************************
2301 template< typename MT // Type of the adapted dense matrix
2302  , bool SO > // Storage order of the adapted dense matrix
2303 inline size_t HermitianMatrix<MT,SO,true>::nonZeros() const
2304 {
2305  return matrix_.nonZeros();
2306 }
2308 //*************************************************************************************************
2309 
2310 
2311 //*************************************************************************************************
2323 template< typename MT // Type of the adapted dense matrix
2324  , bool SO > // Storage order of the adapted dense matrix
2325 inline size_t HermitianMatrix<MT,SO,true>::nonZeros( size_t i ) const
2326 {
2327  return matrix_.nonZeros(i);
2328 }
2330 //*************************************************************************************************
2331 
2332 
2333 //*************************************************************************************************
2339 template< typename MT // Type of the adapted dense matrix
2340  , bool SO > // Storage order of the adapted dense matrix
2342 {
2343  matrix_.reset();
2344 }
2346 //*************************************************************************************************
2347 
2348 
2349 //*************************************************************************************************
2385 template< typename MT // Type of the adapted dense matrix
2386  , bool SO > // Storage order of the adapted dense matrix
2387 inline void HermitianMatrix<MT,SO,true>::reset( size_t i )
2388 {
2389  row ( matrix_, i ).reset();
2390  column( matrix_, i ).reset();
2391 }
2393 //*************************************************************************************************
2394 
2395 
2396 //*************************************************************************************************
2408 template< typename MT // Type of the adapted dense matrix
2409  , bool SO > // Storage order of the adapted dense matrix
2411 {
2412  using blaze::clear;
2413 
2414  clear( matrix_ );
2415 }
2417 //*************************************************************************************************
2418 
2419 
2420 //*************************************************************************************************
2455 template< typename MT // Type of the adapted dense matrix
2456  , bool SO > // Storage order of the adapted dense matrix
2457 void HermitianMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2458 {
2460 
2461  UNUSED_PARAMETER( preserve );
2462 
2463  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square Hermitian matrix detected" );
2464 
2465  const size_t oldsize( matrix_.rows() );
2466 
2467  matrix_.resize( n, n, true );
2468 
2469  if( n > oldsize ) {
2470  const size_t increment( n - oldsize );
2471  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2472  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2473  }
2474 }
2476 //*************************************************************************************************
2477 
2478 
2479 //*************************************************************************************************
2492 template< typename MT // Type of the adapted dense matrix
2493  , bool SO > // Storage order of the adapted dense matrix
2494 inline void HermitianMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2495 {
2497 
2498  UNUSED_PARAMETER( preserve );
2499 
2500  resize( rows() + n, true );
2501 }
2502 //*************************************************************************************************
2503 
2504 
2505 //*************************************************************************************************
2515 template< typename MT // Type of the adapted dense matrix
2516  , bool SO > // Storage order of the adapted dense matrix
2517 inline void HermitianMatrix<MT,SO,true>::reserve( size_t elements )
2518 {
2519  matrix_.reserve( elements );
2520 }
2522 //*************************************************************************************************
2523 
2524 
2525 //*************************************************************************************************
2531 template< typename MT // Type of the adapted dense matrix
2532  , bool SO > // Storage order of the adapted dense matrix
2533 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::transpose()
2534 {
2535  if( IsComplex<ElementType>::value )
2536  matrix_.transpose();
2537  return *this;
2538 }
2540 //*************************************************************************************************
2541 
2542 
2543 //*************************************************************************************************
2549 template< typename MT // Type of the adapted dense matrix
2550  , bool SO > // Storage order of the adapted dense matrix
2551 inline HermitianMatrix<MT,SO,true>& HermitianMatrix<MT,SO,true>::ctranspose()
2552 {
2553  return *this;
2554 }
2556 //*************************************************************************************************
2557 
2558 
2559 //*************************************************************************************************
2566 template< typename MT // Type of the adapted dense matrix
2567  , bool SO > // Storage order of the adapted dense matrix
2568 template< typename Other > // Data type of the scalar value
2569 inline HermitianMatrix<MT,SO,true>&
2570  HermitianMatrix<MT,SO,true>::scale( const Other& scalar )
2571 {
2572  matrix_.scale( scalar );
2573  return *this;
2574 }
2576 //*************************************************************************************************
2577 
2578 
2579 //*************************************************************************************************
2586 template< typename MT // Type of the adapted dense matrix
2587  , bool SO > // Storage order of the adapted dense matrix
2588 inline void HermitianMatrix<MT,SO,true>::swap( HermitianMatrix& m ) noexcept
2589 {
2590  using std::swap;
2591 
2592  swap( matrix_, m.matrix_ );
2593 }
2595 //*************************************************************************************************
2596 
2597 
2598 
2599 
2600 //=================================================================================================
2601 //
2602 // DEBUGGING FUNCTIONS
2603 //
2604 //=================================================================================================
2605 
2606 //*************************************************************************************************
2616 template< typename MT // Type of the adapted dense matrix
2617  , bool SO > // Storage order of the adapted dense matrix
2618 inline bool HermitianMatrix<MT,SO,true>::isIntact() const noexcept
2619 {
2620  using blaze::isIntact;
2621 
2622  return ( isIntact( matrix_ ) && isHermitian( matrix_ ) );
2623 }
2625 //*************************************************************************************************
2626 
2627 
2628 
2629 
2630 //=================================================================================================
2631 //
2632 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2633 //
2634 //=================================================================================================
2635 
2636 //*************************************************************************************************
2647 template< typename MT // Type of the adapted dense matrix
2648  , bool SO > // Storage order of the adapted dense matrix
2649 template< typename Other > // Data type of the foreign expression
2650 inline bool HermitianMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2651 {
2652  return matrix_.canAlias( alias );
2653 }
2655 //*************************************************************************************************
2656 
2657 
2658 //*************************************************************************************************
2669 template< typename MT // Type of the adapted dense matrix
2670  , bool SO > // Storage order of the adapted dense matrix
2671 template< typename Other > // Data type of the foreign expression
2672 inline bool HermitianMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2673 {
2674  return matrix_.isAliased( alias );
2675 }
2677 //*************************************************************************************************
2678 
2679 
2680 //*************************************************************************************************
2690 template< typename MT // Type of the adapted dense matrix
2691  , bool SO > // Storage order of the adapted dense matrix
2692 inline bool HermitianMatrix<MT,SO,true>::isAligned() const noexcept
2693 {
2694  return matrix_.isAligned();
2695 }
2697 //*************************************************************************************************
2698 
2699 
2700 //*************************************************************************************************
2711 template< typename MT // Type of the adapted dense matrix
2712  , bool SO > // Storage order of the adapted dense matrix
2713 inline bool HermitianMatrix<MT,SO,true>::canSMPAssign() const noexcept
2714 {
2715  return matrix_.canSMPAssign();
2716 }
2718 //*************************************************************************************************
2719 
2720 
2721 //*************************************************************************************************
2737 template< typename MT // Type of the adapted dense matrix
2738  , bool SO > // Storage order of the adapted dense matrix
2739 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2740  HermitianMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2741 {
2742  return matrix_.load( i, j );
2743 }
2745 //*************************************************************************************************
2746 
2747 
2748 //*************************************************************************************************
2764 template< typename MT // Type of the adapted dense matrix
2765  , bool SO > // Storage order of the adapted dense matrix
2766 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2767  HermitianMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2768 {
2769  return matrix_.loada( i, j );
2770 }
2772 //*************************************************************************************************
2773 
2774 
2775 //*************************************************************************************************
2791 template< typename MT // Type of the adapted dense matrix
2792  , bool SO > // Storage order of the adapted dense matrix
2793 BLAZE_ALWAYS_INLINE typename HermitianMatrix<MT,SO,true>::SIMDType
2794  HermitianMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2795 {
2796  return matrix_.loadu( i, j );
2797 }
2799 //*************************************************************************************************
2800 
2801 
2802 //*************************************************************************************************
2819 template< typename MT // Type of the adapted dense matrix
2820  , bool SO > // Storage order of the adapted dense matrix
2821 inline void
2822  HermitianMatrix<MT,SO,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2823 {
2824  matrix_.store( i, j, value );
2825 
2826  if( SO ) {
2827  const size_t kend( min( i+SIMDSIZE, rows() ) );
2828  for( size_t k=i; k<kend; ++k )
2829  matrix_(j,k) = conj( matrix_(k,j) );
2830  }
2831  else {
2832  const size_t kend( min( j+SIMDSIZE, columns() ) );
2833  for( size_t k=j; k<kend; ++k )
2834  matrix_(k,i) = conj( matrix_(i,k) );
2835  }
2836 }
2838 //*************************************************************************************************
2839 
2840 
2841 //*************************************************************************************************
2858 template< typename MT // Type of the adapted dense matrix
2859  , bool SO > // Storage order of the adapted dense matrix
2860 inline void
2861  HermitianMatrix<MT,SO,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2862 {
2863  matrix_.storea( i, j, value );
2864 
2865  if( SO ) {
2866  const size_t kend( min( i+SIMDSIZE, rows() ) );
2867  for( size_t k=i; k<kend; ++k )
2868  matrix_(j,k) = conj( matrix_(k,j) );
2869  }
2870  else {
2871  const size_t kend( min( j+SIMDSIZE, columns() ) );
2872  for( size_t k=j; k<kend; ++k )
2873  matrix_(k,i) = conj( matrix_(i,k) );
2874  }
2875 }
2877 //*************************************************************************************************
2878 
2879 
2880 //*************************************************************************************************
2897 template< typename MT // Type of the adapted dense matrix
2898  , bool SO > // Storage order of the adapted dense matrix
2899 inline void
2900  HermitianMatrix<MT,SO,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2901 {
2902  matrix_.storeu( i, j, value );
2903 
2904  if( SO ) {
2905  const size_t kend( min( i+SIMDSIZE, rows() ) );
2906  for( size_t k=i; k<kend; ++k )
2907  matrix_(j,k) = conj( matrix_(k,j) );
2908  }
2909  else {
2910  const size_t kend( min( j+SIMDSIZE, columns() ) );
2911  for( size_t k=j; k<kend; ++k )
2912  matrix_(k,i) = conj( matrix_(i,k) );
2913  }
2914 }
2916 //*************************************************************************************************
2917 
2918 
2919 //*************************************************************************************************
2936 template< typename MT // Type of the adapted dense matrix
2937  , bool SO > // Storage order of the adapted dense matrix
2938 inline void
2939  HermitianMatrix<MT,SO,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2940 {
2941  matrix_.stream( i, j, value );
2942 
2943  if( SO ) {
2944  const size_t kend( min( i+SIMDSIZE, rows() ) );
2945  for( size_t k=i; k<kend; ++k )
2946  matrix_(j,k) = conj( matrix_(k,j) );
2947  }
2948  else {
2949  const size_t kend( min( j+SIMDSIZE, columns() ) );
2950  for( size_t k=j; k<kend; ++k )
2951  matrix_(k,i) = conj( matrix_(i,k) );
2952  }
2953 }
2955 //*************************************************************************************************
2956 
2957 
2958 
2959 
2960 //=================================================================================================
2961 //
2962 // CONSTRUCTION FUNCTIONS
2963 //
2964 //=================================================================================================
2965 
2966 //*************************************************************************************************
2968 template< typename MT // Type of the adapted dense matrix
2969  , bool SO > // Storage order of the adapted dense matrix
2970 template< typename MT2 // Type of the foreign matrix
2971  , bool SO2 // Storage order of the foreign matrix
2972  , typename T > // Type of the third argument
2973 inline const MT2& HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2974 {
2975  return ~m;
2976 }
2978 //*************************************************************************************************
2979 
2980 
2981 //*************************************************************************************************
2983 template< typename MT // Type of the adapted dense matrix
2984  , bool SO > // Storage order of the adapted dense matrix
2985 template< typename MT2 > // Type of the foreign matrix
2986 inline TransExprTrait_<MT2>
2987  HermitianMatrix<MT,SO,true>::construct( const Matrix<MT2,!SO>& m, TrueType )
2988 {
2989  return trans( ~m );
2990 }
2992 //*************************************************************************************************
2993 
2994 } // namespace blaze
2995 
2996 #endif
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
const DMatForEachExpr< MT, Conj, SO > conj(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the complex conjugate of each single element of dm.
Definition: DMatForEachExpr.h:1158
Header file for auxiliary alias declarations.
Constraint on the data type.
Header file for mathematical functions.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
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:404
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
#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
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
Header file for the dense matrix inversion flags.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2643
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5077
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:590
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
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:442
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:384
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
STL namespace.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2639
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:298
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:232
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
Constraint on the data type.
constexpr bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:143
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5148
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5131
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Header file for the implementation of the base template of the HeritianMatrix.
Header file for all forward declarations for expression class templates.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for all restructuring column functions.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:258
Header file for the TransExprTrait class template.
Constraint on the data type.
Constraint on the data type.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2637
bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:328
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
bool isHermitian(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is Hermitian.
Definition: DenseMatrix.h:759
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
Header file for the HermitianProxy class.
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
Header file for the IsComplex type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:167
Header file for the IsHermitian type trait.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:609
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
Header file for the TrueType type/value trait base class.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:564