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>
57 #include <blaze/math/Exception.h>
60 #include <blaze/math/Functions.h>
63 #include <blaze/math/shims/Clear.h>
65 #include <blaze/math/SIMD.h>
72 #include <blaze/math/views/Row.h>
74 #include <blaze/system/Inline.h>
75 #include <blaze/util/Assert.h>
81 #include <blaze/util/DisableIf.h>
82 #include <blaze/util/EnableIf.h>
83 #include <blaze/util/mpl/If.h>
85 #include <blaze/util/Types.h>
88 #include <blaze/util/Unused.h>
89 
90 
91 namespace blaze {
92 
93 //=================================================================================================
94 //
95 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NUMERIC ELEMENT TYPE
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
107 template< typename MT // Type of the adapted dense matrix
108  , bool SO > // Storage order of the adapted dense matrix
109 class SymmetricMatrix<MT,SO,true,true>
110  : public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
111 {
112  private:
113  //**Type definitions****************************************************************************
114  typedef OppositeType_<MT> OT;
115  typedef TransposeType_<MT> TT;
116  typedef ElementType_<MT> ET;
117  //**********************************************************************************************
118 
119  public:
120  //**Type definitions****************************************************************************
121  typedef SymmetricMatrix<MT,SO,true,true> This;
122  typedef DenseMatrix<This,SO> BaseType;
123  typedef This ResultType;
124  typedef SymmetricMatrix<OT,!SO,true,true> OppositeType;
125  typedef SymmetricMatrix<TT,!SO,true,true> TransposeType;
126  typedef ET ElementType;
127  typedef SIMDType_<MT> SIMDType;
128  typedef ReturnType_<MT> ReturnType;
129  typedef const This& CompositeType;
130  typedef NumericProxy<MT> Reference;
131  typedef ConstReference_<MT> ConstReference;
132  typedef Pointer_<MT> Pointer;
133  typedef ConstPointer_<MT> ConstPointer;
134  typedef ConstIterator_<MT> ConstIterator;
135  //**********************************************************************************************
136 
137  //**Rebind struct definition********************************************************************
140  template< typename NewType > // Data type of the other matrix
141  struct Rebind {
143  typedef SymmetricMatrix< typename MT::template Rebind<NewType>::Other > Other;
144  };
145  //**********************************************************************************************
146 
147  //**Resize struct definition********************************************************************
150  template< size_t NewM // Number of rows of the other matrix
151  , size_t NewN > // Number of columns of the other matrix
152  struct Resize {
154  typedef SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other > Other;
155  };
156  //**********************************************************************************************
157 
158  //**Iterator class definition*******************************************************************
161  class Iterator
162  {
163  public:
164  //**Type definitions*************************************************************************
165  typedef std::random_access_iterator_tag IteratorCategory;
166  typedef ElementType_<MT> ValueType;
167  typedef NumericProxy<MT> PointerType;
168  typedef NumericProxy<MT> ReferenceType;
169  typedef ptrdiff_t DifferenceType;
170 
171  // STL iterator requirements
172  typedef IteratorCategory iterator_category;
173  typedef ValueType value_type;
174  typedef PointerType pointer;
175  typedef ReferenceType reference;
176  typedef DifferenceType difference_type;
177  //*******************************************************************************************
178 
179  //**Constructor******************************************************************************
182  inline Iterator() noexcept
183  : matrix_( nullptr ) // Reference to the adapted dense matrix
184  , row_ ( 0UL ) // The current row index of the iterator
185  , column_( 0UL ) // The current column index of the iterator
186  {}
187  //*******************************************************************************************
188 
189  //**Constructor******************************************************************************
196  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
197  : matrix_( &matrix ) // Reference to the adapted dense matrix
198  , row_ ( row ) // The current row index of the iterator
199  , column_( column ) // The current column index of the iterator
200  {}
201  //*******************************************************************************************
202 
203  //**Addition assignment operator*************************************************************
209  inline Iterator& operator+=( size_t inc ) noexcept {
210  ( SO )?( row_ += inc ):( column_ += inc );
211  return *this;
212  }
213  //*******************************************************************************************
214 
215  //**Subtraction assignment operator**********************************************************
221  inline Iterator& operator-=( size_t dec ) noexcept {
222  ( SO )?( row_ -= dec ):( column_ -= dec );
223  return *this;
224  }
225  //*******************************************************************************************
226 
227  //**Prefix increment operator****************************************************************
232  inline Iterator& operator++() noexcept {
233  ( SO )?( ++row_ ):( ++column_ );
234  return *this;
235  }
236  //*******************************************************************************************
237 
238  //**Postfix increment operator***************************************************************
243  inline const Iterator operator++( int ) noexcept {
244  const Iterator tmp( *this );
245  ++(*this);
246  return tmp;
247  }
248  //*******************************************************************************************
249 
250  //**Prefix decrement operator****************************************************************
255  inline Iterator& operator--() noexcept {
256  ( SO )?( --row_ ):( --column_ );
257  return *this;
258  }
259  //*******************************************************************************************
260 
261  //**Postfix decrement operator***************************************************************
266  inline const Iterator operator--( int ) noexcept {
267  const Iterator tmp( *this );
268  --(*this);
269  return tmp;
270  }
271  //*******************************************************************************************
272 
273  //**Element access operator******************************************************************
278  inline ReferenceType operator*() const {
279  return ReferenceType( *matrix_, row_, column_ );
280  }
281  //*******************************************************************************************
282 
283  //**Element access operator******************************************************************
288  inline PointerType operator->() const {
289  return PointerType( *matrix_, row_, column_ );
290  }
291  //*******************************************************************************************
292 
293  //**Load function****************************************************************************
303  inline SIMDType load() const {
304  return (*matrix_).load(row_,column_);
305  }
306  //*******************************************************************************************
307 
308  //**Loada function***************************************************************************
318  inline SIMDType loada() const {
319  return (*matrix_).loada(row_,column_);
320  }
321  //*******************************************************************************************
322 
323  //**Loadu function***************************************************************************
333  inline SIMDType loadu() const {
334  return (*matrix_).loadu(row_,column_);
335  }
336  //*******************************************************************************************
337 
338  //**Store function***************************************************************************
349  inline void store( const SIMDType& value ) const {
350  (*matrix_).store( row_, column_, value );
351  sync();
352  }
353  //*******************************************************************************************
354 
355  //**Storea function**************************************************************************
366  inline void storea( const SIMDType& value ) const {
367  (*matrix_).storea( row_, column_, value );
368  sync();
369  }
370  //*******************************************************************************************
371 
372  //**Storeu function**************************************************************************
383  inline void storeu( const SIMDType& value ) const {
384  (*matrix_).storeu( row_, column_, value );
385  sync();
386  }
387  //*******************************************************************************************
388 
389  //**Stream function**************************************************************************
400  inline void stream( const SIMDType& value ) const {
401  (*matrix_).stream( row_, column_, value );
402  sync();
403  }
404  //*******************************************************************************************
405 
406  //**Conversion operator**********************************************************************
411  inline operator ConstIterator() const {
412  if( SO )
413  return matrix_->begin( column_ ) + row_;
414  else
415  return matrix_->begin( row_ ) + column_;
416  }
417  //*******************************************************************************************
418 
419  //**Equality operator************************************************************************
426  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
427  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
428  }
429  //*******************************************************************************************
430 
431  //**Equality operator************************************************************************
438  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
439  return ( ConstIterator( lhs ) == rhs );
440  }
441  //*******************************************************************************************
442 
443  //**Equality operator************************************************************************
450  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
451  return ( lhs == ConstIterator( rhs ) );
452  }
453  //*******************************************************************************************
454 
455  //**Inequality operator**********************************************************************
462  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
463  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
464  }
465  //*******************************************************************************************
466 
467  //**Inequality operator**********************************************************************
474  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
475  return ( ConstIterator( lhs ) != rhs );
476  }
477  //*******************************************************************************************
478 
479  //**Inequality operator**********************************************************************
486  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
487  return ( lhs != ConstIterator( rhs ) );
488  }
489  //*******************************************************************************************
490 
491  //**Less-than operator***********************************************************************
498  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
499  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
500  }
501  //*******************************************************************************************
502 
503  //**Less-than operator***********************************************************************
510  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
511  return ( ConstIterator( lhs ) < rhs );
512  }
513  //*******************************************************************************************
514 
515  //**Less-than operator***********************************************************************
522  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
523  return ( lhs < ConstIterator( rhs ) );
524  }
525  //*******************************************************************************************
526 
527  //**Greater-than operator********************************************************************
534  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
535  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
536  }
537  //*******************************************************************************************
538 
539  //**Greater-than operator********************************************************************
546  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
547  return ( ConstIterator( lhs ) > rhs );
548  }
549  //*******************************************************************************************
550 
551  //**Greater-than operator********************************************************************
558  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
559  return ( lhs > ConstIterator( rhs ) );
560  }
561  //*******************************************************************************************
562 
563  //**Less-or-equal-than operator**************************************************************
570  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
571  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
572  }
573  //*******************************************************************************************
574 
575  //**Less-or-equal-than operator**************************************************************
582  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
583  return ( ConstIterator( lhs ) <= rhs );
584  }
585  //*******************************************************************************************
586 
587  //**Less-or-equal-than operator**************************************************************
594  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
595  return ( lhs <= ConstIterator( rhs ) );
596  }
597  //*******************************************************************************************
598 
599  //**Greater-or-equal-than operator***********************************************************
606  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
607  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
608  }
609  //*******************************************************************************************
610 
611  //**Greater-or-equal-than operator***********************************************************
618  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
619  return ( ConstIterator( lhs ) >= rhs );
620  }
621  //*******************************************************************************************
622 
623  //**Greater-or-equal-than operator***********************************************************
630  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
631  return ( lhs >= ConstIterator( rhs ) );
632  }
633  //*******************************************************************************************
634 
635  //**Subtraction operator*********************************************************************
641  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
642  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
643  }
644  //*******************************************************************************************
645 
646  //**Addition operator************************************************************************
653  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
654  if( SO )
655  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
656  else
657  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
658  }
659  //*******************************************************************************************
660 
661  //**Addition operator************************************************************************
668  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
669  if( SO )
670  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
671  else
672  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
673  }
674  //*******************************************************************************************
675 
676  //**Subtraction operator*********************************************************************
683  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
684  if( SO )
685  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
686  else
687  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
688  }
689  //*******************************************************************************************
690 
691  private:
692  //**Sync function****************************************************************************
697  void sync() const {
698  if( SO ) {
699  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
700  for( size_t k=row_; k<kend; ++k )
701  (*matrix_)(column_,k) = (*matrix_)(k,column_);
702  }
703  else {
704  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
705  for( size_t k=column_; k<kend; ++k )
706  (*matrix_)(k,row_) = (*matrix_)(row_,k);
707  }
708  }
709  //*******************************************************************************************
710 
711  //**Member variables*************************************************************************
712  MT* matrix_;
713  size_t row_;
714  size_t column_;
715  //*******************************************************************************************
716  };
717  //**********************************************************************************************
718 
719  //**Compilation flags***************************************************************************
721  enum : bool { simdEnabled = MT::simdEnabled };
722 
724  enum : bool { smpAssignable = MT::smpAssignable };
725  //**********************************************************************************************
726 
727  //**Constructors********************************************************************************
730  explicit inline SymmetricMatrix();
731  explicit inline SymmetricMatrix( size_t n );
732  explicit inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
733 
734  template< typename Other >
735  explicit inline SymmetricMatrix( size_t n, const Other* array );
736 
737  template< typename Other, size_t N >
738  explicit inline SymmetricMatrix( const Other (&array)[N][N] );
739 
740  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
741  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
742 
743  template< typename Deleter >
744  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, Deleter d );
745 
746  template< typename Deleter >
747  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
748 
749  inline SymmetricMatrix( const SymmetricMatrix& m );
750  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
751 
752  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
753  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
755  //**********************************************************************************************
756 
757  //**Destructor**********************************************************************************
758  // No explicitly declared destructor.
759  //**********************************************************************************************
760 
761  //**Data access functions***********************************************************************
764  inline Reference operator()( size_t i, size_t j );
765  inline ConstReference operator()( size_t i, size_t j ) const;
766  inline Reference at( size_t i, size_t j );
767  inline ConstReference at( size_t i, size_t j ) const;
768  inline ConstPointer data () const noexcept;
769  inline ConstPointer data ( size_t i ) const noexcept;
770  inline Iterator begin ( size_t i );
771  inline ConstIterator begin ( size_t i ) const;
772  inline ConstIterator cbegin( size_t i ) const;
773  inline Iterator end ( size_t i );
774  inline ConstIterator end ( size_t i ) const;
775  inline ConstIterator cend ( size_t i ) const;
777  //**********************************************************************************************
778 
779  //**Assignment operators************************************************************************
782  inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
783 
784  template< typename Other, size_t N >
785  inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
786 
787  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
788  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
789 
790  template< typename MT2 >
791  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
792 
793  template< typename MT2 >
794  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
795 
796  template< typename MT2 >
797  inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
798 
799  template< typename MT2 >
800  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
801 
802  template< typename MT2 >
803  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
804 
805  template< typename MT2 >
806  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
807 
808  template< typename MT2 >
809  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
810 
811  template< typename MT2 >
812  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
813 
814  template< typename MT2 >
815  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
816 
817  template< typename MT2, bool SO2 >
818  inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
819 
820  template< typename Other >
821  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator*=( Other rhs );
822 
823  template< typename Other >
824  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator/=( Other rhs );
826  //**********************************************************************************************
827 
828  //**Utility functions***************************************************************************
831  inline size_t rows() const noexcept;
832  inline size_t columns() const noexcept;
833  inline size_t spacing() const noexcept;
834  inline size_t capacity() const noexcept;
835  inline size_t capacity( size_t i ) const noexcept;
836  inline size_t nonZeros() const;
837  inline size_t nonZeros( size_t i ) const;
838  inline void reset();
839  inline void reset( size_t i );
840  inline void clear();
841  void resize ( size_t n, bool preserve=true );
842  inline void extend ( size_t n, bool preserve=true );
843  inline void reserve( size_t elements );
844  inline void swap( SymmetricMatrix& m ) noexcept;
846  //**********************************************************************************************
847 
848  //**Numeric functions***************************************************************************
851  inline SymmetricMatrix& transpose();
852  inline SymmetricMatrix& ctranspose();
853 
854  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
856  //**********************************************************************************************
857 
858  //**Debugging functions*************************************************************************
861  inline bool isIntact() const noexcept;
863  //**********************************************************************************************
864 
865  //**Expression template evaluation functions****************************************************
868  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
869  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
870 
871  inline bool isAligned () const noexcept;
872  inline bool canSMPAssign() const noexcept;
873 
874  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
875  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
876  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
877 
878  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
879  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
880  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
881  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
883  //**********************************************************************************************
884 
885  private:
886  //**SIMD properties*****************************************************************************
888  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
889  //**********************************************************************************************
890 
891  //**Member variables****************************************************************************
894  MT matrix_;
895 
896  //**********************************************************************************************
897 
898  //**Friend declarations*************************************************************************
899  template< bool RF, typename MT2, bool SO2, bool DF2, bool NF2 >
900  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
901 
902  template< InversionFlag IF, typename MT2, bool SO2 >
903  friend void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
904  //**********************************************************************************************
905 
906  //**Compile time checks*************************************************************************
920  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
921  //**********************************************************************************************
922 };
924 //*************************************************************************************************
925 
926 
927 
928 
929 //=================================================================================================
930 //
931 // CONSTRUCTORS
932 //
933 //=================================================================================================
934 
935 //*************************************************************************************************
939 template< typename MT // Type of the adapted dense matrix
940  , bool SO > // Storage order of the adapted dense matrix
941 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
942  : matrix_() // The adapted dense matrix
943 {
944  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
945  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
946 }
948 //*************************************************************************************************
949 
950 
951 //*************************************************************************************************
957 template< typename MT // Type of the adapted dense matrix
958  , bool SO > // Storage order of the adapted dense matrix
959 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n )
960  : matrix_( n, n, ElementType() ) // The adapted dense matrix
961 {
963 
964  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
965  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
966 }
968 //*************************************************************************************************
969 
970 
971 //*************************************************************************************************
994 template< typename MT // Type of the adapted dense matrix
995  , bool SO > // Storage order of the adapted dense matrix
996 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
997  : matrix_( list ) // The adapted dense matrix
998 {
999  if( !isSymmetric( matrix_ ) ) {
1000  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1001  }
1002 
1003  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1004 }
1006 //*************************************************************************************************
1007 
1008 
1009 //*************************************************************************************************
1035 template< typename MT // Type of the adapted dense matrix
1036  , bool SO > // Storage order of the adapted dense matrix
1037 template< typename Other > // Data type of the initialization array
1038 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n, const Other* array )
1039  : matrix_( n, n, array ) // The adapted dense matrix
1040 {
1041  if( !isSymmetric( matrix_ ) ) {
1042  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1043  }
1044 
1045  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1046 }
1048 //*************************************************************************************************
1049 
1050 
1051 //*************************************************************************************************
1074 template< typename MT // Type of the adapted dense matrix
1075  , bool SO > // Storage order of the adapted dense matrix
1076 template< typename Other // Data type of the initialization array
1077  , size_t N > // Number of rows and columns of the initialization array
1078 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Other (&array)[N][N] )
1079  : matrix_( array ) // The adapted dense matrix
1080 {
1081  if( !isSymmetric( matrix_ ) ) {
1082  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1083  }
1084 
1085  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1086 }
1088 //*************************************************************************************************
1089 
1090 
1091 //*************************************************************************************************
1112 template< typename MT // Type of the adapted dense matrix
1113  , bool SO > // Storage order of the adapted dense matrix
1114 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n )
1115  : matrix_( ptr, n, n ) // The adapted dense matrix
1116 {
1117  if( !isSymmetric( matrix_ ) ) {
1118  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1119  }
1120 
1121  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1122 }
1124 //*************************************************************************************************
1125 
1126 
1127 //*************************************************************************************************
1150 template< typename MT // Type of the adapted dense matrix
1151  , bool SO > // Storage order of the adapted dense matrix
1152 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
1153  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1154 {
1155  if( !isSymmetric( matrix_ ) ) {
1156  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1157  }
1158 
1159  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1160 }
1162 //*************************************************************************************************
1163 
1164 
1165 //*************************************************************************************************
1186 template< typename MT // Type of the adapted dense matrix
1187  , bool SO > // Storage order of the adapted dense matrix
1188 template< typename Deleter > // Type of the custom deleter
1189 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, Deleter d )
1190  : matrix_( ptr, n, n, d ) // The adapted dense matrix
1191 {
1192  if( !isSymmetric( matrix_ ) ) {
1193  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1194  }
1195 
1196  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1197 }
1199 //*************************************************************************************************
1200 
1201 
1202 //*************************************************************************************************
1224 template< typename MT // Type of the adapted dense matrix
1225  , bool SO > // Storage order of the adapted dense matrix
1226 template< typename Deleter > // Type of the custom deleter
1227 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
1228  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
1229 {
1230  if( !isSymmetric( matrix_ ) ) {
1231  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1232  }
1233 
1234  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1235 }
1237 //*************************************************************************************************
1238 
1239 
1240 //*************************************************************************************************
1246 template< typename MT // Type of the adapted dense matrix
1247  , bool SO > // Storage order of the adapted dense matrix
1248 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
1249  : matrix_( m.matrix_ ) // The adapted dense matrix
1250 {
1251  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1252  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1253 }
1255 //*************************************************************************************************
1256 
1257 
1258 //*************************************************************************************************
1264 template< typename MT // Type of the adapted dense matrix
1265  , bool SO > // Storage order of the adapted dense matrix
1266 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
1267  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1268 {
1269  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1270  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1271 }
1273 //*************************************************************************************************
1274 
1275 
1276 //*************************************************************************************************
1286 template< typename MT // Type of the adapted dense matrix
1287  , bool SO > // Storage order of the adapted dense matrix
1288 template< typename MT2 > // Type of the foreign matrix
1289 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
1290  : matrix_( ~m ) // The adapted dense matrix
1291 {
1292  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1293  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1294  }
1295 
1296  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1297  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1298 }
1300 //*************************************************************************************************
1301 
1302 
1303 //*************************************************************************************************
1313 template< typename MT // Type of the adapted dense matrix
1314  , bool SO > // Storage order of the adapted dense matrix
1315 template< typename MT2 > // Type of the foreign matrix
1316 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
1317  : matrix_( trans( ~m ) ) // The adapted dense matrix
1318 {
1319  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1320  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1321  }
1322 
1323  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1324  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1325 }
1327 //*************************************************************************************************
1328 
1329 
1330 
1331 
1332 //=================================================================================================
1333 //
1334 // DATA ACCESS FUNCTIONS
1335 //
1336 //=================================================================================================
1337 
1338 //*************************************************************************************************
1353 template< typename MT // Type of the adapted dense matrix
1354  , bool SO > // Storage order of the adapted dense matrix
1356  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
1357 {
1358  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1359  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1360 
1361  return Reference( matrix_, i, j );
1362 }
1364 //*************************************************************************************************
1365 
1366 
1367 //*************************************************************************************************
1382 template< typename MT // Type of the adapted dense matrix
1383  , bool SO > // Storage order of the adapted dense matrix
1385  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
1386 {
1387  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1388  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1389 
1390  return matrix_(i,j);
1391 }
1393 //*************************************************************************************************
1394 
1395 
1396 //*************************************************************************************************
1412 template< typename MT // Type of the adapted dense matrix
1413  , bool SO > // Storage order of the adapted dense matrix
1415  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j )
1416 {
1417  if( i >= rows() ) {
1418  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1419  }
1420  if( j >= columns() ) {
1421  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1422  }
1423  return (*this)(i,j);
1424 }
1426 //*************************************************************************************************
1427 
1428 
1429 //*************************************************************************************************
1445 template< typename MT // Type of the adapted dense matrix
1446  , bool SO > // Storage order of the adapted dense matrix
1448  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j ) const
1449 {
1450  if( i >= rows() ) {
1451  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1452  }
1453  if( j >= columns() ) {
1454  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1455  }
1456  return (*this)(i,j);
1457 }
1459 //*************************************************************************************************
1460 
1461 
1462 //*************************************************************************************************
1476 template< typename MT // Type of the adapted dense matrix
1477  , bool SO > // Storage order of the adapted dense matrix
1478 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1479  SymmetricMatrix<MT,SO,true,true>::data() const noexcept
1480 {
1481  return matrix_.data();
1482 }
1484 //*************************************************************************************************
1485 
1486 
1487 //*************************************************************************************************
1498 template< typename MT // Type of the adapted dense matrix
1499  , bool SO > // Storage order of the adapted dense matrix
1500 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1501  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const noexcept
1502 {
1503  return matrix_.data(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  if( SO )
1527  return Iterator( matrix_, 0UL, i );
1528  else
1529  return Iterator( matrix_, i, 0UL );
1530 }
1532 //*************************************************************************************************
1533 
1534 
1535 //*************************************************************************************************
1547 template< typename MT // Type of the adapted dense matrix
1548  , bool SO > // Storage order of the adapted dense matrix
1550  SymmetricMatrix<MT,SO,true,true>::begin( size_t i ) const
1551 {
1552  return matrix_.begin(i);
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
1574 {
1575  return matrix_.cbegin(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
1597 {
1598  if( SO )
1599  return Iterator( matrix_, rows(), i );
1600  else
1601  return Iterator( matrix_, i, columns() );
1602 }
1604 //*************************************************************************************************
1605 
1606 
1607 //*************************************************************************************************
1619 template< typename MT // Type of the adapted dense matrix
1620  , bool SO > // Storage order of the adapted dense matrix
1622  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1623 {
1624  return matrix_.end(i);
1625 }
1627 //*************************************************************************************************
1628 
1629 
1630 //*************************************************************************************************
1642 template< typename MT // Type of the adapted dense matrix
1643  , bool SO > // Storage order of the adapted dense matrix
1645  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1646 {
1647  return matrix_.cend(i);
1648 }
1650 //*************************************************************************************************
1651 
1652 
1653 
1654 
1655 //=================================================================================================
1656 //
1657 // ASSIGNMENT OPERATORS
1658 //
1659 //=================================================================================================
1660 
1661 //*************************************************************************************************
1685 template< typename MT // Type of the adapted dense matrix
1686  , bool SO > // Storage order of the adapted dense matrix
1687 inline SymmetricMatrix<MT,SO,true,true>&
1688  SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1689 {
1690  MT tmp( list );
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 //*************************************************************************************************
1731 template< typename MT // Type of the adapted dense matrix
1732  , bool SO > // Storage order of the adapted dense matrix
1733 template< typename Other // Data type of the initialization array
1734  , size_t N > // Number of rows and columns of the initialization array
1735 inline SymmetricMatrix<MT,SO,true,true>&
1736  SymmetricMatrix<MT,SO,true,true>::operator=( const Other (&array)[N][N] )
1737 {
1738  MT tmp( array );
1739 
1740  if( !isSymmetric( tmp ) ) {
1741  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1742  }
1743 
1744  matrix_ = std::move( tmp );
1745 
1746  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1747  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1748 
1749  return *this;
1750 }
1752 //*************************************************************************************************
1753 
1754 
1755 //*************************************************************************************************
1765 template< typename MT // Type of the adapted dense matrix
1766  , bool SO > // Storage order of the adapted dense matrix
1767 inline SymmetricMatrix<MT,SO,true,true>&
1768  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1769 {
1770  matrix_ = rhs.matrix_;
1771 
1772  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1773  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1774 
1775  return *this;
1776 }
1778 //*************************************************************************************************
1779 
1780 
1781 //*************************************************************************************************
1788 template< typename MT // Type of the adapted dense matrix
1789  , bool SO > // Storage order of the adapted dense matrix
1790 inline SymmetricMatrix<MT,SO,true,true>&
1791  SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1792 {
1793  matrix_ = std::move( rhs.matrix_ );
1794 
1795  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1796  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1797 
1798  return *this;
1799 }
1801 //*************************************************************************************************
1802 
1803 
1804 //*************************************************************************************************
1817 template< typename MT // Type of the adapted dense matrix
1818  , bool SO > // Storage order of the adapted dense matrix
1819 template< typename MT2 > // Type of the right-hand side matrix
1820 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1821  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1822 {
1823  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1824  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1825  }
1826 
1827  matrix_ = ~rhs;
1828 
1829  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1830  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1831 
1832  return *this;
1833 }
1835 //*************************************************************************************************
1836 
1837 
1838 //*************************************************************************************************
1851 template< typename MT // Type of the adapted dense matrix
1852  , bool SO > // Storage order of the adapted dense matrix
1853 template< typename MT2 > // Type of the right-hand side matrix
1854 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1855  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1856 {
1857  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1858  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1859  }
1860 
1861  if( IsSymmetric<MT2>::value ) {
1862  matrix_ = ~rhs;
1863  }
1864  else {
1865  MT tmp( ~rhs );
1866 
1867  if( !isSymmetric( tmp ) ) {
1868  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1869  }
1870 
1871  matrix_ = std::move( tmp );
1872  }
1873 
1874  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1875  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1876 
1877  return *this;
1878 }
1880 //*************************************************************************************************
1881 
1882 
1883 //*************************************************************************************************
1896 template< typename MT // Type of the adapted dense matrix
1897  , bool SO > // Storage order of the adapted dense matrix
1898 template< typename MT2 > // Type of the right-hand side matrix
1899 inline SymmetricMatrix<MT,SO,true,true>&
1900  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1901 {
1902  return this->operator=( trans( ~rhs ) );
1903 }
1905 //*************************************************************************************************
1906 
1907 
1908 //*************************************************************************************************
1921 template< typename MT // Type of the adapted dense matrix
1922  , bool SO > // Storage order of the adapted dense matrix
1923 template< typename MT2 > // Type of the right-hand side matrix
1924 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1925  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1926 {
1927  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1928  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1929  }
1930 
1931  matrix_ += ~rhs;
1932 
1933  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1934  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1935 
1936  return *this;
1937 }
1939 //*************************************************************************************************
1940 
1941 
1942 //*************************************************************************************************
1955 template< typename MT // Type of the adapted dense matrix
1956  , bool SO > // Storage order of the adapted dense matrix
1957 template< typename MT2 > // Type of the right-hand side matrix
1958 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1959  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1960 {
1961  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1962  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1963  }
1964 
1965  if( IsSymmetric<MT2>::value ) {
1966  matrix_ += ~rhs;
1967  }
1968  else {
1969  const ResultType_<MT2> tmp( ~rhs );
1970 
1971  if( !isSymmetric( tmp ) ) {
1972  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1973  }
1974 
1975  matrix_ += tmp;
1976  }
1977 
1978  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1979  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1980 
1981  return *this;
1982 }
1984 //*************************************************************************************************
1985 
1986 
1987 //*************************************************************************************************
2001 template< typename MT // Type of the adapted dense matrix
2002  , bool SO > // Storage order of the adapted dense matrix
2003 template< typename MT2 > // Type of the right-hand side matrix
2004 inline SymmetricMatrix<MT,SO,true,true>&
2005  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
2006 {
2007  return this->operator+=( trans( ~rhs ) );
2008 }
2010 //*************************************************************************************************
2011 
2012 
2013 //*************************************************************************************************
2026 template< typename MT // Type of the adapted dense matrix
2027  , bool SO > // Storage order of the adapted dense matrix
2028 template< typename MT2 > // Type of the right-hand side matrix
2029 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2030  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2031 {
2032  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
2033  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2034  }
2035 
2036  matrix_ -= ~rhs;
2037 
2038  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2039  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2040 
2041  return *this;
2042 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2060 template< typename MT // Type of the adapted dense matrix
2061  , bool SO > // Storage order of the adapted dense matrix
2062 template< typename MT2 > // Type of the right-hand side matrix
2063 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2064  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2065 {
2066  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2067  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2068  }
2069 
2070  if( IsSymmetric<MT2>::value ) {
2071  matrix_ -= ~rhs;
2072  }
2073  else {
2074  const ResultType_<MT2> tmp( ~rhs );
2075 
2076  if( !isSymmetric( tmp ) ) {
2077  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2078  }
2079 
2080  matrix_ -= tmp;
2081  }
2082 
2083  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2084  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2085 
2086  return *this;
2087 }
2089 //*************************************************************************************************
2090 
2091 
2092 //*************************************************************************************************
2106 template< typename MT // Type of the adapted dense matrix
2107  , bool SO > // Storage order of the adapted dense matrix
2108 template< typename MT2 > // Type of the right-hand side matrix
2109 inline SymmetricMatrix<MT,SO,true,true>&
2110  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2111 {
2112  return this->operator-=( trans( ~rhs ) );
2113 }
2115 //*************************************************************************************************
2116 
2117 
2118 //*************************************************************************************************
2130 template< typename MT // Type of the adapted dense matrix
2131  , bool SO > // Storage order of the adapted dense matrix
2132 template< typename MT2 // Type of the right-hand side matrix
2133  , bool SO2 > // Storage order of the right-hand side matrix
2134 inline SymmetricMatrix<MT,SO,true,true>&
2135  SymmetricMatrix<MT,SO,true,true>::operator*=( const Matrix<MT2,SO2>& rhs )
2136 {
2137  if( matrix_.rows() != (~rhs).columns() ) {
2138  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2139  }
2140 
2141  MT tmp( matrix_ * ~rhs );
2142 
2143  if( !isSymmetric( tmp ) ) {
2144  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2145  }
2146 
2147  matrix_ = std::move( tmp );
2148 
2149  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2150  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2151 
2152  return *this;
2153 }
2155 //*************************************************************************************************
2156 
2157 
2158 //*************************************************************************************************
2166 template< typename MT // Type of the adapted dense matrix
2167  , bool SO > // Storage order of the adapted dense matrix
2168 template< typename Other > // Data type of the right-hand side scalar
2169 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >&
2171 {
2172  matrix_ *= rhs;
2173  return *this;
2174 }
2175 //*************************************************************************************************
2176 
2177 
2178 //*************************************************************************************************
2186 template< typename MT // Type of the adapted dense matrix
2187  , bool SO > // Storage order of the adapted dense matrix
2188 template< typename Other > // Data type of the right-hand side scalar
2189 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >&
2191 {
2192  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2193 
2194  matrix_ /= rhs;
2195  return *this;
2196 }
2198 //*************************************************************************************************
2199 
2200 
2201 
2202 
2203 //=================================================================================================
2204 //
2205 // UTILITY FUNCTIONS
2206 //
2207 //=================================================================================================
2208 
2209 //*************************************************************************************************
2215 template< typename MT // Type of the adapted dense matrix
2216  , bool SO > // Storage order of the adapted dense matrix
2217 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const noexcept
2218 {
2219  return matrix_.rows();
2220 }
2222 //*************************************************************************************************
2223 
2224 
2225 //*************************************************************************************************
2231 template< typename MT // Type of the adapted dense matrix
2232  , bool SO > // Storage order of the adapted dense matrix
2233 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const noexcept
2234 {
2235  return matrix_.columns();
2236 }
2238 //*************************************************************************************************
2239 
2240 
2241 //*************************************************************************************************
2253 template< typename MT // Type of the adapted dense matrix
2254  , bool SO > // Storage order of the adapted dense matrix
2255 inline size_t SymmetricMatrix<MT,SO,true,true>::spacing() const noexcept
2256 {
2257  return matrix_.spacing();
2258 }
2260 //*************************************************************************************************
2261 
2262 
2263 //*************************************************************************************************
2269 template< typename MT // Type of the adapted dense matrix
2270  , bool SO > // Storage order of the adapted dense matrix
2271 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const noexcept
2272 {
2273  return matrix_.capacity();
2274 }
2276 //*************************************************************************************************
2277 
2278 
2279 //*************************************************************************************************
2290 template< typename MT // Type of the adapted dense matrix
2291  , bool SO > // Storage order of the adapted dense matrix
2292 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const noexcept
2293 {
2294  return matrix_.capacity(i);
2295 }
2297 //*************************************************************************************************
2298 
2299 
2300 //*************************************************************************************************
2306 template< typename MT // Type of the adapted dense matrix
2307  , bool SO > // Storage order of the adapted dense matrix
2308 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
2309 {
2310  return matrix_.nonZeros();
2311 }
2313 //*************************************************************************************************
2314 
2315 
2316 //*************************************************************************************************
2328 template< typename MT // Type of the adapted dense matrix
2329  , bool SO > // Storage order of the adapted dense matrix
2330 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
2331 {
2332  return matrix_.nonZeros(i);
2333 }
2335 //*************************************************************************************************
2336 
2337 
2338 //*************************************************************************************************
2344 template< typename MT // Type of the adapted dense matrix
2345  , bool SO > // Storage order of the adapted dense matrix
2347 {
2348  matrix_.reset();
2349 }
2351 //*************************************************************************************************
2352 
2353 
2354 //*************************************************************************************************
2390 template< typename MT // Type of the adapted dense matrix
2391  , bool SO > // Storage order of the adapted dense matrix
2392 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
2393 {
2394  row ( matrix_, i ).reset();
2395  column( matrix_, i ).reset();
2396 }
2398 //*************************************************************************************************
2399 
2400 
2401 //*************************************************************************************************
2413 template< typename MT // Type of the adapted dense matrix
2414  , bool SO > // Storage order of the adapted dense matrix
2416 {
2417  using blaze::clear;
2418 
2419  clear( matrix_ );
2420 }
2422 //*************************************************************************************************
2423 
2424 
2425 //*************************************************************************************************
2460 template< typename MT // Type of the adapted dense matrix
2461  , bool SO > // Storage order of the adapted dense matrix
2462 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
2463 {
2465 
2466  UNUSED_PARAMETER( preserve );
2467 
2468  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2469 
2470  const size_t oldsize( matrix_.rows() );
2471 
2472  matrix_.resize( n, n, true );
2473 
2474  if( n > oldsize ) {
2475  const size_t increment( n - oldsize );
2476  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2477  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2478  }
2479 }
2481 //*************************************************************************************************
2482 
2483 
2484 //*************************************************************************************************
2497 template< typename MT // Type of the adapted dense matrix
2498  , bool SO > // Storage order of the adapted dense matrix
2499 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
2500 {
2502 
2503  UNUSED_PARAMETER( preserve );
2504 
2505  resize( rows() + n, true );
2506 }
2507 //*************************************************************************************************
2508 
2509 
2510 //*************************************************************************************************
2520 template< typename MT // Type of the adapted dense matrix
2521  , bool SO > // Storage order of the adapted dense matrix
2522 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
2523 {
2524  matrix_.reserve( elements );
2525 }
2527 //*************************************************************************************************
2528 
2529 
2530 //*************************************************************************************************
2537 template< typename MT // Type of the adapted dense matrix
2538  , bool SO > // Storage order of the adapted dense matrix
2539 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) noexcept
2540 {
2541  using std::swap;
2542 
2543  swap( matrix_, m.matrix_ );
2544 }
2546 //*************************************************************************************************
2547 
2548 
2549 
2550 
2551 //=================================================================================================
2552 //
2553 // NUMERIC FUNCTIONS
2554 //
2555 //=================================================================================================
2556 
2557 //*************************************************************************************************
2563 template< typename MT // Type of the adapted dense matrix
2564  , bool SO > // Storage order of the adapted dense matrix
2565 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
2566 {
2567  return *this;
2568 }
2570 //*************************************************************************************************
2571 
2572 
2573 //*************************************************************************************************
2579 template< typename MT // Type of the adapted dense matrix
2580  , bool SO > // Storage order of the adapted dense matrix
2581 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::ctranspose()
2582 {
2583  if( !IsBuiltin<ElementType>::value )
2584  conjugate( matrix_ );
2585 
2586  return *this;
2587 }
2589 //*************************************************************************************************
2590 
2591 
2592 //*************************************************************************************************
2599 template< typename MT // Type of the adapted dense matrix
2600  , bool SO > // Storage order of the adapted dense matrix
2601 template< typename Other > // Data type of the scalar value
2602 inline SymmetricMatrix<MT,SO,true,true>&
2603  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
2604 {
2605  matrix_.scale( scalar );
2606  return *this;
2607 }
2609 //*************************************************************************************************
2610 
2611 
2612 
2613 
2614 //=================================================================================================
2615 //
2616 // DEBUGGING FUNCTIONS
2617 //
2618 //=================================================================================================
2619 
2620 //*************************************************************************************************
2630 template< typename MT // Type of the adapted dense matrix
2631  , bool SO > // Storage order of the adapted dense matrix
2632 inline bool SymmetricMatrix<MT,SO,true,true>::isIntact() const noexcept
2633 {
2634  using blaze::isIntact;
2635 
2636  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2637 }
2639 //*************************************************************************************************
2640 
2641 
2642 
2643 
2644 //=================================================================================================
2645 //
2646 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2647 //
2648 //=================================================================================================
2649 
2650 //*************************************************************************************************
2661 template< typename MT // Type of the adapted dense matrix
2662  , bool SO > // Storage order of the adapted dense matrix
2663 template< typename Other > // Data type of the foreign expression
2664 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const noexcept
2665 {
2666  return matrix_.canAlias( alias );
2667 }
2669 //*************************************************************************************************
2670 
2671 
2672 //*************************************************************************************************
2683 template< typename MT // Type of the adapted dense matrix
2684  , bool SO > // Storage order of the adapted dense matrix
2685 template< typename Other > // Data type of the foreign expression
2686 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const noexcept
2687 {
2688  return matrix_.isAliased( alias );
2689 }
2691 //*************************************************************************************************
2692 
2693 
2694 //*************************************************************************************************
2704 template< typename MT // Type of the adapted dense matrix
2705  , bool SO > // Storage order of the adapted dense matrix
2706 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2707 {
2708  return matrix_.isAligned();
2709 }
2711 //*************************************************************************************************
2712 
2713 
2714 //*************************************************************************************************
2725 template< typename MT // Type of the adapted dense matrix
2726  , bool SO > // Storage order of the adapted dense matrix
2727 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2728 {
2729  return matrix_.canSMPAssign();
2730 }
2732 //*************************************************************************************************
2733 
2734 
2735 //*************************************************************************************************
2751 template< typename MT // Type of the adapted dense matrix
2752  , bool SO > // Storage order of the adapted dense matrix
2753 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2754  SymmetricMatrix<MT,SO,true,true>::load( size_t i, size_t j ) const noexcept
2755 {
2756  return matrix_.load( i, j );
2757 }
2759 //*************************************************************************************************
2760 
2761 
2762 //*************************************************************************************************
2778 template< typename MT // Type of the adapted dense matrix
2779  , bool SO > // Storage order of the adapted dense matrix
2780 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2781  SymmetricMatrix<MT,SO,true,true>::loada( size_t i, size_t j ) const noexcept
2782 {
2783  return matrix_.loada( i, j );
2784 }
2786 //*************************************************************************************************
2787 
2788 
2789 //*************************************************************************************************
2805 template< typename MT // Type of the adapted dense matrix
2806  , bool SO > // Storage order of the adapted dense matrix
2807 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2808  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const noexcept
2809 {
2810  return matrix_.loadu( i, j );
2811 }
2813 //*************************************************************************************************
2814 
2815 
2816 //*************************************************************************************************
2833 template< typename MT // Type of the adapted dense matrix
2834  , bool SO > // Storage order of the adapted dense matrix
2835 inline void
2836  SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2837 {
2838  matrix_.store( i, j, value );
2839 
2840  if( SO ) {
2841  const size_t kend( min( i+SIMDSIZE, rows() ) );
2842  for( size_t k=i; k<kend; ++k )
2843  matrix_(j,k) = matrix_(k,j);
2844  }
2845  else {
2846  const size_t kend( min( j+SIMDSIZE, columns() ) );
2847  for( size_t k=j; k<kend; ++k )
2848  matrix_(k,i) = matrix_(i,k);
2849  }
2850 }
2852 //*************************************************************************************************
2853 
2854 
2855 //*************************************************************************************************
2872 template< typename MT // Type of the adapted dense matrix
2873  , bool SO > // Storage order of the adapted dense matrix
2874 inline void
2875  SymmetricMatrix<MT,SO,true,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2876 {
2877  matrix_.storea( i, j, value );
2878 
2879  if( SO ) {
2880  const size_t kend( min( i+SIMDSIZE, rows() ) );
2881  for( size_t k=i; k<kend; ++k )
2882  matrix_(j,k) = matrix_(k,j);
2883  }
2884  else {
2885  const size_t kend( min( j+SIMDSIZE, columns() ) );
2886  for( size_t k=j; k<kend; ++k )
2887  matrix_(k,i) = matrix_(i,k);
2888  }
2889 }
2891 //*************************************************************************************************
2892 
2893 
2894 //*************************************************************************************************
2911 template< typename MT // Type of the adapted dense matrix
2912  , bool SO > // Storage order of the adapted dense matrix
2913 inline void
2914  SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2915 {
2916  matrix_.storeu( i, j, value );
2917 
2918  if( SO ) {
2919  const size_t kend( min( i+SIMDSIZE, rows() ) );
2920  for( size_t k=i; k<kend; ++k )
2921  matrix_(j,k) = matrix_(k,j);
2922  }
2923  else {
2924  const size_t kend( min( j+SIMDSIZE, columns() ) );
2925  for( size_t k=j; k<kend; ++k )
2926  matrix_(k,i) = matrix_(i,k);
2927  }
2928 }
2930 //*************************************************************************************************
2931 
2932 
2933 //*************************************************************************************************
2950 template< typename MT // Type of the adapted dense matrix
2951  , bool SO > // Storage order of the adapted dense matrix
2952 inline void
2953  SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2954 {
2955  matrix_.stream( i, j, value );
2956 
2957  if( SO ) {
2958  const size_t kend( min( i+SIMDSIZE, rows() ) );
2959  for( size_t k=i; k<kend; ++k )
2960  matrix_(j,k) = matrix_(k,j);
2961  }
2962  else {
2963  const size_t kend( min( j+SIMDSIZE, columns() ) );
2964  for( size_t k=j; k<kend; ++k )
2965  matrix_(k,i) = matrix_(i,k);
2966  }
2967 }
2969 //*************************************************************************************************
2970 
2971 } // namespace blaze
2972 
2973 #endif
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:102
Header file for auxiliary alias declarations.
Constraint on the data type.
Header file for mathematical functions.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
Header file for the dense matrix inversion flags.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:194
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5556
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:596
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:390
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
Header file for the NumericProxy class.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2931
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:304
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:238
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5635
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5618
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:336
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:544
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for all forward declarations for expression class templates.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for all restructuring column functions.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:267
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:697
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:733
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:168
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:677
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:570