Blaze  3.6
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>
60 #include <blaze/math/Exception.h>
65 #include <blaze/math/shims/Clear.h>
68 #include <blaze/math/SIMD.h>
73 #include <blaze/math/views/Check.h>
75 #include <blaze/math/views/Row.h>
77 #include <blaze/system/Inline.h>
79 #include <blaze/util/Assert.h>
85 #include <blaze/util/DisableIf.h>
86 #include <blaze/util/EnableIf.h>
87 #include <blaze/util/MaybeUnused.h>
88 #include <blaze/util/mpl/If.h>
90 #include <blaze/util/Types.h>
93 
94 
95 namespace blaze {
96 
97 //=================================================================================================
98 //
99 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NUMERIC ELEMENT TYPE
100 //
101 //=================================================================================================
102 
103 //*************************************************************************************************
111 template< typename MT // Type of the adapted dense matrix
112  , bool SO > // Storage order of the adapted dense matrix
113 class SymmetricMatrix<MT,SO,true,true>
114  : public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
115 {
116  private:
117  //**Type definitions****************************************************************************
118  using OT = OppositeType_t<MT>;
119  using TT = TransposeType_t<MT>;
120  using ET = ElementType_t<MT>;
121  //**********************************************************************************************
122 
123  public:
124  //**Type definitions****************************************************************************
125  using This = SymmetricMatrix<MT,SO,true,true>;
126  using BaseType = DenseMatrix<This,SO>;
127  using ResultType = This;
128  using OppositeType = SymmetricMatrix<OT,!SO,true,true>;
129  using TransposeType = SymmetricMatrix<TT,!SO,true,true>;
130  using ElementType = ET;
131  using SIMDType = SIMDType_t<MT>;
132  using ReturnType = ReturnType_t<MT>;
133  using CompositeType = const This&;
134  using Reference = NumericProxy<MT>;
135  using ConstReference = ConstReference_t<MT>;
136  using Pointer = Pointer_t<MT>;
137  using ConstPointer = ConstPointer_t<MT>;
138  using ConstIterator = ConstIterator_t<MT>;
139  //**********************************************************************************************
140 
141  //**Rebind struct definition********************************************************************
144  template< typename NewType > // Data type of the other matrix
145  struct Rebind {
147  using Other = SymmetricMatrix< typename MT::template Rebind<NewType>::Other >;
148  };
149  //**********************************************************************************************
150 
151  //**Resize struct definition********************************************************************
154  template< size_t NewM // Number of rows of the other matrix
155  , size_t NewN > // Number of columns of the other matrix
156  struct Resize {
158  using Other = SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other >;
159  };
160  //**********************************************************************************************
161 
162  //**Iterator class definition*******************************************************************
165  class Iterator
166  {
167  public:
168  //**Type definitions*************************************************************************
169  using IteratorCategory = std::random_access_iterator_tag;
170  using ValueType = ElementType_t<MT>;
171  using PointerType = NumericProxy<MT>;
172  using ReferenceType = NumericProxy<MT>;
173  using DifferenceType = ptrdiff_t;
174 
175  // STL iterator requirements
176  using iterator_category = IteratorCategory;
177  using value_type = ValueType;
178  using pointer = PointerType;
179  using reference = ReferenceType;
180  using difference_type = DifferenceType;
181  //*******************************************************************************************
182 
183  //**Constructor******************************************************************************
186  inline Iterator() noexcept
187  : matrix_( nullptr ) // Reference to the adapted dense matrix
188  , row_ ( 0UL ) // The current row index of the iterator
189  , column_( 0UL ) // The current column index of the iterator
190  {}
191  //*******************************************************************************************
192 
193  //**Constructor******************************************************************************
200  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
201  : matrix_( &matrix ) // Reference to the adapted dense matrix
202  , row_ ( row ) // The current row index of the iterator
203  , column_( column ) // The current column index of the iterator
204  {}
205  //*******************************************************************************************
206 
207  //**Addition assignment operator*************************************************************
213  inline Iterator& operator+=( size_t inc ) noexcept {
214  ( SO )?( row_ += inc ):( column_ += inc );
215  return *this;
216  }
217  //*******************************************************************************************
218 
219  //**Subtraction assignment operator**********************************************************
225  inline Iterator& operator-=( size_t dec ) noexcept {
226  ( SO )?( row_ -= dec ):( column_ -= dec );
227  return *this;
228  }
229  //*******************************************************************************************
230 
231  //**Prefix increment operator****************************************************************
236  inline Iterator& operator++() noexcept {
237  ( SO )?( ++row_ ):( ++column_ );
238  return *this;
239  }
240  //*******************************************************************************************
241 
242  //**Postfix increment operator***************************************************************
247  inline const Iterator operator++( int ) noexcept {
248  const Iterator tmp( *this );
249  ++(*this);
250  return tmp;
251  }
252  //*******************************************************************************************
253 
254  //**Prefix decrement operator****************************************************************
259  inline Iterator& operator--() noexcept {
260  ( SO )?( --row_ ):( --column_ );
261  return *this;
262  }
263  //*******************************************************************************************
264 
265  //**Postfix decrement operator***************************************************************
270  inline const Iterator operator--( int ) noexcept {
271  const Iterator tmp( *this );
272  --(*this);
273  return tmp;
274  }
275  //*******************************************************************************************
276 
277  //**Element access operator******************************************************************
282  inline ReferenceType operator*() const {
283  return ReferenceType( *matrix_, row_, column_ );
284  }
285  //*******************************************************************************************
286 
287  //**Element access operator******************************************************************
292  inline PointerType operator->() const {
293  return PointerType( *matrix_, row_, column_ );
294  }
295  //*******************************************************************************************
296 
297  //**Load function****************************************************************************
307  inline SIMDType load() const {
308  return (*matrix_).load(row_,column_);
309  }
310  //*******************************************************************************************
311 
312  //**Loada function***************************************************************************
322  inline SIMDType loada() const {
323  return (*matrix_).loada(row_,column_);
324  }
325  //*******************************************************************************************
326 
327  //**Loadu function***************************************************************************
337  inline SIMDType loadu() const {
338  return (*matrix_).loadu(row_,column_);
339  }
340  //*******************************************************************************************
341 
342  //**Store function***************************************************************************
353  inline void store( const SIMDType& value ) const {
354  (*matrix_).store( row_, column_, value );
355  sync();
356  }
357  //*******************************************************************************************
358 
359  //**Storea function**************************************************************************
370  inline void storea( const SIMDType& value ) const {
371  (*matrix_).storea( row_, column_, value );
372  sync();
373  }
374  //*******************************************************************************************
375 
376  //**Storeu function**************************************************************************
387  inline void storeu( const SIMDType& value ) const {
388  (*matrix_).storeu( row_, column_, value );
389  sync();
390  }
391  //*******************************************************************************************
392 
393  //**Stream function**************************************************************************
404  inline void stream( const SIMDType& value ) const {
405  (*matrix_).stream( row_, column_, value );
406  sync();
407  }
408  //*******************************************************************************************
409 
410  //**Conversion operator**********************************************************************
415  inline operator ConstIterator() const {
416  if( SO )
417  return matrix_->begin( column_ ) + row_;
418  else
419  return matrix_->begin( row_ ) + column_;
420  }
421  //*******************************************************************************************
422 
423  //**Equality operator************************************************************************
430  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
431  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
432  }
433  //*******************************************************************************************
434 
435  //**Equality operator************************************************************************
442  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
443  return ( ConstIterator( lhs ) == rhs );
444  }
445  //*******************************************************************************************
446 
447  //**Equality operator************************************************************************
454  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
455  return ( lhs == ConstIterator( rhs ) );
456  }
457  //*******************************************************************************************
458 
459  //**Inequality operator**********************************************************************
466  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
467  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
468  }
469  //*******************************************************************************************
470 
471  //**Inequality operator**********************************************************************
478  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
479  return ( ConstIterator( lhs ) != rhs );
480  }
481  //*******************************************************************************************
482 
483  //**Inequality operator**********************************************************************
490  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
491  return ( lhs != ConstIterator( rhs ) );
492  }
493  //*******************************************************************************************
494 
495  //**Less-than operator***********************************************************************
502  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
503  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
504  }
505  //*******************************************************************************************
506 
507  //**Less-than operator***********************************************************************
514  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
515  return ( ConstIterator( lhs ) < rhs );
516  }
517  //*******************************************************************************************
518 
519  //**Less-than operator***********************************************************************
526  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
527  return ( lhs < ConstIterator( rhs ) );
528  }
529  //*******************************************************************************************
530 
531  //**Greater-than operator********************************************************************
538  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
539  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
540  }
541  //*******************************************************************************************
542 
543  //**Greater-than operator********************************************************************
550  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
551  return ( ConstIterator( lhs ) > rhs );
552  }
553  //*******************************************************************************************
554 
555  //**Greater-than operator********************************************************************
562  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
563  return ( lhs > ConstIterator( rhs ) );
564  }
565  //*******************************************************************************************
566 
567  //**Less-or-equal-than operator**************************************************************
574  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
575  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
576  }
577  //*******************************************************************************************
578 
579  //**Less-or-equal-than operator**************************************************************
586  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
587  return ( ConstIterator( lhs ) <= rhs );
588  }
589  //*******************************************************************************************
590 
591  //**Less-or-equal-than operator**************************************************************
598  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
599  return ( lhs <= ConstIterator( rhs ) );
600  }
601  //*******************************************************************************************
602 
603  //**Greater-or-equal-than operator***********************************************************
610  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
611  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
612  }
613  //*******************************************************************************************
614 
615  //**Greater-or-equal-than operator***********************************************************
622  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
623  return ( ConstIterator( lhs ) >= rhs );
624  }
625  //*******************************************************************************************
626 
627  //**Greater-or-equal-than operator***********************************************************
634  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
635  return ( lhs >= ConstIterator( rhs ) );
636  }
637  //*******************************************************************************************
638 
639  //**Subtraction operator*********************************************************************
645  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
646  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
647  }
648  //*******************************************************************************************
649 
650  //**Addition operator************************************************************************
657  friend inline const Iterator operator+( const Iterator& it, size_t inc ) 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  //**Addition operator************************************************************************
672  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
673  if( SO )
674  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
675  else
676  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
677  }
678  //*******************************************************************************************
679 
680  //**Subtraction operator*********************************************************************
687  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
688  if( SO )
689  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
690  else
691  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
692  }
693  //*******************************************************************************************
694 
695  private:
696  //**Sync function****************************************************************************
701  void sync() const {
702  if( SO ) {
703  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
704  for( size_t k=row_; k<kend; ++k )
705  (*matrix_)(column_,k) = (*matrix_)(k,column_);
706  }
707  else {
708  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
709  for( size_t k=column_; k<kend; ++k )
710  (*matrix_)(k,row_) = (*matrix_)(row_,k);
711  }
712  }
713  //*******************************************************************************************
714 
715  //**Member variables*************************************************************************
716  MT* matrix_;
717  size_t row_;
718  size_t column_;
719  //*******************************************************************************************
720  };
721  //**********************************************************************************************
722 
723  //**Compilation flags***************************************************************************
725  static constexpr bool simdEnabled = MT::simdEnabled;
726 
728  static constexpr bool smpAssignable = MT::smpAssignable;
729  //**********************************************************************************************
730 
731  //**Constructors********************************************************************************
734  explicit inline SymmetricMatrix();
735  explicit inline SymmetricMatrix( size_t n );
736  inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
737 
738  template< typename Other >
739  explicit inline SymmetricMatrix( size_t n, const Other* array );
740 
741  template< typename Other, size_t N >
742  explicit inline SymmetricMatrix( const Other (&array)[N][N] );
743 
744  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
745  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
746 
747  inline SymmetricMatrix( const SymmetricMatrix& m );
748  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
749 
750  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
751  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
753  //**********************************************************************************************
754 
755  //**Destructor**********************************************************************************
758  ~SymmetricMatrix() = default;
760  //**********************************************************************************************
761 
762  //**Data access functions***********************************************************************
765  inline Reference operator()( size_t i, size_t j );
766  inline ConstReference operator()( size_t i, size_t j ) const;
767  inline Reference at( size_t i, size_t j );
768  inline ConstReference at( size_t i, size_t j ) const;
769  inline ConstPointer data () const noexcept;
770  inline ConstPointer data ( size_t i ) const noexcept;
771  inline Iterator begin ( size_t i );
772  inline ConstIterator begin ( size_t i ) const;
773  inline ConstIterator cbegin( size_t i ) const;
774  inline Iterator end ( size_t i );
775  inline ConstIterator end ( size_t i ) const;
776  inline ConstIterator cend ( size_t i ) const;
778  //**********************************************************************************************
779 
780  //**Assignment operators************************************************************************
783  inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
784 
785  template< typename Other, size_t N >
786  inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
787 
788  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
789  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
790 
791  template< typename MT2 >
792  inline auto operator=( const Matrix<MT2,SO>& rhs )
793  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
794 
795  template< typename MT2 >
796  inline auto operator=( const Matrix<MT2,SO>& rhs )
797  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
798 
799  template< typename MT2 >
800  inline auto operator=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
801 
802  template< typename MT2 >
803  inline auto operator+=( const Matrix<MT2,SO>& rhs )
804  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
805 
806  template< typename MT2 >
807  inline auto operator+=( const Matrix<MT2,SO>& rhs )
808  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
809 
810  template< typename MT2 >
811  inline auto operator+=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
812 
813  template< typename MT2 >
814  inline auto operator-=( const Matrix<MT2,SO>& rhs )
815  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
816 
817  template< typename MT2 >
818  inline auto operator-=( const Matrix<MT2,SO>& rhs )
819  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
820 
821  template< typename MT2 >
822  inline auto operator-=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
823 
824  template< typename MT2 >
825  inline auto operator%=( const Matrix<MT2,SO>& rhs )
826  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
827 
828  template< typename MT2 >
829  inline auto operator%=( const Matrix<MT2,SO>& rhs )
830  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
831 
832  template< typename MT2 >
833  inline auto operator%=( const Matrix<MT2,!SO>& rhs )
834  -> SymmetricMatrix&;
835 
836  template< typename ST >
837  inline auto operator*=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >;
838 
839  template< typename ST >
840  inline auto operator/=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >;
842  //**********************************************************************************************
843 
844  //**Utility functions***************************************************************************
847  inline size_t rows() const noexcept;
848  inline size_t columns() const noexcept;
849  inline size_t spacing() const noexcept;
850  inline size_t capacity() const noexcept;
851  inline size_t capacity( size_t i ) const noexcept;
852  inline size_t nonZeros() const;
853  inline size_t nonZeros( size_t i ) const;
854  inline void reset();
855  inline void reset( size_t i );
856  inline void clear();
857  void resize ( size_t n, bool preserve=true );
858  inline void extend ( size_t n, bool preserve=true );
859  inline void reserve( size_t elements );
860  inline void shrinkToFit();
861  inline void swap( SymmetricMatrix& m ) noexcept;
863  //**********************************************************************************************
864 
865  //**Numeric functions***************************************************************************
868  inline SymmetricMatrix& transpose();
869  inline SymmetricMatrix& ctranspose();
870 
871  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
873  //**********************************************************************************************
874 
875  //**Debugging functions*************************************************************************
878  inline bool isIntact() const noexcept;
880  //**********************************************************************************************
881 
882  //**Expression template evaluation functions****************************************************
885  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
886  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
887 
888  inline bool isAligned () const noexcept;
889  inline bool canSMPAssign() const noexcept;
890 
891  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
892  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
893  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
894 
895  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
896  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
897  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
898  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
900  //**********************************************************************************************
901 
902  private:
903  //**SIMD properties*****************************************************************************
905  static constexpr size_t SIMDSIZE = SIMDTrait<ET>::size;
906  //**********************************************************************************************
907 
908  //**Member variables****************************************************************************
911  MT matrix_;
912 
913  //**********************************************************************************************
914 
915  //**Friend declarations*************************************************************************
916  template< bool RF, typename MT2, bool SO2, bool DF2, bool NF2 >
917  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
918 
919  template< InversionFlag IF, typename MT2, bool SO2 >
920  friend void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
921  //**********************************************************************************************
922 
923  //**Compile time checks*************************************************************************
939  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
940  //**********************************************************************************************
941 };
943 //*************************************************************************************************
944 
945 
946 
947 
948 //=================================================================================================
949 //
950 // CONSTRUCTORS
951 //
952 //=================================================================================================
953 
954 //*************************************************************************************************
958 template< typename MT // Type of the adapted dense matrix
959  , bool SO > // Storage order of the adapted dense matrix
960 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
961  : matrix_() // The adapted dense matrix
962 {
963  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
964  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
965 }
967 //*************************************************************************************************
968 
969 
970 //*************************************************************************************************
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( size_t n )
979  : matrix_( n, n, ElementType() ) // The adapted dense matrix
980 {
982 
983  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
984  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
985 }
987 //*************************************************************************************************
988 
989 
990 //*************************************************************************************************
1014 template< typename MT // Type of the adapted dense matrix
1015  , bool SO > // Storage order of the adapted dense matrix
1016 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
1017  : matrix_( list ) // The adapted dense matrix
1018 {
1019  if( !isSymmetric( matrix_ ) ) {
1020  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1021  }
1022 
1023  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1024 }
1026 //*************************************************************************************************
1027 
1028 
1029 //*************************************************************************************************
1055 template< typename MT // Type of the adapted dense matrix
1056  , bool SO > // Storage order of the adapted dense matrix
1057 template< typename Other > // Data type of the initialization array
1058 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n, const Other* array )
1059  : matrix_( n, n, array ) // The adapted dense matrix
1060 {
1061  if( !isSymmetric( matrix_ ) ) {
1062  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1063  }
1064 
1065  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1066 }
1068 //*************************************************************************************************
1069 
1070 
1071 //*************************************************************************************************
1094 template< typename MT // Type of the adapted dense matrix
1095  , bool SO > // Storage order of the adapted dense matrix
1096 template< typename Other // Data type of the initialization array
1097  , size_t N > // Number of rows and columns of the initialization array
1098 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Other (&array)[N][N] )
1099  : matrix_( array ) // The adapted dense matrix
1100 {
1101  if( !isSymmetric( matrix_ ) ) {
1102  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1103  }
1104 
1105  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1106 }
1108 //*************************************************************************************************
1109 
1110 
1111 //*************************************************************************************************
1143 template< typename MT // Type of the adapted dense matrix
1144  , bool SO > // Storage order of the adapted dense matrix
1145 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n )
1146  : matrix_( ptr, n, n ) // The adapted dense matrix
1147 {
1148  if( !isSymmetric( matrix_ ) ) {
1149  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1150  }
1151 
1152  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1153 }
1155 //*************************************************************************************************
1156 
1157 
1158 //*************************************************************************************************
1192 template< typename MT // Type of the adapted dense matrix
1193  , bool SO > // Storage order of the adapted dense matrix
1194 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
1195  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1196 {
1197  if( !isSymmetric( matrix_ ) ) {
1198  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1199  }
1200 
1201  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1202 }
1204 //*************************************************************************************************
1205 
1206 
1207 //*************************************************************************************************
1213 template< typename MT // Type of the adapted dense matrix
1214  , bool SO > // Storage order of the adapted dense matrix
1215 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
1216  : matrix_( m.matrix_ ) // The adapted dense matrix
1217 {
1218  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1219  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1220 }
1222 //*************************************************************************************************
1223 
1224 
1225 //*************************************************************************************************
1231 template< typename MT // Type of the adapted dense matrix
1232  , bool SO > // Storage order of the adapted dense matrix
1233 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
1234  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1235 {
1236  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1237  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1238 }
1240 //*************************************************************************************************
1241 
1242 
1243 //*************************************************************************************************
1253 template< typename MT // Type of the adapted dense matrix
1254  , bool SO > // Storage order of the adapted dense matrix
1255 template< typename MT2 > // Type of the foreign matrix
1256 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
1257  : matrix_( ~m ) // The adapted dense matrix
1258 {
1259  if( !IsSymmetric_v<MT2> && !isSymmetric( matrix_ ) ) {
1260  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1261  }
1262 
1263  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1264  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1265 }
1267 //*************************************************************************************************
1268 
1269 
1270 //*************************************************************************************************
1280 template< typename MT // Type of the adapted dense matrix
1281  , bool SO > // Storage order of the adapted dense matrix
1282 template< typename MT2 > // Type of the foreign matrix
1283 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
1284  : matrix_( trans( ~m ) ) // The adapted dense matrix
1285 {
1286  if( !IsSymmetric_v<MT2> && !isSymmetric( matrix_ ) ) {
1287  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1288  }
1289 
1290  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1291  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1292 }
1294 //*************************************************************************************************
1295 
1296 
1297 
1298 
1299 //=================================================================================================
1300 //
1301 // DATA ACCESS FUNCTIONS
1302 //
1303 //=================================================================================================
1304 
1305 //*************************************************************************************************
1320 template< typename MT // Type of the adapted dense matrix
1321  , bool SO > // Storage order of the adapted dense matrix
1322 inline typename SymmetricMatrix<MT,SO,true,true>::Reference
1323  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
1324 {
1325  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1326  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1327 
1328  return Reference( matrix_, i, j );
1329 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1349 template< typename MT // Type of the adapted dense matrix
1350  , bool SO > // Storage order of the adapted dense matrix
1351 inline typename SymmetricMatrix<MT,SO,true,true>::ConstReference
1352  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
1353 {
1354  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1355  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1356 
1357  return matrix_(i,j);
1358 }
1360 //*************************************************************************************************
1361 
1362 
1363 //*************************************************************************************************
1379 template< typename MT // Type of the adapted dense matrix
1380  , bool SO > // Storage order of the adapted dense matrix
1381 inline typename SymmetricMatrix<MT,SO,true,true>::Reference
1382  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j )
1383 {
1384  if( i >= rows() ) {
1385  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1386  }
1387  if( j >= columns() ) {
1388  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1389  }
1390  return (*this)(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
1414 inline typename SymmetricMatrix<MT,SO,true,true>::ConstReference
1415  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j ) const
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 //*************************************************************************************************
1443 template< typename MT // Type of the adapted dense matrix
1444  , bool SO > // Storage order of the adapted dense matrix
1445 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1447 {
1448  return matrix_.data();
1449 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1465 template< typename MT // Type of the adapted dense matrix
1466  , bool SO > // Storage order of the adapted dense matrix
1467 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1468  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const noexcept
1469 {
1470  return matrix_.data(i);
1471 }
1473 //*************************************************************************************************
1474 
1475 
1476 //*************************************************************************************************
1488 template< typename MT // Type of the adapted dense matrix
1489  , bool SO > // Storage order of the adapted dense matrix
1490 inline typename SymmetricMatrix<MT,SO,true,true>::Iterator
1492 {
1493  if( SO )
1494  return Iterator( matrix_, 0UL, i );
1495  else
1496  return Iterator( matrix_, i, 0UL );
1497 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1514 template< typename MT // Type of the adapted dense matrix
1515  , bool SO > // Storage order of the adapted dense matrix
1516 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1517  SymmetricMatrix<MT,SO,true,true>::begin( size_t i ) const
1518 {
1519  return matrix_.begin(i);
1520 }
1522 //*************************************************************************************************
1523 
1524 
1525 //*************************************************************************************************
1537 template< typename MT // Type of the adapted dense matrix
1538  , bool SO > // Storage order of the adapted dense matrix
1539 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1541 {
1542  return matrix_.cbegin(i);
1543 }
1545 //*************************************************************************************************
1546 
1547 
1548 //*************************************************************************************************
1560 template< typename MT // Type of the adapted dense matrix
1561  , bool SO > // Storage order of the adapted dense matrix
1562 inline typename SymmetricMatrix<MT,SO,true,true>::Iterator
1564 {
1565  if( SO )
1566  return Iterator( matrix_, rows(), i );
1567  else
1568  return Iterator( matrix_, i, columns() );
1569 }
1571 //*************************************************************************************************
1572 
1573 
1574 //*************************************************************************************************
1586 template< typename MT // Type of the adapted dense matrix
1587  , bool SO > // Storage order of the adapted dense matrix
1588 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1589  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1590 {
1591  return matrix_.end(i);
1592 }
1594 //*************************************************************************************************
1595 
1596 
1597 //*************************************************************************************************
1609 template< typename MT // Type of the adapted dense matrix
1610  , bool SO > // Storage order of the adapted dense matrix
1611 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1612  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1613 {
1614  return matrix_.cend(i);
1615 }
1617 //*************************************************************************************************
1618 
1619 
1620 
1621 
1622 //=================================================================================================
1623 //
1624 // ASSIGNMENT OPERATORS
1625 //
1626 //=================================================================================================
1627 
1628 //*************************************************************************************************
1653 template< typename MT // Type of the adapted dense matrix
1654  , bool SO > // Storage order of the adapted dense matrix
1655 inline SymmetricMatrix<MT,SO,true,true>&
1656  SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1657 {
1658  const InitializerMatrix<ElementType> tmp( list, list.size() );
1659 
1660  if( !isSymmetric( tmp ) ) {
1661  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1662  }
1663 
1664  matrix_ = list;
1665 
1666  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1667  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1668 
1669  return *this;
1670 }
1672 //*************************************************************************************************
1673 
1674 
1675 //*************************************************************************************************
1699 template< typename MT // Type of the adapted dense matrix
1700  , bool SO > // Storage order of the adapted dense matrix
1701 template< typename Other // Data type of the initialization array
1702  , size_t N > // Number of rows and columns of the initialization array
1703 inline SymmetricMatrix<MT,SO,true,true>&
1704  SymmetricMatrix<MT,SO,true,true>::operator=( const Other (&array)[N][N] )
1705 {
1706  MT tmp( array );
1707 
1708  if( !isSymmetric( tmp ) ) {
1709  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1710  }
1711 
1712  matrix_ = std::move( tmp );
1713 
1714  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1715  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1716 
1717  return *this;
1718 }
1720 //*************************************************************************************************
1721 
1722 
1723 //*************************************************************************************************
1733 template< typename MT // Type of the adapted dense matrix
1734  , bool SO > // Storage order of the adapted dense matrix
1735 inline SymmetricMatrix<MT,SO,true,true>&
1736  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1737 {
1738  matrix_ = rhs.matrix_;
1739 
1740  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1741  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1742 
1743  return *this;
1744 }
1746 //*************************************************************************************************
1747 
1748 
1749 //*************************************************************************************************
1756 template< typename MT // Type of the adapted dense matrix
1757  , bool SO > // Storage order of the adapted dense matrix
1758 inline SymmetricMatrix<MT,SO,true,true>&
1759  SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1760 {
1761  matrix_ = std::move( rhs.matrix_ );
1762 
1763  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1764  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1765 
1766  return *this;
1767 }
1769 //*************************************************************************************************
1770 
1771 
1772 //*************************************************************************************************
1785 template< typename MT // Type of the adapted dense matrix
1786  , bool SO > // Storage order of the adapted dense matrix
1787 template< typename MT2 > // Type of the right-hand side matrix
1788 inline auto SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1789  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1790 {
1791  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
1792  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1793  }
1794 
1795  matrix_ = ~rhs;
1796 
1797  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1798  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1799 
1800  return *this;
1801 }
1803 //*************************************************************************************************
1804 
1805 
1806 //*************************************************************************************************
1819 template< typename MT // Type of the adapted dense matrix
1820  , bool SO > // Storage order of the adapted dense matrix
1821 template< typename MT2 > // Type of the right-hand side matrix
1822 inline auto SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1823  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1824 {
1825  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1826  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1827  }
1828 
1829  if( IsSymmetric_v<MT2> ) {
1830  matrix_ = ~rhs;
1831  }
1832  else {
1833  MT tmp( ~rhs );
1834 
1835  if( !isSymmetric( tmp ) ) {
1836  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1837  }
1838 
1839  matrix_ = std::move( tmp );
1840  }
1841 
1842  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1843  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1844 
1845  return *this;
1846 }
1848 //*************************************************************************************************
1849 
1850 
1851 //*************************************************************************************************
1864 template< typename MT // Type of the adapted dense matrix
1865  , bool SO > // Storage order of the adapted dense matrix
1866 template< typename MT2 > // Type of the right-hand side matrix
1867 inline auto SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1868  -> SymmetricMatrix&
1869 {
1870  return this->operator=( trans( ~rhs ) );
1871 }
1873 //*************************************************************************************************
1874 
1875 
1876 //*************************************************************************************************
1889 template< typename MT // Type of the adapted dense matrix
1890  , bool SO > // Storage order of the adapted dense matrix
1891 template< typename MT2 > // Type of the right-hand side matrix
1892 inline auto SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1893  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1894 {
1895  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
1896  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1897  }
1898 
1899  matrix_ += ~rhs;
1900 
1901  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1902  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1903 
1904  return *this;
1905 }
1907 //*************************************************************************************************
1908 
1909 
1910 //*************************************************************************************************
1923 template< typename MT // Type of the adapted dense matrix
1924  , bool SO > // Storage order of the adapted dense matrix
1925 template< typename MT2 > // Type of the right-hand side matrix
1926 inline auto SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1927  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1928 {
1929  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1930  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1931  }
1932 
1933  if( IsSymmetric_v<MT2> ) {
1934  matrix_ += ~rhs;
1935  }
1936  else {
1937  const ResultType_t<MT2> tmp( ~rhs );
1938 
1939  if( !isSymmetric( tmp ) ) {
1940  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1941  }
1942 
1943  matrix_ += tmp;
1944  }
1945 
1946  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1947  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1948 
1949  return *this;
1950 }
1952 //*************************************************************************************************
1953 
1954 
1955 //*************************************************************************************************
1969 template< typename MT // Type of the adapted dense matrix
1970  , bool SO > // Storage order of the adapted dense matrix
1971 template< typename MT2 > // Type of the right-hand side matrix
1972 inline auto SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1973  -> SymmetricMatrix&
1974 {
1975  return this->operator+=( trans( ~rhs ) );
1976 }
1978 //*************************************************************************************************
1979 
1980 
1981 //*************************************************************************************************
1994 template< typename MT // Type of the adapted dense matrix
1995  , bool SO > // Storage order of the adapted dense matrix
1996 template< typename MT2 > // Type of the right-hand side matrix
1997 inline auto SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
1998  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1999 {
2000  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
2001  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2002  }
2003 
2004  matrix_ -= ~rhs;
2005 
2006  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2007  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2008 
2009  return *this;
2010 }
2012 //*************************************************************************************************
2013 
2014 
2015 //*************************************************************************************************
2028 template< typename MT // Type of the adapted dense matrix
2029  , bool SO > // Storage order of the adapted dense matrix
2030 template< typename MT2 > // Type of the right-hand side matrix
2031 inline auto SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2032  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2033 {
2034  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2035  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2036  }
2037 
2038  if( IsSymmetric_v<MT2> ) {
2039  matrix_ -= ~rhs;
2040  }
2041  else {
2042  const ResultType_t<MT2> tmp( ~rhs );
2043 
2044  if( !isSymmetric( tmp ) ) {
2045  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2046  }
2047 
2048  matrix_ -= tmp;
2049  }
2050 
2051  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2052  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2053 
2054  return *this;
2055 }
2057 //*************************************************************************************************
2058 
2059 
2060 //*************************************************************************************************
2074 template< typename MT // Type of the adapted dense matrix
2075  , bool SO > // Storage order of the adapted dense matrix
2076 template< typename MT2 > // Type of the right-hand side matrix
2077 inline auto SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2078  -> SymmetricMatrix&
2079 {
2080  return this->operator-=( trans( ~rhs ) );
2081 }
2083 //*************************************************************************************************
2084 
2085 
2086 //*************************************************************************************************
2100 template< typename MT // Type of the adapted dense matrix
2101  , bool SO > // Storage order of the adapted dense matrix
2102 template< typename MT2 > // Type of the right-hand side matrix
2103 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2104  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2105 {
2106  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
2107  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2108  }
2109 
2110  matrix_ %= ~rhs;
2111 
2112  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2113  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2114 
2115  return *this;
2116 }
2118 //*************************************************************************************************
2119 
2120 
2121 //*************************************************************************************************
2135 template< typename MT // Type of the adapted dense matrix
2136  , bool SO > // Storage order of the adapted dense matrix
2137 template< typename MT2 > // Type of the right-hand side matrix
2138 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2139  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2140 {
2141  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2142  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2143  }
2144 
2145  if( IsSymmetric_v<MT2> ) {
2146  matrix_ %= ~rhs;
2147  }
2148  else {
2149  const ResultType_t<MT2> tmp( ~rhs );
2150 
2151  if( !isSymmetric( tmp ) ) {
2152  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2153  }
2154 
2155  matrix_ %= tmp;
2156  }
2157 
2158  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2159  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2160 
2161  return *this;
2162 }
2164 //*************************************************************************************************
2165 
2166 
2167 //*************************************************************************************************
2181 template< typename MT // Type of the adapted dense matrix
2182  , bool SO > // Storage order of the adapted dense matrix
2183 template< typename MT2 > // Type of the right-hand side matrix
2184 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2185  -> SymmetricMatrix&
2186 {
2187  return this->operator%=( trans( ~rhs ) );
2188 }
2190 //*************************************************************************************************
2191 
2192 
2193 //*************************************************************************************************
2201 template< typename MT // Type of the adapted dense matrix
2202  , bool SO > // Storage order of the adapted dense matrix
2203 template< typename ST > // Data type of the right-hand side scalar
2205  -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >
2206 {
2207  matrix_ *= rhs;
2208  return *this;
2209 }
2210 //*************************************************************************************************
2211 
2212 
2213 //*************************************************************************************************
2221 template< typename MT // Type of the adapted dense matrix
2222  , bool SO > // Storage order of the adapted dense matrix
2223 template< typename ST > // Data type of the right-hand side scalar
2225  -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >
2226 {
2227  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2228 
2229  matrix_ /= rhs;
2230  return *this;
2231 }
2233 //*************************************************************************************************
2234 
2235 
2236 
2237 
2238 //=================================================================================================
2239 //
2240 // UTILITY FUNCTIONS
2241 //
2242 //=================================================================================================
2243 
2244 //*************************************************************************************************
2250 template< typename MT // Type of the adapted dense matrix
2251  , bool SO > // Storage order of the adapted dense matrix
2252 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const noexcept
2253 {
2254  return matrix_.rows();
2255 }
2257 //*************************************************************************************************
2258 
2259 
2260 //*************************************************************************************************
2266 template< typename MT // Type of the adapted dense matrix
2267  , bool SO > // Storage order of the adapted dense matrix
2268 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const noexcept
2269 {
2270  return matrix_.columns();
2271 }
2273 //*************************************************************************************************
2274 
2275 
2276 //*************************************************************************************************
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>::spacing() const noexcept
2291 {
2292  return matrix_.spacing();
2293 }
2295 //*************************************************************************************************
2296 
2297 
2298 //*************************************************************************************************
2304 template< typename MT // Type of the adapted dense matrix
2305  , bool SO > // Storage order of the adapted dense matrix
2306 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const noexcept
2307 {
2308  return matrix_.capacity();
2309 }
2311 //*************************************************************************************************
2312 
2313 
2314 //*************************************************************************************************
2325 template< typename MT // Type of the adapted dense matrix
2326  , bool SO > // Storage order of the adapted dense matrix
2327 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const noexcept
2328 {
2329  return matrix_.capacity(i);
2330 }
2332 //*************************************************************************************************
2333 
2334 
2335 //*************************************************************************************************
2341 template< typename MT // Type of the adapted dense matrix
2342  , bool SO > // Storage order of the adapted dense matrix
2343 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
2344 {
2345  return matrix_.nonZeros();
2346 }
2348 //*************************************************************************************************
2349 
2350 
2351 //*************************************************************************************************
2363 template< typename MT // Type of the adapted dense matrix
2364  , bool SO > // Storage order of the adapted dense matrix
2365 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
2366 {
2367  return matrix_.nonZeros(i);
2368 }
2370 //*************************************************************************************************
2371 
2372 
2373 //*************************************************************************************************
2379 template< typename MT // Type of the adapted dense matrix
2380  , bool SO > // Storage order of the adapted dense matrix
2382 {
2383  matrix_.reset();
2384 }
2386 //*************************************************************************************************
2387 
2388 
2389 //*************************************************************************************************
2425 template< typename MT // Type of the adapted dense matrix
2426  , bool SO > // Storage order of the adapted dense matrix
2427 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
2428 {
2429  row ( matrix_, i, unchecked ).reset();
2430  column( matrix_, i, unchecked ).reset();
2431 }
2433 //*************************************************************************************************
2434 
2435 
2436 //*************************************************************************************************
2448 template< typename MT // Type of the adapted dense matrix
2449  , bool SO > // Storage order of the adapted dense matrix
2451 {
2452  using blaze::clear;
2453 
2454  clear( matrix_ );
2455 }
2457 //*************************************************************************************************
2458 
2459 
2460 //*************************************************************************************************
2495 template< typename MT // Type of the adapted dense matrix
2496  , bool SO > // Storage order of the adapted dense matrix
2497 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
2498 {
2500 
2501  MAYBE_UNUSED( preserve );
2502 
2503  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2504 
2505  const size_t oldsize( matrix_.rows() );
2506 
2507  matrix_.resize( n, n, true );
2508 
2509  if( n > oldsize ) {
2510  const size_t increment( n - oldsize );
2511  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2512  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2513  }
2514 }
2516 //*************************************************************************************************
2517 
2518 
2519 //*************************************************************************************************
2532 template< typename MT // Type of the adapted dense matrix
2533  , bool SO > // Storage order of the adapted dense matrix
2534 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
2535 {
2537 
2538  MAYBE_UNUSED( preserve );
2539 
2540  resize( rows() + n, true );
2541 }
2542 //*************************************************************************************************
2543 
2544 
2545 //*************************************************************************************************
2555 template< typename MT // Type of the adapted dense matrix
2556  , bool SO > // Storage order of the adapted dense matrix
2557 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
2558 {
2559  matrix_.reserve( elements );
2560 }
2562 //*************************************************************************************************
2563 
2564 
2565 //*************************************************************************************************
2575 template< typename MT // Type of the adapted dense matrix
2576  , bool SO > // Storage order of the adapted dense matrix
2578 {
2579  matrix_.shrinkToFit();
2580 }
2582 //*************************************************************************************************
2583 
2584 
2585 //*************************************************************************************************
2592 template< typename MT // Type of the adapted dense matrix
2593  , bool SO > // Storage order of the adapted dense matrix
2594 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) noexcept
2595 {
2596  using std::swap;
2597 
2598  swap( matrix_, m.matrix_ );
2599 }
2601 //*************************************************************************************************
2602 
2603 
2604 
2605 
2606 //=================================================================================================
2607 //
2608 // NUMERIC FUNCTIONS
2609 //
2610 //=================================================================================================
2611 
2612 //*************************************************************************************************
2618 template< typename MT // Type of the adapted dense matrix
2619  , bool SO > // Storage order of the adapted dense matrix
2620 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
2621 {
2622  return *this;
2623 }
2625 //*************************************************************************************************
2626 
2627 
2628 //*************************************************************************************************
2634 template< typename MT // Type of the adapted dense matrix
2635  , bool SO > // Storage order of the adapted dense matrix
2636 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::ctranspose()
2637 {
2638  if( !IsBuiltin_v<ElementType> )
2639  conjugate( matrix_ );
2640 
2641  return *this;
2642 }
2644 //*************************************************************************************************
2645 
2646 
2647 //*************************************************************************************************
2665 template< typename MT // Type of the adapted dense matrix
2666  , bool SO > // Storage order of the adapted dense matrix
2667 template< typename Other > // Data type of the scalar value
2668 inline SymmetricMatrix<MT,SO,true,true>&
2669  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
2670 {
2671  matrix_.scale( scalar );
2672  return *this;
2673 }
2675 //*************************************************************************************************
2676 
2677 
2678 
2679 
2680 //=================================================================================================
2681 //
2682 // DEBUGGING FUNCTIONS
2683 //
2684 //=================================================================================================
2685 
2686 //*************************************************************************************************
2696 template< typename MT // Type of the adapted dense matrix
2697  , bool SO > // Storage order of the adapted dense matrix
2698 inline bool SymmetricMatrix<MT,SO,true,true>::isIntact() const noexcept
2699 {
2700  using blaze::isIntact;
2701 
2702  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2703 }
2705 //*************************************************************************************************
2706 
2707 
2708 
2709 
2710 //=================================================================================================
2711 //
2712 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2713 //
2714 //=================================================================================================
2715 
2716 //*************************************************************************************************
2727 template< typename MT // Type of the adapted dense matrix
2728  , bool SO > // Storage order of the adapted dense matrix
2729 template< typename Other > // Data type of the foreign expression
2730 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const noexcept
2731 {
2732  return matrix_.canAlias( alias );
2733 }
2735 //*************************************************************************************************
2736 
2737 
2738 //*************************************************************************************************
2749 template< typename MT // Type of the adapted dense matrix
2750  , bool SO > // Storage order of the adapted dense matrix
2751 template< typename Other > // Data type of the foreign expression
2752 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const noexcept
2753 {
2754  return matrix_.isAliased( alias );
2755 }
2757 //*************************************************************************************************
2758 
2759 
2760 //*************************************************************************************************
2770 template< typename MT // Type of the adapted dense matrix
2771  , bool SO > // Storage order of the adapted dense matrix
2772 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2773 {
2774  return matrix_.isAligned();
2775 }
2777 //*************************************************************************************************
2778 
2779 
2780 //*************************************************************************************************
2791 template< typename MT // Type of the adapted dense matrix
2792  , bool SO > // Storage order of the adapted dense matrix
2793 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2794 {
2795  return matrix_.canSMPAssign();
2796 }
2798 //*************************************************************************************************
2799 
2800 
2801 //*************************************************************************************************
2817 template< typename MT // Type of the adapted dense matrix
2818  , bool SO > // Storage order of the adapted dense matrix
2819 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2820  SymmetricMatrix<MT,SO,true,true>::load( size_t i, size_t j ) const noexcept
2821 {
2822  return matrix_.load( i, j );
2823 }
2825 //*************************************************************************************************
2826 
2827 
2828 //*************************************************************************************************
2844 template< typename MT // Type of the adapted dense matrix
2845  , bool SO > // Storage order of the adapted dense matrix
2846 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2847  SymmetricMatrix<MT,SO,true,true>::loada( size_t i, size_t j ) const noexcept
2848 {
2849  return matrix_.loada( i, j );
2850 }
2852 //*************************************************************************************************
2853 
2854 
2855 //*************************************************************************************************
2871 template< typename MT // Type of the adapted dense matrix
2872  , bool SO > // Storage order of the adapted dense matrix
2873 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2874  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const noexcept
2875 {
2876  return matrix_.loadu( i, j );
2877 }
2879 //*************************************************************************************************
2880 
2881 
2882 //*************************************************************************************************
2899 template< typename MT // Type of the adapted dense matrix
2900  , bool SO > // Storage order of the adapted dense matrix
2901 inline void
2902  SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2903 {
2904  matrix_.store( i, j, value );
2905 
2906  if( SO ) {
2907  const size_t kend( min( i+SIMDSIZE, rows() ) );
2908  for( size_t k=i; k<kend; ++k )
2909  matrix_(j,k) = matrix_(k,j);
2910  }
2911  else {
2912  const size_t kend( min( j+SIMDSIZE, columns() ) );
2913  for( size_t k=j; k<kend; ++k )
2914  matrix_(k,i) = matrix_(i,k);
2915  }
2916 }
2918 //*************************************************************************************************
2919 
2920 
2921 //*************************************************************************************************
2938 template< typename MT // Type of the adapted dense matrix
2939  , bool SO > // Storage order of the adapted dense matrix
2940 inline void
2941  SymmetricMatrix<MT,SO,true,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2942 {
2943  matrix_.storea( i, j, value );
2944 
2945  if( SO ) {
2946  const size_t kend( min( i+SIMDSIZE, rows() ) );
2947  for( size_t k=i; k<kend; ++k )
2948  matrix_(j,k) = matrix_(k,j);
2949  }
2950  else {
2951  const size_t kend( min( j+SIMDSIZE, columns() ) );
2952  for( size_t k=j; k<kend; ++k )
2953  matrix_(k,i) = matrix_(i,k);
2954  }
2955 }
2957 //*************************************************************************************************
2958 
2959 
2960 //*************************************************************************************************
2977 template< typename MT // Type of the adapted dense matrix
2978  , bool SO > // Storage order of the adapted dense matrix
2979 inline void
2980  SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2981 {
2982  matrix_.storeu( i, j, value );
2983 
2984  if( SO ) {
2985  const size_t kend( min( i+SIMDSIZE, rows() ) );
2986  for( size_t k=i; k<kend; ++k )
2987  matrix_(j,k) = matrix_(k,j);
2988  }
2989  else {
2990  const size_t kend( min( j+SIMDSIZE, columns() ) );
2991  for( size_t k=j; k<kend; ++k )
2992  matrix_(k,i) = matrix_(i,k);
2993  }
2994 }
2996 //*************************************************************************************************
2997 
2998 
2999 //*************************************************************************************************
3016 template< typename MT // Type of the adapted dense matrix
3017  , bool SO > // Storage order of the adapted dense matrix
3018 inline void
3019  SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3020 {
3021  matrix_.stream( i, j, value );
3022 
3023  if( SO ) {
3024  const size_t kend( min( i+SIMDSIZE, rows() ) );
3025  for( size_t k=i; k<kend; ++k )
3026  matrix_(j,k) = matrix_(k,j);
3027  }
3028  else {
3029  const size_t kend( min( j+SIMDSIZE, columns() ) );
3030  for( size_t k=j; k<kend; ++k )
3031  matrix_(k,i) = matrix_(i,k);
3032  }
3033 }
3035 //*************************************************************************************************
3036 
3037 } // namespace blaze
3038 
3039 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.In case the given data type T is a transformation expression (i....
Definition: Transformation.h:81
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
Constraint on the data type.
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:170
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Header file for the isZero shim.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i....
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type,...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
Constraint on the data type.
Header file for the dense matrix inversion flags.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
Header file for the MAYBE_UNUSED function template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
Constraint on the data type.
Header file for the NumericProxy class.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:253
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:677
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the If class template.
Compile time assertion.
decltype(auto) operator *(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9091
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:446
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
Constraints on the storage order of matrix types.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:139
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type,...
Definition: Upper.h:81
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
Header file for the implementation of the Column view.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:558
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type,...
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type,...
Definition: Lower.h:81
Header file for all forward declarations for expression class templates.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type,...
Definition: Reference.h:79
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Constraint on the data type.
Constraint on the data type.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1328
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.In case the given data type T is a view type (i.e. a subvector,...
Definition: View.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
auto operator *=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:494
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type,...
Definition: Hermitian.h:79
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
#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
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Constraint on the data type.
System settings for the inline keywords.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Header file for the implementation of the Row view.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825