SparseNonNumeric.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_SPARSENONNUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_SPARSENONNUMERIC_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
45 #include <vector>
49 #include <blaze/math/Aliases.h>
59 #include <blaze/math/Exception.h>
61 #include <blaze/math/shims/Clear.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>
86 #include <blaze/util/Types.h>
87 #include <blaze/util/Unused.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES WITH NON-NUMERIC ELEMENT TYPE
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
106 template< typename MT // Type of the adapted sparse matrix
107  , bool SO > // Storage order of the adapted sparse matrix
108 class SymmetricMatrix<MT,SO,false,false>
109  : public SparseMatrix< SymmetricMatrix<MT,SO,false,false>, SO >
110 {
111  private:
112  //**Type definitions****************************************************************************
113  typedef OppositeType_<MT> OT;
114  typedef TransposeType_<MT> TT;
115  typedef ElementType_<MT> ET;
116 
118  typedef typename MT::template Rebind< SharedValue<ET> >::Other MatrixType;
119  //**********************************************************************************************
120 
121  public:
122  //**Type definitions****************************************************************************
123  typedef SymmetricMatrix<MT,SO,false,false> This;
124  typedef SparseMatrix<This,SO> BaseType;
125  typedef This ResultType;
126  typedef SymmetricMatrix<OT,!SO,false,false> OppositeType;
127  typedef SymmetricMatrix<TT,!SO,false,false> TransposeType;
128  typedef ET ElementType;
129  typedef ReturnType_<MT> ReturnType;
130  typedef const This& CompositeType;
131  typedef NonNumericProxy<MatrixType> Reference;
132  typedef ConstReference_<MT> ConstReference;
133  //**********************************************************************************************
134 
135  //**Rebind struct definition********************************************************************
138  template< typename ET > // Data type of the other matrix
139  struct Rebind {
141  typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
142  };
143  //**********************************************************************************************
144 
145  //**SharedElement class definition**************************************************************
148  template< typename IteratorType > // Type of the sparse matrix iterator
149  class SharedElement : private SparseElement
150  {
151  public:
152  //**Type definitions*************************************************************************
153  typedef ET ValueType;
154  typedef size_t IndexType;
155  typedef ValueType& Reference;
156  typedef const ValueType& ConstReference;
157  typedef SharedElement* Pointer;
158  typedef const SharedElement* ConstPointer;
159  //*******************************************************************************************
160 
161  //**Constructor******************************************************************************
166  inline SharedElement( IteratorType pos )
167  : pos_( pos ) // Iterator to the current sparse symmetric matrix element
168  {}
169  //*******************************************************************************************
170 
171  //**Assignment operator**********************************************************************
177  template< typename T > inline SharedElement& operator=( const T& v ) {
178  *pos_->value() = v;
179  return *this;
180  }
181  //*******************************************************************************************
182 
183  //**Addition assignment operator*************************************************************
189  template< typename T > inline SharedElement& operator+=( const T& v ) {
190  *pos_->value() += v;
191  return *this;
192  }
193  //*******************************************************************************************
194 
195  //**Subtraction assignment operator**********************************************************
201  template< typename T > inline SharedElement& operator-=( const T& v ) {
202  *pos_->value() -= v;
203  return *this;
204  }
205  //*******************************************************************************************
206 
207  //**Multiplication assignment operator*******************************************************
213  template< typename T > inline SharedElement& operator*=( const T& v ) {
214  *pos_->value() *= v;
215  return *this;
216  }
217  //*******************************************************************************************
218 
219  //**Division assignment operator*************************************************************
225  template< typename T > inline SharedElement& operator/=( const T& v ) {
226  *pos_->value() /= v;
227  return *this;
228  }
229  //*******************************************************************************************
230 
231  //**Element access operator******************************************************************
236  inline Pointer operator->() {
237  return this;
238  }
239  //*******************************************************************************************
240 
241  //**Element access operator******************************************************************
246  inline ConstPointer operator->() const {
247  return this;
248  }
249  //*******************************************************************************************
250 
251  //**Value function***************************************************************************
256  inline Reference value() {
257  return *pos_->value();
258  }
259  //*******************************************************************************************
260 
261  //**Value function***************************************************************************
266  inline ConstReference value() const {
267  return *pos_->value();
268  }
269  //*******************************************************************************************
270 
271  //**Index function***************************************************************************
276  inline IndexType index() const {
277  return pos_->index();
278  }
279  //*******************************************************************************************
280 
281  private:
282  //**Member variables*************************************************************************
283  IteratorType pos_;
284  //*******************************************************************************************
285  };
286  //**********************************************************************************************
287 
288  //**SharedIterator class definition*************************************************************
291  template< typename SparseElementType // Type of the underlying sparse elements.
292  , typename IteratorType > // Type of the sparse matrix iterator
293  class SharedIterator
294  {
295  public:
296  //**Type definitions*************************************************************************
297  typedef std::forward_iterator_tag IteratorCategory;
298  typedef SparseElementType ValueType;
299  typedef SparseElementType PointerType;
300  typedef SparseElementType ReferenceType;
301  typedef ptrdiff_t DifferenceType;
302 
303  // STL iterator requirements
304  typedef IteratorCategory iterator_category;
305  typedef ValueType value_type;
306  typedef PointerType pointer;
307  typedef ReferenceType reference;
308  typedef DifferenceType difference_type;
309  //*******************************************************************************************
310 
311  //**Default constructor**********************************************************************
314  inline SharedIterator()
315  : pos_() // Iterator to the current sparse symmetric matrix element
316  {}
317  //*******************************************************************************************
318 
319  //**Constructor******************************************************************************
324  inline SharedIterator( IteratorType pos )
325  : pos_( pos ) // Iterator to the current sparse symmetric matrix element
326  {}
327  //*******************************************************************************************
328 
329  //**Constructor******************************************************************************
334  template< typename SparseElementType2, typename IteratorType2 >
335  inline SharedIterator( const SharedIterator<SparseElementType2,IteratorType2>& it )
336  : pos_( it.pos_ ) // Iterator to the current sparse symmetric matrix element
337  {}
338  //*******************************************************************************************
339 
340  //**Prefix increment operator****************************************************************
345  inline SharedIterator& operator++() {
346  ++pos_;
347  return *this;
348  }
349  //*******************************************************************************************
350 
351  //**Postfix increment operator***************************************************************
356  inline const SharedIterator operator++( int ) {
357  const SharedIterator tmp( *this );
358  ++(*this);
359  return tmp;
360  }
361  //*******************************************************************************************
362 
363  //**Element access operator******************************************************************
368  inline ReferenceType operator*() const {
369  return ReferenceType( pos_ );
370  }
371  //*******************************************************************************************
372 
373  //**Element access operator******************************************************************
378  inline PointerType operator->() const {
379  return PointerType( pos_ );
380  }
381  //*******************************************************************************************
382 
383  //**Equality operator************************************************************************
389  inline bool operator==( const SharedIterator& rhs ) const {
390  return pos_ == rhs.pos_;
391  }
392  //*******************************************************************************************
393 
394  //**Inequality operator**********************************************************************
400  inline bool operator!=( const SharedIterator& rhs ) const {
401  return !( *this == rhs );
402  }
403  //*******************************************************************************************
404 
405  //**Subtraction operator*********************************************************************
411  inline DifferenceType operator-( const SharedIterator& rhs ) const {
412  return pos_ - rhs.pos_;
413  }
414  //*******************************************************************************************
415 
416  //**Base function****************************************************************************
421  inline IteratorType base() const {
422  return pos_;
423  }
424  //*******************************************************************************************
425 
426  private:
427  //**Member variables*************************************************************************
428  IteratorType pos_;
429  //*******************************************************************************************
430 
431  //**Friend declarations**********************************************************************
432  template< typename SparseElementType2, typename IteratorType2 > friend class SharedIterator;
433  //*******************************************************************************************
434  };
435  //**********************************************************************************************
436 
437  //**Type definitions****************************************************************************
439  typedef SharedIterator< SharedElement< Iterator_<MatrixType> >
440  , Iterator_<MatrixType>
441  > Iterator;
442 
444  typedef SharedIterator< const SharedElement< ConstIterator_<MatrixType> >
445  , ConstIterator_<MatrixType>
446  > ConstIterator;
447  //**********************************************************************************************
448 
449  //**Compilation flags***************************************************************************
451  enum : bool { smpAssignable = false };
452  //**********************************************************************************************
453 
454  //**Constructors********************************************************************************
457  explicit inline SymmetricMatrix();
458  explicit inline SymmetricMatrix( size_t n );
459  explicit inline SymmetricMatrix( size_t n, size_t nonzeros );
460  explicit inline SymmetricMatrix( size_t n, const std::vector<size_t>& nonzeros );
461 
462  inline SymmetricMatrix( const SymmetricMatrix& m );
463  inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
464 
465  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
466  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
468  //**********************************************************************************************
469 
470  //**Destructor**********************************************************************************
471  // No explicitly declared destructor.
472  //**********************************************************************************************
473 
474  //**Data access functions***********************************************************************
477  inline Reference operator()( size_t i, size_t j );
478  inline ConstReference operator()( size_t i, size_t j ) const;
479  inline Reference at( size_t i, size_t j );
480  inline ConstReference at( size_t i, size_t j ) const;
481  inline Iterator begin ( size_t i );
482  inline ConstIterator begin ( size_t i ) const;
483  inline ConstIterator cbegin( size_t i ) const;
484  inline Iterator end ( size_t i );
485  inline ConstIterator end ( size_t i ) const;
486  inline ConstIterator cend ( size_t i ) const;
488  //**********************************************************************************************
489 
490  //**Assignment operators************************************************************************
493  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
494  inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
495 
496  template< typename MT2 >
497  inline DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
498 
499  template< typename MT2 >
500  inline EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
501 
502  template< typename MT2 >
503  inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
504 
505  template< typename MT2 >
506  inline SymmetricMatrix& operator+=( const Matrix<MT2,SO>& rhs );
507 
508  template< typename MT2 >
509  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
510 
511  template< typename MT2 >
512  inline SymmetricMatrix& operator-=( const Matrix<MT2,SO>& rhs );
513 
514  template< typename MT2 >
515  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
516 
517  template< typename MT2, bool SO2 >
518  inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
519 
520  template< typename Other >
521  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator*=( Other rhs );
522 
523  template< typename Other >
524  inline EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator/=( Other rhs );
526  //**********************************************************************************************
527 
528  //**Utility functions***************************************************************************
531  inline size_t rows() const noexcept;
532  inline size_t columns() const noexcept;
533  inline size_t capacity() const noexcept;
534  inline size_t capacity( size_t i ) const noexcept;
535  inline size_t nonZeros() const;
536  inline size_t nonZeros( size_t i ) const;
537  inline void reset();
538  inline void reset( size_t i );
539  inline void clear();
540  inline Iterator set( size_t i, size_t j, const ElementType& value );
541  inline Iterator insert( size_t i, size_t j, const ElementType& value );
542  inline void erase( size_t i, size_t j );
543  inline Iterator erase( size_t i, Iterator pos );
544  inline Iterator erase( size_t i, Iterator first, Iterator last );
545  inline void resize ( size_t n, bool preserve=true );
546  inline void reserve( size_t nonzeros );
547  inline void reserve( size_t i, size_t nonzeros );
548  inline void trim();
549  inline void trim( size_t i );
550  inline SymmetricMatrix& transpose();
551  inline SymmetricMatrix& ctranspose();
552  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
553  template< typename Other > inline SymmetricMatrix& scaleDiagonal( Other scale );
554  inline void swap( SymmetricMatrix& m ) noexcept;
556  //**********************************************************************************************
557 
558  //**Lookup functions****************************************************************************
561  inline Iterator find ( size_t i, size_t j );
562  inline ConstIterator find ( size_t i, size_t j ) const;
563  inline Iterator lowerBound( size_t i, size_t j );
564  inline ConstIterator lowerBound( size_t i, size_t j ) const;
565  inline Iterator upperBound( size_t i, size_t j );
566  inline ConstIterator upperBound( size_t i, size_t j ) const;
568  //**********************************************************************************************
569 
570  //**Low-level utility functions*****************************************************************
573  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
574  inline void finalize( size_t i );
576  //**********************************************************************************************
577 
578  //**Debugging functions*************************************************************************
581  inline bool isIntact() const noexcept;
583  //**********************************************************************************************
584 
585  //**Expression template evaluation functions****************************************************
588  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
589  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
590 
591  inline bool canSMPAssign() const noexcept;
593  //**********************************************************************************************
594 
595  private:
596  //**Expression template evaluation functions****************************************************
599  template< typename MT2 > void assign( DenseMatrix<MT2,SO>& rhs );
600  template< typename MT2 > void assign( const DenseMatrix<MT2,SO>& rhs );
601  template< typename MT2 > void assign( SparseMatrix<MT2,SO>& rhs );
602  template< typename MT2 > void assign( const SparseMatrix<MT2,SO>& rhs );
604  //**********************************************************************************************
605 
606  //**Member variables****************************************************************************
609  MatrixType matrix_;
610 
611  //**********************************************************************************************
612 
613  //**Friend declarations*************************************************************************
614  template< typename MT2, bool SO2, bool DF2, bool NF2 >
615  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
616  //**********************************************************************************************
617 
618  //**Compile time checks*************************************************************************
632  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
633  //**********************************************************************************************
634 };
636 //*************************************************************************************************
637 
638 
639 
640 
641 //=================================================================================================
642 //
643 // CONSTRUCTORS
644 //
645 //=================================================================================================
646 
647 //*************************************************************************************************
651 template< typename MT // Type of the adapted sparse matrix
652  , bool SO > // Storage order of the adapted sparse matrix
653 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix()
654  : matrix_() // The adapted sparse matrix
655 {
656  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
657 }
659 //*************************************************************************************************
660 
661 
662 //*************************************************************************************************
670 template< typename MT // Type of the adapted sparse matrix
671  , bool SO > // Storage order of the adapted sparse matrix
672 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( size_t n )
673  : matrix_( n, n ) // The adapted sparse matrix
674 {
676 
677  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
678 }
680 //*************************************************************************************************
681 
682 
683 //*************************************************************************************************
692 template< typename MT // Type of the adapted sparse matrix
693  , bool SO > // Storage order of the adapted sparse matrix
694 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( size_t n, size_t nonzeros )
695  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
696 {
698 
699  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
700 }
702 //*************************************************************************************************
703 
704 
705 //*************************************************************************************************
716 template< typename MT // Type of the adapted sparse matrix
717  , bool SO > // Storage order of the adapted sparse matrix
718 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( size_t n, const std::vector<size_t>& nonzeros )
719  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
720 {
722 
723  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
724 }
726 //*************************************************************************************************
727 
728 
729 //*************************************************************************************************
735 template< typename MT // Type of the adapted sparse matrix
736  , bool SO > // Storage order of the adapted sparse matrix
737 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( const SymmetricMatrix& m )
738  : matrix_() // The adapted sparse matrix
739 {
740  using blaze::resize;
741 
742  resize( matrix_, m.rows(), m.columns() );
743  assign( m );
744 
745  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
746  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
747 }
749 //*************************************************************************************************
750 
751 
752 //*************************************************************************************************
758 template< typename MT // Type of the adapted sparse matrix
759  , bool SO > // Storage order of the adapted sparse matrix
760 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
761  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
762 {
763  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
764  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
765 }
767 //*************************************************************************************************
768 
769 
770 //*************************************************************************************************
780 template< typename MT // Type of the adapted sparse matrix
781  , bool SO > // Storage order of the adapted sparse matrix
782 template< typename MT2 > // Type of the foreign matrix
783 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( const Matrix<MT2,SO>& m )
784  : matrix_() // The adapted sparse matrix
785 {
786  using blaze::resize;
787 
788  typedef RemoveAdaptor_< ResultType_<MT2> > RT;
789  typedef If_< IsComputation<MT2>, RT, const MT2& > Tmp;
790 
791  Tmp tmp( ~m );
792 
793  if( !IsSymmetric<MT2>::value && !isSymmetric( tmp ) ) {
794  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
795  }
796 
797  resize( matrix_, tmp.rows(), tmp.columns() );
798  assign( tmp );
799 
800  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
801  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
802 }
804 //*************************************************************************************************
805 
806 
807 //*************************************************************************************************
817 template< typename MT // Type of the adapted sparse matrix
818  , bool SO > // Storage order of the adapted sparse matrix
819 template< typename MT2 > // Type of the foreign matrix
820 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
821  : matrix_() // The adapted sparse matrix
822 {
823  using blaze::resize;
824 
825  typedef RemoveAdaptor_< ResultType_<MT2> > RT;
826  typedef If_< IsComputation<MT2>, RT, const MT2& > Tmp;
827 
828  Tmp tmp( ~m );
829 
830  if( !IsSymmetric<MT2>::value && !isSymmetric( tmp ) ) {
831  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
832  }
833 
834  resize( matrix_, tmp.rows(), tmp.columns() );
835  assign( trans( tmp ) );
836 
837  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
838  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
839 }
841 //*************************************************************************************************
842 
843 
844 
845 
846 //=================================================================================================
847 //
848 // DATA ACCESS FUNCTIONS
849 //
850 //=================================================================================================
851 
852 //*************************************************************************************************
867 template< typename MT // Type of the adapted sparse matrix
868  , bool SO > // Storage order of the adapted sparse matrix
870  SymmetricMatrix<MT,SO,false,false>::operator()( size_t i, size_t j )
871 {
872  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
873  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
874 
875  return Reference( matrix_, i, j );
876 }
878 //*************************************************************************************************
879 
880 
881 //*************************************************************************************************
896 template< typename MT // Type of the adapted sparse matrix
897  , bool SO > // Storage order of the adapted sparse matrix
899  SymmetricMatrix<MT,SO,false,false>::operator()( size_t i, size_t j ) const
900 {
901  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
902  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
903 
904  return *matrix_(i,j);
905 }
907 //*************************************************************************************************
908 
909 
910 //*************************************************************************************************
926 template< typename MT // Type of the adapted dense matrix
927  , bool SO > // Storage order of the adapted dense matrix
929  SymmetricMatrix<MT,SO,false,false>::at( size_t i, size_t j )
930 {
931  if( i >= rows() ) {
932  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
933  }
934  if( j >= columns() ) {
935  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
936  }
937  return (*this)(i,j);
938 }
940 //*************************************************************************************************
941 
942 
943 //*************************************************************************************************
959 template< typename MT // Type of the adapted dense matrix
960  , bool SO > // Storage order of the adapted dense matrix
962  SymmetricMatrix<MT,SO,false,false>::at( size_t i, size_t j ) const
963 {
964  if( i >= rows() ) {
965  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
966  }
967  if( j >= columns() ) {
968  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
969  }
970  return (*this)(i,j);
971 }
973 //*************************************************************************************************
974 
975 
976 //*************************************************************************************************
988 template< typename MT // Type of the adapted sparse matrix
989  , bool SO > // Storage order of the adapted sparse matrix
992 {
993  return Iterator( matrix_.begin(i) );
994 }
996 //*************************************************************************************************
997 
998 
999 //*************************************************************************************************
1011 template< typename MT // Type of the adapted sparse matrix
1012  , bool SO > // Storage order of the adapted sparse matrix
1015 {
1016  return ConstIterator( matrix_.begin(i) );
1017 }
1019 //*************************************************************************************************
1020 
1021 
1022 //*************************************************************************************************
1034 template< typename MT // Type of the adapted sparse matrix
1035  , bool SO > // Storage order of the adapted sparse matrix
1038 {
1039  return ConstIterator( matrix_.cbegin(i) );
1040 }
1042 //*************************************************************************************************
1043 
1044 
1045 //*************************************************************************************************
1057 template< typename MT // Type of the adapted sparse matrix
1058  , bool SO > // Storage order of the adapted sparse matrix
1061 {
1062  return Iterator( matrix_.end(i) );
1063 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1080 template< typename MT // Type of the adapted sparse matrix
1081  , bool SO > // Storage order of the adapted sparse matrix
1083  SymmetricMatrix<MT,SO,false,false>::end( size_t i ) const
1084 {
1085  return ConstIterator( matrix_.end(i) );
1086 }
1088 //*************************************************************************************************
1089 
1090 
1091 //*************************************************************************************************
1103 template< typename MT // Type of the adapted sparse matrix
1104  , bool SO > // Storage order of the adapted sparse matrix
1107 {
1108  return ConstIterator( matrix_.cend(i) );
1109 }
1111 //*************************************************************************************************
1112 
1113 
1114 
1115 
1116 //=================================================================================================
1117 //
1118 // ASSIGNMENT OPERATORS
1119 //
1120 //=================================================================================================
1121 
1122 //*************************************************************************************************
1132 template< typename MT // Type of the adapted sparse matrix
1133  , bool SO > // Storage order of the adapted sparse matrix
1134 inline SymmetricMatrix<MT,SO,false,false>&
1135  SymmetricMatrix<MT,SO,false,false>::operator=( const SymmetricMatrix& rhs )
1136 {
1137  using blaze::resize;
1138 
1139  if( &rhs == this ) return *this;
1140 
1141  resize( matrix_, rhs.rows(), rhs.columns() );
1142  reset();
1143  assign( rhs );
1144 
1145  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1146  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1147 
1148  return *this;
1149 }
1151 //*************************************************************************************************
1152 
1153 
1154 //*************************************************************************************************
1161 template< typename MT // Type of the adapted sparse matrix
1162  , bool SO > // Storage order of the adapted sparse matrix
1163 inline SymmetricMatrix<MT,SO,false,false>&
1164  SymmetricMatrix<MT,SO,false,false>::operator=( SymmetricMatrix&& rhs ) noexcept
1165 {
1166  matrix_ = std::move( rhs.matrix_ );
1167 
1168  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1169  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1170 
1171  return *this;
1172 }
1174 //*************************************************************************************************
1175 
1176 
1177 //*************************************************************************************************
1191 template< typename MT // Type of the adapted sparse matrix
1192  , bool SO > // Storage order of the adapted sparse matrix
1193 template< typename MT2 > // Type of the right-hand side matrix
1194 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,false,false>& >
1195  SymmetricMatrix<MT,SO,false,false>::operator=( const Matrix<MT2,SO>& rhs )
1196 {
1197  using blaze::resize;
1198 
1199  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1200  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1201  }
1202 
1203  if( (~rhs).canAlias( this ) ) {
1204  SymmetricMatrix tmp( ~rhs );
1205  swap( tmp );
1206  }
1207  else {
1208  resize( matrix_, (~rhs).rows(), (~rhs).columns() );
1209  reset();
1210  assign( ~rhs );
1211  }
1212 
1213  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1214  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1215 
1216  return *this;
1217 }
1219 //*************************************************************************************************
1220 
1221 
1222 //*************************************************************************************************
1236 template< typename MT // Type of the adapted sparse matrix
1237  , bool SO > // Storage order of the adapted sparse matrix
1238 template< typename MT2 > // Type of the right-hand side matrix
1239 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,false,false>& >
1240  SymmetricMatrix<MT,SO,false,false>::operator=( const Matrix<MT2,SO>& rhs )
1241 {
1242  using blaze::resize;
1243 
1244  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1245  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1246  }
1247 
1248  const ResultType_<MT2> tmp( ~rhs );
1249 
1250  if( !IsSymmetric<MT2>::value && !isSymmetric( tmp ) ) {
1251  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1252  }
1253 
1254  resize( matrix_, tmp.rows(), tmp.columns() );
1255  reset();
1256  assign( tmp );
1257 
1258  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1259  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1260 
1261  return *this;
1262 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1281 template< typename MT // Type of the adapted sparse matrix
1282  , bool SO > // Storage order of the adapted sparse matrix
1283 template< typename MT2 > // Type of the right-hand side matrix
1284 inline SymmetricMatrix<MT,SO,false,false>&
1285  SymmetricMatrix<MT,SO,false,false>::operator=( const Matrix<MT2,!SO>& rhs )
1286 {
1287  return this->operator=( trans( ~rhs ) );
1288 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1306 template< typename MT // Type of the adapted sparse matrix
1307  , bool SO > // Storage order of the adapted sparse matrix
1308 template< typename MT2 > // Type of the right-hand side matrix
1309 inline SymmetricMatrix<MT,SO,false,false>&
1310  SymmetricMatrix<MT,SO,false,false>::operator+=( const Matrix<MT2,SO>& rhs )
1311 {
1312  using blaze::resize;
1313 
1314  typedef AddTrait_< MT, ResultType_<MT2> > Tmp;
1315 
1316  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1317  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1318  }
1319 
1320  Tmp tmp( (*this) + ~rhs );
1321 
1322  if( !IsSymmetric<Tmp>::value && !isSymmetric( tmp ) ) {
1323  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1324  }
1325 
1326  resize( matrix_, tmp.rows(), tmp.columns() );
1327  reset();
1328  assign( tmp );
1329 
1330  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1331  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1332 
1333  return *this;
1334 }
1336 //*************************************************************************************************
1337 
1338 
1339 //*************************************************************************************************
1353 template< typename MT // Type of the adapted sparse matrix
1354  , bool SO > // Storage order of the adapted sparse matrix
1355 template< typename MT2 > // Type of the right-hand side matrix
1356 inline SymmetricMatrix<MT,SO,false,false>&
1357  SymmetricMatrix<MT,SO,false,false>::operator+=( const Matrix<MT2,!SO>& rhs )
1358 {
1359  return this->operator+=( trans( ~rhs ) );
1360 }
1362 //*************************************************************************************************
1363 
1364 
1365 //*************************************************************************************************
1378 template< typename MT // Type of the adapted sparse matrix
1379  , bool SO > // Storage order of the adapted sparse matrix
1380 template< typename MT2 > // Type of the right-hand side matrix
1381 inline SymmetricMatrix<MT,SO,false,false>&
1382  SymmetricMatrix<MT,SO,false,false>::operator-=( const Matrix<MT2,SO>& rhs )
1383 {
1384  using blaze::resize;
1385 
1386  typedef SubTrait_< MT, ResultType_<MT2> > Tmp;
1387 
1388  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1389  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1390  }
1391 
1392  Tmp tmp( (*this) - ~rhs );
1393 
1394  if( !IsSymmetric<Tmp>::value && !isSymmetric( tmp ) ) {
1395  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1396  }
1397 
1398  resize( matrix_, tmp.rows(), tmp.columns() );
1399  reset();
1400  assign( tmp );
1401 
1402  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1403  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1404 
1405  return *this;
1406 }
1408 //*************************************************************************************************
1409 
1410 
1411 //*************************************************************************************************
1425 template< typename MT // Type of the adapted sparse matrix
1426  , bool SO > // Storage order of the adapted sparse matrix
1427 template< typename MT2 > // Type of the right-hand side matrix
1428 inline SymmetricMatrix<MT,SO,false,false>&
1429  SymmetricMatrix<MT,SO,false,false>::operator-=( const Matrix<MT2,!SO>& rhs )
1430 {
1431  return this->operator-=( trans( ~rhs ) );
1432 }
1434 //*************************************************************************************************
1435 
1436 
1437 //*************************************************************************************************
1449 template< typename MT // Type of the adapted sparse matrix
1450  , bool SO > // Storage order of the adapted sparse matrix
1451 template< typename MT2 // Type of the right-hand side matrix
1452  , bool SO2 > // Storage order of the right-hand side matrix
1453 inline SymmetricMatrix<MT,SO,false,false>&
1454  SymmetricMatrix<MT,SO,false,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1455 {
1456  using blaze::resize;
1457 
1458  typedef MultTrait_< MT, ResultType_<MT2> > Tmp;
1459 
1460  if( matrix_.rows() != (~rhs).columns() ) {
1461  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1462  }
1463 
1464  Tmp tmp( (*this) * ~rhs );
1465 
1466  if( !IsSymmetric<Tmp>::value && !isSymmetric( tmp ) ) {
1467  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1468  }
1469 
1470  resize( matrix_, tmp.rows(), tmp.columns() );
1471  reset();
1472  assign( tmp );
1473 
1474  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1475  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1476 
1477  return *this;
1478 }
1480 //*************************************************************************************************
1481 
1482 
1483 //*************************************************************************************************
1491 template< typename MT // Type of the adapted sparse matrix
1492  , bool SO > // Storage order of the adapted sparse matrix
1493 template< typename Other > // Data type of the right-hand side scalar
1494 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,false,false> >&
1496 {
1497  for( size_t i=0UL; i<rows(); ++i ) {
1498  const Iterator_<MatrixType> last( matrix_.upperBound(i,i) );
1499  for( Iterator_<MatrixType> element=matrix_.begin(i); element!=last; ++element )
1500  *element->value() *= rhs;
1501  }
1502 
1503  return *this;
1504 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1517 template< typename MT // Type of the adapted sparse matrix
1518  , bool SO > // Storage order of the adapted sparse matrix
1519 template< typename Other > // Data type of the right-hand side scalar
1520 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,false,false> >&
1522 {
1523  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1524 
1525  for( size_t i=0UL; i<rows(); ++i ) {
1526  const Iterator_<MatrixType> last( matrix_.upperBound(i,i) );
1527  for( Iterator_<MatrixType> element=matrix_.begin(i); element!=last; ++element )
1528  *element->value() /= rhs;
1529  }
1530 
1531  return *this;
1532 }
1534 //*************************************************************************************************
1535 
1536 
1537 
1538 
1539 //=================================================================================================
1540 //
1541 // UTILITY FUNCTIONS
1542 //
1543 //=================================================================================================
1544 
1545 //*************************************************************************************************
1551 template< typename MT // Type of the adapted sparse matrix
1552  , bool SO > // Storage order of the adapted sparse matrix
1553 inline size_t SymmetricMatrix<MT,SO,false,false>::rows() const noexcept
1554 {
1555  return matrix_.rows();
1556 }
1558 //*************************************************************************************************
1559 
1560 
1561 //*************************************************************************************************
1567 template< typename MT // Type of the adapted sparse matrix
1568  , bool SO > // Storage order of the adapted sparse matrix
1569 inline size_t SymmetricMatrix<MT,SO,false,false>::columns() const noexcept
1570 {
1571  return matrix_.columns();
1572 }
1574 //*************************************************************************************************
1575 
1576 
1577 //*************************************************************************************************
1583 template< typename MT // Type of the adapted sparse matrix
1584  , bool SO > // Storage order of the adapted sparse matrix
1585 inline size_t SymmetricMatrix<MT,SO,false,false>::capacity() const noexcept
1586 {
1587  return matrix_.capacity();
1588 }
1590 //*************************************************************************************************
1591 
1592 
1593 //*************************************************************************************************
1604 template< typename MT // Type of the adapted sparse matrix
1605  , bool SO > // Storage order of the adapted sparse matrix
1606 inline size_t SymmetricMatrix<MT,SO,false,false>::capacity( size_t i ) const noexcept
1607 {
1608  return matrix_.capacity(i);
1609 }
1611 //*************************************************************************************************
1612 
1613 
1614 //*************************************************************************************************
1620 template< typename MT // Type of the adapted sparse matrix
1621  , bool SO > // Storage order of the adapted sparse matrix
1623 {
1624  return matrix_.nonZeros();
1625 }
1627 //*************************************************************************************************
1628 
1629 
1630 //*************************************************************************************************
1642 template< typename MT // Type of the adapted sparse matrix
1643  , bool SO > // Storage order of the adapted sparse matrix
1644 inline size_t SymmetricMatrix<MT,SO,false,false>::nonZeros( size_t i ) const
1645 {
1646  return matrix_.nonZeros(i);
1647 }
1649 //*************************************************************************************************
1650 
1651 
1652 //*************************************************************************************************
1658 template< typename MT // Type of the adapted sparse matrix
1659  , bool SO > // Storage order of the adapted sparse matrix
1661 {
1662  matrix_.reset();
1663 }
1665 //*************************************************************************************************
1666 
1667 
1668 //*************************************************************************************************
1708 template< typename MT // Type of the adapted sparse matrix
1709  , bool SO > // Storage order of the adapted sparse matrix
1710 inline void SymmetricMatrix<MT,SO,false,false>::reset( size_t i )
1711 {
1712  for( Iterator_<MatrixType> it=matrix_.begin(i); it!=matrix_.end(i); ++it )
1713  {
1714  const size_t j( it->index() );
1715 
1716  if( i == j )
1717  continue;
1718 
1719  if( SO ) {
1720  const Iterator_<MatrixType> pos( matrix_.find( i, j ) );
1721  BLAZE_INTERNAL_ASSERT( pos != matrix_.end( j ), "Missing element detected" );
1722  matrix_.erase( j, pos );
1723  }
1724  else {
1725  const Iterator_<MatrixType> pos( matrix_.find( j, i ) );
1726  BLAZE_INTERNAL_ASSERT( pos != matrix_.end( j ), "Missing element detected" );
1727  matrix_.erase( j, pos );
1728  }
1729  }
1730 
1731  matrix_.reset( i );
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 //*************************************************************************************************
1745 template< typename MT // Type of the adapted sparse matrix
1746  , bool SO > // Storage order of the adapted sparse matrix
1748 {
1749  using blaze::clear;
1750 
1751  clear( matrix_ );
1752 }
1754 //*************************************************************************************************
1755 
1756 
1757 //*************************************************************************************************
1771 template< typename MT // Type of the adapted sparse matrix
1772  , bool SO > // Storage order of the adapted sparse matrix
1774  SymmetricMatrix<MT,SO,false,false>::set( size_t i, size_t j, const ElementType& value )
1775 {
1776  SharedValue<ET> shared( value );
1777 
1778  if( i != j )
1779  matrix_.set( j, i, shared );
1780 
1781  return Iterator( matrix_.set( i, j, shared ) );
1782 }
1784 //*************************************************************************************************
1785 
1786 
1787 //*************************************************************************************************
1802 template< typename MT // Type of the adapted sparse matrix
1803  , bool SO > // Storage order of the adapted sparse matrix
1805  SymmetricMatrix<MT,SO,false,false>::insert( size_t i, size_t j, const ElementType& value )
1806 {
1807  SharedValue<ET> shared( value );
1808 
1809  if( i != j )
1810  matrix_.insert( j, i, shared );
1811 
1812  return Iterator( matrix_.insert( i, j, shared ) );
1813 }
1815 //*************************************************************************************************
1816 
1817 
1818 //*************************************************************************************************
1828 template< typename MT // Type of the adapted sparse matrix
1829  , bool SO > // Storage order of the adapted sparse matrix
1830 inline void SymmetricMatrix<MT,SO,false,false>::erase( size_t i, size_t j )
1831 {
1832  matrix_.erase( i, j );
1833  if( i != j )
1834  matrix_.erase( j, i );
1835 }
1837 //*************************************************************************************************
1838 
1839 
1840 //*************************************************************************************************
1852 template< typename MT // Type of the adapted sparse matrix
1853  , bool SO > // Storage order of the adapted sparse matrix
1855  SymmetricMatrix<MT,SO,false,false>::erase( size_t i, Iterator pos )
1856 {
1857  if( pos == end( i ) )
1858  return pos;
1859 
1860  const size_t j( pos->index() );
1861 
1862  if( i == j )
1863  return Iterator( matrix_.erase( i, pos.base() ) );
1864 
1865  if( SO ) {
1866  BLAZE_INTERNAL_ASSERT( matrix_.find( i, j ) != matrix_.end( j ), "Missing element detected" );
1867  matrix_.erase( j, matrix_.find( i, j ) );
1868  return Iterator( matrix_.erase( i, pos.base() ) );
1869  }
1870  else {
1871  BLAZE_INTERNAL_ASSERT( matrix_.find( j, i ) != matrix_.end( j ), "Missing element detected" );
1872  matrix_.erase( j, matrix_.find( j, i ) );
1873  return Iterator( matrix_.erase( i, pos.base() ) );
1874  }
1875 }
1877 //*************************************************************************************************
1878 
1879 
1880 //*************************************************************************************************
1894 template< typename MT // Type of the adapted sparse matrix
1895  , bool SO > // Storage order of the adapted sparse matrix
1897  SymmetricMatrix<MT,SO,false,false>::erase( size_t i, Iterator first, Iterator last )
1898 {
1899  for( Iterator it=first; it!=last; ++it )
1900  {
1901  const size_t j( it->index() );
1902 
1903  if( i == j )
1904  continue;
1905 
1906  if( SO ) {
1907  BLAZE_INTERNAL_ASSERT( matrix_.find( i, j ) != matrix_.end( j ), "Missing element detected" );
1908  matrix_.erase( i, j );
1909  }
1910  else {
1911  BLAZE_INTERNAL_ASSERT( matrix_.find( j, i ) != matrix_.end( j ), "Missing element detected" );
1912  matrix_.erase( j, i );
1913  }
1914  }
1915 
1916  return Iterator( matrix_.erase( i, first.base(), last.base() ) );
1917 }
1919 //*************************************************************************************************
1920 
1921 
1922 //*************************************************************************************************
1937 template< typename MT // Type of the adapted sparse matrix
1938  , bool SO > // Storage order of the adapted sparse matrix
1939 void SymmetricMatrix<MT,SO,false,false>::resize( size_t n, bool preserve )
1940 {
1942 
1943  UNUSED_PARAMETER( preserve );
1944 
1945  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1946 
1947  matrix_.resize( n, n, true );
1948 }
1950 //*************************************************************************************************
1951 
1952 
1953 //*************************************************************************************************
1964 template< typename MT // Type of the adapted sparse matrix
1965  , bool SO > // Storage order of the adapted sparse matrix
1966 inline void SymmetricMatrix<MT,SO,false,false>::reserve( size_t nonzeros )
1967 {
1968  matrix_.reserve( nonzeros );
1969 }
1971 //*************************************************************************************************
1972 
1973 
1974 //*************************************************************************************************
1988 template< typename MT // Type of the adapted sparse matrix
1989  , bool SO > // Storage order of the adapted sparse matrix
1990 inline void SymmetricMatrix<MT,SO,false,false>::reserve( size_t i, size_t nonzeros )
1991 {
1992  matrix_.reserve( i, nonzeros );
1993 }
1995 //*************************************************************************************************
1996 
1997 
1998 //*************************************************************************************************
2009 template< typename MT // Type of the adapted sparse matrix
2010  , bool SO > // Storage order of the adapted sparse matrix
2011 inline void SymmetricMatrix<MT,SO,false,false>::trim()
2012 {
2013  matrix_.trim();
2014 }
2016 //*************************************************************************************************
2017 
2018 
2019 //*************************************************************************************************
2031 template< typename MT // Type of the adapted sparse matrix
2032  , bool SO > // Storage order of the adapted sparse matrix
2033 inline void SymmetricMatrix<MT,SO,false,false>::trim( size_t i )
2034 {
2035  matrix_.trim( i );
2036 }
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2047 template< typename MT // Type of the adapted sparse matrix
2048  , bool SO > // Storage order of the adapted sparse matrix
2049 inline SymmetricMatrix<MT,SO,false,false>& SymmetricMatrix<MT,SO,false,false>::transpose()
2050 {
2051  return *this;
2052 }
2054 //*************************************************************************************************
2055 
2056 
2057 //*************************************************************************************************
2063 template< typename MT // Type of the adapted sparse matrix
2064  , bool SO > // Storage order of the adapted sparse matrix
2065 inline SymmetricMatrix<MT,SO,false,false>& SymmetricMatrix<MT,SO,false,false>::ctranspose()
2066 {
2067  for( size_t i=0UL; i<rows(); ++i ) {
2068  const Iterator_<MatrixType> last( matrix_.upperBound(i,i) );
2069  for( Iterator_<MatrixType> element=matrix_.begin(i); element!=last; ++element )
2070  conjugate( *element->value() );
2071  }
2072 
2073  return *this;
2074 }
2076 //*************************************************************************************************
2077 
2078 
2079 //*************************************************************************************************
2086 template< typename MT // Type of the adapted sparse matrix
2087  , bool SO > // Storage order of the adapted sparse matrix
2088 template< typename Other > // Data type of the scalar value
2089 inline SymmetricMatrix<MT,SO,false,false>&
2090  SymmetricMatrix<MT,SO,false,false>::scale( const Other& scalar )
2091 {
2092  for( size_t i=0UL; i<rows(); ++i ) {
2093  const Iterator_<MatrixType> last( matrix_.upperBound(i,i) );
2094  for( Iterator_<MatrixType> element=matrix_.begin(i); element!=last; ++element )
2095  ( *element->value() ).scale( scalar );
2096  }
2097 
2098  return *this;
2099 }
2101 //*************************************************************************************************
2102 
2103 
2104 //*************************************************************************************************
2111 template< typename MT // Type of the adapted sparse matrix
2112  , bool SO > // Storage order of the adapted sparse matrix
2113 template< typename Other > // Data type of the scalar value
2114 inline SymmetricMatrix<MT,SO,false,false>&
2115  SymmetricMatrix<MT,SO,false,false>::scaleDiagonal( Other scalar )
2116 {
2117  matrix_.scaleDiagonal( scalar );
2118  return *this;
2119 }
2121 //*************************************************************************************************
2122 
2123 
2124 //*************************************************************************************************
2131 template< typename MT // Type of the adapted sparse matrix
2132  , bool SO > // Storage order of the adapted sparse matrix
2133 inline void SymmetricMatrix<MT,SO,false,false>::swap( SymmetricMatrix& m ) noexcept
2134 {
2135  using std::swap;
2136 
2137  swap( matrix_, m.matrix_ );
2138 }
2140 //*************************************************************************************************
2141 
2142 
2143 
2144 
2145 //=================================================================================================
2146 //
2147 // LOOKUP FUNCTIONS
2148 //
2149 //=================================================================================================
2150 
2151 //*************************************************************************************************
2167 template< typename MT // Type of the adapted sparse matrix
2168  , bool SO > // Storage order of the adapted sparse matrix
2170  SymmetricMatrix<MT,SO,false,false>::find( size_t i, size_t j )
2171 {
2172  return Iterator( matrix_.find( i, j ) );
2173 }
2175 //*************************************************************************************************
2176 
2177 
2178 //*************************************************************************************************
2194 template< typename MT // Type of the adapted sparse matrix
2195  , bool SO > // Storage order of the adapted sparse matrix
2197  SymmetricMatrix<MT,SO,false,false>::find( size_t i, size_t j ) const
2198 {
2199  return ConstIterator( matrix_.find( i, j ) );
2200 }
2202 //*************************************************************************************************
2203 
2204 
2205 //*************************************************************************************************
2221 template< typename MT // Type of the adapted sparse matrix
2222  , bool SO > // Storage order of the adapted sparse matrix
2224  SymmetricMatrix<MT,SO,false,false>::lowerBound( size_t i, size_t j )
2225 {
2226  return Iterator( matrix_.lowerBound( i, j ) );
2227 }
2229 //*************************************************************************************************
2230 
2231 
2232 //*************************************************************************************************
2248 template< typename MT // Type of the adapted sparse matrix
2249  , bool SO > // Storage order of the adapted sparse matrix
2251  SymmetricMatrix<MT,SO,false,false>::lowerBound( size_t i, size_t j ) const
2252 {
2253  return ConstIterator( matrix_.lowerBound( i, j ) );
2254 }
2256 //*************************************************************************************************
2257 
2258 
2259 //*************************************************************************************************
2275 template< typename MT // Type of the adapted sparse matrix
2276  , bool SO > // Storage order of the adapted sparse matrix
2278  SymmetricMatrix<MT,SO,false,false>::upperBound( size_t i, size_t j )
2279 {
2280  return Iterator( matrix_.upperBound( i, j ) );
2281 }
2283 //*************************************************************************************************
2284 
2285 
2286 //*************************************************************************************************
2302 template< typename MT // Type of the adapted sparse matrix
2303  , bool SO > // Storage order of the adapted sparse matrix
2305  SymmetricMatrix<MT,SO,false,false>::upperBound( size_t i, size_t j ) const
2306 {
2307  return ConstIterator( matrix_.upperBound( i, j ) );
2308 }
2310 //*************************************************************************************************
2311 
2312 
2313 
2314 
2315 //=================================================================================================
2316 //
2317 // LOW-LEVEL UTILITY FUNCTIONS
2318 //
2319 //=================================================================================================
2320 
2321 //*************************************************************************************************
2376 template< typename MT // Type of the adapted sparse matrix
2377  , bool SO > // Storage order of the adapted sparse matrix
2378 inline void SymmetricMatrix<MT,SO,false,false>::append( size_t i, size_t j, const ElementType& value, bool check )
2379 {
2380  SharedValue<ET> shared( value );
2381 
2382  matrix_.append( i, j, shared, check );
2383  if( i != j && ( !check || !isDefault( value ) ) )
2384  matrix_.insert( j, i, shared );
2385 }
2387 //*************************************************************************************************
2388 
2389 
2390 //*************************************************************************************************
2404 template< typename MT // Type of the adapted sparse matrix
2405  , bool SO > // Storage order of the adapted sparse matrix
2406 inline void SymmetricMatrix<MT,SO,false,false>::finalize( size_t i )
2407 {
2408  matrix_.trim( i );
2409 }
2411 //*************************************************************************************************
2412 
2413 
2414 
2415 
2416 //=================================================================================================
2417 //
2418 // DEBUGGING FUNCTIONS
2419 //
2420 //=================================================================================================
2421 
2422 //*************************************************************************************************
2432 template< typename MT // Type of the adapted dense matrix
2433  , bool SO > // Storage order of the adapted dense matrix
2434 inline bool SymmetricMatrix<MT,SO,false,false>::isIntact() const noexcept
2435 {
2436  using blaze::isIntact;
2437 
2438  return ( isIntact( matrix_ ) && isSymmetric( matrix_ ) );
2439 }
2441 //*************************************************************************************************
2442 
2443 
2444 
2445 
2446 //=================================================================================================
2447 //
2448 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2449 //
2450 //=================================================================================================
2451 
2452 //*************************************************************************************************
2463 template< typename MT // Type of the adapted sparse matrix
2464  , bool SO > // Storage order of the adapted sparse matrix
2465 template< typename Other > // Data type of the foreign expression
2466 inline bool SymmetricMatrix<MT,SO,false,false>::canAlias( const Other* alias ) const noexcept
2467 {
2468  return matrix_.canAlias( alias );
2469 }
2471 //*************************************************************************************************
2472 
2473 
2474 //*************************************************************************************************
2485 template< typename MT // Type of the adapted sparse matrix
2486  , bool SO > // Storage order of the adapted sparse matrix
2487 template< typename Other > // Data type of the foreign expression
2488 inline bool SymmetricMatrix<MT,SO,false,false>::isAliased( const Other* alias ) const noexcept
2489 {
2490  return matrix_.isAliased( alias );
2491 }
2493 //*************************************************************************************************
2494 
2495 
2496 //*************************************************************************************************
2507 template< typename MT // Type of the adapted sparse matrix
2508  , bool SO > // Storage order of the adapted sparse matrix
2509 inline bool SymmetricMatrix<MT,SO,false,false>::canSMPAssign() const noexcept
2510 {
2511  return matrix_.canSMPAssign();
2512 }
2514 //*************************************************************************************************
2515 
2516 
2517 //*************************************************************************************************
2529 template< typename MT // Type of the adapted sparse matrix
2530  , bool SO > // Storage order of the adapted sparse matrix
2531 template< typename MT2 > // Type of the right-hand side dense matrix
2532 void SymmetricMatrix<MT,SO,false,false>::assign( DenseMatrix<MT2,SO>& rhs )
2533 {
2535 
2536  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2537  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2538 
2539  std::vector<size_t> nonzeros( rows(), 0UL );
2540  size_t sum( 0UL );
2541 
2542  for( size_t i=0UL; i<rows(); ++i ) {
2543  nonzeros[i] = (~rhs).nonZeros(i);
2544  sum += nonzeros[i];
2545  }
2546 
2547  matrix_.reserve( sum );
2548  for( size_t i=0UL; i<rows(); ++i ) {
2549  matrix_.reserve( i, nonzeros[i] );
2550  }
2551 
2552  for( size_t i=0UL; i<rows(); ++i ) {
2553  for( size_t j=i; j<columns(); ++j ) {
2554  if( !isDefault( (~rhs)(i,j) ) ) {
2555  SharedValue<ET> shared;
2556  *shared = std::move( (~rhs)(i,j) );
2557  matrix_.append( i, j, shared, false );
2558  if( i != j )
2559  matrix_.append( j, i, shared, false );
2560  }
2561  }
2562  }
2563 }
2565 //*************************************************************************************************
2566 
2567 
2568 //*************************************************************************************************
2580 template< typename MT // Type of the adapted sparse matrix
2581  , bool SO > // Storage order of the adapted sparse matrix
2582 template< typename MT2 > // Type of the right-hand side dense matrix
2583 void SymmetricMatrix<MT,SO,false,false>::assign( const DenseMatrix<MT2,SO>& rhs )
2584 {
2586 
2587  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2588  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2589 
2590  std::vector<size_t> nonzeros( rows(), 0UL );
2591  size_t sum( 0UL );
2592 
2593  for( size_t i=0UL; i<rows(); ++i ) {
2594  nonzeros[i] = (~rhs).nonZeros(i);
2595  sum += nonzeros[i];
2596  }
2597 
2598  matrix_.reserve( sum );
2599  for( size_t i=0UL; i<rows(); ++i ) {
2600  matrix_.reserve( i, nonzeros[i] );
2601  }
2602 
2603  for( size_t i=0UL; i<rows(); ++i ) {
2604  for( size_t j=i; j<columns(); ++j ) {
2605  if( !isDefault( (~rhs)(i,j) ) ) {
2606  const SharedValue<ET> shared( (~rhs)(i,j) );
2607  matrix_.append( i, j, shared, false );
2608  if( i != j )
2609  matrix_.append( j, i, shared, false );
2610  }
2611  }
2612  }
2613 }
2615 //*************************************************************************************************
2616 
2617 
2618 //*************************************************************************************************
2630 template< typename MT // Type of the adapted sparse matrix
2631  , bool SO > // Storage order of the adapted sparse matrix
2632 template< typename MT2 > // Type of the right-hand side sparse matrix
2633 void SymmetricMatrix<MT,SO,false,false>::assign( SparseMatrix<MT2,SO>& rhs )
2634 {
2636 
2637  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2638  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2639 
2640  std::vector<size_t> nonzeros( rows(), 0UL );
2641  size_t sum( 0UL );
2642 
2643  for( size_t i=0UL; i<rows(); ++i ) {
2644  nonzeros[i] = (~rhs).nonZeros(i);
2645  sum += nonzeros[i];
2646  }
2647 
2648  matrix_.reserve( sum );
2649  for( size_t i=0UL; i<rows(); ++i ) {
2650  matrix_.reserve( i, nonzeros[i] );
2651  }
2652 
2653  for( size_t i=0UL; i<rows(); ++i ) {
2654  for( Iterator_<MT2> it=(~rhs).lowerBound(i,i); it!=(~rhs).end(i); ++it ) {
2655  if( !isDefault( it->value() ) ) {
2656  SharedValue<ET> shared;
2657  *shared = std::move( it->value() );
2658  matrix_.append( i, it->index(), shared, false );
2659  if( i != it->index() )
2660  matrix_.append( it->index(), i, shared, false );
2661  }
2662  }
2663  }
2664 }
2666 //*************************************************************************************************
2667 
2668 
2669 //*************************************************************************************************
2681 template< typename MT // Type of the adapted sparse matrix
2682  , bool SO > // Storage order of the adapted sparse matrix
2683 template< typename MT2 > // Type of the right-hand side sparse matrix
2684 void SymmetricMatrix<MT,SO,false,false>::assign( const SparseMatrix<MT2,SO>& rhs )
2685 {
2687 
2688  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2689  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2690 
2691  std::vector<size_t> nonzeros( rows(), 0UL );
2692  size_t sum( 0UL );
2693 
2694  for( size_t i=0UL; i<rows(); ++i ) {
2695  nonzeros[i] = (~rhs).nonZeros(i);
2696  sum += nonzeros[i];
2697  }
2698 
2699  matrix_.reserve( sum );
2700  for( size_t i=0UL; i<rows(); ++i ) {
2701  matrix_.reserve( i, nonzeros[i] );
2702  }
2703 
2704  for( size_t i=0UL; i<rows(); ++i ) {
2705  for( ConstIterator_<MT2> it=(~rhs).lowerBound(i,i); it!=(~rhs).end(i); ++it ) {
2706  if( !isDefault( it->value() ) ) {
2707  const SharedValue<ET> shared( it->value() );
2708  matrix_.append( i, it->index(), shared, false );
2709  if( i != it->index() )
2710  matrix_.append( it->index(), i, shared, false );
2711  }
2712  }
2713  }
2714 }
2716 //*************************************************************************************************
2717 
2718 } // namespace blaze
2719 
2720 #endif
#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
Constraint on the data type.
Header file for auxiliary alias declarations.
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE const complex< int8_t > sum(const SIMDcint8 &a) noexcept
Returns the sum of all elements in the 8-bit integral complex SIMD vector.
Definition: Reduction.h:63
#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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:689
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Constraint on the data type.
Header file for the SharedValue class.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2643
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5077
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:590
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:384
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
STL namespace.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2639
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:298
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:232
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
Header file for the SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:5104
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5148
Header file for the If class template.
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5131
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the Columns type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
Header file for the SparseElement base class.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is a numeric (integral or floating point) d...
Definition: Numeric.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Header file for the RemoveAdaptor type trait.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the NonNumericProxy class.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Header file for the addition trait.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:258
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric< T >::value)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2637
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:950
Header file for the IsComputation type trait class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:609
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:564