DenseNumeric.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
58 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Clear.h>
66 #include <blaze/math/SIMD.h>
71 #include <blaze/math/views/Check.h>
73 #include <blaze/math/views/Row.h>
75 #include <blaze/system/Inline.h>
77 #include <blaze/util/Assert.h>
83 #include <blaze/util/DisableIf.h>
84 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/Types.h>
90 #include <blaze/util/Unused.h>
91 
92 
93 namespace blaze {
94 
95 //=================================================================================================
96 //
97 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NUMERIC ELEMENT TYPE
98 //
99 //=================================================================================================
100 
101 //*************************************************************************************************
109 template< typename MT // Type of the adapted dense matrix
110  , bool SO > // Storage order of the adapted dense matrix
111 class SymmetricMatrix<MT,SO,true,true>
112  : public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
113 {
114  private:
115  //**Type definitions****************************************************************************
116  using OT = OppositeType_<MT>;
117  using TT = TransposeType_<MT>;
118  using ET = ElementType_<MT>;
119  //**********************************************************************************************
120 
121  public:
122  //**Type definitions****************************************************************************
123  using This = SymmetricMatrix<MT,SO,true,true>;
124  using BaseType = DenseMatrix<This,SO>;
125  using ResultType = This;
126  using OppositeType = SymmetricMatrix<OT,!SO,true,true>;
127  using TransposeType = SymmetricMatrix<TT,!SO,true,true>;
128  using ElementType = ET;
129  using SIMDType = SIMDType_<MT>;
130  using ReturnType = ReturnType_<MT>;
131  using CompositeType = const This&;
132  using Reference = NumericProxy<MT>;
133  using ConstReference = ConstReference_<MT>;
134  using Pointer = Pointer_<MT>;
135  using ConstPointer = ConstPointer_<MT>;
136  using ConstIterator = ConstIterator_<MT>;
137  //**********************************************************************************************
138 
139  //**Rebind struct definition********************************************************************
142  template< typename NewType > // Data type of the other matrix
143  struct Rebind {
145  using Other = SymmetricMatrix< typename MT::template Rebind<NewType>::Other >;
146  };
147  //**********************************************************************************************
148 
149  //**Resize struct definition********************************************************************
152  template< size_t NewM // Number of rows of the other matrix
153  , size_t NewN > // Number of columns of the other matrix
154  struct Resize {
156  using Other = SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other >;
157  };
158  //**********************************************************************************************
159 
160  //**Iterator class definition*******************************************************************
163  class Iterator
164  {
165  public:
166  //**Type definitions*************************************************************************
167  using IteratorCategory = std::random_access_iterator_tag;
168  using ValueType = ElementType_<MT>;
169  using PointerType = NumericProxy<MT>;
170  using ReferenceType = NumericProxy<MT>;
171  using DifferenceType = ptrdiff_t;
172 
173  // STL iterator requirements
174  using iterator_category = IteratorCategory;
175  using value_type = ValueType;
176  using pointer = PointerType;
177  using reference = ReferenceType;
178  using difference_type = DifferenceType;
179  //*******************************************************************************************
180 
181  //**Constructor******************************************************************************
184  inline Iterator() noexcept
185  : matrix_( nullptr ) // Reference to the adapted dense matrix
186  , row_ ( 0UL ) // The current row index of the iterator
187  , column_( 0UL ) // The current column index of the iterator
188  {}
189  //*******************************************************************************************
190 
191  //**Constructor******************************************************************************
198  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
199  : matrix_( &matrix ) // Reference to the adapted dense matrix
200  , row_ ( row ) // The current row index of the iterator
201  , column_( column ) // The current column index of the iterator
202  {}
203  //*******************************************************************************************
204 
205  //**Addition assignment operator*************************************************************
211  inline Iterator& operator+=( size_t inc ) noexcept {
212  ( SO )?( row_ += inc ):( column_ += inc );
213  return *this;
214  }
215  //*******************************************************************************************
216 
217  //**Subtraction assignment operator**********************************************************
223  inline Iterator& operator-=( size_t dec ) noexcept {
224  ( SO )?( row_ -= dec ):( column_ -= dec );
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Prefix increment operator****************************************************************
234  inline Iterator& operator++() noexcept {
235  ( SO )?( ++row_ ):( ++column_ );
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Postfix increment operator***************************************************************
245  inline const Iterator operator++( int ) noexcept {
246  const Iterator tmp( *this );
247  ++(*this);
248  return tmp;
249  }
250  //*******************************************************************************************
251 
252  //**Prefix decrement operator****************************************************************
257  inline Iterator& operator--() noexcept {
258  ( SO )?( --row_ ):( --column_ );
259  return *this;
260  }
261  //*******************************************************************************************
262 
263  //**Postfix decrement operator***************************************************************
268  inline const Iterator operator--( int ) noexcept {
269  const Iterator tmp( *this );
270  --(*this);
271  return tmp;
272  }
273  //*******************************************************************************************
274 
275  //**Element access operator******************************************************************
280  inline ReferenceType operator*() const {
281  return ReferenceType( *matrix_, row_, column_ );
282  }
283  //*******************************************************************************************
284 
285  //**Element access operator******************************************************************
290  inline PointerType operator->() const {
291  return PointerType( *matrix_, row_, column_ );
292  }
293  //*******************************************************************************************
294 
295  //**Load function****************************************************************************
305  inline SIMDType load() const {
306  return (*matrix_).load(row_,column_);
307  }
308  //*******************************************************************************************
309 
310  //**Loada function***************************************************************************
320  inline SIMDType loada() const {
321  return (*matrix_).loada(row_,column_);
322  }
323  //*******************************************************************************************
324 
325  //**Loadu function***************************************************************************
335  inline SIMDType loadu() const {
336  return (*matrix_).loadu(row_,column_);
337  }
338  //*******************************************************************************************
339 
340  //**Store function***************************************************************************
351  inline void store( const SIMDType& value ) const {
352  (*matrix_).store( row_, column_, value );
353  sync();
354  }
355  //*******************************************************************************************
356 
357  //**Storea function**************************************************************************
368  inline void storea( const SIMDType& value ) const {
369  (*matrix_).storea( row_, column_, value );
370  sync();
371  }
372  //*******************************************************************************************
373 
374  //**Storeu function**************************************************************************
385  inline void storeu( const SIMDType& value ) const {
386  (*matrix_).storeu( row_, column_, value );
387  sync();
388  }
389  //*******************************************************************************************
390 
391  //**Stream function**************************************************************************
402  inline void stream( const SIMDType& value ) const {
403  (*matrix_).stream( row_, column_, value );
404  sync();
405  }
406  //*******************************************************************************************
407 
408  //**Conversion operator**********************************************************************
413  inline operator ConstIterator() const {
414  if( SO )
415  return matrix_->begin( column_ ) + row_;
416  else
417  return matrix_->begin( row_ ) + column_;
418  }
419  //*******************************************************************************************
420 
421  //**Equality operator************************************************************************
428  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
429  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
430  }
431  //*******************************************************************************************
432 
433  //**Equality operator************************************************************************
440  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
441  return ( ConstIterator( lhs ) == rhs );
442  }
443  //*******************************************************************************************
444 
445  //**Equality operator************************************************************************
452  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
453  return ( lhs == ConstIterator( rhs ) );
454  }
455  //*******************************************************************************************
456 
457  //**Inequality operator**********************************************************************
464  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
465  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
466  }
467  //*******************************************************************************************
468 
469  //**Inequality operator**********************************************************************
476  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
477  return ( ConstIterator( lhs ) != rhs );
478  }
479  //*******************************************************************************************
480 
481  //**Inequality operator**********************************************************************
488  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
489  return ( lhs != ConstIterator( rhs ) );
490  }
491  //*******************************************************************************************
492 
493  //**Less-than operator***********************************************************************
500  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
501  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
502  }
503  //*******************************************************************************************
504 
505  //**Less-than operator***********************************************************************
512  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
513  return ( ConstIterator( lhs ) < rhs );
514  }
515  //*******************************************************************************************
516 
517  //**Less-than operator***********************************************************************
524  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
525  return ( lhs < ConstIterator( rhs ) );
526  }
527  //*******************************************************************************************
528 
529  //**Greater-than operator********************************************************************
536  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
537  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
538  }
539  //*******************************************************************************************
540 
541  //**Greater-than operator********************************************************************
548  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
549  return ( ConstIterator( lhs ) > rhs );
550  }
551  //*******************************************************************************************
552 
553  //**Greater-than operator********************************************************************
560  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
561  return ( lhs > ConstIterator( rhs ) );
562  }
563  //*******************************************************************************************
564 
565  //**Less-or-equal-than operator**************************************************************
572  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
573  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
574  }
575  //*******************************************************************************************
576 
577  //**Less-or-equal-than operator**************************************************************
584  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
585  return ( ConstIterator( lhs ) <= rhs );
586  }
587  //*******************************************************************************************
588 
589  //**Less-or-equal-than operator**************************************************************
596  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
597  return ( lhs <= ConstIterator( rhs ) );
598  }
599  //*******************************************************************************************
600 
601  //**Greater-or-equal-than operator***********************************************************
608  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
609  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
610  }
611  //*******************************************************************************************
612 
613  //**Greater-or-equal-than operator***********************************************************
620  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
621  return ( ConstIterator( lhs ) >= rhs );
622  }
623  //*******************************************************************************************
624 
625  //**Greater-or-equal-than operator***********************************************************
632  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
633  return ( lhs >= ConstIterator( rhs ) );
634  }
635  //*******************************************************************************************
636 
637  //**Subtraction operator*********************************************************************
643  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
644  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
645  }
646  //*******************************************************************************************
647 
648  //**Addition operator************************************************************************
655  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
656  if( SO )
657  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
658  else
659  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
660  }
661  //*******************************************************************************************
662 
663  //**Addition operator************************************************************************
670  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
671  if( SO )
672  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
673  else
674  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
675  }
676  //*******************************************************************************************
677 
678  //**Subtraction operator*********************************************************************
685  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
686  if( SO )
687  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
688  else
689  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
690  }
691  //*******************************************************************************************
692 
693  private:
694  //**Sync function****************************************************************************
699  void sync() const {
700  if( SO ) {
701  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
702  for( size_t k=row_; k<kend; ++k )
703  (*matrix_)(column_,k) = (*matrix_)(k,column_);
704  }
705  else {
706  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
707  for( size_t k=column_; k<kend; ++k )
708  (*matrix_)(k,row_) = (*matrix_)(row_,k);
709  }
710  }
711  //*******************************************************************************************
712 
713  //**Member variables*************************************************************************
714  MT* matrix_;
715  size_t row_;
716  size_t column_;
717  //*******************************************************************************************
718  };
719  //**********************************************************************************************
720 
721  //**Compilation flags***************************************************************************
723  enum : bool { simdEnabled = MT::simdEnabled };
724 
726  enum : bool { smpAssignable = MT::smpAssignable };
727  //**********************************************************************************************
728 
729  //**Constructors********************************************************************************
732  explicit inline SymmetricMatrix();
733  explicit inline SymmetricMatrix( size_t n );
734  explicit inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
735 
736  template< typename Other >
737  explicit inline SymmetricMatrix( size_t n, const Other* array );
738 
739  template< typename Other, size_t N >
740  explicit inline SymmetricMatrix( const Other (&array)[N][N] );
741 
742  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
743  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
744 
745  inline SymmetricMatrix( const SymmetricMatrix& m );
746  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
747 
748  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
749  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
751  //**********************************************************************************************
752 
753  //**Destructor**********************************************************************************
754  // No explicitly declared destructor.
755  //**********************************************************************************************
756 
757  //**Data access functions***********************************************************************
760  inline Reference operator()( size_t i, size_t j );
761  inline ConstReference operator()( size_t i, size_t j ) const;
762  inline Reference at( size_t i, size_t j );
763  inline ConstReference at( size_t i, size_t j ) const;
764  inline ConstPointer data () const noexcept;
765  inline ConstPointer data ( size_t i ) const noexcept;
766  inline Iterator begin ( size_t i );
767  inline ConstIterator begin ( size_t i ) const;
768  inline ConstIterator cbegin( size_t i ) const;
769  inline Iterator end ( size_t i );
770  inline ConstIterator end ( size_t i ) const;
771  inline ConstIterator cend ( size_t i ) const;
773  //**********************************************************************************************
774 
775  //**Assignment operators************************************************************************
778  inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
779 
780  template< typename Other, size_t N >
781  inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
782 
783  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
784  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
785 
786  template< typename MT2 >
787  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
788 
789  template< typename MT2 >
790  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
791 
792  template< typename MT2 >
793  inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
794 
795  template< typename MT2 >
796  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
797 
798  template< typename MT2 >
799  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
800 
801  template< typename MT2 >
802  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
803 
804  template< typename MT2 >
805  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
806 
807  template< typename MT2 >
808  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
809 
810  template< typename MT2 >
811  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
812 
813  template< typename MT2 >
814  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator%=( const Matrix<MT2,SO>& rhs );
815 
816  template< typename MT2 >
817  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator%=( const Matrix<MT2,SO>& rhs );
818 
819  template< typename MT2 >
820  inline SymmetricMatrix& operator%=( const Matrix<MT2,!SO>& rhs );
821 
822  template< typename ST >
823  inline EnableIf_< IsNumeric<ST>, SymmetricMatrix >& operator*=( ST rhs );
824 
825  template< typename ST >
826  inline EnableIf_< IsNumeric<ST>, SymmetricMatrix >& operator/=( ST rhs );
828  //**********************************************************************************************
829 
830  //**Utility functions***************************************************************************
833  inline size_t rows() const noexcept;
834  inline size_t columns() const noexcept;
835  inline size_t spacing() const noexcept;
836  inline size_t capacity() const noexcept;
837  inline size_t capacity( size_t i ) const noexcept;
838  inline size_t nonZeros() const;
839  inline size_t nonZeros( size_t i ) const;
840  inline void reset();
841  inline void reset( size_t i );
842  inline void clear();
843  void resize ( size_t n, bool preserve=true );
844  inline void extend ( size_t n, bool preserve=true );
845  inline void reserve( size_t elements );
846  inline void shrinkToFit();
847  inline void swap( SymmetricMatrix& m ) noexcept;
849  //**********************************************************************************************
850 
851  //**Numeric functions***************************************************************************
854  inline SymmetricMatrix& transpose();
855  inline SymmetricMatrix& ctranspose();
856 
857  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
859  //**********************************************************************************************
860 
861  //**Debugging functions*************************************************************************
864  inline bool isIntact() const noexcept;
866  //**********************************************************************************************
867 
868  //**Expression template evaluation functions****************************************************
871  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
872  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
873 
874  inline bool isAligned () const noexcept;
875  inline bool canSMPAssign() const noexcept;
876 
877  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
878  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
879  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
880 
881  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
882  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
883  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
884  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
886  //**********************************************************************************************
887 
888  private:
889  //**SIMD properties*****************************************************************************
891  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
892  //**********************************************************************************************
893 
894  //**Member variables****************************************************************************
897  MT matrix_;
898 
899  //**********************************************************************************************
900 
901  //**Friend declarations*************************************************************************
902  template< bool RF, typename MT2, bool SO2, bool DF2, bool NF2 >
903  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
904 
905  template< InversionFlag IF, typename MT2, bool SO2 >
906  friend void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
907  //**********************************************************************************************
908 
909  //**Compile time checks*************************************************************************
923  BLAZE_STATIC_ASSERT( ( Size<MT,0UL>::value == Size<MT,1UL>::value ) );
924  //**********************************************************************************************
925 };
927 //*************************************************************************************************
928 
929 
930 
931 
932 //=================================================================================================
933 //
934 // CONSTRUCTORS
935 //
936 //=================================================================================================
937 
938 //*************************************************************************************************
942 template< typename MT // Type of the adapted dense matrix
943  , bool SO > // Storage order of the adapted dense matrix
944 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
945  : matrix_() // The adapted dense matrix
946 {
947  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
948  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
949 }
951 //*************************************************************************************************
952 
953 
954 //*************************************************************************************************
960 template< typename MT // Type of the adapted dense matrix
961  , bool SO > // Storage order of the adapted dense matrix
962 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n )
963  : matrix_( n, n, ElementType() ) // The adapted dense matrix
964 {
966 
967  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
968  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
969 }
971 //*************************************************************************************************
972 
973 
974 //*************************************************************************************************
998 template< typename MT // Type of the adapted dense matrix
999  , bool SO > // Storage order of the adapted dense matrix
1000 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
1001  : matrix_( list ) // The adapted dense matrix
1002 {
1003  if( !isSymmetric( matrix_ ) ) {
1004  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1005  }
1006 
1007  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1008 }
1010 //*************************************************************************************************
1011 
1012 
1013 //*************************************************************************************************
1039 template< typename MT // Type of the adapted dense matrix
1040  , bool SO > // Storage order of the adapted dense matrix
1041 template< typename Other > // Data type of the initialization array
1042 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n, const Other* array )
1043  : matrix_( n, n, array ) // The adapted dense matrix
1044 {
1045  if( !isSymmetric( matrix_ ) ) {
1046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1047  }
1048 
1049  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1050 }
1052 //*************************************************************************************************
1053 
1054 
1055 //*************************************************************************************************
1078 template< typename MT // Type of the adapted dense matrix
1079  , bool SO > // Storage order of the adapted dense matrix
1080 template< typename Other // Data type of the initialization array
1081  , size_t N > // Number of rows and columns of the initialization array
1082 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Other (&array)[N][N] )
1083  : matrix_( array ) // The adapted dense matrix
1084 {
1085  if( !isSymmetric( matrix_ ) ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1087  }
1088 
1089  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1090 }
1092 //*************************************************************************************************
1093 
1094 
1095 //*************************************************************************************************
1127 template< typename MT // Type of the adapted dense matrix
1128  , bool SO > // Storage order of the adapted dense matrix
1129 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n )
1130  : matrix_( ptr, n, n ) // The adapted dense matrix
1131 {
1132  if( !isSymmetric( matrix_ ) ) {
1133  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1134  }
1135 
1136  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1137 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1176 template< typename MT // Type of the adapted dense matrix
1177  , bool SO > // Storage order of the adapted dense matrix
1178 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
1179  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1180 {
1181  if( !isSymmetric( matrix_ ) ) {
1182  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1183  }
1184 
1185  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1186 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1197 template< typename MT // Type of the adapted dense matrix
1198  , bool SO > // Storage order of the adapted dense matrix
1199 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
1200  : matrix_( m.matrix_ ) // The adapted dense matrix
1201 {
1202  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1203  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1204 }
1206 //*************************************************************************************************
1207 
1208 
1209 //*************************************************************************************************
1215 template< typename MT // Type of the adapted dense matrix
1216  , bool SO > // Storage order of the adapted dense matrix
1217 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
1218  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1219 {
1220  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1221  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1222 }
1224 //*************************************************************************************************
1225 
1226 
1227 //*************************************************************************************************
1237 template< typename MT // Type of the adapted dense matrix
1238  , bool SO > // Storage order of the adapted dense matrix
1239 template< typename MT2 > // Type of the foreign matrix
1240 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
1241  : matrix_( ~m ) // The adapted dense matrix
1242 {
1243  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1244  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1245  }
1246 
1247  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1248  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1249 }
1251 //*************************************************************************************************
1252 
1253 
1254 //*************************************************************************************************
1264 template< typename MT // Type of the adapted dense matrix
1265  , bool SO > // Storage order of the adapted dense matrix
1266 template< typename MT2 > // Type of the foreign matrix
1267 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
1268  : matrix_( trans( ~m ) ) // The adapted dense matrix
1269 {
1270  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1271  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1272  }
1273 
1274  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1275  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1276 }
1278 //*************************************************************************************************
1279 
1280 
1281 
1282 
1283 //=================================================================================================
1284 //
1285 // DATA ACCESS FUNCTIONS
1286 //
1287 //=================================================================================================
1288 
1289 //*************************************************************************************************
1304 template< typename MT // Type of the adapted dense matrix
1305  , bool SO > // Storage order of the adapted dense matrix
1307  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
1308 {
1309  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1310  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1311 
1312  return Reference( matrix_, i, j );
1313 }
1315 //*************************************************************************************************
1316 
1317 
1318 //*************************************************************************************************
1333 template< typename MT // Type of the adapted dense matrix
1334  , bool SO > // Storage order of the adapted dense matrix
1336  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
1337 {
1338  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1339  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1340 
1341  return matrix_(i,j);
1342 }
1344 //*************************************************************************************************
1345 
1346 
1347 //*************************************************************************************************
1363 template< typename MT // Type of the adapted dense matrix
1364  , bool SO > // Storage order of the adapted dense matrix
1366  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j )
1367 {
1368  if( i >= rows() ) {
1369  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1370  }
1371  if( j >= columns() ) {
1372  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1373  }
1374  return (*this)(i,j);
1375 }
1377 //*************************************************************************************************
1378 
1379 
1380 //*************************************************************************************************
1396 template< typename MT // Type of the adapted dense matrix
1397  , bool SO > // Storage order of the adapted dense matrix
1399  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j ) const
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 //*************************************************************************************************
1427 template< typename MT // Type of the adapted dense matrix
1428  , bool SO > // Storage order of the adapted dense matrix
1429 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1431 {
1432  return matrix_.data();
1433 }
1435 //*************************************************************************************************
1436 
1437 
1438 //*************************************************************************************************
1449 template< typename MT // Type of the adapted dense matrix
1450  , bool SO > // Storage order of the adapted dense matrix
1451 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1452  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const noexcept
1453 {
1454  return matrix_.data(i);
1455 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1472 template< typename MT // Type of the adapted dense matrix
1473  , bool SO > // Storage order of the adapted dense matrix
1476 {
1477  if( SO )
1478  return Iterator( matrix_, 0UL, i );
1479  else
1480  return Iterator( matrix_, i, 0UL );
1481 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1498 template< typename MT // Type of the adapted dense matrix
1499  , bool SO > // Storage order of the adapted dense matrix
1501  SymmetricMatrix<MT,SO,true,true>::begin( size_t i ) const
1502 {
1503  return matrix_.begin(i);
1504 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1521 template< typename MT // Type of the adapted dense matrix
1522  , bool SO > // Storage order of the adapted dense matrix
1525 {
1526  return matrix_.cbegin(i);
1527 }
1529 //*************************************************************************************************
1530 
1531 
1532 //*************************************************************************************************
1544 template< typename MT // Type of the adapted dense matrix
1545  , bool SO > // Storage order of the adapted dense matrix
1548 {
1549  if( SO )
1550  return Iterator( matrix_, rows(), i );
1551  else
1552  return Iterator( matrix_, i, columns() );
1553 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1570 template< typename MT // Type of the adapted dense matrix
1571  , bool SO > // Storage order of the adapted dense matrix
1573  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1574 {
1575  return matrix_.end(i);
1576 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1593 template< typename MT // Type of the adapted dense matrix
1594  , bool SO > // Storage order of the adapted dense matrix
1596  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1597 {
1598  return matrix_.cend(i);
1599 }
1601 //*************************************************************************************************
1602 
1603 
1604 
1605 
1606 //=================================================================================================
1607 //
1608 // ASSIGNMENT OPERATORS
1609 //
1610 //=================================================================================================
1611 
1612 //*************************************************************************************************
1637 template< typename MT // Type of the adapted dense matrix
1638  , bool SO > // Storage order of the adapted dense matrix
1639 inline SymmetricMatrix<MT,SO,true,true>&
1640  SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1641 {
1642  const InitializerMatrix<ElementType> tmp( list, list.size() );
1643 
1644  if( !isSymmetric( tmp ) ) {
1645  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1646  }
1647 
1648  matrix_ = list;
1649 
1650  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1651  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1652 
1653  return *this;
1654 }
1656 //*************************************************************************************************
1657 
1658 
1659 //*************************************************************************************************
1683 template< typename MT // Type of the adapted dense matrix
1684  , bool SO > // Storage order of the adapted dense matrix
1685 template< typename Other // Data type of the initialization array
1686  , size_t N > // Number of rows and columns of the initialization array
1687 inline SymmetricMatrix<MT,SO,true,true>&
1688  SymmetricMatrix<MT,SO,true,true>::operator=( const Other (&array)[N][N] )
1689 {
1690  MT tmp( array );
1691 
1692  if( !isSymmetric( tmp ) ) {
1693  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1694  }
1695 
1696  matrix_ = std::move( tmp );
1697 
1698  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1699  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1700 
1701  return *this;
1702 }
1704 //*************************************************************************************************
1705 
1706 
1707 //*************************************************************************************************
1717 template< typename MT // Type of the adapted dense matrix
1718  , bool SO > // Storage order of the adapted dense matrix
1719 inline SymmetricMatrix<MT,SO,true,true>&
1720  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1721 {
1722  matrix_ = rhs.matrix_;
1723 
1724  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1725  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1726 
1727  return *this;
1728 }
1730 //*************************************************************************************************
1731 
1732 
1733 //*************************************************************************************************
1740 template< typename MT // Type of the adapted dense matrix
1741  , bool SO > // Storage order of the adapted dense matrix
1742 inline SymmetricMatrix<MT,SO,true,true>&
1743  SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1744 {
1745  matrix_ = std::move( rhs.matrix_ );
1746 
1747  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1748  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1749 
1750  return *this;
1751 }
1753 //*************************************************************************************************
1754 
1755 
1756 //*************************************************************************************************
1769 template< typename MT // Type of the adapted dense matrix
1770  , bool SO > // Storage order of the adapted dense matrix
1771 template< typename MT2 > // Type of the right-hand side matrix
1772 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1773  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1774 {
1775  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1776  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1777  }
1778 
1779  matrix_ = ~rhs;
1780 
1781  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1782  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1783 
1784  return *this;
1785 }
1787 //*************************************************************************************************
1788 
1789 
1790 //*************************************************************************************************
1803 template< typename MT // Type of the adapted dense matrix
1804  , bool SO > // Storage order of the adapted dense matrix
1805 template< typename MT2 > // Type of the right-hand side matrix
1806 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1807  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1808 {
1809  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1810  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1811  }
1812 
1813  if( IsSymmetric<MT2>::value ) {
1814  matrix_ = ~rhs;
1815  }
1816  else {
1817  MT tmp( ~rhs );
1818 
1819  if( !isSymmetric( tmp ) ) {
1820  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1821  }
1822 
1823  matrix_ = std::move( tmp );
1824  }
1825 
1826  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1827  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1828 
1829  return *this;
1830 }
1832 //*************************************************************************************************
1833 
1834 
1835 //*************************************************************************************************
1848 template< typename MT // Type of the adapted dense matrix
1849  , bool SO > // Storage order of the adapted dense matrix
1850 template< typename MT2 > // Type of the right-hand side matrix
1851 inline SymmetricMatrix<MT,SO,true,true>&
1852  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1853 {
1854  return this->operator=( trans( ~rhs ) );
1855 }
1857 //*************************************************************************************************
1858 
1859 
1860 //*************************************************************************************************
1873 template< typename MT // Type of the adapted dense matrix
1874  , bool SO > // Storage order of the adapted dense matrix
1875 template< typename MT2 > // Type of the right-hand side matrix
1876 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1877  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1878 {
1879  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1880  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1881  }
1882 
1883  matrix_ += ~rhs;
1884 
1885  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1886  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1887 
1888  return *this;
1889 }
1891 //*************************************************************************************************
1892 
1893 
1894 //*************************************************************************************************
1907 template< typename MT // Type of the adapted dense matrix
1908  , bool SO > // Storage order of the adapted dense matrix
1909 template< typename MT2 > // Type of the right-hand side matrix
1910 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1911  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1912 {
1913  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1914  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1915  }
1916 
1917  if( IsSymmetric<MT2>::value ) {
1918  matrix_ += ~rhs;
1919  }
1920  else {
1921  const ResultType_<MT2> tmp( ~rhs );
1922 
1923  if( !isSymmetric( tmp ) ) {
1924  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1925  }
1926 
1927  matrix_ += tmp;
1928  }
1929 
1930  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1931  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1932 
1933  return *this;
1934 }
1936 //*************************************************************************************************
1937 
1938 
1939 //*************************************************************************************************
1953 template< typename MT // Type of the adapted dense matrix
1954  , bool SO > // Storage order of the adapted dense matrix
1955 template< typename MT2 > // Type of the right-hand side matrix
1956 inline SymmetricMatrix<MT,SO,true,true>&
1957  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1958 {
1959  return this->operator+=( trans( ~rhs ) );
1960 }
1962 //*************************************************************************************************
1963 
1964 
1965 //*************************************************************************************************
1978 template< typename MT // Type of the adapted dense matrix
1979  , bool SO > // Storage order of the adapted dense matrix
1980 template< typename MT2 > // Type of the right-hand side matrix
1981 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1982  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
1983 {
1984  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1985  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1986  }
1987 
1988  matrix_ -= ~rhs;
1989 
1990  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1991  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1992 
1993  return *this;
1994 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2012 template< typename MT // Type of the adapted dense matrix
2013  , bool SO > // Storage order of the adapted dense matrix
2014 template< typename MT2 > // Type of the right-hand side matrix
2015 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2016  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2017 {
2018  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2019  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2020  }
2021 
2022  if( IsSymmetric<MT2>::value ) {
2023  matrix_ -= ~rhs;
2024  }
2025  else {
2026  const ResultType_<MT2> tmp( ~rhs );
2027 
2028  if( !isSymmetric( tmp ) ) {
2029  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2030  }
2031 
2032  matrix_ -= tmp;
2033  }
2034 
2035  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2036  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2037 
2038  return *this;
2039 }
2041 //*************************************************************************************************
2042 
2043 
2044 //*************************************************************************************************
2058 template< typename MT // Type of the adapted dense matrix
2059  , bool SO > // Storage order of the adapted dense matrix
2060 template< typename MT2 > // Type of the right-hand side matrix
2061 inline SymmetricMatrix<MT,SO,true,true>&
2062  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2063 {
2064  return this->operator-=( trans( ~rhs ) );
2065 }
2067 //*************************************************************************************************
2068 
2069 
2070 //*************************************************************************************************
2084 template< typename MT // Type of the adapted dense matrix
2085  , bool SO > // Storage order of the adapted dense matrix
2086 template< typename MT2 > // Type of the right-hand side matrix
2087 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2088  SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2089 {
2090  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
2091  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2092  }
2093 
2094  matrix_ %= ~rhs;
2095 
2096  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2097  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2098 
2099  return *this;
2100 }
2102 //*************************************************************************************************
2103 
2104 
2105 //*************************************************************************************************
2119 template< typename MT // Type of the adapted dense matrix
2120  , bool SO > // Storage order of the adapted dense matrix
2121 template< typename MT2 > // Type of the right-hand side matrix
2122 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2123  SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2124 {
2125  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2126  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2127  }
2128 
2129  if( IsSymmetric<MT2>::value ) {
2130  matrix_ %= ~rhs;
2131  }
2132  else {
2133  const ResultType_<MT2> tmp( ~rhs );
2134 
2135  if( !isSymmetric( tmp ) ) {
2136  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2137  }
2138 
2139  matrix_ %= tmp;
2140  }
2141 
2142  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2143  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2144 
2145  return *this;
2146 }
2148 //*************************************************************************************************
2149 
2150 
2151 //*************************************************************************************************
2165 template< typename MT // Type of the adapted dense matrix
2166  , bool SO > // Storage order of the adapted dense matrix
2167 template< typename MT2 > // Type of the right-hand side matrix
2168 inline SymmetricMatrix<MT,SO,true,true>&
2169  SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2170 {
2171  return this->operator%=( trans( ~rhs ) );
2172 }
2174 //*************************************************************************************************
2175 
2176 
2177 //*************************************************************************************************
2185 template< typename MT // Type of the adapted dense matrix
2186  , bool SO > // Storage order of the adapted dense matrix
2187 template< typename ST > // Data type of the right-hand side scalar
2188 inline EnableIf_< IsNumeric<ST>, SymmetricMatrix<MT,SO,true,true> >&
2190 {
2191  matrix_ *= rhs;
2192  return *this;
2193 }
2194 //*************************************************************************************************
2195 
2196 
2197 //*************************************************************************************************
2205 template< typename MT // Type of the adapted dense matrix
2206  , bool SO > // Storage order of the adapted dense matrix
2207 template< typename ST > // Data type of the right-hand side scalar
2208 inline EnableIf_< IsNumeric<ST>, SymmetricMatrix<MT,SO,true,true> >&
2210 {
2211  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2212 
2213  matrix_ /= rhs;
2214  return *this;
2215 }
2217 //*************************************************************************************************
2218 
2219 
2220 
2221 
2222 //=================================================================================================
2223 //
2224 // UTILITY FUNCTIONS
2225 //
2226 //=================================================================================================
2227 
2228 //*************************************************************************************************
2234 template< typename MT // Type of the adapted dense matrix
2235  , bool SO > // Storage order of the adapted dense matrix
2236 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const noexcept
2237 {
2238  return matrix_.rows();
2239 }
2241 //*************************************************************************************************
2242 
2243 
2244 //*************************************************************************************************
2250 template< typename MT // Type of the adapted dense matrix
2251  , bool SO > // Storage order of the adapted dense matrix
2252 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const noexcept
2253 {
2254  return matrix_.columns();
2255 }
2257 //*************************************************************************************************
2258 
2259 
2260 //*************************************************************************************************
2272 template< typename MT // Type of the adapted dense matrix
2273  , bool SO > // Storage order of the adapted dense matrix
2274 inline size_t SymmetricMatrix<MT,SO,true,true>::spacing() const noexcept
2275 {
2276  return matrix_.spacing();
2277 }
2279 //*************************************************************************************************
2280 
2281 
2282 //*************************************************************************************************
2288 template< typename MT // Type of the adapted dense matrix
2289  , bool SO > // Storage order of the adapted dense matrix
2290 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const noexcept
2291 {
2292  return matrix_.capacity();
2293 }
2295 //*************************************************************************************************
2296 
2297 
2298 //*************************************************************************************************
2309 template< typename MT // Type of the adapted dense matrix
2310  , bool SO > // Storage order of the adapted dense matrix
2311 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const noexcept
2312 {
2313  return matrix_.capacity(i);
2314 }
2316 //*************************************************************************************************
2317 
2318 
2319 //*************************************************************************************************
2325 template< typename MT // Type of the adapted dense matrix
2326  , bool SO > // Storage order of the adapted dense matrix
2327 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
2328 {
2329  return matrix_.nonZeros();
2330 }
2332 //*************************************************************************************************
2333 
2334 
2335 //*************************************************************************************************
2347 template< typename MT // Type of the adapted dense matrix
2348  , bool SO > // Storage order of the adapted dense matrix
2349 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
2350 {
2351  return matrix_.nonZeros(i);
2352 }
2354 //*************************************************************************************************
2355 
2356 
2357 //*************************************************************************************************
2363 template< typename MT // Type of the adapted dense matrix
2364  , bool SO > // Storage order of the adapted dense matrix
2366 {
2367  matrix_.reset();
2368 }
2370 //*************************************************************************************************
2371 
2372 
2373 //*************************************************************************************************
2409 template< typename MT // Type of the adapted dense matrix
2410  , bool SO > // Storage order of the adapted dense matrix
2411 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
2412 {
2413  row ( matrix_, i, unchecked ).reset();
2414  column( matrix_, i, unchecked ).reset();
2415 }
2417 //*************************************************************************************************
2418 
2419 
2420 //*************************************************************************************************
2432 template< typename MT // Type of the adapted dense matrix
2433  , bool SO > // Storage order of the adapted dense matrix
2435 {
2436  using blaze::clear;
2437 
2438  clear( matrix_ );
2439 }
2441 //*************************************************************************************************
2442 
2443 
2444 //*************************************************************************************************
2479 template< typename MT // Type of the adapted dense matrix
2480  , bool SO > // Storage order of the adapted dense matrix
2481 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
2482 {
2484 
2485  UNUSED_PARAMETER( preserve );
2486 
2487  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2488 
2489  const size_t oldsize( matrix_.rows() );
2490 
2491  matrix_.resize( n, n, true );
2492 
2493  if( n > oldsize ) {
2494  const size_t increment( n - oldsize );
2495  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2496  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2497  }
2498 }
2500 //*************************************************************************************************
2501 
2502 
2503 //*************************************************************************************************
2516 template< typename MT // Type of the adapted dense matrix
2517  , bool SO > // Storage order of the adapted dense matrix
2518 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
2519 {
2521 
2522  UNUSED_PARAMETER( preserve );
2523 
2524  resize( rows() + n, true );
2525 }
2526 //*************************************************************************************************
2527 
2528 
2529 //*************************************************************************************************
2539 template< typename MT // Type of the adapted dense matrix
2540  , bool SO > // Storage order of the adapted dense matrix
2541 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
2542 {
2543  matrix_.reserve( elements );
2544 }
2546 //*************************************************************************************************
2547 
2548 
2549 //*************************************************************************************************
2559 template< typename MT // Type of the adapted dense matrix
2560  , bool SO > // Storage order of the adapted dense matrix
2562 {
2563  matrix_.shrinkToFit();
2564 }
2566 //*************************************************************************************************
2567 
2568 
2569 //*************************************************************************************************
2576 template< typename MT // Type of the adapted dense matrix
2577  , bool SO > // Storage order of the adapted dense matrix
2578 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) noexcept
2579 {
2580  using std::swap;
2581 
2582  swap( matrix_, m.matrix_ );
2583 }
2585 //*************************************************************************************************
2586 
2587 
2588 
2589 
2590 //=================================================================================================
2591 //
2592 // NUMERIC FUNCTIONS
2593 //
2594 //=================================================================================================
2595 
2596 //*************************************************************************************************
2602 template< typename MT // Type of the adapted dense matrix
2603  , bool SO > // Storage order of the adapted dense matrix
2604 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
2605 {
2606  return *this;
2607 }
2609 //*************************************************************************************************
2610 
2611 
2612 //*************************************************************************************************
2618 template< typename MT // Type of the adapted dense matrix
2619  , bool SO > // Storage order of the adapted dense matrix
2620 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::ctranspose()
2621 {
2622  if( !IsBuiltin<ElementType>::value )
2623  conjugate( matrix_ );
2624 
2625  return *this;
2626 }
2628 //*************************************************************************************************
2629 
2630 
2631 //*************************************************************************************************
2649 template< typename MT // Type of the adapted dense matrix
2650  , bool SO > // Storage order of the adapted dense matrix
2651 template< typename Other > // Data type of the scalar value
2652 inline SymmetricMatrix<MT,SO,true,true>&
2653  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
2654 {
2655  matrix_.scale( scalar );
2656  return *this;
2657 }
2659 //*************************************************************************************************
2660 
2661 
2662 
2663 
2664 //=================================================================================================
2665 //
2666 // DEBUGGING FUNCTIONS
2667 //
2668 //=================================================================================================
2669 
2670 //*************************************************************************************************
2680 template< typename MT // Type of the adapted dense matrix
2681  , bool SO > // Storage order of the adapted dense matrix
2682 inline bool SymmetricMatrix<MT,SO,true,true>::isIntact() const noexcept
2683 {
2684  using blaze::isIntact;
2685 
2686  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2687 }
2689 //*************************************************************************************************
2690 
2691 
2692 
2693 
2694 //=================================================================================================
2695 //
2696 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
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 template< typename Other > // Data type of the foreign expression
2714 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const noexcept
2715 {
2716  return matrix_.canAlias( alias );
2717 }
2719 //*************************************************************************************************
2720 
2721 
2722 //*************************************************************************************************
2733 template< typename MT // Type of the adapted dense matrix
2734  , bool SO > // Storage order of the adapted dense matrix
2735 template< typename Other > // Data type of the foreign expression
2736 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const noexcept
2737 {
2738  return matrix_.isAliased( alias );
2739 }
2741 //*************************************************************************************************
2742 
2743 
2744 //*************************************************************************************************
2754 template< typename MT // Type of the adapted dense matrix
2755  , bool SO > // Storage order of the adapted dense matrix
2756 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2757 {
2758  return matrix_.isAligned();
2759 }
2761 //*************************************************************************************************
2762 
2763 
2764 //*************************************************************************************************
2775 template< typename MT // Type of the adapted dense matrix
2776  , bool SO > // Storage order of the adapted dense matrix
2777 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2778 {
2779  return matrix_.canSMPAssign();
2780 }
2782 //*************************************************************************************************
2783 
2784 
2785 //*************************************************************************************************
2801 template< typename MT // Type of the adapted dense matrix
2802  , bool SO > // Storage order of the adapted dense matrix
2803 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2804  SymmetricMatrix<MT,SO,true,true>::load( size_t i, size_t j ) const noexcept
2805 {
2806  return matrix_.load( i, j );
2807 }
2809 //*************************************************************************************************
2810 
2811 
2812 //*************************************************************************************************
2828 template< typename MT // Type of the adapted dense matrix
2829  , bool SO > // Storage order of the adapted dense matrix
2830 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2831  SymmetricMatrix<MT,SO,true,true>::loada( size_t i, size_t j ) const noexcept
2832 {
2833  return matrix_.loada( i, j );
2834 }
2836 //*************************************************************************************************
2837 
2838 
2839 //*************************************************************************************************
2855 template< typename MT // Type of the adapted dense matrix
2856  , bool SO > // Storage order of the adapted dense matrix
2857 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2858  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const noexcept
2859 {
2860  return matrix_.loadu( i, j );
2861 }
2863 //*************************************************************************************************
2864 
2865 
2866 //*************************************************************************************************
2883 template< typename MT // Type of the adapted dense matrix
2884  , bool SO > // Storage order of the adapted dense matrix
2885 inline void
2886  SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2887 {
2888  matrix_.store( i, j, value );
2889 
2890  if( SO ) {
2891  const size_t kend( min( i+SIMDSIZE, rows() ) );
2892  for( size_t k=i; k<kend; ++k )
2893  matrix_(j,k) = matrix_(k,j);
2894  }
2895  else {
2896  const size_t kend( min( j+SIMDSIZE, columns() ) );
2897  for( size_t k=j; k<kend; ++k )
2898  matrix_(k,i) = matrix_(i,k);
2899  }
2900 }
2902 //*************************************************************************************************
2903 
2904 
2905 //*************************************************************************************************
2922 template< typename MT // Type of the adapted dense matrix
2923  , bool SO > // Storage order of the adapted dense matrix
2924 inline void
2925  SymmetricMatrix<MT,SO,true,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2926 {
2927  matrix_.storea( i, j, value );
2928 
2929  if( SO ) {
2930  const size_t kend( min( i+SIMDSIZE, rows() ) );
2931  for( size_t k=i; k<kend; ++k )
2932  matrix_(j,k) = matrix_(k,j);
2933  }
2934  else {
2935  const size_t kend( min( j+SIMDSIZE, columns() ) );
2936  for( size_t k=j; k<kend; ++k )
2937  matrix_(k,i) = matrix_(i,k);
2938  }
2939 }
2941 //*************************************************************************************************
2942 
2943 
2944 //*************************************************************************************************
2961 template< typename MT // Type of the adapted dense matrix
2962  , bool SO > // Storage order of the adapted dense matrix
2963 inline void
2964  SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2965 {
2966  matrix_.storeu( i, j, value );
2967 
2968  if( SO ) {
2969  const size_t kend( min( i+SIMDSIZE, rows() ) );
2970  for( size_t k=i; k<kend; ++k )
2971  matrix_(j,k) = matrix_(k,j);
2972  }
2973  else {
2974  const size_t kend( min( j+SIMDSIZE, columns() ) );
2975  for( size_t k=j; k<kend; ++k )
2976  matrix_(k,i) = matrix_(i,k);
2977  }
2978 }
2980 //*************************************************************************************************
2981 
2982 
2983 //*************************************************************************************************
3000 template< typename MT // Type of the adapted dense matrix
3001  , bool SO > // Storage order of the adapted dense matrix
3002 inline void
3003  SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3004 {
3005  matrix_.stream( i, j, value );
3006 
3007  if( SO ) {
3008  const size_t kend( min( i+SIMDSIZE, rows() ) );
3009  for( size_t k=i; k<kend; ++k )
3010  matrix_(j,k) = matrix_(k,j);
3011  }
3012  else {
3013  const size_t kend( min( j+SIMDSIZE, columns() ) );
3014  for( size_t k=j; k<kend; ++k )
3015  matrix_(k,i) = matrix_(i,k);
3016  }
3017 }
3019 //*************************************************************************************************
3020 
3021 } // namespace blaze
3022 
3023 #endif
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
Constraint on the data type.
Header file for the dense matrix inversion flags.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:701
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:775
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5829
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:827
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:733
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Header file for the extended initializer_list functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
Header file for the NumericProxy class.
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:670
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:772
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5891
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
Header file for the isZero shim.
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraints on the storage order of matrix types.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:134
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:714
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for all forward declarations for expression class templates.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the implementation of the Column view.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:272
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric< T >::value)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:405
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:841
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:789
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:801