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 ET > // Data type of the other matrix
141  struct Rebind {
143  typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
144  };
145  //**********************************************************************************************
146 
147  //**Iterator class definition*******************************************************************
150  class Iterator
151  {
152  public:
153  //**Type definitions*************************************************************************
154  typedef std::random_access_iterator_tag IteratorCategory;
155  typedef ElementType_<MT> ValueType;
156  typedef NumericProxy<MT> PointerType;
157  typedef NumericProxy<MT> ReferenceType;
158  typedef ptrdiff_t DifferenceType;
159 
160  // STL iterator requirements
161  typedef IteratorCategory iterator_category;
162  typedef ValueType value_type;
163  typedef PointerType pointer;
164  typedef ReferenceType reference;
165  typedef DifferenceType difference_type;
166  //*******************************************************************************************
167 
168  //**Constructor******************************************************************************
171  inline Iterator() noexcept
172  : matrix_( nullptr ) // Reference to the adapted dense matrix
173  , row_ ( 0UL ) // The current row index of the iterator
174  , column_( 0UL ) // The current column index of the iterator
175  {}
176  //*******************************************************************************************
177 
178  //**Constructor******************************************************************************
185  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
186  : matrix_( &matrix ) // Reference to the adapted dense matrix
187  , row_ ( row ) // The current row index of the iterator
188  , column_( column ) // The current column index of the iterator
189  {}
190  //*******************************************************************************************
191 
192  //**Addition assignment operator*************************************************************
198  inline Iterator& operator+=( size_t inc ) noexcept {
199  ( SO )?( row_ += inc ):( column_ += inc );
200  return *this;
201  }
202  //*******************************************************************************************
203 
204  //**Subtraction assignment operator**********************************************************
210  inline Iterator& operator-=( size_t dec ) noexcept {
211  ( SO )?( row_ -= dec ):( column_ -= dec );
212  return *this;
213  }
214  //*******************************************************************************************
215 
216  //**Prefix increment operator****************************************************************
221  inline Iterator& operator++() noexcept {
222  ( SO )?( ++row_ ):( ++column_ );
223  return *this;
224  }
225  //*******************************************************************************************
226 
227  //**Postfix increment operator***************************************************************
232  inline const Iterator operator++( int ) noexcept {
233  const Iterator tmp( *this );
234  ++(*this);
235  return tmp;
236  }
237  //*******************************************************************************************
238 
239  //**Prefix decrement operator****************************************************************
244  inline Iterator& operator--() noexcept {
245  ( SO )?( --row_ ):( --column_ );
246  return *this;
247  }
248  //*******************************************************************************************
249 
250  //**Postfix decrement operator***************************************************************
255  inline const Iterator operator--( int ) noexcept {
256  const Iterator tmp( *this );
257  --(*this);
258  return tmp;
259  }
260  //*******************************************************************************************
261 
262  //**Element access operator******************************************************************
267  inline ReferenceType operator*() const {
268  return ReferenceType( *matrix_, row_, column_ );
269  }
270  //*******************************************************************************************
271 
272  //**Element access operator******************************************************************
277  inline PointerType operator->() const {
278  return PointerType( *matrix_, row_, column_ );
279  }
280  //*******************************************************************************************
281 
282  //**Load function****************************************************************************
292  inline SIMDType load() const {
293  return (*matrix_).load(row_,column_);
294  }
295  //*******************************************************************************************
296 
297  //**Loada function***************************************************************************
307  inline SIMDType loada() const {
308  return (*matrix_).loada(row_,column_);
309  }
310  //*******************************************************************************************
311 
312  //**Loadu function***************************************************************************
322  inline SIMDType loadu() const {
323  return (*matrix_).loadu(row_,column_);
324  }
325  //*******************************************************************************************
326 
327  //**Store function***************************************************************************
338  inline void store( const SIMDType& value ) const {
339  (*matrix_).store( row_, column_, value );
340  sync();
341  }
342  //*******************************************************************************************
343 
344  //**Storea function**************************************************************************
355  inline void storea( const SIMDType& value ) const {
356  (*matrix_).storea( row_, column_, value );
357  sync();
358  }
359  //*******************************************************************************************
360 
361  //**Storeu function**************************************************************************
372  inline void storeu( const SIMDType& value ) const {
373  (*matrix_).storeu( row_, column_, value );
374  sync();
375  }
376  //*******************************************************************************************
377 
378  //**Stream function**************************************************************************
389  inline void stream( const SIMDType& value ) const {
390  (*matrix_).stream( row_, column_, value );
391  sync();
392  }
393  //*******************************************************************************************
394 
395  //**Conversion operator**********************************************************************
400  inline operator ConstIterator() const {
401  if( SO )
402  return matrix_->begin( column_ ) + row_;
403  else
404  return matrix_->begin( row_ ) + column_;
405  }
406  //*******************************************************************************************
407 
408  //**Equality operator************************************************************************
415  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
416  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
417  }
418  //*******************************************************************************************
419 
420  //**Equality operator************************************************************************
427  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
428  return ( ConstIterator( lhs ) == rhs );
429  }
430  //*******************************************************************************************
431 
432  //**Equality operator************************************************************************
439  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
440  return ( lhs == ConstIterator( rhs ) );
441  }
442  //*******************************************************************************************
443 
444  //**Inequality operator**********************************************************************
451  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
452  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
453  }
454  //*******************************************************************************************
455 
456  //**Inequality operator**********************************************************************
463  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
464  return ( ConstIterator( lhs ) != rhs );
465  }
466  //*******************************************************************************************
467 
468  //**Inequality operator**********************************************************************
475  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
476  return ( lhs != ConstIterator( rhs ) );
477  }
478  //*******************************************************************************************
479 
480  //**Less-than operator***********************************************************************
487  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
488  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
489  }
490  //*******************************************************************************************
491 
492  //**Less-than operator***********************************************************************
499  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
500  return ( ConstIterator( lhs ) < rhs );
501  }
502  //*******************************************************************************************
503 
504  //**Less-than operator***********************************************************************
511  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
512  return ( lhs < ConstIterator( rhs ) );
513  }
514  //*******************************************************************************************
515 
516  //**Greater-than operator********************************************************************
523  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
524  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
525  }
526  //*******************************************************************************************
527 
528  //**Greater-than operator********************************************************************
535  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
536  return ( ConstIterator( lhs ) > rhs );
537  }
538  //*******************************************************************************************
539 
540  //**Greater-than operator********************************************************************
547  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
548  return ( lhs > ConstIterator( rhs ) );
549  }
550  //*******************************************************************************************
551 
552  //**Less-or-equal-than operator**************************************************************
559  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
560  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
561  }
562  //*******************************************************************************************
563 
564  //**Less-or-equal-than operator**************************************************************
571  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
572  return ( ConstIterator( lhs ) <= rhs );
573  }
574  //*******************************************************************************************
575 
576  //**Less-or-equal-than operator**************************************************************
583  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
584  return ( lhs <= ConstIterator( rhs ) );
585  }
586  //*******************************************************************************************
587 
588  //**Greater-or-equal-than operator***********************************************************
595  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
596  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
597  }
598  //*******************************************************************************************
599 
600  //**Greater-or-equal-than operator***********************************************************
607  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
608  return ( ConstIterator( lhs ) >= rhs );
609  }
610  //*******************************************************************************************
611 
612  //**Greater-or-equal-than operator***********************************************************
619  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
620  return ( lhs >= ConstIterator( rhs ) );
621  }
622  //*******************************************************************************************
623 
624  //**Subtraction operator*********************************************************************
630  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
631  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
632  }
633  //*******************************************************************************************
634 
635  //**Addition operator************************************************************************
642  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
643  if( SO )
644  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
645  else
646  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
647  }
648  //*******************************************************************************************
649 
650  //**Addition operator************************************************************************
657  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
658  if( SO )
659  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
660  else
661  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
662  }
663  //*******************************************************************************************
664 
665  //**Subtraction operator*********************************************************************
672  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
673  if( SO )
674  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
675  else
676  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
677  }
678  //*******************************************************************************************
679 
680  private:
681  //**Sync function****************************************************************************
686  void sync() const {
687  if( SO ) {
688  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
689  for( size_t k=row_; k<kend; ++k )
690  (*matrix_)(column_,k) = (*matrix_)(k,column_);
691  }
692  else {
693  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
694  for( size_t k=column_; k<kend; ++k )
695  (*matrix_)(k,row_) = (*matrix_)(row_,k);
696  }
697  }
698  //*******************************************************************************************
699 
700  //**Member variables*************************************************************************
701  MT* matrix_;
702  size_t row_;
703  size_t column_;
704  //*******************************************************************************************
705  };
706  //**********************************************************************************************
707 
708  //**Compilation flags***************************************************************************
710  enum : bool { simdEnabled = MT::simdEnabled };
711 
713  enum : bool { smpAssignable = MT::smpAssignable };
714  //**********************************************************************************************
715 
716  //**Constructors********************************************************************************
719  explicit inline SymmetricMatrix();
720  explicit inline SymmetricMatrix( size_t n );
721  explicit inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
722 
723  template< typename Other >
724  explicit inline SymmetricMatrix( size_t n, const Other* array );
725 
726  template< typename Other, size_t N >
727  explicit inline SymmetricMatrix( const Other (&array)[N][N] );
728 
729  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
730  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
731 
732  template< typename Deleter >
733  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, Deleter d );
734 
735  template< typename Deleter >
736  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
737 
738  inline SymmetricMatrix( const SymmetricMatrix& m );
739  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
740 
741  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
742  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
744  //**********************************************************************************************
745 
746  //**Destructor**********************************************************************************
747  // No explicitly declared destructor.
748  //**********************************************************************************************
749 
750  //**Data access functions***********************************************************************
753  inline Reference operator()( size_t i, size_t j );
754  inline ConstReference operator()( size_t i, size_t j ) const;
755  inline Reference at( size_t i, size_t j );
756  inline ConstReference at( size_t i, size_t j ) const;
757  inline ConstPointer data () const noexcept;
758  inline ConstPointer data ( size_t i ) const noexcept;
759  inline Iterator begin ( size_t i );
760  inline ConstIterator begin ( size_t i ) const;
761  inline ConstIterator cbegin( size_t i ) const;
762  inline Iterator end ( size_t i );
763  inline ConstIterator end ( size_t i ) const;
764  inline ConstIterator cend ( size_t i ) const;
766  //**********************************************************************************************
767 
768  //**Assignment operators************************************************************************
771  inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
772 
773  template< typename Other, size_t N >
774  inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
775 
776  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
777  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
778 
779  template< typename MT2 >
780  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
781 
782  template< typename MT2 >
783  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
784 
785  template< typename MT2 >
786  inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
787 
788  template< typename MT2 >
789  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
790 
791  template< typename MT2 >
792  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
793 
794  template< typename MT2 >
795  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
796 
797  template< typename MT2 >
798  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
799 
800  template< typename MT2 >
801  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
802 
803  template< typename MT2 >
804  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
805 
806  template< typename MT2, bool SO2 >
807  inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
808 
809  template< typename Other >
810  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator*=( Other rhs );
811 
812  template< typename Other >
813  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator/=( Other rhs );
815  //**********************************************************************************************
816 
817  //**Utility functions***************************************************************************
820  inline size_t rows() const noexcept;
821  inline size_t columns() const noexcept;
822  inline size_t spacing() const noexcept;
823  inline size_t capacity() const noexcept;
824  inline size_t capacity( size_t i ) const noexcept;
825  inline size_t nonZeros() const;
826  inline size_t nonZeros( size_t i ) const;
827  inline void reset();
828  inline void reset( size_t i );
829  inline void clear();
830  void resize ( size_t n, bool preserve=true );
831  inline void extend ( size_t n, bool preserve=true );
832  inline void reserve( size_t elements );
833  inline SymmetricMatrix& transpose();
834  inline SymmetricMatrix& ctranspose();
835  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
836  inline void swap( SymmetricMatrix& m ) noexcept;
838  //**********************************************************************************************
839 
840  //**Debugging functions*************************************************************************
843  inline bool isIntact() const noexcept;
845  //**********************************************************************************************
846 
847  //**Expression template evaluation functions****************************************************
850  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
851  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
852 
853  inline bool isAligned () const noexcept;
854  inline bool canSMPAssign() const noexcept;
855 
856  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
857  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
858  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
859 
860  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
861  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
862  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
863  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
865  //**********************************************************************************************
866 
867  private:
868  //**SIMD properties*****************************************************************************
870  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
871  //**********************************************************************************************
872 
873  //**Member variables****************************************************************************
876  MT matrix_;
877 
878  //**********************************************************************************************
879 
880  //**Friend declarations*************************************************************************
881  template< typename MT2, bool SO2, bool DF2, bool NF2 >
882  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
883 
884  template< InversionFlag IF, typename MT2, bool SO2 >
885  friend void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
886  //**********************************************************************************************
887 
888  //**Compile time checks*************************************************************************
902  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
903  //**********************************************************************************************
904 };
906 //*************************************************************************************************
907 
908 
909 
910 
911 //=================================================================================================
912 //
913 // CONSTRUCTORS
914 //
915 //=================================================================================================
916 
917 //*************************************************************************************************
921 template< typename MT // Type of the adapted dense matrix
922  , bool SO > // Storage order of the adapted dense matrix
923 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
924  : matrix_() // The adapted dense matrix
925 {
926  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
927  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
928 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
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( size_t n )
942  : matrix_( n, n, ElementType() ) // The adapted dense matrix
943 {
945 
946  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
947  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
948 }
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
976 template< typename MT // Type of the adapted dense matrix
977  , bool SO > // Storage order of the adapted dense matrix
978 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
979  : matrix_( list ) // The adapted dense matrix
980 {
981  if( !isSymmetric( matrix_ ) ) {
982  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
983  }
984 
985  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
986 }
988 //*************************************************************************************************
989 
990 
991 //*************************************************************************************************
1017 template< typename MT // Type of the adapted dense matrix
1018  , bool SO > // Storage order of the adapted dense matrix
1019 template< typename Other > // Data type of the initialization array
1020 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n, const Other* array )
1021  : matrix_( n, n, array ) // The adapted dense matrix
1022 {
1023  if( !isSymmetric( matrix_ ) ) {
1024  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1025  }
1026 
1027  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1028 }
1030 //*************************************************************************************************
1031 
1032 
1033 //*************************************************************************************************
1056 template< typename MT // Type of the adapted dense matrix
1057  , bool SO > // Storage order of the adapted dense matrix
1058 template< typename Other // Data type of the initialization array
1059  , size_t N > // Number of rows and columns of the initialization array
1060 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Other (&array)[N][N] )
1061  : matrix_( array ) // The adapted dense matrix
1062 {
1063  if( !isSymmetric( matrix_ ) ) {
1064  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1065  }
1066 
1067  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1068 }
1070 //*************************************************************************************************
1071 
1072 
1073 //*************************************************************************************************
1094 template< typename MT // Type of the adapted dense matrix
1095  , bool SO > // Storage order of the adapted dense matrix
1096 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n )
1097  : matrix_( ptr, n, n ) // The adapted dense matrix
1098 {
1099  if( !isSymmetric( matrix_ ) ) {
1100  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1101  }
1102 
1103  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1104 }
1106 //*************************************************************************************************
1107 
1108 
1109 //*************************************************************************************************
1132 template< typename MT // Type of the adapted dense matrix
1133  , bool SO > // Storage order of the adapted dense matrix
1134 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
1135  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1136 {
1137  if( !isSymmetric( matrix_ ) ) {
1138  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1139  }
1140 
1141  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1142 }
1144 //*************************************************************************************************
1145 
1146 
1147 //*************************************************************************************************
1168 template< typename MT // Type of the adapted dense matrix
1169  , bool SO > // Storage order of the adapted dense matrix
1170 template< typename Deleter > // Type of the custom deleter
1171 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, Deleter d )
1172  : matrix_( ptr, n, n, d ) // The adapted dense matrix
1173 {
1174  if( !isSymmetric( matrix_ ) ) {
1175  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1176  }
1177 
1178  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1179 }
1181 //*************************************************************************************************
1182 
1183 
1184 //*************************************************************************************************
1206 template< typename MT // Type of the adapted dense matrix
1207  , bool SO > // Storage order of the adapted dense matrix
1208 template< typename Deleter > // Type of the custom deleter
1209 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
1210  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
1211 {
1212  if( !isSymmetric( matrix_ ) ) {
1213  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1214  }
1215 
1216  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1217 }
1219 //*************************************************************************************************
1220 
1221 
1222 //*************************************************************************************************
1228 template< typename MT // Type of the adapted dense matrix
1229  , bool SO > // Storage order of the adapted dense matrix
1230 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
1231  : matrix_( m.matrix_ ) // The adapted dense matrix
1232 {
1233  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
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( SymmetricMatrix&& m ) noexcept
1249  : matrix_( std::move( 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 //*************************************************************************************************
1268 template< typename MT // Type of the adapted dense matrix
1269  , bool SO > // Storage order of the adapted dense matrix
1270 template< typename MT2 > // Type of the foreign matrix
1271 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
1272  : matrix_( ~m ) // The adapted dense matrix
1273 {
1274  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1275  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1276  }
1277 
1278  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1279  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1280 }
1282 //*************************************************************************************************
1283 
1284 
1285 //*************************************************************************************************
1295 template< typename MT // Type of the adapted dense matrix
1296  , bool SO > // Storage order of the adapted dense matrix
1297 template< typename MT2 > // Type of the foreign matrix
1298 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
1299  : matrix_( trans( ~m ) ) // The adapted dense matrix
1300 {
1301  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1302  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1303  }
1304 
1305  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1306  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1307 }
1309 //*************************************************************************************************
1310 
1311 
1312 
1313 
1314 //=================================================================================================
1315 //
1316 // DATA ACCESS FUNCTIONS
1317 //
1318 //=================================================================================================
1319 
1320 //*************************************************************************************************
1335 template< typename MT // Type of the adapted dense matrix
1336  , bool SO > // Storage order of the adapted dense matrix
1338  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
1339 {
1340  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1341  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1342 
1343  return Reference( matrix_, i, j );
1344 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1364 template< typename MT // Type of the adapted dense matrix
1365  , bool SO > // Storage order of the adapted dense matrix
1367  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
1368 {
1369  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1370  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1371 
1372  return matrix_(i,j);
1373 }
1375 //*************************************************************************************************
1376 
1377 
1378 //*************************************************************************************************
1394 template< typename MT // Type of the adapted dense matrix
1395  , bool SO > // Storage order of the adapted dense matrix
1397  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j )
1398 {
1399  if( i >= rows() ) {
1400  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1401  }
1402  if( j >= columns() ) {
1403  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1404  }
1405  return (*this)(i,j);
1406 }
1408 //*************************************************************************************************
1409 
1410 
1411 //*************************************************************************************************
1427 template< typename MT // Type of the adapted dense matrix
1428  , bool SO > // Storage order of the adapted dense matrix
1430  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j ) const
1431 {
1432  if( i >= rows() ) {
1433  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1434  }
1435  if( j >= columns() ) {
1436  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1437  }
1438  return (*this)(i,j);
1439 }
1441 //*************************************************************************************************
1442 
1443 
1444 //*************************************************************************************************
1458 template< typename MT // Type of the adapted dense matrix
1459  , bool SO > // Storage order of the adapted dense matrix
1460 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1461  SymmetricMatrix<MT,SO,true,true>::data() const noexcept
1462 {
1463  return matrix_.data();
1464 }
1466 //*************************************************************************************************
1467 
1468 
1469 //*************************************************************************************************
1480 template< typename MT // Type of the adapted dense matrix
1481  , bool SO > // Storage order of the adapted dense matrix
1482 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1483  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const noexcept
1484 {
1485  return matrix_.data(i);
1486 }
1488 //*************************************************************************************************
1489 
1490 
1491 //*************************************************************************************************
1503 template< typename MT // Type of the adapted dense matrix
1504  , bool SO > // Storage order of the adapted dense matrix
1507 {
1508  if( SO )
1509  return Iterator( matrix_, 0UL, i );
1510  else
1511  return Iterator( matrix_, i, 0UL );
1512 }
1514 //*************************************************************************************************
1515 
1516 
1517 //*************************************************************************************************
1529 template< typename MT // Type of the adapted dense matrix
1530  , bool SO > // Storage order of the adapted dense matrix
1532  SymmetricMatrix<MT,SO,true,true>::begin( size_t i ) const
1533 {
1534  return matrix_.begin(i);
1535 }
1537 //*************************************************************************************************
1538 
1539 
1540 //*************************************************************************************************
1552 template< typename MT // Type of the adapted dense matrix
1553  , bool SO > // Storage order of the adapted dense matrix
1556 {
1557  return matrix_.cbegin(i);
1558 }
1560 //*************************************************************************************************
1561 
1562 
1563 //*************************************************************************************************
1575 template< typename MT // Type of the adapted dense matrix
1576  , bool SO > // Storage order of the adapted dense matrix
1579 {
1580  if( SO )
1581  return Iterator( matrix_, rows(), i );
1582  else
1583  return Iterator( matrix_, i, columns() );
1584 }
1586 //*************************************************************************************************
1587 
1588 
1589 //*************************************************************************************************
1601 template< typename MT // Type of the adapted dense matrix
1602  , bool SO > // Storage order of the adapted dense matrix
1604  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1605 {
1606  return matrix_.end(i);
1607 }
1609 //*************************************************************************************************
1610 
1611 
1612 //*************************************************************************************************
1624 template< typename MT // Type of the adapted dense matrix
1625  , bool SO > // Storage order of the adapted dense matrix
1627  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1628 {
1629  return matrix_.cend(i);
1630 }
1632 //*************************************************************************************************
1633 
1634 
1635 
1636 
1637 //=================================================================================================
1638 //
1639 // ASSIGNMENT OPERATORS
1640 //
1641 //=================================================================================================
1642 
1643 //*************************************************************************************************
1667 template< typename MT // Type of the adapted dense matrix
1668  , bool SO > // Storage order of the adapted dense matrix
1669 inline SymmetricMatrix<MT,SO,true,true>&
1670  SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1671 {
1672  MT tmp( list );
1673 
1674  if( !isSymmetric( tmp ) ) {
1675  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1676  }
1677 
1678  matrix_ = std::move( tmp );
1679 
1680  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1681  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1682 
1683  return *this;
1684 }
1686 //*************************************************************************************************
1687 
1688 
1689 //*************************************************************************************************
1713 template< typename MT // Type of the adapted dense matrix
1714  , bool SO > // Storage order of the adapted dense matrix
1715 template< typename Other // Data type of the initialization array
1716  , size_t N > // Number of rows and columns of the initialization array
1717 inline SymmetricMatrix<MT,SO,true,true>&
1718  SymmetricMatrix<MT,SO,true,true>::operator=( const Other (&array)[N][N] )
1719 {
1720  MT tmp( array );
1721 
1722  if( !isSymmetric( tmp ) ) {
1723  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1724  }
1725 
1726  matrix_ = std::move( tmp );
1727 
1728  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1729  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1730 
1731  return *this;
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 //*************************************************************************************************
1747 template< typename MT // Type of the adapted dense matrix
1748  , bool SO > // Storage order of the adapted dense matrix
1749 inline SymmetricMatrix<MT,SO,true,true>&
1750  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1751 {
1752  matrix_ = rhs.matrix_;
1753 
1754  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1755  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1756 
1757  return *this;
1758 }
1760 //*************************************************************************************************
1761 
1762 
1763 //*************************************************************************************************
1770 template< typename MT // Type of the adapted dense matrix
1771  , bool SO > // Storage order of the adapted dense matrix
1772 inline SymmetricMatrix<MT,SO,true,true>&
1773  SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1774 {
1775  matrix_ = std::move( rhs.matrix_ );
1776 
1777  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1778  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1779 
1780  return *this;
1781 }
1783 //*************************************************************************************************
1784 
1785 
1786 //*************************************************************************************************
1799 template< typename MT // Type of the adapted dense matrix
1800  , bool SO > // Storage order of the adapted dense matrix
1801 template< typename MT2 > // Type of the right-hand side matrix
1802 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1803  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1804 {
1805  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1806  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1807  }
1808 
1809  matrix_ = ~rhs;
1810 
1811  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1812  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1813 
1814  return *this;
1815 }
1817 //*************************************************************************************************
1818 
1819 
1820 //*************************************************************************************************
1833 template< typename MT // Type of the adapted dense matrix
1834  , bool SO > // Storage order of the adapted dense matrix
1835 template< typename MT2 > // Type of the right-hand side matrix
1836 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1837  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1838 {
1839  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1840  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1841  }
1842 
1843  if( IsSymmetric<MT2>::value ) {
1844  matrix_ = ~rhs;
1845  }
1846  else {
1847  MT tmp( ~rhs );
1848 
1849  if( !isSymmetric( tmp ) ) {
1850  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1851  }
1852 
1853  matrix_ = std::move( tmp );
1854  }
1855 
1856  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1857  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1858 
1859  return *this;
1860 }
1862 //*************************************************************************************************
1863 
1864 
1865 //*************************************************************************************************
1878 template< typename MT // Type of the adapted dense matrix
1879  , bool SO > // Storage order of the adapted dense matrix
1880 template< typename MT2 > // Type of the right-hand side matrix
1881 inline SymmetricMatrix<MT,SO,true,true>&
1882  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1883 {
1884  return this->operator=( trans( ~rhs ) );
1885 }
1887 //*************************************************************************************************
1888 
1889 
1890 //*************************************************************************************************
1903 template< typename MT // Type of the adapted dense matrix
1904  , bool SO > // Storage order of the adapted dense matrix
1905 template< typename MT2 > // Type of the right-hand side matrix
1906 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1907  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1908 {
1909  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1910  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1911  }
1912 
1913  matrix_ += ~rhs;
1914 
1915  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1916  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1917 
1918  return *this;
1919 }
1921 //*************************************************************************************************
1922 
1923 
1924 //*************************************************************************************************
1937 template< typename MT // Type of the adapted dense matrix
1938  , bool SO > // Storage order of the adapted dense matrix
1939 template< typename MT2 > // Type of the right-hand side matrix
1940 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1941  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1942 {
1943  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1944  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1945  }
1946 
1947  if( IsSymmetric<MT2>::value ) {
1948  matrix_ += ~rhs;
1949  }
1950  else {
1951  const ResultType_<MT2> tmp( ~rhs );
1952 
1953  if( !isSymmetric( tmp ) ) {
1954  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1955  }
1956 
1957  matrix_ += tmp;
1958  }
1959 
1960  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1961  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1962 
1963  return *this;
1964 }
1966 //*************************************************************************************************
1967 
1968 
1969 //*************************************************************************************************
1983 template< typename MT // Type of the adapted dense matrix
1984  , bool SO > // Storage order of the adapted dense matrix
1985 template< typename MT2 > // Type of the right-hand side matrix
1986 inline SymmetricMatrix<MT,SO,true,true>&
1987  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1988 {
1989  return this->operator+=( trans( ~rhs ) );
1990 }
1992 //*************************************************************************************************
1993 
1994 
1995 //*************************************************************************************************
2008 template< typename MT // Type of the adapted dense matrix
2009  , bool SO > // Storage order of the adapted dense matrix
2010 template< typename MT2 > // Type of the right-hand side matrix
2011 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2012  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2013 {
2014  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
2015  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2016  }
2017 
2018  matrix_ -= ~rhs;
2019 
2020  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2021  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2022 
2023  return *this;
2024 }
2026 //*************************************************************************************************
2027 
2028 
2029 //*************************************************************************************************
2042 template< typename MT // Type of the adapted dense matrix
2043  , bool SO > // Storage order of the adapted dense matrix
2044 template< typename MT2 > // Type of the right-hand side matrix
2045 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2046  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2047 {
2048  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2049  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2050  }
2051 
2052  if( IsSymmetric<MT2>::value ) {
2053  matrix_ -= ~rhs;
2054  }
2055  else {
2056  const ResultType_<MT2> tmp( ~rhs );
2057 
2058  if( !isSymmetric( tmp ) ) {
2059  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2060  }
2061 
2062  matrix_ -= tmp;
2063  }
2064 
2065  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2066  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2067 
2068  return *this;
2069 }
2071 //*************************************************************************************************
2072 
2073 
2074 //*************************************************************************************************
2088 template< typename MT // Type of the adapted dense matrix
2089  , bool SO > // Storage order of the adapted dense matrix
2090 template< typename MT2 > // Type of the right-hand side matrix
2091 inline SymmetricMatrix<MT,SO,true,true>&
2092  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2093 {
2094  return this->operator-=( trans( ~rhs ) );
2095 }
2097 //*************************************************************************************************
2098 
2099 
2100 //*************************************************************************************************
2112 template< typename MT // Type of the adapted dense matrix
2113  , bool SO > // Storage order of the adapted dense matrix
2114 template< typename MT2 // Type of the right-hand side matrix
2115  , bool SO2 > // Storage order of the right-hand side matrix
2116 inline SymmetricMatrix<MT,SO,true,true>&
2117  SymmetricMatrix<MT,SO,true,true>::operator*=( const Matrix<MT2,SO2>& rhs )
2118 {
2119  if( matrix_.rows() != (~rhs).columns() ) {
2120  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2121  }
2122 
2123  MT tmp( matrix_ * ~rhs );
2124 
2125  if( !isSymmetric( tmp ) ) {
2126  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2127  }
2128 
2129  matrix_ = std::move( tmp );
2130 
2131  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2132  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2133 
2134  return *this;
2135 }
2137 //*************************************************************************************************
2138 
2139 
2140 //*************************************************************************************************
2148 template< typename MT // Type of the adapted dense matrix
2149  , bool SO > // Storage order of the adapted dense matrix
2150 template< typename Other > // Data type of the right-hand side scalar
2151 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >&
2153 {
2154  matrix_ *= rhs;
2155  return *this;
2156 }
2157 //*************************************************************************************************
2158 
2159 
2160 //*************************************************************************************************
2168 template< typename MT // Type of the adapted dense matrix
2169  , bool SO > // Storage order of the adapted dense matrix
2170 template< typename Other > // Data type of the right-hand side scalar
2171 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >&
2173 {
2174  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2175 
2176  matrix_ /= rhs;
2177  return *this;
2178 }
2180 //*************************************************************************************************
2181 
2182 
2183 
2184 
2185 //=================================================================================================
2186 //
2187 // UTILITY FUNCTIONS
2188 //
2189 //=================================================================================================
2190 
2191 //*************************************************************************************************
2197 template< typename MT // Type of the adapted dense matrix
2198  , bool SO > // Storage order of the adapted dense matrix
2199 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const noexcept
2200 {
2201  return matrix_.rows();
2202 }
2204 //*************************************************************************************************
2205 
2206 
2207 //*************************************************************************************************
2213 template< typename MT // Type of the adapted dense matrix
2214  , bool SO > // Storage order of the adapted dense matrix
2215 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const noexcept
2216 {
2217  return matrix_.columns();
2218 }
2220 //*************************************************************************************************
2221 
2222 
2223 //*************************************************************************************************
2235 template< typename MT // Type of the adapted dense matrix
2236  , bool SO > // Storage order of the adapted dense matrix
2237 inline size_t SymmetricMatrix<MT,SO,true,true>::spacing() const noexcept
2238 {
2239  return matrix_.spacing();
2240 }
2242 //*************************************************************************************************
2243 
2244 
2245 //*************************************************************************************************
2251 template< typename MT // Type of the adapted dense matrix
2252  , bool SO > // Storage order of the adapted dense matrix
2253 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const noexcept
2254 {
2255  return matrix_.capacity();
2256 }
2258 //*************************************************************************************************
2259 
2260 
2261 //*************************************************************************************************
2272 template< typename MT // Type of the adapted dense matrix
2273  , bool SO > // Storage order of the adapted dense matrix
2274 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const noexcept
2275 {
2276  return matrix_.capacity(i);
2277 }
2279 //*************************************************************************************************
2280 
2281 
2282 //*************************************************************************************************
2288 template< typename MT // Type of the adapted dense matrix
2289  , bool SO > // Storage order of the adapted dense matrix
2290 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
2291 {
2292  return matrix_.nonZeros();
2293 }
2295 //*************************************************************************************************
2296 
2297 
2298 //*************************************************************************************************
2310 template< typename MT // Type of the adapted dense matrix
2311  , bool SO > // Storage order of the adapted dense matrix
2312 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
2313 {
2314  return matrix_.nonZeros(i);
2315 }
2317 //*************************************************************************************************
2318 
2319 
2320 //*************************************************************************************************
2326 template< typename MT // Type of the adapted dense matrix
2327  , bool SO > // Storage order of the adapted dense matrix
2329 {
2330  matrix_.reset();
2331 }
2333 //*************************************************************************************************
2334 
2335 
2336 //*************************************************************************************************
2372 template< typename MT // Type of the adapted dense matrix
2373  , bool SO > // Storage order of the adapted dense matrix
2374 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
2375 {
2376  row ( matrix_, i ).reset();
2377  column( matrix_, i ).reset();
2378 }
2380 //*************************************************************************************************
2381 
2382 
2383 //*************************************************************************************************
2395 template< typename MT // Type of the adapted dense matrix
2396  , bool SO > // Storage order of the adapted dense matrix
2398 {
2399  using blaze::clear;
2400 
2401  clear( matrix_ );
2402 }
2404 //*************************************************************************************************
2405 
2406 
2407 //*************************************************************************************************
2442 template< typename MT // Type of the adapted dense matrix
2443  , bool SO > // Storage order of the adapted dense matrix
2444 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
2445 {
2447 
2448  UNUSED_PARAMETER( preserve );
2449 
2450  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2451 
2452  const size_t oldsize( matrix_.rows() );
2453 
2454  matrix_.resize( n, n, true );
2455 
2456  if( n > oldsize ) {
2457  const size_t increment( n - oldsize );
2458  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2459  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2460  }
2461 }
2463 //*************************************************************************************************
2464 
2465 
2466 //*************************************************************************************************
2479 template< typename MT // Type of the adapted dense matrix
2480  , bool SO > // Storage order of the adapted dense matrix
2481 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
2482 {
2484 
2485  UNUSED_PARAMETER( preserve );
2486 
2487  resize( rows() + n, true );
2488 }
2489 //*************************************************************************************************
2490 
2491 
2492 //*************************************************************************************************
2502 template< typename MT // Type of the adapted dense matrix
2503  , bool SO > // Storage order of the adapted dense matrix
2504 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
2505 {
2506  matrix_.reserve( elements );
2507 }
2509 //*************************************************************************************************
2510 
2511 
2512 //*************************************************************************************************
2518 template< typename MT // Type of the adapted dense matrix
2519  , bool SO > // Storage order of the adapted dense matrix
2520 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
2521 {
2522  return *this;
2523 }
2525 //*************************************************************************************************
2526 
2527 
2528 //*************************************************************************************************
2534 template< typename MT // Type of the adapted dense matrix
2535  , bool SO > // Storage order of the adapted dense matrix
2536 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::ctranspose()
2537 {
2538  if( !IsBuiltin<ElementType>::value )
2539  conjugate( matrix_ );
2540 
2541  return *this;
2542 }
2544 //*************************************************************************************************
2545 
2546 
2547 //*************************************************************************************************
2554 template< typename MT // Type of the adapted dense matrix
2555  , bool SO > // Storage order of the adapted dense matrix
2556 template< typename Other > // Data type of the scalar value
2557 inline SymmetricMatrix<MT,SO,true,true>&
2558  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
2559 {
2560  matrix_.scale( scalar );
2561  return *this;
2562 }
2564 //*************************************************************************************************
2565 
2566 
2567 //*************************************************************************************************
2574 template< typename MT // Type of the adapted dense matrix
2575  , bool SO > // Storage order of the adapted dense matrix
2576 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) noexcept
2577 {
2578  using std::swap;
2579 
2580  swap( matrix_, m.matrix_ );
2581 }
2583 //*************************************************************************************************
2584 
2585 
2586 
2587 
2588 //=================================================================================================
2589 //
2590 // DEBUGGING FUNCTIONS
2591 //
2592 //=================================================================================================
2593 
2594 //*************************************************************************************************
2604 template< typename MT // Type of the adapted dense matrix
2605  , bool SO > // Storage order of the adapted dense matrix
2606 inline bool SymmetricMatrix<MT,SO,true,true>::isIntact() const noexcept
2607 {
2608  using blaze::isIntact;
2609 
2610  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2611 }
2613 //*************************************************************************************************
2614 
2615 
2616 
2617 
2618 //=================================================================================================
2619 //
2620 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2621 //
2622 //=================================================================================================
2623 
2624 //*************************************************************************************************
2635 template< typename MT // Type of the adapted dense matrix
2636  , bool SO > // Storage order of the adapted dense matrix
2637 template< typename Other > // Data type of the foreign expression
2638 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const noexcept
2639 {
2640  return matrix_.canAlias( alias );
2641 }
2643 //*************************************************************************************************
2644 
2645 
2646 //*************************************************************************************************
2657 template< typename MT // Type of the adapted dense matrix
2658  , bool SO > // Storage order of the adapted dense matrix
2659 template< typename Other > // Data type of the foreign expression
2660 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const noexcept
2661 {
2662  return matrix_.isAliased( alias );
2663 }
2665 //*************************************************************************************************
2666 
2667 
2668 //*************************************************************************************************
2678 template< typename MT // Type of the adapted dense matrix
2679  , bool SO > // Storage order of the adapted dense matrix
2680 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2681 {
2682  return matrix_.isAligned();
2683 }
2685 //*************************************************************************************************
2686 
2687 
2688 //*************************************************************************************************
2699 template< typename MT // Type of the adapted dense matrix
2700  , bool SO > // Storage order of the adapted dense matrix
2701 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2702 {
2703  return matrix_.canSMPAssign();
2704 }
2706 //*************************************************************************************************
2707 
2708 
2709 //*************************************************************************************************
2725 template< typename MT // Type of the adapted dense matrix
2726  , bool SO > // Storage order of the adapted dense matrix
2727 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2728  SymmetricMatrix<MT,SO,true,true>::load( size_t i, size_t j ) const noexcept
2729 {
2730  return matrix_.load( i, j );
2731 }
2733 //*************************************************************************************************
2734 
2735 
2736 //*************************************************************************************************
2752 template< typename MT // Type of the adapted dense matrix
2753  , bool SO > // Storage order of the adapted dense matrix
2754 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2755  SymmetricMatrix<MT,SO,true,true>::loada( size_t i, size_t j ) const noexcept
2756 {
2757  return matrix_.loada( i, j );
2758 }
2760 //*************************************************************************************************
2761 
2762 
2763 //*************************************************************************************************
2779 template< typename MT // Type of the adapted dense matrix
2780  , bool SO > // Storage order of the adapted dense matrix
2781 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2782  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const noexcept
2783 {
2784  return matrix_.loadu( i, j );
2785 }
2787 //*************************************************************************************************
2788 
2789 
2790 //*************************************************************************************************
2807 template< typename MT // Type of the adapted dense matrix
2808  , bool SO > // Storage order of the adapted dense matrix
2809 inline void
2810  SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2811 {
2812  matrix_.store( i, j, value );
2813 
2814  if( SO ) {
2815  const size_t kend( min( i+SIMDSIZE, rows() ) );
2816  for( size_t k=i; k<kend; ++k )
2817  matrix_(j,k) = matrix_(k,j);
2818  }
2819  else {
2820  const size_t kend( min( j+SIMDSIZE, columns() ) );
2821  for( size_t k=j; k<kend; ++k )
2822  matrix_(k,i) = matrix_(i,k);
2823  }
2824 }
2826 //*************************************************************************************************
2827 
2828 
2829 //*************************************************************************************************
2846 template< typename MT // Type of the adapted dense matrix
2847  , bool SO > // Storage order of the adapted dense matrix
2848 inline void
2849  SymmetricMatrix<MT,SO,true,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2850 {
2851  matrix_.storea( i, j, value );
2852 
2853  if( SO ) {
2854  const size_t kend( min( i+SIMDSIZE, rows() ) );
2855  for( size_t k=i; k<kend; ++k )
2856  matrix_(j,k) = matrix_(k,j);
2857  }
2858  else {
2859  const size_t kend( min( j+SIMDSIZE, columns() ) );
2860  for( size_t k=j; k<kend; ++k )
2861  matrix_(k,i) = matrix_(i,k);
2862  }
2863 }
2865 //*************************************************************************************************
2866 
2867 
2868 //*************************************************************************************************
2885 template< typename MT // Type of the adapted dense matrix
2886  , bool SO > // Storage order of the adapted dense matrix
2887 inline void
2888  SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2889 {
2890  matrix_.storeu( i, j, value );
2891 
2892  if( SO ) {
2893  const size_t kend( min( i+SIMDSIZE, rows() ) );
2894  for( size_t k=i; k<kend; ++k )
2895  matrix_(j,k) = matrix_(k,j);
2896  }
2897  else {
2898  const size_t kend( min( j+SIMDSIZE, columns() ) );
2899  for( size_t k=j; k<kend; ++k )
2900  matrix_(k,i) = matrix_(i,k);
2901  }
2902 }
2904 //*************************************************************************************************
2905 
2906 
2907 //*************************************************************************************************
2924 template< typename MT // Type of the adapted dense matrix
2925  , bool SO > // Storage order of the adapted dense matrix
2926 inline void
2927  SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2928 {
2929  matrix_.stream( i, j, value );
2930 
2931  if( SO ) {
2932  const size_t kend( min( i+SIMDSIZE, rows() ) );
2933  for( size_t k=i; k<kend; ++k )
2934  matrix_(j,k) = matrix_(k,j);
2935  }
2936  else {
2937  const size_t kend( min( j+SIMDSIZE, columns() ) );
2938  for( size_t k=j; k<kend; ++k )
2939  matrix_(k,i) = matrix_(i,k);
2940  }
2941 }
2943 //*************************************************************************************************
2944 
2945 } // namespace blaze
2946 
2947 #endif
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Constraint on the data type.
Header file for mathematical functions.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:404
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
Header file for the dense matrix inversion flags.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:689
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2643
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5077
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:590
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:442
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:384
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
STL namespace.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
Header file for the NumericProxy class.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2639
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:298
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:232
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
constexpr bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
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:5148
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5131
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Header file for all forward declarations for expression class templates.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for all restructuring column functions.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:258
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
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2637
bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:328
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:167
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:609
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:564