DenseNumeric.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
58 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Clear.h>
66 #include <blaze/math/SIMD.h>
71 #include <blaze/math/views/Check.h>
73 #include <blaze/math/views/Row.h>
75 #include <blaze/system/Inline.h>
77 #include <blaze/util/Assert.h>
83 #include <blaze/util/DisableIf.h>
84 #include <blaze/util/EnableIf.h>
85 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/Types.h>
90 #include <blaze/util/Unused.h>
91 
92 
93 namespace blaze {
94 
95 //=================================================================================================
96 //
97 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NUMERIC ELEMENT TYPE
98 //
99 //=================================================================================================
100 
101 //*************************************************************************************************
109 template< typename MT // Type of the adapted dense matrix
110  , bool SO > // Storage order of the adapted dense matrix
111 class SymmetricMatrix<MT,SO,true,true>
112  : public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
113 {
114  private:
115  //**Type definitions****************************************************************************
116  using OT = OppositeType_t<MT>;
117  using TT = TransposeType_t<MT>;
118  using ET = ElementType_t<MT>;
119  //**********************************************************************************************
120 
121  public:
122  //**Type definitions****************************************************************************
123  using This = SymmetricMatrix<MT,SO,true,true>;
124  using BaseType = DenseMatrix<This,SO>;
125  using ResultType = This;
126  using OppositeType = SymmetricMatrix<OT,!SO,true,true>;
127  using TransposeType = SymmetricMatrix<TT,!SO,true,true>;
128  using ElementType = ET;
129  using SIMDType = SIMDType_t<MT>;
130  using ReturnType = ReturnType_t<MT>;
131  using CompositeType = const This&;
132  using Reference = NumericProxy<MT>;
133  using ConstReference = ConstReference_t<MT>;
134  using Pointer = Pointer_t<MT>;
135  using ConstPointer = ConstPointer_t<MT>;
136  using ConstIterator = ConstIterator_t<MT>;
137  //**********************************************************************************************
138 
139  //**Rebind struct definition********************************************************************
142  template< typename NewType > // Data type of the other matrix
143  struct Rebind {
145  using Other = SymmetricMatrix< typename MT::template Rebind<NewType>::Other >;
146  };
147  //**********************************************************************************************
148 
149  //**Resize struct definition********************************************************************
152  template< size_t NewM // Number of rows of the other matrix
153  , size_t NewN > // Number of columns of the other matrix
154  struct Resize {
156  using Other = SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other >;
157  };
158  //**********************************************************************************************
159 
160  //**Iterator class definition*******************************************************************
163  class Iterator
164  {
165  public:
166  //**Type definitions*************************************************************************
167  using IteratorCategory = std::random_access_iterator_tag;
168  using ValueType = ElementType_t<MT>;
169  using PointerType = NumericProxy<MT>;
170  using ReferenceType = NumericProxy<MT>;
171  using DifferenceType = ptrdiff_t;
172 
173  // STL iterator requirements
174  using iterator_category = IteratorCategory;
175  using value_type = ValueType;
176  using pointer = PointerType;
177  using reference = ReferenceType;
178  using difference_type = DifferenceType;
179  //*******************************************************************************************
180 
181  //**Constructor******************************************************************************
184  inline Iterator() noexcept
185  : matrix_( nullptr ) // Reference to the adapted dense matrix
186  , row_ ( 0UL ) // The current row index of the iterator
187  , column_( 0UL ) // The current column index of the iterator
188  {}
189  //*******************************************************************************************
190 
191  //**Constructor******************************************************************************
198  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
199  : matrix_( &matrix ) // Reference to the adapted dense matrix
200  , row_ ( row ) // The current row index of the iterator
201  , column_( column ) // The current column index of the iterator
202  {}
203  //*******************************************************************************************
204 
205  //**Addition assignment operator*************************************************************
211  inline Iterator& operator+=( size_t inc ) noexcept {
212  ( SO )?( row_ += inc ):( column_ += inc );
213  return *this;
214  }
215  //*******************************************************************************************
216 
217  //**Subtraction assignment operator**********************************************************
223  inline Iterator& operator-=( size_t dec ) noexcept {
224  ( SO )?( row_ -= dec ):( column_ -= dec );
225  return *this;
226  }
227  //*******************************************************************************************
228 
229  //**Prefix increment operator****************************************************************
234  inline Iterator& operator++() noexcept {
235  ( SO )?( ++row_ ):( ++column_ );
236  return *this;
237  }
238  //*******************************************************************************************
239 
240  //**Postfix increment operator***************************************************************
245  inline const Iterator operator++( int ) noexcept {
246  const Iterator tmp( *this );
247  ++(*this);
248  return tmp;
249  }
250  //*******************************************************************************************
251 
252  //**Prefix decrement operator****************************************************************
257  inline Iterator& operator--() noexcept {
258  ( SO )?( --row_ ):( --column_ );
259  return *this;
260  }
261  //*******************************************************************************************
262 
263  //**Postfix decrement operator***************************************************************
268  inline const Iterator operator--( int ) noexcept {
269  const Iterator tmp( *this );
270  --(*this);
271  return tmp;
272  }
273  //*******************************************************************************************
274 
275  //**Element access operator******************************************************************
280  inline ReferenceType operator*() const {
281  return ReferenceType( *matrix_, row_, column_ );
282  }
283  //*******************************************************************************************
284 
285  //**Element access operator******************************************************************
290  inline PointerType operator->() const {
291  return PointerType( *matrix_, row_, column_ );
292  }
293  //*******************************************************************************************
294 
295  //**Load function****************************************************************************
305  inline SIMDType load() const {
306  return (*matrix_).load(row_,column_);
307  }
308  //*******************************************************************************************
309 
310  //**Loada function***************************************************************************
320  inline SIMDType loada() const {
321  return (*matrix_).loada(row_,column_);
322  }
323  //*******************************************************************************************
324 
325  //**Loadu function***************************************************************************
335  inline SIMDType loadu() const {
336  return (*matrix_).loadu(row_,column_);
337  }
338  //*******************************************************************************************
339 
340  //**Store function***************************************************************************
351  inline void store( const SIMDType& value ) const {
352  (*matrix_).store( row_, column_, value );
353  sync();
354  }
355  //*******************************************************************************************
356 
357  //**Storea function**************************************************************************
368  inline void storea( const SIMDType& value ) const {
369  (*matrix_).storea( row_, column_, value );
370  sync();
371  }
372  //*******************************************************************************************
373 
374  //**Storeu function**************************************************************************
385  inline void storeu( const SIMDType& value ) const {
386  (*matrix_).storeu( row_, column_, value );
387  sync();
388  }
389  //*******************************************************************************************
390 
391  //**Stream function**************************************************************************
402  inline void stream( const SIMDType& value ) const {
403  (*matrix_).stream( row_, column_, value );
404  sync();
405  }
406  //*******************************************************************************************
407 
408  //**Conversion operator**********************************************************************
413  inline operator ConstIterator() const {
414  if( SO )
415  return matrix_->begin( column_ ) + row_;
416  else
417  return matrix_->begin( row_ ) + column_;
418  }
419  //*******************************************************************************************
420 
421  //**Equality operator************************************************************************
428  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
429  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
430  }
431  //*******************************************************************************************
432 
433  //**Equality operator************************************************************************
440  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
441  return ( ConstIterator( lhs ) == rhs );
442  }
443  //*******************************************************************************************
444 
445  //**Equality operator************************************************************************
452  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
453  return ( lhs == ConstIterator( rhs ) );
454  }
455  //*******************************************************************************************
456 
457  //**Inequality operator**********************************************************************
464  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
465  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
466  }
467  //*******************************************************************************************
468 
469  //**Inequality operator**********************************************************************
476  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
477  return ( ConstIterator( lhs ) != rhs );
478  }
479  //*******************************************************************************************
480 
481  //**Inequality operator**********************************************************************
488  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
489  return ( lhs != ConstIterator( rhs ) );
490  }
491  //*******************************************************************************************
492 
493  //**Less-than operator***********************************************************************
500  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
501  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
502  }
503  //*******************************************************************************************
504 
505  //**Less-than operator***********************************************************************
512  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
513  return ( ConstIterator( lhs ) < rhs );
514  }
515  //*******************************************************************************************
516 
517  //**Less-than operator***********************************************************************
524  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
525  return ( lhs < ConstIterator( rhs ) );
526  }
527  //*******************************************************************************************
528 
529  //**Greater-than operator********************************************************************
536  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
537  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
538  }
539  //*******************************************************************************************
540 
541  //**Greater-than operator********************************************************************
548  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
549  return ( ConstIterator( lhs ) > rhs );
550  }
551  //*******************************************************************************************
552 
553  //**Greater-than operator********************************************************************
560  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
561  return ( lhs > ConstIterator( rhs ) );
562  }
563  //*******************************************************************************************
564 
565  //**Less-or-equal-than operator**************************************************************
572  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
573  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
574  }
575  //*******************************************************************************************
576 
577  //**Less-or-equal-than operator**************************************************************
584  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
585  return ( ConstIterator( lhs ) <= rhs );
586  }
587  //*******************************************************************************************
588 
589  //**Less-or-equal-than operator**************************************************************
596  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
597  return ( lhs <= ConstIterator( rhs ) );
598  }
599  //*******************************************************************************************
600 
601  //**Greater-or-equal-than operator***********************************************************
608  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
609  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
610  }
611  //*******************************************************************************************
612 
613  //**Greater-or-equal-than operator***********************************************************
620  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
621  return ( ConstIterator( lhs ) >= rhs );
622  }
623  //*******************************************************************************************
624 
625  //**Greater-or-equal-than operator***********************************************************
632  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
633  return ( lhs >= ConstIterator( rhs ) );
634  }
635  //*******************************************************************************************
636 
637  //**Subtraction operator*********************************************************************
643  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
644  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
645  }
646  //*******************************************************************************************
647 
648  //**Addition operator************************************************************************
655  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
656  if( SO )
657  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
658  else
659  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
660  }
661  //*******************************************************************************************
662 
663  //**Addition operator************************************************************************
670  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
671  if( SO )
672  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
673  else
674  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
675  }
676  //*******************************************************************************************
677 
678  //**Subtraction operator*********************************************************************
685  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
686  if( SO )
687  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
688  else
689  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
690  }
691  //*******************************************************************************************
692 
693  private:
694  //**Sync function****************************************************************************
699  void sync() const {
700  if( SO ) {
701  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
702  for( size_t k=row_; k<kend; ++k )
703  (*matrix_)(column_,k) = (*matrix_)(k,column_);
704  }
705  else {
706  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
707  for( size_t k=column_; k<kend; ++k )
708  (*matrix_)(k,row_) = (*matrix_)(row_,k);
709  }
710  }
711  //*******************************************************************************************
712 
713  //**Member variables*************************************************************************
714  MT* matrix_;
715  size_t row_;
716  size_t column_;
717  //*******************************************************************************************
718  };
719  //**********************************************************************************************
720 
721  //**Compilation flags***************************************************************************
723  static constexpr bool simdEnabled = MT::simdEnabled;
724 
726  static constexpr bool smpAssignable = MT::smpAssignable;
727  //**********************************************************************************************
728 
729  //**Constructors********************************************************************************
732  explicit inline SymmetricMatrix();
733  explicit inline SymmetricMatrix( size_t n );
734  explicit inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
735 
736  template< typename Other >
737  explicit inline SymmetricMatrix( size_t n, const Other* array );
738 
739  template< typename Other, size_t N >
740  explicit inline SymmetricMatrix( const Other (&array)[N][N] );
741 
742  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
743  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
744 
745  inline SymmetricMatrix( const SymmetricMatrix& m );
746  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
747 
748  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
749  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
751  //**********************************************************************************************
752 
753  //**Destructor**********************************************************************************
756  ~SymmetricMatrix() = default;
758  //**********************************************************************************************
759 
760  //**Data access functions***********************************************************************
763  inline Reference operator()( size_t i, size_t j );
764  inline ConstReference operator()( size_t i, size_t j ) const;
765  inline Reference at( size_t i, size_t j );
766  inline ConstReference at( size_t i, size_t j ) const;
767  inline ConstPointer data () const noexcept;
768  inline ConstPointer data ( size_t i ) const noexcept;
769  inline Iterator begin ( size_t i );
770  inline ConstIterator begin ( size_t i ) const;
771  inline ConstIterator cbegin( size_t i ) const;
772  inline Iterator end ( size_t i );
773  inline ConstIterator end ( size_t i ) const;
774  inline ConstIterator cend ( size_t i ) const;
776  //**********************************************************************************************
777 
778  //**Assignment operators************************************************************************
781  inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
782 
783  template< typename Other, size_t N >
784  inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
785 
786  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
787  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
788 
789  template< typename MT2 >
790  inline auto operator=( const Matrix<MT2,SO>& rhs )
791  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
792 
793  template< typename MT2 >
794  inline auto operator=( const Matrix<MT2,SO>& rhs )
795  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
796 
797  template< typename MT2 >
798  inline auto operator=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
799 
800  template< typename MT2 >
801  inline auto operator+=( const Matrix<MT2,SO>& rhs )
802  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
803 
804  template< typename MT2 >
805  inline auto operator+=( const Matrix<MT2,SO>& rhs )
806  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
807 
808  template< typename MT2 >
809  inline auto operator+=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
810 
811  template< typename MT2 >
812  inline auto operator-=( const Matrix<MT2,SO>& rhs )
813  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
814 
815  template< typename MT2 >
816  inline auto operator-=( const Matrix<MT2,SO>& rhs )
817  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
818 
819  template< typename MT2 >
820  inline auto operator-=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
821 
822  template< typename MT2 >
823  inline auto operator%=( const Matrix<MT2,SO>& rhs )
824  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
825 
826  template< typename MT2 >
827  inline auto operator%=( const Matrix<MT2,SO>& rhs )
828  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >;
829 
830  template< typename MT2 >
831  inline auto operator%=( const Matrix<MT2,!SO>& rhs )
832  -> SymmetricMatrix&;
833 
834  template< typename ST >
835  inline auto operator*=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >;
836 
837  template< typename ST >
838  inline auto operator/=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >;
840  //**********************************************************************************************
841 
842  //**Utility functions***************************************************************************
845  inline size_t rows() const noexcept;
846  inline size_t columns() const noexcept;
847  inline size_t spacing() const noexcept;
848  inline size_t capacity() const noexcept;
849  inline size_t capacity( size_t i ) const noexcept;
850  inline size_t nonZeros() const;
851  inline size_t nonZeros( size_t i ) const;
852  inline void reset();
853  inline void reset( size_t i );
854  inline void clear();
855  void resize ( size_t n, bool preserve=true );
856  inline void extend ( size_t n, bool preserve=true );
857  inline void reserve( size_t elements );
858  inline void shrinkToFit();
859  inline void swap( SymmetricMatrix& m ) noexcept;
861  //**********************************************************************************************
862 
863  //**Numeric functions***************************************************************************
866  inline SymmetricMatrix& transpose();
867  inline SymmetricMatrix& ctranspose();
868 
869  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
871  //**********************************************************************************************
872 
873  //**Debugging functions*************************************************************************
876  inline bool isIntact() const noexcept;
878  //**********************************************************************************************
879 
880  //**Expression template evaluation functions****************************************************
883  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
884  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
885 
886  inline bool isAligned () const noexcept;
887  inline bool canSMPAssign() const noexcept;
888 
889  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
890  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
891  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
892 
893  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
894  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
895  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
896  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
898  //**********************************************************************************************
899 
900  private:
901  //**SIMD properties*****************************************************************************
903  static constexpr size_t SIMDSIZE = SIMDTrait<ET>::size;
904  //**********************************************************************************************
905 
906  //**Member variables****************************************************************************
909  MT matrix_;
910 
911  //**********************************************************************************************
912 
913  //**Friend declarations*************************************************************************
914  template< bool RF, typename MT2, bool SO2, bool DF2, bool NF2 >
915  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
916 
917  template< InversionFlag IF, typename MT2, bool SO2 >
918  friend void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
919  //**********************************************************************************************
920 
921  //**Compile time checks*************************************************************************
935  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
936  //**********************************************************************************************
937 };
939 //*************************************************************************************************
940 
941 
942 
943 
944 //=================================================================================================
945 //
946 // CONSTRUCTORS
947 //
948 //=================================================================================================
949 
950 //*************************************************************************************************
954 template< typename MT // Type of the adapted dense matrix
955  , bool SO > // Storage order of the adapted dense matrix
956 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
957  : matrix_() // The adapted dense matrix
958 {
959  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
960  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
961 }
963 //*************************************************************************************************
964 
965 
966 //*************************************************************************************************
972 template< typename MT // Type of the adapted dense matrix
973  , bool SO > // Storage order of the adapted dense matrix
974 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n )
975  : matrix_( n, n, ElementType() ) // The adapted dense matrix
976 {
978 
979  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
980  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
981 }
983 //*************************************************************************************************
984 
985 
986 //*************************************************************************************************
1010 template< typename MT // Type of the adapted dense matrix
1011  , bool SO > // Storage order of the adapted dense matrix
1012 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
1013  : matrix_( list ) // The adapted dense matrix
1014 {
1015  if( !isSymmetric( matrix_ ) ) {
1016  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1017  }
1018 
1019  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1020 }
1022 //*************************************************************************************************
1023 
1024 
1025 //*************************************************************************************************
1051 template< typename MT // Type of the adapted dense matrix
1052  , bool SO > // Storage order of the adapted dense matrix
1053 template< typename Other > // Data type of the initialization array
1054 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n, const Other* array )
1055  : matrix_( n, n, array ) // The adapted dense matrix
1056 {
1057  if( !isSymmetric( matrix_ ) ) {
1058  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1059  }
1060 
1061  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1062 }
1064 //*************************************************************************************************
1065 
1066 
1067 //*************************************************************************************************
1090 template< typename MT // Type of the adapted dense matrix
1091  , bool SO > // Storage order of the adapted dense matrix
1092 template< typename Other // Data type of the initialization array
1093  , size_t N > // Number of rows and columns of the initialization array
1094 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Other (&array)[N][N] )
1095  : matrix_( array ) // The adapted dense matrix
1096 {
1097  if( !isSymmetric( matrix_ ) ) {
1098  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1099  }
1100 
1101  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1102 }
1104 //*************************************************************************************************
1105 
1106 
1107 //*************************************************************************************************
1139 template< typename MT // Type of the adapted dense matrix
1140  , bool SO > // Storage order of the adapted dense matrix
1141 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n )
1142  : matrix_( ptr, n, n ) // The adapted dense matrix
1143 {
1144  if( !isSymmetric( matrix_ ) ) {
1145  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1146  }
1147 
1148  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1149 }
1151 //*************************************************************************************************
1152 
1153 
1154 //*************************************************************************************************
1188 template< typename MT // Type of the adapted dense matrix
1189  , bool SO > // Storage order of the adapted dense matrix
1190 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
1191  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1192 {
1193  if( !isSymmetric( matrix_ ) ) {
1194  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1195  }
1196 
1197  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1198 }
1200 //*************************************************************************************************
1201 
1202 
1203 //*************************************************************************************************
1209 template< typename MT // Type of the adapted dense matrix
1210  , bool SO > // Storage order of the adapted dense matrix
1211 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
1212  : matrix_( m.matrix_ ) // The adapted dense matrix
1213 {
1214  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1215  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1216 }
1218 //*************************************************************************************************
1219 
1220 
1221 //*************************************************************************************************
1227 template< typename MT // Type of the adapted dense matrix
1228  , bool SO > // Storage order of the adapted dense matrix
1229 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
1230  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1231 {
1232  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1233  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1234 }
1236 //*************************************************************************************************
1237 
1238 
1239 //*************************************************************************************************
1249 template< typename MT // Type of the adapted dense matrix
1250  , bool SO > // Storage order of the adapted dense matrix
1251 template< typename MT2 > // Type of the foreign matrix
1252 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
1253  : matrix_( ~m ) // The adapted dense matrix
1254 {
1255  if( !IsSymmetric_v<MT2> && !isSymmetric( matrix_ ) ) {
1256  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1257  }
1258 
1259  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1260  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1261 }
1263 //*************************************************************************************************
1264 
1265 
1266 //*************************************************************************************************
1276 template< typename MT // Type of the adapted dense matrix
1277  , bool SO > // Storage order of the adapted dense matrix
1278 template< typename MT2 > // Type of the foreign matrix
1279 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
1280  : matrix_( trans( ~m ) ) // The adapted dense matrix
1281 {
1282  if( !IsSymmetric_v<MT2> && !isSymmetric( matrix_ ) ) {
1283  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1284  }
1285 
1286  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1287  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1288 }
1290 //*************************************************************************************************
1291 
1292 
1293 
1294 
1295 //=================================================================================================
1296 //
1297 // DATA ACCESS FUNCTIONS
1298 //
1299 //=================================================================================================
1300 
1301 //*************************************************************************************************
1316 template< typename MT // Type of the adapted dense matrix
1317  , bool SO > // Storage order of the adapted dense matrix
1319  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
1320 {
1321  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1322  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1323 
1324  return Reference( matrix_, i, j );
1325 }
1327 //*************************************************************************************************
1328 
1329 
1330 //*************************************************************************************************
1345 template< typename MT // Type of the adapted dense matrix
1346  , bool SO > // Storage order of the adapted dense matrix
1348  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
1349 {
1350  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1351  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1352 
1353  return matrix_(i,j);
1354 }
1356 //*************************************************************************************************
1357 
1358 
1359 //*************************************************************************************************
1375 template< typename MT // Type of the adapted dense matrix
1376  , bool SO > // Storage order of the adapted dense matrix
1378  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j )
1379 {
1380  if( i >= rows() ) {
1381  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1382  }
1383  if( j >= columns() ) {
1384  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1385  }
1386  return (*this)(i,j);
1387 }
1389 //*************************************************************************************************
1390 
1391 
1392 //*************************************************************************************************
1408 template< typename MT // Type of the adapted dense matrix
1409  , bool SO > // Storage order of the adapted dense matrix
1411  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j ) const
1412 {
1413  if( i >= rows() ) {
1414  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1415  }
1416  if( j >= columns() ) {
1417  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1418  }
1419  return (*this)(i,j);
1420 }
1422 //*************************************************************************************************
1423 
1424 
1425 //*************************************************************************************************
1439 template< typename MT // Type of the adapted dense matrix
1440  , bool SO > // Storage order of the adapted dense matrix
1441 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1443 {
1444  return matrix_.data();
1445 }
1447 //*************************************************************************************************
1448 
1449 
1450 //*************************************************************************************************
1461 template< typename MT // Type of the adapted dense matrix
1462  , bool SO > // Storage order of the adapted dense matrix
1463 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1464  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const noexcept
1465 {
1466  return matrix_.data(i);
1467 }
1469 //*************************************************************************************************
1470 
1471 
1472 //*************************************************************************************************
1484 template< typename MT // Type of the adapted dense matrix
1485  , bool SO > // Storage order of the adapted dense matrix
1488 {
1489  if( SO )
1490  return Iterator( matrix_, 0UL, i );
1491  else
1492  return Iterator( matrix_, i, 0UL );
1493 }
1495 //*************************************************************************************************
1496 
1497 
1498 //*************************************************************************************************
1510 template< typename MT // Type of the adapted dense matrix
1511  , bool SO > // Storage order of the adapted dense matrix
1513  SymmetricMatrix<MT,SO,true,true>::begin( size_t i ) const
1514 {
1515  return matrix_.begin(i);
1516 }
1518 //*************************************************************************************************
1519 
1520 
1521 //*************************************************************************************************
1533 template< typename MT // Type of the adapted dense matrix
1534  , bool SO > // Storage order of the adapted dense matrix
1537 {
1538  return matrix_.cbegin(i);
1539 }
1541 //*************************************************************************************************
1542 
1543 
1544 //*************************************************************************************************
1556 template< typename MT // Type of the adapted dense matrix
1557  , bool SO > // Storage order of the adapted dense matrix
1560 {
1561  if( SO )
1562  return Iterator( matrix_, rows(), i );
1563  else
1564  return Iterator( matrix_, i, columns() );
1565 }
1567 //*************************************************************************************************
1568 
1569 
1570 //*************************************************************************************************
1582 template< typename MT // Type of the adapted dense matrix
1583  , bool SO > // Storage order of the adapted dense matrix
1585  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1586 {
1587  return matrix_.end(i);
1588 }
1590 //*************************************************************************************************
1591 
1592 
1593 //*************************************************************************************************
1605 template< typename MT // Type of the adapted dense matrix
1606  , bool SO > // Storage order of the adapted dense matrix
1608  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1609 {
1610  return matrix_.cend(i);
1611 }
1613 //*************************************************************************************************
1614 
1615 
1616 
1617 
1618 //=================================================================================================
1619 //
1620 // ASSIGNMENT OPERATORS
1621 //
1622 //=================================================================================================
1623 
1624 //*************************************************************************************************
1649 template< typename MT // Type of the adapted dense matrix
1650  , bool SO > // Storage order of the adapted dense matrix
1651 inline SymmetricMatrix<MT,SO,true,true>&
1652  SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1653 {
1654  const InitializerMatrix<ElementType> tmp( list, list.size() );
1655 
1656  if( !isSymmetric( tmp ) ) {
1657  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1658  }
1659 
1660  matrix_ = list;
1661 
1662  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1663  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1664 
1665  return *this;
1666 }
1668 //*************************************************************************************************
1669 
1670 
1671 //*************************************************************************************************
1695 template< typename MT // Type of the adapted dense matrix
1696  , bool SO > // Storage order of the adapted dense matrix
1697 template< typename Other // Data type of the initialization array
1698  , size_t N > // Number of rows and columns of the initialization array
1699 inline SymmetricMatrix<MT,SO,true,true>&
1700  SymmetricMatrix<MT,SO,true,true>::operator=( const Other (&array)[N][N] )
1701 {
1702  MT tmp( array );
1703 
1704  if( !isSymmetric( tmp ) ) {
1705  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1706  }
1707 
1708  matrix_ = std::move( tmp );
1709 
1710  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1711  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1712 
1713  return *this;
1714 }
1716 //*************************************************************************************************
1717 
1718 
1719 //*************************************************************************************************
1729 template< typename MT // Type of the adapted dense matrix
1730  , bool SO > // Storage order of the adapted dense matrix
1731 inline SymmetricMatrix<MT,SO,true,true>&
1732  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1733 {
1734  matrix_ = rhs.matrix_;
1735 
1736  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1737  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1738 
1739  return *this;
1740 }
1742 //*************************************************************************************************
1743 
1744 
1745 //*************************************************************************************************
1752 template< typename MT // Type of the adapted dense matrix
1753  , bool SO > // Storage order of the adapted dense matrix
1754 inline SymmetricMatrix<MT,SO,true,true>&
1755  SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1756 {
1757  matrix_ = std::move( rhs.matrix_ );
1758 
1759  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1760  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1761 
1762  return *this;
1763 }
1765 //*************************************************************************************************
1766 
1767 
1768 //*************************************************************************************************
1781 template< typename MT // Type of the adapted dense matrix
1782  , bool SO > // Storage order of the adapted dense matrix
1783 template< typename MT2 > // Type of the right-hand side matrix
1784 inline auto SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1785  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1786 {
1787  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
1788  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1789  }
1790 
1791  matrix_ = ~rhs;
1792 
1793  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1794  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1795 
1796  return *this;
1797 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1815 template< typename MT // Type of the adapted dense matrix
1816  , bool SO > // Storage order of the adapted dense matrix
1817 template< typename MT2 > // Type of the right-hand side matrix
1818 inline auto SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1819  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1820 {
1821  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1822  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1823  }
1824 
1825  if( IsSymmetric_v<MT2> ) {
1826  matrix_ = ~rhs;
1827  }
1828  else {
1829  MT tmp( ~rhs );
1830 
1831  if( !isSymmetric( tmp ) ) {
1832  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1833  }
1834 
1835  matrix_ = std::move( tmp );
1836  }
1837 
1838  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1839  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1840 
1841  return *this;
1842 }
1844 //*************************************************************************************************
1845 
1846 
1847 //*************************************************************************************************
1860 template< typename MT // Type of the adapted dense matrix
1861  , bool SO > // Storage order of the adapted dense matrix
1862 template< typename MT2 > // Type of the right-hand side matrix
1863 inline auto SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1864  -> SymmetricMatrix&
1865 {
1866  return this->operator=( trans( ~rhs ) );
1867 }
1869 //*************************************************************************************************
1870 
1871 
1872 //*************************************************************************************************
1885 template< typename MT // Type of the adapted dense matrix
1886  , bool SO > // Storage order of the adapted dense matrix
1887 template< typename MT2 > // Type of the right-hand side matrix
1888 inline auto SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1889  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1890 {
1891  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
1892  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1893  }
1894 
1895  matrix_ += ~rhs;
1896 
1897  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1898  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1899 
1900  return *this;
1901 }
1903 //*************************************************************************************************
1904 
1905 
1906 //*************************************************************************************************
1919 template< typename MT // Type of the adapted dense matrix
1920  , bool SO > // Storage order of the adapted dense matrix
1921 template< typename MT2 > // Type of the right-hand side matrix
1922 inline auto SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1923  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1924 {
1925  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1926  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1927  }
1928 
1929  if( IsSymmetric_v<MT2> ) {
1930  matrix_ += ~rhs;
1931  }
1932  else {
1933  const ResultType_t<MT2> tmp( ~rhs );
1934 
1935  if( !isSymmetric( tmp ) ) {
1936  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1937  }
1938 
1939  matrix_ += tmp;
1940  }
1941 
1942  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1943  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1944 
1945  return *this;
1946 }
1948 //*************************************************************************************************
1949 
1950 
1951 //*************************************************************************************************
1965 template< typename MT // Type of the adapted dense matrix
1966  , bool SO > // Storage order of the adapted dense matrix
1967 template< typename MT2 > // Type of the right-hand side matrix
1968 inline auto SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1969  -> SymmetricMatrix&
1970 {
1971  return this->operator+=( trans( ~rhs ) );
1972 }
1974 //*************************************************************************************************
1975 
1976 
1977 //*************************************************************************************************
1990 template< typename MT // Type of the adapted dense matrix
1991  , bool SO > // Storage order of the adapted dense matrix
1992 template< typename MT2 > // Type of the right-hand side matrix
1993 inline auto SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
1994  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1995 {
1996  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
1997  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1998  }
1999 
2000  matrix_ -= ~rhs;
2001 
2002  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2003  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2004 
2005  return *this;
2006 }
2008 //*************************************************************************************************
2009 
2010 
2011 //*************************************************************************************************
2024 template< typename MT // Type of the adapted dense matrix
2025  , bool SO > // Storage order of the adapted dense matrix
2026 template< typename MT2 > // Type of the right-hand side matrix
2027 inline auto SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2028  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2029 {
2030  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2031  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2032  }
2033 
2034  if( IsSymmetric_v<MT2> ) {
2035  matrix_ -= ~rhs;
2036  }
2037  else {
2038  const ResultType_t<MT2> tmp( ~rhs );
2039 
2040  if( !isSymmetric( tmp ) ) {
2041  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2042  }
2043 
2044  matrix_ -= tmp;
2045  }
2046 
2047  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2048  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2049 
2050  return *this;
2051 }
2053 //*************************************************************************************************
2054 
2055 
2056 //*************************************************************************************************
2070 template< typename MT // Type of the adapted dense matrix
2071  , bool SO > // Storage order of the adapted dense matrix
2072 template< typename MT2 > // Type of the right-hand side matrix
2073 inline auto SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2074  -> SymmetricMatrix&
2075 {
2076  return this->operator-=( trans( ~rhs ) );
2077 }
2079 //*************************************************************************************************
2080 
2081 
2082 //*************************************************************************************************
2096 template< typename MT // Type of the adapted dense matrix
2097  , bool SO > // Storage order of the adapted dense matrix
2098 template< typename MT2 > // Type of the right-hand side matrix
2099 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2100  -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2101 {
2102  if( !IsSymmetric_v<MT2> && !isSymmetric( ~rhs ) ) {
2103  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2104  }
2105 
2106  matrix_ %= ~rhs;
2107 
2108  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2109  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2110 
2111  return *this;
2112 }
2114 //*************************************************************************************************
2115 
2116 
2117 //*************************************************************************************************
2131 template< typename MT // Type of the adapted dense matrix
2132  , bool SO > // Storage order of the adapted dense matrix
2133 template< typename MT2 > // Type of the right-hand side matrix
2134 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2135  -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2136 {
2137  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
2138  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2139  }
2140 
2141  if( IsSymmetric_v<MT2> ) {
2142  matrix_ %= ~rhs;
2143  }
2144  else {
2145  const ResultType_t<MT2> tmp( ~rhs );
2146 
2147  if( !isSymmetric( tmp ) ) {
2148  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2149  }
2150 
2151  matrix_ %= tmp;
2152  }
2153 
2154  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2155  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2156 
2157  return *this;
2158 }
2160 //*************************************************************************************************
2161 
2162 
2163 //*************************************************************************************************
2177 template< typename MT // Type of the adapted dense matrix
2178  , bool SO > // Storage order of the adapted dense matrix
2179 template< typename MT2 > // Type of the right-hand side matrix
2180 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2181  -> SymmetricMatrix&
2182 {
2183  return this->operator%=( trans( ~rhs ) );
2184 }
2186 //*************************************************************************************************
2187 
2188 
2189 //*************************************************************************************************
2197 template< typename MT // Type of the adapted dense matrix
2198  , bool SO > // Storage order of the adapted dense matrix
2199 template< typename ST > // Data type of the right-hand side scalar
2201  -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >
2202 {
2203  matrix_ *= rhs;
2204  return *this;
2205 }
2206 //*************************************************************************************************
2207 
2208 
2209 //*************************************************************************************************
2217 template< typename MT // Type of the adapted dense matrix
2218  , bool SO > // Storage order of the adapted dense matrix
2219 template< typename ST > // Data type of the right-hand side scalar
2221  -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >
2222 {
2223  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
2224 
2225  matrix_ /= rhs;
2226  return *this;
2227 }
2229 //*************************************************************************************************
2230 
2231 
2232 
2233 
2234 //=================================================================================================
2235 //
2236 // UTILITY FUNCTIONS
2237 //
2238 //=================================================================================================
2239 
2240 //*************************************************************************************************
2246 template< typename MT // Type of the adapted dense matrix
2247  , bool SO > // Storage order of the adapted dense matrix
2248 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const noexcept
2249 {
2250  return matrix_.rows();
2251 }
2253 //*************************************************************************************************
2254 
2255 
2256 //*************************************************************************************************
2262 template< typename MT // Type of the adapted dense matrix
2263  , bool SO > // Storage order of the adapted dense matrix
2264 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const noexcept
2265 {
2266  return matrix_.columns();
2267 }
2269 //*************************************************************************************************
2270 
2271 
2272 //*************************************************************************************************
2284 template< typename MT // Type of the adapted dense matrix
2285  , bool SO > // Storage order of the adapted dense matrix
2286 inline size_t SymmetricMatrix<MT,SO,true,true>::spacing() const noexcept
2287 {
2288  return matrix_.spacing();
2289 }
2291 //*************************************************************************************************
2292 
2293 
2294 //*************************************************************************************************
2300 template< typename MT // Type of the adapted dense matrix
2301  , bool SO > // Storage order of the adapted dense matrix
2302 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const noexcept
2303 {
2304  return matrix_.capacity();
2305 }
2307 //*************************************************************************************************
2308 
2309 
2310 //*************************************************************************************************
2321 template< typename MT // Type of the adapted dense matrix
2322  , bool SO > // Storage order of the adapted dense matrix
2323 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const noexcept
2324 {
2325  return matrix_.capacity(i);
2326 }
2328 //*************************************************************************************************
2329 
2330 
2331 //*************************************************************************************************
2337 template< typename MT // Type of the adapted dense matrix
2338  , bool SO > // Storage order of the adapted dense matrix
2339 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
2340 {
2341  return matrix_.nonZeros();
2342 }
2344 //*************************************************************************************************
2345 
2346 
2347 //*************************************************************************************************
2359 template< typename MT // Type of the adapted dense matrix
2360  , bool SO > // Storage order of the adapted dense matrix
2361 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
2362 {
2363  return matrix_.nonZeros(i);
2364 }
2366 //*************************************************************************************************
2367 
2368 
2369 //*************************************************************************************************
2375 template< typename MT // Type of the adapted dense matrix
2376  , bool SO > // Storage order of the adapted dense matrix
2378 {
2379  matrix_.reset();
2380 }
2382 //*************************************************************************************************
2383 
2384 
2385 //*************************************************************************************************
2421 template< typename MT // Type of the adapted dense matrix
2422  , bool SO > // Storage order of the adapted dense matrix
2423 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
2424 {
2425  row ( matrix_, i, unchecked ).reset();
2426  column( matrix_, i, unchecked ).reset();
2427 }
2429 //*************************************************************************************************
2430 
2431 
2432 //*************************************************************************************************
2444 template< typename MT // Type of the adapted dense matrix
2445  , bool SO > // Storage order of the adapted dense matrix
2447 {
2448  using blaze::clear;
2449 
2450  clear( matrix_ );
2451 }
2453 //*************************************************************************************************
2454 
2455 
2456 //*************************************************************************************************
2491 template< typename MT // Type of the adapted dense matrix
2492  , bool SO > // Storage order of the adapted dense matrix
2493 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
2494 {
2496 
2497  UNUSED_PARAMETER( preserve );
2498 
2499  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2500 
2501  const size_t oldsize( matrix_.rows() );
2502 
2503  matrix_.resize( n, n, true );
2504 
2505  if( n > oldsize ) {
2506  const size_t increment( n - oldsize );
2507  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2508  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2509  }
2510 }
2512 //*************************************************************************************************
2513 
2514 
2515 //*************************************************************************************************
2528 template< typename MT // Type of the adapted dense matrix
2529  , bool SO > // Storage order of the adapted dense matrix
2530 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
2531 {
2533 
2534  UNUSED_PARAMETER( preserve );
2535 
2536  resize( rows() + n, true );
2537 }
2538 //*************************************************************************************************
2539 
2540 
2541 //*************************************************************************************************
2551 template< typename MT // Type of the adapted dense matrix
2552  , bool SO > // Storage order of the adapted dense matrix
2553 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
2554 {
2555  matrix_.reserve( elements );
2556 }
2558 //*************************************************************************************************
2559 
2560 
2561 //*************************************************************************************************
2571 template< typename MT // Type of the adapted dense matrix
2572  , bool SO > // Storage order of the adapted dense matrix
2574 {
2575  matrix_.shrinkToFit();
2576 }
2578 //*************************************************************************************************
2579 
2580 
2581 //*************************************************************************************************
2588 template< typename MT // Type of the adapted dense matrix
2589  , bool SO > // Storage order of the adapted dense matrix
2590 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) noexcept
2591 {
2592  using std::swap;
2593 
2594  swap( matrix_, m.matrix_ );
2595 }
2597 //*************************************************************************************************
2598 
2599 
2600 
2601 
2602 //=================================================================================================
2603 //
2604 // NUMERIC FUNCTIONS
2605 //
2606 //=================================================================================================
2607 
2608 //*************************************************************************************************
2614 template< typename MT // Type of the adapted dense matrix
2615  , bool SO > // Storage order of the adapted dense matrix
2616 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
2617 {
2618  return *this;
2619 }
2621 //*************************************************************************************************
2622 
2623 
2624 //*************************************************************************************************
2630 template< typename MT // Type of the adapted dense matrix
2631  , bool SO > // Storage order of the adapted dense matrix
2632 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::ctranspose()
2633 {
2634  if( !IsBuiltin_v<ElementType> )
2635  conjugate( matrix_ );
2636 
2637  return *this;
2638 }
2640 //*************************************************************************************************
2641 
2642 
2643 //*************************************************************************************************
2661 template< typename MT // Type of the adapted dense matrix
2662  , bool SO > // Storage order of the adapted dense matrix
2663 template< typename Other > // Data type of the scalar value
2664 inline SymmetricMatrix<MT,SO,true,true>&
2665  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
2666 {
2667  matrix_.scale( scalar );
2668  return *this;
2669 }
2671 //*************************************************************************************************
2672 
2673 
2674 
2675 
2676 //=================================================================================================
2677 //
2678 // DEBUGGING FUNCTIONS
2679 //
2680 //=================================================================================================
2681 
2682 //*************************************************************************************************
2692 template< typename MT // Type of the adapted dense matrix
2693  , bool SO > // Storage order of the adapted dense matrix
2694 inline bool SymmetricMatrix<MT,SO,true,true>::isIntact() const noexcept
2695 {
2696  using blaze::isIntact;
2697 
2698  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2699 }
2701 //*************************************************************************************************
2702 
2703 
2704 
2705 
2706 //=================================================================================================
2707 //
2708 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2709 //
2710 //=================================================================================================
2711 
2712 //*************************************************************************************************
2723 template< typename MT // Type of the adapted dense matrix
2724  , bool SO > // Storage order of the adapted dense matrix
2725 template< typename Other > // Data type of the foreign expression
2726 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const noexcept
2727 {
2728  return matrix_.canAlias( alias );
2729 }
2731 //*************************************************************************************************
2732 
2733 
2734 //*************************************************************************************************
2745 template< typename MT // Type of the adapted dense matrix
2746  , bool SO > // Storage order of the adapted dense matrix
2747 template< typename Other > // Data type of the foreign expression
2748 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const noexcept
2749 {
2750  return matrix_.isAliased( alias );
2751 }
2753 //*************************************************************************************************
2754 
2755 
2756 //*************************************************************************************************
2766 template< typename MT // Type of the adapted dense matrix
2767  , bool SO > // Storage order of the adapted dense matrix
2768 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2769 {
2770  return matrix_.isAligned();
2771 }
2773 //*************************************************************************************************
2774 
2775 
2776 //*************************************************************************************************
2787 template< typename MT // Type of the adapted dense matrix
2788  , bool SO > // Storage order of the adapted dense matrix
2789 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2790 {
2791  return matrix_.canSMPAssign();
2792 }
2794 //*************************************************************************************************
2795 
2796 
2797 //*************************************************************************************************
2813 template< typename MT // Type of the adapted dense matrix
2814  , bool SO > // Storage order of the adapted dense matrix
2815 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2816  SymmetricMatrix<MT,SO,true,true>::load( size_t i, size_t j ) const noexcept
2817 {
2818  return matrix_.load( i, j );
2819 }
2821 //*************************************************************************************************
2822 
2823 
2824 //*************************************************************************************************
2840 template< typename MT // Type of the adapted dense matrix
2841  , bool SO > // Storage order of the adapted dense matrix
2842 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2843  SymmetricMatrix<MT,SO,true,true>::loada( size_t i, size_t j ) const noexcept
2844 {
2845  return matrix_.loada( i, j );
2846 }
2848 //*************************************************************************************************
2849 
2850 
2851 //*************************************************************************************************
2867 template< typename MT // Type of the adapted dense matrix
2868  , bool SO > // Storage order of the adapted dense matrix
2869 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2870  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const noexcept
2871 {
2872  return matrix_.loadu( i, j );
2873 }
2875 //*************************************************************************************************
2876 
2877 
2878 //*************************************************************************************************
2895 template< typename MT // Type of the adapted dense matrix
2896  , bool SO > // Storage order of the adapted dense matrix
2897 inline void
2898  SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2899 {
2900  matrix_.store( i, j, value );
2901 
2902  if( SO ) {
2903  const size_t kend( min( i+SIMDSIZE, rows() ) );
2904  for( size_t k=i; k<kend; ++k )
2905  matrix_(j,k) = matrix_(k,j);
2906  }
2907  else {
2908  const size_t kend( min( j+SIMDSIZE, columns() ) );
2909  for( size_t k=j; k<kend; ++k )
2910  matrix_(k,i) = matrix_(i,k);
2911  }
2912 }
2914 //*************************************************************************************************
2915 
2916 
2917 //*************************************************************************************************
2934 template< typename MT // Type of the adapted dense matrix
2935  , bool SO > // Storage order of the adapted dense matrix
2936 inline void
2937  SymmetricMatrix<MT,SO,true,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2938 {
2939  matrix_.storea( i, j, value );
2940 
2941  if( SO ) {
2942  const size_t kend( min( i+SIMDSIZE, rows() ) );
2943  for( size_t k=i; k<kend; ++k )
2944  matrix_(j,k) = matrix_(k,j);
2945  }
2946  else {
2947  const size_t kend( min( j+SIMDSIZE, columns() ) );
2948  for( size_t k=j; k<kend; ++k )
2949  matrix_(k,i) = matrix_(i,k);
2950  }
2951 }
2953 //*************************************************************************************************
2954 
2955 
2956 //*************************************************************************************************
2973 template< typename MT // Type of the adapted dense matrix
2974  , bool SO > // Storage order of the adapted dense matrix
2975 inline void
2976  SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2977 {
2978  matrix_.storeu( i, j, value );
2979 
2980  if( SO ) {
2981  const size_t kend( min( i+SIMDSIZE, rows() ) );
2982  for( size_t k=i; k<kend; ++k )
2983  matrix_(j,k) = matrix_(k,j);
2984  }
2985  else {
2986  const size_t kend( min( j+SIMDSIZE, columns() ) );
2987  for( size_t k=j; k<kend; ++k )
2988  matrix_(k,i) = matrix_(i,k);
2989  }
2990 }
2992 //*************************************************************************************************
2993 
2994 
2995 //*************************************************************************************************
3012 template< typename MT // Type of the adapted dense matrix
3013  , bool SO > // Storage order of the adapted dense matrix
3014 inline void
3015  SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3016 {
3017  matrix_.stream( i, j, value );
3018 
3019  if( SO ) {
3020  const size_t kend( min( i+SIMDSIZE, rows() ) );
3021  for( size_t k=i; k<kend; ++k )
3022  matrix_(j,k) = matrix_(k,j);
3023  }
3024  else {
3025  const size_t kend( min( j+SIMDSIZE, columns() ) );
3026  for( size_t k=j; k<kend; ++k )
3027  matrix_(k,i) = matrix_(i,k);
3028  }
3029 }
3031 //*************************************************************************************************
3032 
3033 } // namespace blaze
3034 
3035 #endif
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3078
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
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:354
Header file for the UNUSED_PARAMETER function template.
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:169
#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_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.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
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
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
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 clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5828
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
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.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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:252
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:673
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:775
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5890
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
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:1147
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
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.
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:135
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
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:8908
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 all forward declarations for expression class templates.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the implementation of the Column view.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
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:539
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
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
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 &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
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:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
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
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
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
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825