DenseNumeric.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
57 #include <blaze/math/Exception.h>
62 #include <blaze/math/shims/Clear.h>
64 #include <blaze/math/SIMD.h>
71 #include <blaze/math/views/Row.h>
73 #include <blaze/system/Inline.h>
75 #include <blaze/util/Assert.h>
81 #include <blaze/util/DisableIf.h>
82 #include <blaze/util/EnableIf.h>
83 #include <blaze/util/mpl/If.h>
85 #include <blaze/util/Types.h>
88 #include <blaze/util/Unused.h>
89 
90 
91 namespace blaze {
92 
93 //=================================================================================================
94 //
95 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NUMERIC ELEMENT TYPE
96 //
97 //=================================================================================================
98 
99 //*************************************************************************************************
107 template< typename MT // Type of the adapted dense matrix
108  , bool SO > // Storage order of the adapted dense matrix
109 class SymmetricMatrix<MT,SO,true,true>
110  : public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
111 {
112  private:
113  //**Type definitions****************************************************************************
114  using OT = OppositeType_<MT>;
115  using TT = TransposeType_<MT>;
116  using ET = ElementType_<MT>;
117  //**********************************************************************************************
118 
119  public:
120  //**Type definitions****************************************************************************
121  using This = SymmetricMatrix<MT,SO,true,true>;
122  using BaseType = DenseMatrix<This,SO>;
123  using ResultType = This;
124  using OppositeType = SymmetricMatrix<OT,!SO,true,true>;
125  using TransposeType = SymmetricMatrix<TT,!SO,true,true>;
126  using ElementType = ET;
127  using SIMDType = SIMDType_<MT>;
128  using ReturnType = ReturnType_<MT>;
129  using CompositeType = const This&;
130  using Reference = NumericProxy<MT>;
131  using ConstReference = ConstReference_<MT>;
132  using Pointer = Pointer_<MT>;
133  using ConstPointer = ConstPointer_<MT>;
134  using ConstIterator = ConstIterator_<MT>;
135  //**********************************************************************************************
136 
137  //**Rebind struct definition********************************************************************
140  template< typename NewType > // Data type of the other matrix
141  struct Rebind {
143  using Other = SymmetricMatrix< typename MT::template Rebind<NewType>::Other >;
144  };
145  //**********************************************************************************************
146 
147  //**Resize struct definition********************************************************************
150  template< size_t NewM // Number of rows of the other matrix
151  , size_t NewN > // Number of columns of the other matrix
152  struct Resize {
154  using Other = SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other >;
155  };
156  //**********************************************************************************************
157 
158  //**Iterator class definition*******************************************************************
161  class Iterator
162  {
163  public:
164  //**Type definitions*************************************************************************
165  using IteratorCategory = std::random_access_iterator_tag;
166  using ValueType = ElementType_<MT>;
167  using PointerType = NumericProxy<MT>;
168  using ReferenceType = NumericProxy<MT>;
169  using DifferenceType = ptrdiff_t;
170 
171  // STL iterator requirements
172  using iterator_category = IteratorCategory;
173  using value_type = ValueType;
174  using pointer = PointerType;
175  using reference = ReferenceType;
176  using difference_type = DifferenceType;
177  //*******************************************************************************************
178 
179  //**Constructor******************************************************************************
182  inline Iterator() noexcept
183  : matrix_( nullptr ) // Reference to the adapted dense matrix
184  , row_ ( 0UL ) // The current row index of the iterator
185  , column_( 0UL ) // The current column index of the iterator
186  {}
187  //*******************************************************************************************
188 
189  //**Constructor******************************************************************************
196  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
197  : matrix_( &matrix ) // Reference to the adapted dense matrix
198  , row_ ( row ) // The current row index of the iterator
199  , column_( column ) // The current column index of the iterator
200  {}
201  //*******************************************************************************************
202 
203  //**Addition assignment operator*************************************************************
209  inline Iterator& operator+=( size_t inc ) noexcept {
210  ( SO )?( row_ += inc ):( column_ += inc );
211  return *this;
212  }
213  //*******************************************************************************************
214 
215  //**Subtraction assignment operator**********************************************************
221  inline Iterator& operator-=( size_t dec ) noexcept {
222  ( SO )?( row_ -= dec ):( column_ -= dec );
223  return *this;
224  }
225  //*******************************************************************************************
226 
227  //**Prefix increment operator****************************************************************
232  inline Iterator& operator++() noexcept {
233  ( SO )?( ++row_ ):( ++column_ );
234  return *this;
235  }
236  //*******************************************************************************************
237 
238  //**Postfix increment operator***************************************************************
243  inline const Iterator operator++( int ) noexcept {
244  const Iterator tmp( *this );
245  ++(*this);
246  return tmp;
247  }
248  //*******************************************************************************************
249 
250  //**Prefix decrement operator****************************************************************
255  inline Iterator& operator--() noexcept {
256  ( SO )?( --row_ ):( --column_ );
257  return *this;
258  }
259  //*******************************************************************************************
260 
261  //**Postfix decrement operator***************************************************************
266  inline const Iterator operator--( int ) noexcept {
267  const Iterator tmp( *this );
268  --(*this);
269  return tmp;
270  }
271  //*******************************************************************************************
272 
273  //**Element access operator******************************************************************
278  inline ReferenceType operator*() const {
279  return ReferenceType( *matrix_, row_, column_ );
280  }
281  //*******************************************************************************************
282 
283  //**Element access operator******************************************************************
288  inline PointerType operator->() const {
289  return PointerType( *matrix_, row_, column_ );
290  }
291  //*******************************************************************************************
292 
293  //**Load function****************************************************************************
303  inline SIMDType load() const {
304  return (*matrix_).load(row_,column_);
305  }
306  //*******************************************************************************************
307 
308  //**Loada function***************************************************************************
318  inline SIMDType loada() const {
319  return (*matrix_).loada(row_,column_);
320  }
321  //*******************************************************************************************
322 
323  //**Loadu function***************************************************************************
333  inline SIMDType loadu() const {
334  return (*matrix_).loadu(row_,column_);
335  }
336  //*******************************************************************************************
337 
338  //**Store function***************************************************************************
349  inline void store( const SIMDType& value ) const {
350  (*matrix_).store( row_, column_, value );
351  sync();
352  }
353  //*******************************************************************************************
354 
355  //**Storea function**************************************************************************
366  inline void storea( const SIMDType& value ) const {
367  (*matrix_).storea( row_, column_, value );
368  sync();
369  }
370  //*******************************************************************************************
371 
372  //**Storeu function**************************************************************************
383  inline void storeu( const SIMDType& value ) const {
384  (*matrix_).storeu( row_, column_, value );
385  sync();
386  }
387  //*******************************************************************************************
388 
389  //**Stream function**************************************************************************
400  inline void stream( const SIMDType& value ) const {
401  (*matrix_).stream( row_, column_, value );
402  sync();
403  }
404  //*******************************************************************************************
405 
406  //**Conversion operator**********************************************************************
411  inline operator ConstIterator() const {
412  if( SO )
413  return matrix_->begin( column_ ) + row_;
414  else
415  return matrix_->begin( row_ ) + column_;
416  }
417  //*******************************************************************************************
418 
419  //**Equality operator************************************************************************
426  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
427  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
428  }
429  //*******************************************************************************************
430 
431  //**Equality operator************************************************************************
438  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
439  return ( ConstIterator( lhs ) == rhs );
440  }
441  //*******************************************************************************************
442 
443  //**Equality operator************************************************************************
450  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
451  return ( lhs == ConstIterator( rhs ) );
452  }
453  //*******************************************************************************************
454 
455  //**Inequality operator**********************************************************************
462  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
463  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
464  }
465  //*******************************************************************************************
466 
467  //**Inequality operator**********************************************************************
474  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
475  return ( ConstIterator( lhs ) != rhs );
476  }
477  //*******************************************************************************************
478 
479  //**Inequality operator**********************************************************************
486  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
487  return ( lhs != ConstIterator( rhs ) );
488  }
489  //*******************************************************************************************
490 
491  //**Less-than operator***********************************************************************
498  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
499  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
500  }
501  //*******************************************************************************************
502 
503  //**Less-than operator***********************************************************************
510  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
511  return ( ConstIterator( lhs ) < rhs );
512  }
513  //*******************************************************************************************
514 
515  //**Less-than operator***********************************************************************
522  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
523  return ( lhs < ConstIterator( rhs ) );
524  }
525  //*******************************************************************************************
526 
527  //**Greater-than operator********************************************************************
534  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
535  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
536  }
537  //*******************************************************************************************
538 
539  //**Greater-than operator********************************************************************
546  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
547  return ( ConstIterator( lhs ) > rhs );
548  }
549  //*******************************************************************************************
550 
551  //**Greater-than operator********************************************************************
558  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
559  return ( lhs > ConstIterator( rhs ) );
560  }
561  //*******************************************************************************************
562 
563  //**Less-or-equal-than operator**************************************************************
570  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
571  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
572  }
573  //*******************************************************************************************
574 
575  //**Less-or-equal-than operator**************************************************************
582  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
583  return ( ConstIterator( lhs ) <= rhs );
584  }
585  //*******************************************************************************************
586 
587  //**Less-or-equal-than operator**************************************************************
594  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
595  return ( lhs <= ConstIterator( rhs ) );
596  }
597  //*******************************************************************************************
598 
599  //**Greater-or-equal-than operator***********************************************************
606  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
607  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
608  }
609  //*******************************************************************************************
610 
611  //**Greater-or-equal-than operator***********************************************************
618  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
619  return ( ConstIterator( lhs ) >= rhs );
620  }
621  //*******************************************************************************************
622 
623  //**Greater-or-equal-than operator***********************************************************
630  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
631  return ( lhs >= ConstIterator( rhs ) );
632  }
633  //*******************************************************************************************
634 
635  //**Subtraction operator*********************************************************************
641  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
642  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
643  }
644  //*******************************************************************************************
645 
646  //**Addition operator************************************************************************
653  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
654  if( SO )
655  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
656  else
657  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
658  }
659  //*******************************************************************************************
660 
661  //**Addition operator************************************************************************
668  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
669  if( SO )
670  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
671  else
672  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
673  }
674  //*******************************************************************************************
675 
676  //**Subtraction operator*********************************************************************
683  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
684  if( SO )
685  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
686  else
687  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
688  }
689  //*******************************************************************************************
690 
691  private:
692  //**Sync function****************************************************************************
697  void sync() const {
698  if( SO ) {
699  const size_t kend( min( row_+SIMDSIZE, (*matrix_).rows() ) );
700  for( size_t k=row_; k<kend; ++k )
701  (*matrix_)(column_,k) = (*matrix_)(k,column_);
702  }
703  else {
704  const size_t kend( min( column_+SIMDSIZE, (*matrix_).columns() ) );
705  for( size_t k=column_; k<kend; ++k )
706  (*matrix_)(k,row_) = (*matrix_)(row_,k);
707  }
708  }
709  //*******************************************************************************************
710 
711  //**Member variables*************************************************************************
712  MT* matrix_;
713  size_t row_;
714  size_t column_;
715  //*******************************************************************************************
716  };
717  //**********************************************************************************************
718 
719  //**Compilation flags***************************************************************************
721  enum : bool { simdEnabled = MT::simdEnabled };
722 
724  enum : bool { smpAssignable = MT::smpAssignable };
725  //**********************************************************************************************
726 
727  //**Constructors********************************************************************************
730  explicit inline SymmetricMatrix();
731  explicit inline SymmetricMatrix( size_t n );
732  explicit inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
733 
734  template< typename Other >
735  explicit inline SymmetricMatrix( size_t n, const Other* array );
736 
737  template< typename Other, size_t N >
738  explicit inline SymmetricMatrix( const Other (&array)[N][N] );
739 
740  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
741  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
742 
743  inline SymmetricMatrix( const SymmetricMatrix& m );
744  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
745 
746  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
747  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
749  //**********************************************************************************************
750 
751  //**Destructor**********************************************************************************
752  // No explicitly declared destructor.
753  //**********************************************************************************************
754 
755  //**Data access functions***********************************************************************
758  inline Reference operator()( size_t i, size_t j );
759  inline ConstReference operator()( size_t i, size_t j ) const;
760  inline Reference at( size_t i, size_t j );
761  inline ConstReference at( size_t i, size_t j ) const;
762  inline ConstPointer data () const noexcept;
763  inline ConstPointer data ( size_t i ) const noexcept;
764  inline Iterator begin ( size_t i );
765  inline ConstIterator begin ( size_t i ) const;
766  inline ConstIterator cbegin( size_t i ) const;
767  inline Iterator end ( size_t i );
768  inline ConstIterator end ( size_t i ) const;
769  inline ConstIterator cend ( size_t i ) const;
771  //**********************************************************************************************
772 
773  //**Assignment operators************************************************************************
776  inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
777 
778  template< typename Other, size_t N >
779  inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
780 
781  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
782  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
783 
784  template< typename MT2 >
785  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
786 
787  template< typename MT2 >
788  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
789 
790  template< typename MT2 >
791  inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
792 
793  template< typename MT2 >
794  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
795 
796  template< typename MT2 >
797  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
798 
799  template< typename MT2 >
800  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
801 
802  template< typename MT2 >
803  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
804 
805  template< typename MT2 >
806  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
807 
808  template< typename MT2 >
809  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
810 
811  template< typename MT2 >
812  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator%=( const Matrix<MT2,SO>& rhs );
813 
814  template< typename MT2 >
815  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator%=( const Matrix<MT2,SO>& rhs );
816 
817  template< typename MT2 >
818  inline SymmetricMatrix& operator%=( const Matrix<MT2,!SO>& rhs );
819 
820  template< typename MT2, bool SO2 >
821  inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
822 
823  template< typename Other >
824  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator*=( Other rhs );
825 
826  template< typename Other >
827  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator/=( Other rhs );
829  //**********************************************************************************************
830 
831  //**Utility functions***************************************************************************
834  inline size_t rows() const noexcept;
835  inline size_t columns() const noexcept;
836  inline size_t spacing() const noexcept;
837  inline size_t capacity() const noexcept;
838  inline size_t capacity( size_t i ) const noexcept;
839  inline size_t nonZeros() const;
840  inline size_t nonZeros( size_t i ) const;
841  inline void reset();
842  inline void reset( size_t i );
843  inline void clear();
844  void resize ( size_t n, bool preserve=true );
845  inline void extend ( size_t n, bool preserve=true );
846  inline void reserve( size_t elements );
847  inline void shrinkToFit();
848  inline void swap( SymmetricMatrix& m ) noexcept;
850  //**********************************************************************************************
851 
852  //**Numeric functions***************************************************************************
855  inline SymmetricMatrix& transpose();
856  inline SymmetricMatrix& ctranspose();
857 
858  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
860  //**********************************************************************************************
861 
862  //**Debugging functions*************************************************************************
865  inline bool isIntact() const noexcept;
867  //**********************************************************************************************
868 
869  //**Expression template evaluation functions****************************************************
872  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
873  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
874 
875  inline bool isAligned () const noexcept;
876  inline bool canSMPAssign() const noexcept;
877 
878  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
879  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
880  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
881 
882  inline void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
883  inline void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
884  inline void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
885  inline void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
887  //**********************************************************************************************
888 
889  private:
890  //**SIMD properties*****************************************************************************
892  enum : size_t { SIMDSIZE = SIMDTrait<ET>::size };
893  //**********************************************************************************************
894 
895  //**Member variables****************************************************************************
898  MT matrix_;
899 
900  //**********************************************************************************************
901 
902  //**Friend declarations*************************************************************************
903  template< bool RF, typename MT2, bool SO2, bool DF2, bool NF2 >
904  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
905 
906  template< InversionFlag IF, typename MT2, bool SO2 >
907  friend void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
908  //**********************************************************************************************
909 
910  //**Compile time checks*************************************************************************
924  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
925  //**********************************************************************************************
926 };
928 //*************************************************************************************************
929 
930 
931 
932 
933 //=================================================================================================
934 //
935 // CONSTRUCTORS
936 //
937 //=================================================================================================
938 
939 //*************************************************************************************************
943 template< typename MT // Type of the adapted dense matrix
944  , bool SO > // Storage order of the adapted dense matrix
945 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
946  : matrix_() // The adapted dense matrix
947 {
948  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
949  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
950 }
952 //*************************************************************************************************
953 
954 
955 //*************************************************************************************************
961 template< typename MT // Type of the adapted dense matrix
962  , bool SO > // Storage order of the adapted dense matrix
963 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n )
964  : matrix_( n, n, ElementType() ) // The adapted dense matrix
965 {
967 
968  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
969  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
970 }
972 //*************************************************************************************************
973 
974 
975 //*************************************************************************************************
998 template< typename MT // Type of the adapted dense matrix
999  , bool SO > // Storage order of the adapted dense matrix
1000 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
1001  : matrix_( list ) // The adapted dense matrix
1002 {
1003  if( !isSymmetric( matrix_ ) ) {
1004  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1005  }
1006 
1007  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1008 }
1010 //*************************************************************************************************
1011 
1012 
1013 //*************************************************************************************************
1039 template< typename MT // Type of the adapted dense matrix
1040  , bool SO > // Storage order of the adapted dense matrix
1041 template< typename Other > // Data type of the initialization array
1042 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n, const Other* array )
1043  : matrix_( n, n, array ) // The adapted dense matrix
1044 {
1045  if( !isSymmetric( matrix_ ) ) {
1046  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1047  }
1048 
1049  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1050 }
1052 //*************************************************************************************************
1053 
1054 
1055 //*************************************************************************************************
1078 template< typename MT // Type of the adapted dense matrix
1079  , bool SO > // Storage order of the adapted dense matrix
1080 template< typename Other // Data type of the initialization array
1081  , size_t N > // Number of rows and columns of the initialization array
1082 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Other (&array)[N][N] )
1083  : matrix_( array ) // The adapted dense matrix
1084 {
1085  if( !isSymmetric( matrix_ ) ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1087  }
1088 
1089  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1090 }
1092 //*************************************************************************************************
1093 
1094 
1095 //*************************************************************************************************
1127 template< typename MT // Type of the adapted dense matrix
1128  , bool SO > // Storage order of the adapted dense matrix
1129 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n )
1130  : matrix_( ptr, n, n ) // The adapted dense matrix
1131 {
1132  if( !isSymmetric( matrix_ ) ) {
1133  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1134  }
1135 
1136  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1137 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1176 template< typename MT // Type of the adapted dense matrix
1177  , bool SO > // Storage order of the adapted dense matrix
1178 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
1179  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1180 {
1181  if( !isSymmetric( matrix_ ) ) {
1182  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1183  }
1184 
1185  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1186 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1197 template< typename MT // Type of the adapted dense matrix
1198  , bool SO > // Storage order of the adapted dense matrix
1199 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
1200  : matrix_( m.matrix_ ) // The adapted dense matrix
1201 {
1202  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1203  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1204 }
1206 //*************************************************************************************************
1207 
1208 
1209 //*************************************************************************************************
1215 template< typename MT // Type of the adapted dense matrix
1216  , bool SO > // Storage order of the adapted dense matrix
1217 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
1218  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1219 {
1220  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1221  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1222 }
1224 //*************************************************************************************************
1225 
1226 
1227 //*************************************************************************************************
1237 template< typename MT // Type of the adapted dense matrix
1238  , bool SO > // Storage order of the adapted dense matrix
1239 template< typename MT2 > // Type of the foreign matrix
1240 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
1241  : matrix_( ~m ) // The adapted dense matrix
1242 {
1243  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1244  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1245  }
1246 
1247  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1248  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1249 }
1251 //*************************************************************************************************
1252 
1253 
1254 //*************************************************************************************************
1264 template< typename MT // Type of the adapted dense matrix
1265  , bool SO > // Storage order of the adapted dense matrix
1266 template< typename MT2 > // Type of the foreign matrix
1267 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
1268  : matrix_( trans( ~m ) ) // The adapted dense matrix
1269 {
1270  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) ) {
1271  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
1272  }
1273 
1274  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1275  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1276 }
1278 //*************************************************************************************************
1279 
1280 
1281 
1282 
1283 //=================================================================================================
1284 //
1285 // DATA ACCESS FUNCTIONS
1286 //
1287 //=================================================================================================
1288 
1289 //*************************************************************************************************
1304 template< typename MT // Type of the adapted dense matrix
1305  , bool SO > // Storage order of the adapted dense matrix
1307  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
1308 {
1309  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1310  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1311 
1312  return Reference( matrix_, i, j );
1313 }
1315 //*************************************************************************************************
1316 
1317 
1318 //*************************************************************************************************
1333 template< typename MT // Type of the adapted dense matrix
1334  , bool SO > // Storage order of the adapted dense matrix
1336  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
1337 {
1338  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1339  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1340 
1341  return matrix_(i,j);
1342 }
1344 //*************************************************************************************************
1345 
1346 
1347 //*************************************************************************************************
1363 template< typename MT // Type of the adapted dense matrix
1364  , bool SO > // Storage order of the adapted dense matrix
1366  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j )
1367 {
1368  if( i >= rows() ) {
1369  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1370  }
1371  if( j >= columns() ) {
1372  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1373  }
1374  return (*this)(i,j);
1375 }
1377 //*************************************************************************************************
1378 
1379 
1380 //*************************************************************************************************
1396 template< typename MT // Type of the adapted dense matrix
1397  , bool SO > // Storage order of the adapted dense matrix
1399  SymmetricMatrix<MT,SO,true,true>::at( size_t i, size_t j ) const
1400 {
1401  if( i >= rows() ) {
1402  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1403  }
1404  if( j >= columns() ) {
1405  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1406  }
1407  return (*this)(i,j);
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1427 template< typename MT // Type of the adapted dense matrix
1428  , bool SO > // Storage order of the adapted dense matrix
1429 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1430  SymmetricMatrix<MT,SO,true,true>::data() const noexcept
1431 {
1432  return matrix_.data();
1433 }
1435 //*************************************************************************************************
1436 
1437 
1438 //*************************************************************************************************
1449 template< typename MT // Type of the adapted dense matrix
1450  , bool SO > // Storage order of the adapted dense matrix
1451 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1452  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const noexcept
1453 {
1454  return matrix_.data(i);
1455 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1472 template< typename MT // Type of the adapted dense matrix
1473  , bool SO > // Storage order of the adapted dense matrix
1476 {
1477  if( SO )
1478  return Iterator( matrix_, 0UL, i );
1479  else
1480  return Iterator( matrix_, i, 0UL );
1481 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1498 template< typename MT // Type of the adapted dense matrix
1499  , bool SO > // Storage order of the adapted dense matrix
1501  SymmetricMatrix<MT,SO,true,true>::begin( size_t i ) const
1502 {
1503  return matrix_.begin(i);
1504 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1521 template< typename MT // Type of the adapted dense matrix
1522  , bool SO > // Storage order of the adapted dense matrix
1525 {
1526  return matrix_.cbegin(i);
1527 }
1529 //*************************************************************************************************
1530 
1531 
1532 //*************************************************************************************************
1544 template< typename MT // Type of the adapted dense matrix
1545  , bool SO > // Storage order of the adapted dense matrix
1548 {
1549  if( SO )
1550  return Iterator( matrix_, rows(), i );
1551  else
1552  return Iterator( matrix_, i, columns() );
1553 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1570 template< typename MT // Type of the adapted dense matrix
1571  , bool SO > // Storage order of the adapted dense matrix
1573  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1574 {
1575  return matrix_.end(i);
1576 }
1578 //*************************************************************************************************
1579 
1580 
1581 //*************************************************************************************************
1593 template< typename MT // Type of the adapted dense matrix
1594  , bool SO > // Storage order of the adapted dense matrix
1596  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1597 {
1598  return matrix_.cend(i);
1599 }
1601 //*************************************************************************************************
1602 
1603 
1604 
1605 
1606 //=================================================================================================
1607 //
1608 // ASSIGNMENT OPERATORS
1609 //
1610 //=================================================================================================
1611 
1612 //*************************************************************************************************
1636 template< typename MT // Type of the adapted dense matrix
1637  , bool SO > // Storage order of the adapted dense matrix
1638 inline SymmetricMatrix<MT,SO,true,true>&
1639  SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1640 {
1641  MT tmp( list );
1642 
1643  if( !isSymmetric( tmp ) ) {
1644  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1645  }
1646 
1647  matrix_ = std::move( tmp );
1648 
1649  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1650  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1651 
1652  return *this;
1653 }
1655 //*************************************************************************************************
1656 
1657 
1658 //*************************************************************************************************
1682 template< typename MT // Type of the adapted dense matrix
1683  , bool SO > // Storage order of the adapted dense matrix
1684 template< typename Other // Data type of the initialization array
1685  , size_t N > // Number of rows and columns of the initialization array
1686 inline SymmetricMatrix<MT,SO,true,true>&
1687  SymmetricMatrix<MT,SO,true,true>::operator=( const Other (&array)[N][N] )
1688 {
1689  MT tmp( array );
1690 
1691  if( !isSymmetric( tmp ) ) {
1692  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1693  }
1694 
1695  matrix_ = std::move( tmp );
1696 
1697  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1698  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1699 
1700  return *this;
1701 }
1703 //*************************************************************************************************
1704 
1705 
1706 //*************************************************************************************************
1716 template< typename MT // Type of the adapted dense matrix
1717  , bool SO > // Storage order of the adapted dense matrix
1718 inline SymmetricMatrix<MT,SO,true,true>&
1719  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1720 {
1721  matrix_ = rhs.matrix_;
1722 
1723  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1724  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1725 
1726  return *this;
1727 }
1729 //*************************************************************************************************
1730 
1731 
1732 //*************************************************************************************************
1739 template< typename MT // Type of the adapted dense matrix
1740  , bool SO > // Storage order of the adapted dense matrix
1741 inline SymmetricMatrix<MT,SO,true,true>&
1742  SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1743 {
1744  matrix_ = std::move( rhs.matrix_ );
1745 
1746  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1747  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1748 
1749  return *this;
1750 }
1752 //*************************************************************************************************
1753 
1754 
1755 //*************************************************************************************************
1768 template< typename MT // Type of the adapted dense matrix
1769  , bool SO > // Storage order of the adapted dense matrix
1770 template< typename MT2 > // Type of the right-hand side matrix
1771 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1772  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1773 {
1774  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1775  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1776  }
1777 
1778  matrix_ = ~rhs;
1779 
1780  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1781  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1782 
1783  return *this;
1784 }
1786 //*************************************************************************************************
1787 
1788 
1789 //*************************************************************************************************
1802 template< typename MT // Type of the adapted dense matrix
1803  , bool SO > // Storage order of the adapted dense matrix
1804 template< typename MT2 > // Type of the right-hand side matrix
1805 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1806  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1807 {
1808  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1809  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1810  }
1811 
1812  if( IsSymmetric<MT2>::value ) {
1813  matrix_ = ~rhs;
1814  }
1815  else {
1816  MT tmp( ~rhs );
1817 
1818  if( !isSymmetric( tmp ) ) {
1819  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1820  }
1821 
1822  matrix_ = std::move( tmp );
1823  }
1824 
1825  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1826  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1827 
1828  return *this;
1829 }
1831 //*************************************************************************************************
1832 
1833 
1834 //*************************************************************************************************
1847 template< typename MT // Type of the adapted dense matrix
1848  , bool SO > // Storage order of the adapted dense matrix
1849 template< typename MT2 > // Type of the right-hand side matrix
1850 inline SymmetricMatrix<MT,SO,true,true>&
1851  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1852 {
1853  return this->operator=( trans( ~rhs ) );
1854 }
1856 //*************************************************************************************************
1857 
1858 
1859 //*************************************************************************************************
1872 template< typename MT // Type of the adapted dense matrix
1873  , bool SO > // Storage order of the adapted dense matrix
1874 template< typename MT2 > // Type of the right-hand side matrix
1875 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1876  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1877 {
1878  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1879  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1880  }
1881 
1882  matrix_ += ~rhs;
1883 
1884  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1885  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1886 
1887  return *this;
1888 }
1890 //*************************************************************************************************
1891 
1892 
1893 //*************************************************************************************************
1906 template< typename MT // Type of the adapted dense matrix
1907  , bool SO > // Storage order of the adapted dense matrix
1908 template< typename MT2 > // Type of the right-hand side matrix
1909 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1910  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1911 {
1912  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1913  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1914  }
1915 
1916  if( IsSymmetric<MT2>::value ) {
1917  matrix_ += ~rhs;
1918  }
1919  else {
1920  const ResultType_<MT2> tmp( ~rhs );
1921 
1922  if( !isSymmetric( tmp ) ) {
1923  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1924  }
1925 
1926  matrix_ += tmp;
1927  }
1928 
1929  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1930  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1931 
1932  return *this;
1933 }
1935 //*************************************************************************************************
1936 
1937 
1938 //*************************************************************************************************
1952 template< typename MT // Type of the adapted dense matrix
1953  , bool SO > // Storage order of the adapted dense matrix
1954 template< typename MT2 > // Type of the right-hand side matrix
1955 inline SymmetricMatrix<MT,SO,true,true>&
1956  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1957 {
1958  return this->operator+=( trans( ~rhs ) );
1959 }
1961 //*************************************************************************************************
1962 
1963 
1964 //*************************************************************************************************
1977 template< typename MT // Type of the adapted dense matrix
1978  , bool SO > // Storage order of the adapted dense matrix
1979 template< typename MT2 > // Type of the right-hand side matrix
1980 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
1981  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
1982 {
1983  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1984  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1985  }
1986 
1987  matrix_ -= ~rhs;
1988 
1989  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1990  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1991 
1992  return *this;
1993 }
1995 //*************************************************************************************************
1996 
1997 
1998 //*************************************************************************************************
2011 template< typename MT // Type of the adapted dense matrix
2012  , bool SO > // Storage order of the adapted dense matrix
2013 template< typename MT2 > // Type of the right-hand side matrix
2014 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2015  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
2016 {
2017  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2018  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2019  }
2020 
2021  if( IsSymmetric<MT2>::value ) {
2022  matrix_ -= ~rhs;
2023  }
2024  else {
2025  const ResultType_<MT2> tmp( ~rhs );
2026 
2027  if( !isSymmetric( tmp ) ) {
2028  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2029  }
2030 
2031  matrix_ -= tmp;
2032  }
2033 
2034  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2035  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2036 
2037  return *this;
2038 }
2040 //*************************************************************************************************
2041 
2042 
2043 //*************************************************************************************************
2057 template< typename MT // Type of the adapted dense matrix
2058  , bool SO > // Storage order of the adapted dense matrix
2059 template< typename MT2 > // Type of the right-hand side matrix
2060 inline SymmetricMatrix<MT,SO,true,true>&
2061  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
2062 {
2063  return this->operator-=( trans( ~rhs ) );
2064 }
2066 //*************************************************************************************************
2067 
2068 
2069 //*************************************************************************************************
2083 template< typename MT // Type of the adapted dense matrix
2084  , bool SO > // Storage order of the adapted dense matrix
2085 template< typename MT2 > // Type of the right-hand side matrix
2086 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2087  SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2088 {
2089  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
2090  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2091  }
2092 
2093  matrix_ %= ~rhs;
2094 
2095  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2096  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2097 
2098  return *this;
2099 }
2101 //*************************************************************************************************
2102 
2103 
2104 //*************************************************************************************************
2118 template< typename MT // Type of the adapted dense matrix
2119  , bool SO > // Storage order of the adapted dense matrix
2120 template< typename MT2 > // Type of the right-hand side matrix
2121 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >
2122  SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,SO>& rhs )
2123 {
2124  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
2125  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2126  }
2127 
2128  if( IsSymmetric<MT2>::value ) {
2129  matrix_ %= ~rhs;
2130  }
2131  else {
2132  const ResultType_<MT2> tmp( ~rhs );
2133 
2134  if( !isSymmetric( tmp ) ) {
2135  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2136  }
2137 
2138  matrix_ %= tmp;
2139  }
2140 
2141  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2142  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2143 
2144  return *this;
2145 }
2147 //*************************************************************************************************
2148 
2149 
2150 //*************************************************************************************************
2164 template< typename MT // Type of the adapted dense matrix
2165  , bool SO > // Storage order of the adapted dense matrix
2166 template< typename MT2 > // Type of the right-hand side matrix
2167 inline SymmetricMatrix<MT,SO,true,true>&
2168  SymmetricMatrix<MT,SO,true,true>::operator%=( const Matrix<MT2,!SO>& rhs )
2169 {
2170  return this->operator%=( trans( ~rhs ) );
2171 }
2173 //*************************************************************************************************
2174 
2175 
2176 //*************************************************************************************************
2188 template< typename MT // Type of the adapted dense matrix
2189  , bool SO > // Storage order of the adapted dense matrix
2190 template< typename MT2 // Type of the right-hand side matrix
2191  , bool SO2 > // Storage order of the right-hand side matrix
2192 inline SymmetricMatrix<MT,SO,true,true>&
2193  SymmetricMatrix<MT,SO,true,true>::operator*=( const Matrix<MT2,SO2>& rhs )
2194 {
2195  if( matrix_.rows() != (~rhs).columns() ) {
2196  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2197  }
2198 
2199  MT tmp( matrix_ * ~rhs );
2200 
2201  if( !isSymmetric( tmp ) ) {
2202  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
2203  }
2204 
2205  matrix_ = std::move( tmp );
2206 
2207  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2208  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
2209 
2210  return *this;
2211 }
2213 //*************************************************************************************************
2214 
2215 
2216 //*************************************************************************************************
2224 template< typename MT // Type of the adapted dense matrix
2225  , bool SO > // Storage order of the adapted dense matrix
2226 template< typename Other > // Data type of the right-hand side scalar
2227 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >&
2229 {
2230  matrix_ *= rhs;
2231  return *this;
2232 }
2233 //*************************************************************************************************
2234 
2235 
2236 //*************************************************************************************************
2244 template< typename MT // Type of the adapted dense matrix
2245  , bool SO > // Storage order of the adapted dense matrix
2246 template< typename Other > // Data type of the right-hand side scalar
2247 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >&
2249 {
2250  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2251 
2252  matrix_ /= rhs;
2253  return *this;
2254 }
2256 //*************************************************************************************************
2257 
2258 
2259 
2260 
2261 //=================================================================================================
2262 //
2263 // UTILITY FUNCTIONS
2264 //
2265 //=================================================================================================
2266 
2267 //*************************************************************************************************
2273 template< typename MT // Type of the adapted dense matrix
2274  , bool SO > // Storage order of the adapted dense matrix
2275 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const noexcept
2276 {
2277  return matrix_.rows();
2278 }
2280 //*************************************************************************************************
2281 
2282 
2283 //*************************************************************************************************
2289 template< typename MT // Type of the adapted dense matrix
2290  , bool SO > // Storage order of the adapted dense matrix
2291 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const noexcept
2292 {
2293  return matrix_.columns();
2294 }
2296 //*************************************************************************************************
2297 
2298 
2299 //*************************************************************************************************
2311 template< typename MT // Type of the adapted dense matrix
2312  , bool SO > // Storage order of the adapted dense matrix
2313 inline size_t SymmetricMatrix<MT,SO,true,true>::spacing() const noexcept
2314 {
2315  return matrix_.spacing();
2316 }
2318 //*************************************************************************************************
2319 
2320 
2321 //*************************************************************************************************
2327 template< typename MT // Type of the adapted dense matrix
2328  , bool SO > // Storage order of the adapted dense matrix
2329 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const noexcept
2330 {
2331  return matrix_.capacity();
2332 }
2334 //*************************************************************************************************
2335 
2336 
2337 //*************************************************************************************************
2348 template< typename MT // Type of the adapted dense matrix
2349  , bool SO > // Storage order of the adapted dense matrix
2350 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const noexcept
2351 {
2352  return matrix_.capacity(i);
2353 }
2355 //*************************************************************************************************
2356 
2357 
2358 //*************************************************************************************************
2364 template< typename MT // Type of the adapted dense matrix
2365  , bool SO > // Storage order of the adapted dense matrix
2366 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
2367 {
2368  return matrix_.nonZeros();
2369 }
2371 //*************************************************************************************************
2372 
2373 
2374 //*************************************************************************************************
2386 template< typename MT // Type of the adapted dense matrix
2387  , bool SO > // Storage order of the adapted dense matrix
2388 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
2389 {
2390  return matrix_.nonZeros(i);
2391 }
2393 //*************************************************************************************************
2394 
2395 
2396 //*************************************************************************************************
2402 template< typename MT // Type of the adapted dense matrix
2403  , bool SO > // Storage order of the adapted dense matrix
2405 {
2406  matrix_.reset();
2407 }
2409 //*************************************************************************************************
2410 
2411 
2412 //*************************************************************************************************
2448 template< typename MT // Type of the adapted dense matrix
2449  , bool SO > // Storage order of the adapted dense matrix
2450 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
2451 {
2452  row ( matrix_, i ).reset();
2453  column( matrix_, i ).reset();
2454 }
2456 //*************************************************************************************************
2457 
2458 
2459 //*************************************************************************************************
2471 template< typename MT // Type of the adapted dense matrix
2472  , bool SO > // Storage order of the adapted dense matrix
2474 {
2475  using blaze::clear;
2476 
2477  clear( matrix_ );
2478 }
2480 //*************************************************************************************************
2481 
2482 
2483 //*************************************************************************************************
2518 template< typename MT // Type of the adapted dense matrix
2519  , bool SO > // Storage order of the adapted dense matrix
2520 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
2521 {
2523 
2524  UNUSED_PARAMETER( preserve );
2525 
2526  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2527 
2528  const size_t oldsize( matrix_.rows() );
2529 
2530  matrix_.resize( n, n, true );
2531 
2532  if( n > oldsize ) {
2533  const size_t increment( n - oldsize );
2534  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2535  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2536  }
2537 }
2539 //*************************************************************************************************
2540 
2541 
2542 //*************************************************************************************************
2555 template< typename MT // Type of the adapted dense matrix
2556  , bool SO > // Storage order of the adapted dense matrix
2557 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
2558 {
2560 
2561  UNUSED_PARAMETER( preserve );
2562 
2563  resize( rows() + n, true );
2564 }
2565 //*************************************************************************************************
2566 
2567 
2568 //*************************************************************************************************
2578 template< typename MT // Type of the adapted dense matrix
2579  , bool SO > // Storage order of the adapted dense matrix
2580 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
2581 {
2582  matrix_.reserve( elements );
2583 }
2585 //*************************************************************************************************
2586 
2587 
2588 //*************************************************************************************************
2598 template< typename MT // Type of the adapted dense matrix
2599  , bool SO > // Storage order of the adapted dense matrix
2601 {
2602  matrix_.shrinkToFit();
2603 }
2605 //*************************************************************************************************
2606 
2607 
2608 //*************************************************************************************************
2615 template< typename MT // Type of the adapted dense matrix
2616  , bool SO > // Storage order of the adapted dense matrix
2617 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) noexcept
2618 {
2619  using std::swap;
2620 
2621  swap( matrix_, m.matrix_ );
2622 }
2624 //*************************************************************************************************
2625 
2626 
2627 
2628 
2629 //=================================================================================================
2630 //
2631 // NUMERIC FUNCTIONS
2632 //
2633 //=================================================================================================
2634 
2635 //*************************************************************************************************
2641 template< typename MT // Type of the adapted dense matrix
2642  , bool SO > // Storage order of the adapted dense matrix
2643 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
2644 {
2645  return *this;
2646 }
2648 //*************************************************************************************************
2649 
2650 
2651 //*************************************************************************************************
2657 template< typename MT // Type of the adapted dense matrix
2658  , bool SO > // Storage order of the adapted dense matrix
2659 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::ctranspose()
2660 {
2661  if( !IsBuiltin<ElementType>::value )
2662  conjugate( matrix_ );
2663 
2664  return *this;
2665 }
2667 //*************************************************************************************************
2668 
2669 
2670 //*************************************************************************************************
2688 template< typename MT // Type of the adapted dense matrix
2689  , bool SO > // Storage order of the adapted dense matrix
2690 template< typename Other > // Data type of the scalar value
2691 inline SymmetricMatrix<MT,SO,true,true>&
2692  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
2693 {
2694  matrix_.scale( scalar );
2695  return *this;
2696 }
2698 //*************************************************************************************************
2699 
2700 
2701 
2702 
2703 //=================================================================================================
2704 //
2705 // DEBUGGING FUNCTIONS
2706 //
2707 //=================================================================================================
2708 
2709 //*************************************************************************************************
2719 template< typename MT // Type of the adapted dense matrix
2720  , bool SO > // Storage order of the adapted dense matrix
2721 inline bool SymmetricMatrix<MT,SO,true,true>::isIntact() const noexcept
2722 {
2723  using blaze::isIntact;
2724 
2725  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2726 }
2728 //*************************************************************************************************
2729 
2730 
2731 
2732 
2733 //=================================================================================================
2734 //
2735 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2736 //
2737 //=================================================================================================
2738 
2739 //*************************************************************************************************
2750 template< typename MT // Type of the adapted dense matrix
2751  , bool SO > // Storage order of the adapted dense matrix
2752 template< typename Other > // Data type of the foreign expression
2753 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const noexcept
2754 {
2755  return matrix_.canAlias( alias );
2756 }
2758 //*************************************************************************************************
2759 
2760 
2761 //*************************************************************************************************
2772 template< typename MT // Type of the adapted dense matrix
2773  , bool SO > // Storage order of the adapted dense matrix
2774 template< typename Other > // Data type of the foreign expression
2775 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const noexcept
2776 {
2777  return matrix_.isAliased( alias );
2778 }
2780 //*************************************************************************************************
2781 
2782 
2783 //*************************************************************************************************
2793 template< typename MT // Type of the adapted dense matrix
2794  , bool SO > // Storage order of the adapted dense matrix
2795 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2796 {
2797  return matrix_.isAligned();
2798 }
2800 //*************************************************************************************************
2801 
2802 
2803 //*************************************************************************************************
2814 template< typename MT // Type of the adapted dense matrix
2815  , bool SO > // Storage order of the adapted dense matrix
2816 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2817 {
2818  return matrix_.canSMPAssign();
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>::load( size_t i, size_t j ) const noexcept
2844 {
2845  return matrix_.load( 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>::loada( size_t i, size_t j ) const noexcept
2871 {
2872  return matrix_.loada( i, j );
2873 }
2875 //*************************************************************************************************
2876 
2877 
2878 //*************************************************************************************************
2894 template< typename MT // Type of the adapted dense matrix
2895  , bool SO > // Storage order of the adapted dense matrix
2896 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::SIMDType
2897  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const noexcept
2898 {
2899  return matrix_.loadu( i, j );
2900 }
2902 //*************************************************************************************************
2903 
2904 
2905 //*************************************************************************************************
2922 template< typename MT // Type of the adapted dense matrix
2923  , bool SO > // Storage order of the adapted dense matrix
2924 inline void
2925  SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2926 {
2927  matrix_.store( i, j, value );
2928 
2929  if( SO ) {
2930  const size_t kend( min( i+SIMDSIZE, rows() ) );
2931  for( size_t k=i; k<kend; ++k )
2932  matrix_(j,k) = matrix_(k,j);
2933  }
2934  else {
2935  const size_t kend( min( j+SIMDSIZE, columns() ) );
2936  for( size_t k=j; k<kend; ++k )
2937  matrix_(k,i) = matrix_(i,k);
2938  }
2939 }
2941 //*************************************************************************************************
2942 
2943 
2944 //*************************************************************************************************
2961 template< typename MT // Type of the adapted dense matrix
2962  , bool SO > // Storage order of the adapted dense matrix
2963 inline void
2964  SymmetricMatrix<MT,SO,true,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2965 {
2966  matrix_.storea( i, j, value );
2967 
2968  if( SO ) {
2969  const size_t kend( min( i+SIMDSIZE, rows() ) );
2970  for( size_t k=i; k<kend; ++k )
2971  matrix_(j,k) = matrix_(k,j);
2972  }
2973  else {
2974  const size_t kend( min( j+SIMDSIZE, columns() ) );
2975  for( size_t k=j; k<kend; ++k )
2976  matrix_(k,i) = matrix_(i,k);
2977  }
2978 }
2980 //*************************************************************************************************
2981 
2982 
2983 //*************************************************************************************************
3000 template< typename MT // Type of the adapted dense matrix
3001  , bool SO > // Storage order of the adapted dense matrix
3002 inline void
3003  SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
3004 {
3005  matrix_.storeu( i, j, value );
3006 
3007  if( SO ) {
3008  const size_t kend( min( i+SIMDSIZE, rows() ) );
3009  for( size_t k=i; k<kend; ++k )
3010  matrix_(j,k) = matrix_(k,j);
3011  }
3012  else {
3013  const size_t kend( min( j+SIMDSIZE, columns() ) );
3014  for( size_t k=j; k<kend; ++k )
3015  matrix_(k,i) = matrix_(i,k);
3016  }
3017 }
3019 //*************************************************************************************************
3020 
3021 
3022 //*************************************************************************************************
3039 template< typename MT // Type of the adapted dense matrix
3040  , bool SO > // Storage order of the adapted dense matrix
3041 inline void
3042  SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
3043 {
3044  matrix_.stream( i, j, value );
3045 
3046  if( SO ) {
3047  const size_t kend( min( i+SIMDSIZE, rows() ) );
3048  for( size_t k=i; k<kend; ++k )
3049  matrix_(j,k) = matrix_(k,j);
3050  }
3051  else {
3052  const size_t kend( min( j+SIMDSIZE, columns() ) );
3053  for( size_t k=j; k<kend; ++k )
3054  matrix_(k,i) = matrix_(i,k);
3055  }
3056 }
3058 //*************************************************************************************************
3059 
3060 } // namespace blaze
3061 
3062 #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.
Headerfile for the generic min algorithm.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3079
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
Constraint on the data type.
Header file for the dense matrix inversion flags.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:609
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5845
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Submatrix< MT, AF > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:352
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1762
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:661
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
Header file for the NumericProxy class.
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:308
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:242
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:110
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:772
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5924
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:5907
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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:3081
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Header file for all SIMD functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:548
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for all forward declarations for expression class templates.
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:580
Header file for all restructuring column functions.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#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:270
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric< T >::value)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:405
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:700
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
#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:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the implementation of the Row view.
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:635