DenseNonNumeric.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENONNUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENONNUMERIC_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <iterator>
57 #include <blaze/math/shims/Clear.h>
60 #include <blaze/math/shims/Move.h>
72 #include <blaze/util/Assert.h>
78 #include <blaze/util/DisableIf.h>
79 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/Exception.h>
81 #include <blaze/util/mpl/If.h>
83 #include <blaze/util/Types.h>
86 #include <blaze/util/Unused.h>
87 
88 
89 namespace blaze {
90 
91 //=================================================================================================
92 //
93 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NON-NUMERIC ELEMENT TYPE
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
105 template< typename MT // Type of the adapted dense matrix
106  , bool SO > // Storage order of the adapted dense matrix
107 class SymmetricMatrix<MT,SO,true,false>
108  : public DenseMatrix< SymmetricMatrix<MT,SO,true,false>, SO >
109 {
110  private:
111  //**Type definitions****************************************************************************
112  typedef typename MT::OppositeType OT;
113  typedef typename MT::TransposeType TT;
114  typedef typename MT::ElementType ET;
115  //**********************************************************************************************
116 
117  public:
118  //**Type definitions****************************************************************************
119  typedef SymmetricMatrix<MT,SO,true,false> This;
120  typedef This ResultType;
121  typedef SymmetricMatrix<OT,!SO,true,false> OppositeType;
122  typedef SymmetricMatrix<TT,!SO,true,false> TransposeType;
123  typedef ET ElementType;
124  typedef typename MT::ReturnType ReturnType;
125  typedef const This& CompositeType;
126  typedef typename MT::Reference Reference;
127  typedef typename MT::ConstReference ConstReference;
128  typedef typename MT::Pointer Pointer;
129  typedef typename MT::ConstPointer ConstPointer;
130  //**********************************************************************************************
131 
132  //**Rebind struct definition********************************************************************
135  template< typename ET > // Data type of the other matrix
136  struct Rebind {
138  typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
139  };
140  //**********************************************************************************************
141 
142  //**MatrixIterator class definition*************************************************************
145  template< typename MatrixType > // Type of the adapted dense matrix
146  class MatrixIterator
147  {
148  public:
149  //**Type definitions*************************************************************************
151  typedef typename IfTrue< IsConst<MatrixType>::value
152  , typename MatrixType::ConstReference
153  , typename MatrixType::Reference >::Type Reference;
154 
155  typedef std::random_access_iterator_tag IteratorCategory;
156  typedef RemoveReference<Reference> ValueType;
157  typedef ValueType* PointerType;
158  typedef Reference ReferenceType;
159  typedef ptrdiff_t DifferenceType;
160 
161  // STL iterator requirements
162  typedef IteratorCategory iterator_category;
163  typedef ValueType value_type;
164  typedef PointerType pointer;
165  typedef ReferenceType reference;
166  typedef DifferenceType difference_type;
167  //*******************************************************************************************
168 
169  //**Constructor******************************************************************************
172  inline MatrixIterator()
173  : matrix_( NULL ) // Reference to the adapted dense matrix
174  , row_ ( 0UL ) // The current row index of the iterator
175  , column_( 0UL ) // The current column index of the iterator
176  {}
177  //*******************************************************************************************
178 
179  //**Constructor******************************************************************************
186  inline MatrixIterator( MatrixType& matrix, size_t row, size_t column )
187  : matrix_( &matrix ) // Reference to the adapted dense matrix
188  , row_ ( row ) // The current row index of the iterator
189  , column_( column ) // The current column index of the iterator
190  {}
191  //*******************************************************************************************
192 
193  //**Conversion constructor*******************************************************************
198  template< typename MatrixType2 >
199  inline MatrixIterator( const MatrixIterator<MatrixType2>& it )
200  : matrix_( it.matrix_ ) // Reference to the adapted dense matrix
201  , row_ ( it.row_ ) // The current row index of the iterator
202  , column_( it.column_ ) // The current column index of the iterator
203  {}
204  //*******************************************************************************************
205 
206  //**Addition assignment operator*************************************************************
212  inline MatrixIterator& operator+=( size_t inc ) {
213  ( SO )?( row_ += inc ):( column_ += inc );
214  return *this;
215  }
216  //*******************************************************************************************
217 
218  //**Subtraction assignment operator**********************************************************
224  inline MatrixIterator& operator-=( size_t dec ) {
225  ( SO )?( row_ -= dec ):( column_ -= dec );
226  return *this;
227  }
228  //*******************************************************************************************
229 
230  //**Prefix increment operator****************************************************************
235  inline MatrixIterator& operator++() {
236  ( SO )?( ++row_ ):( ++column_ );
237  return *this;
238  }
239  //*******************************************************************************************
240 
241  //**Postfix increment operator***************************************************************
246  inline const MatrixIterator operator++( int ) {
247  const MatrixIterator tmp( *this );
248  ++(*this);
249  return tmp;
250  }
251  //*******************************************************************************************
252 
253  //**Prefix decrement operator****************************************************************
258  inline MatrixIterator& operator--() {
259  ( SO )?( --row_ ):( --column_ );
260  return *this;
261  }
262  //*******************************************************************************************
263 
264  //**Postfix decrement operator***************************************************************
269  inline const MatrixIterator operator--( int ) {
270  const MatrixIterator tmp( *this );
271  --(*this);
272  return tmp;
273  }
274  //*******************************************************************************************
275 
276  //**Element access operator******************************************************************
281  inline ReferenceType operator*() const {
282  if( ( SO && row_ < column_ ) || ( !SO && row_ > column_ ) )
283  return (*matrix_)(row_,column_);
284  else
285  return (*matrix_)(column_,row_);
286  }
287  //*******************************************************************************************
288 
289  //**Element access operator******************************************************************
294  inline PointerType operator->() const {
295  if( ( SO && row_ < column_ ) || ( !SO && row_ > column_ ) )
296  return &(*matrix_)(row_,column_);
297  else
298  return &(*matrix_)(column_,row_);
299  }
300  //*******************************************************************************************
301 
302  //**Equality operator************************************************************************
308  template< typename MatrixType2 >
309  inline bool operator==( const MatrixIterator<MatrixType2>& rhs ) const {
310  return ( SO )?( row_ == rhs.row_ ):( column_ == rhs.column_ );
311  }
312  //*******************************************************************************************
313 
314  //**Inequality operator**********************************************************************
320  template< typename MatrixType2 >
321  inline bool operator!=( const MatrixIterator<MatrixType2>& rhs ) const {
322  return ( SO )?( row_ != rhs.row_ ):( column_ != rhs.column_ );
323  }
324  //*******************************************************************************************
325 
326  //**Less-than operator***********************************************************************
332  template< typename MatrixType2 >
333  inline bool operator<( const MatrixIterator<MatrixType2>& rhs ) const {
334  return ( SO )?( row_ < rhs.row_ ):( column_ < rhs.column_ );
335  return ( column_ < rhs.column_ );
336  }
337  //*******************************************************************************************
338 
339  //**Greater-than operator********************************************************************
345  template< typename MatrixType2 >
346  inline bool operator>( const MatrixIterator<MatrixType2>& rhs ) const {
347  return ( SO )?( row_ > rhs.row_ ):( column_ > rhs.column_ );
348  return ( column_ > rhs.column_ );
349  }
350  //*******************************************************************************************
351 
352  //**Less-or-equal-than operator**************************************************************
358  template< typename MatrixType2 >
359  inline bool operator<=( const MatrixIterator<MatrixType2>& rhs ) const {
360  return ( SO )?( row_ <= rhs.row_ ):( column_ <= rhs.column_ );
361  }
362  //*******************************************************************************************
363 
364  //**Greater-or-equal-than operator***********************************************************
370  template< typename MatrixType2 >
371  inline bool operator>=( const MatrixIterator<MatrixType2>& rhs ) const {
372  return ( SO )?( row_ >= rhs.row_ ):( column_ >= rhs.column_ );
373  }
374  //*******************************************************************************************
375 
376  //**Subtraction operator*********************************************************************
382  inline DifferenceType operator-( const MatrixIterator& rhs ) const {
383  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
384  }
385  //*******************************************************************************************
386 
387  //**Addition operator************************************************************************
394  friend inline const MatrixIterator operator+( const MatrixIterator& it, size_t inc ) {
395  if( SO )
396  return MatrixIterator( *it.matrix_, it.row_ + inc, it.column_ );
397  else
398  return MatrixIterator( *it.matrix_, it.row_, it.column_ + inc );
399  }
400  //*******************************************************************************************
401 
402  //**Addition operator************************************************************************
409  friend inline const MatrixIterator operator+( size_t inc, const MatrixIterator& it ) {
410  if( SO )
411  return MatrixIterator( *it.matrix_, it.row_ + inc, it.column_ );
412  else
413  return MatrixIterator( *it.matrix_, it.row_, it.column_ + inc );
414  }
415  //*******************************************************************************************
416 
417  //**Subtraction operator*********************************************************************
424  friend inline const MatrixIterator operator-( const MatrixIterator& it, size_t dec ) {
425  if( SO )
426  return MatrixIterator( *it.matrix_, it.row_ - dec, it.column_ );
427  else
428  return MatrixIterator( *it.matrix_, it.row_, it.column_ - dec );
429  }
430  //*******************************************************************************************
431 
432  private:
433  //**Member variables*************************************************************************
434  MatrixType* matrix_;
435  size_t row_;
436  size_t column_;
437  //*******************************************************************************************
438 
439  //**Friend declarations**********************************************************************
440  template< typename MatrixType2 > friend class MatrixIterator;
441  //*******************************************************************************************
442  };
443  //**********************************************************************************************
444 
445  //**Type definitions****************************************************************************
446  typedef MatrixIterator<MT> Iterator;
447  typedef MatrixIterator<const MT> ConstIterator;
448  //**********************************************************************************************
449 
450  //**Compilation flags***************************************************************************
452  enum { vectorizable = 0 };
453 
455  enum { smpAssignable = MT::smpAssignable && !IsSMPAssignable<ET>::value };
456  //**********************************************************************************************
457 
458  //**Constructors********************************************************************************
461  explicit inline SymmetricMatrix();
462  explicit inline SymmetricMatrix( size_t n );
463 
464  explicit inline SymmetricMatrix( ElementType* ptr, size_t n );
465  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn );
466 
467  template< typename Deleter >
468  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, Deleter d );
469 
470  template< typename Deleter >
471  explicit inline SymmetricMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
472 
473  inline SymmetricMatrix( const SymmetricMatrix& m );
474  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
475  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
477  //**********************************************************************************************
478 
479  //**Destructor**********************************************************************************
480  // No explicitly declared destructor.
481  //**********************************************************************************************
482 
483  //**Data access functions***********************************************************************
486  inline Reference operator()( size_t i, size_t j );
487  inline ConstReference operator()( size_t i, size_t j ) const;
488  inline Reference at( size_t i, size_t j );
489  inline ConstReference at( size_t i, size_t j ) const;
490  inline ConstPointer data () const;
491  inline ConstPointer data ( size_t i ) const;
492  inline Iterator begin ( size_t i );
493  inline ConstIterator begin ( size_t i ) const;
494  inline ConstIterator cbegin( size_t i ) const;
495  inline Iterator end ( size_t i );
496  inline ConstIterator end ( size_t i ) const;
497  inline ConstIterator cend ( size_t i ) const;
499  //**********************************************************************************************
500 
501  //**Assignment operators************************************************************************
504  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
505 
506  template< typename MT2 >
507  inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
508  operator=( const Matrix<MT2,SO>& rhs );
509 
510  template< typename MT2 >
511  inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
512  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 >
518  inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
519  operator+=( const Matrix<MT2,SO>& rhs );
520 
521  template< typename MT2 >
522  inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
523  operator+=( const Matrix<MT2,SO>& rhs );
524 
525  template< typename MT2 >
526  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
527 
528  template< typename MT2 >
529  inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
530  operator-=( const Matrix<MT2,SO>& rhs );
531 
532  template< typename MT2 >
533  inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
534  operator-=( const Matrix<MT2,SO>& rhs );
535 
536  template< typename MT2 >
537  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
538 
539  template< typename MT2, bool SO2 >
540  inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
541 
542  template< typename Other >
543  inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
544  operator*=( Other rhs );
545 
546  template< typename Other >
547  inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
548  operator/=( Other rhs );
550  //**********************************************************************************************
551 
552  //**Utility functions***************************************************************************
555  inline size_t rows() const;
556  inline size_t columns() const;
557  inline size_t spacing() const;
558  inline size_t capacity() const;
559  inline size_t capacity( size_t i ) const;
560  inline size_t nonZeros() const;
561  inline size_t nonZeros( size_t i ) const;
562  inline void reset();
563  inline void reset( size_t i );
564  inline void clear();
565  void resize ( size_t n, bool preserve=true );
566  inline void extend ( size_t n, bool preserve=true );
567  inline void reserve( size_t elements );
568  inline SymmetricMatrix& transpose();
569  inline SymmetricMatrix& ctranspose();
570  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
571  inline void swap( SymmetricMatrix& m ) /* throw() */;
573  //**********************************************************************************************
574 
575  //**Debugging functions*************************************************************************
578  inline bool isIntact() const;
580  //**********************************************************************************************
581 
582  //**Expression template evaluation functions****************************************************
585  template< typename Other > inline bool canAlias ( const Other* alias ) const;
586  template< typename Other > inline bool isAliased( const Other* alias ) const;
587 
588  inline bool isAligned () const;
589  inline bool canSMPAssign() const;
591  //**********************************************************************************************
592 
593  private:
594  //**Expression template evaluation functions****************************************************
597  template< typename MT2 > inline void assign ( DenseMatrix <MT2,SO>& rhs );
598  template< typename MT2 > inline void assign ( const DenseMatrix <MT2,SO>& rhs );
599  template< typename MT2 > inline void assign ( const SparseMatrix<MT2,SO>& rhs );
600  template< typename MT2 > inline void addAssign( const DenseMatrix <MT2,SO>& rhs );
601  template< typename MT2 > inline void addAssign( const SparseMatrix<MT2,SO>& rhs );
602  template< typename MT2 > inline void subAssign( const DenseMatrix <MT2,SO>& rhs );
603  template< typename MT2 > inline void subAssign( const SparseMatrix<MT2,SO>& rhs );
605  //**********************************************************************************************
606 
607  //**Member variables****************************************************************************
610  MT matrix_;
611 
612  //**********************************************************************************************
613 
614  //**Friend declarations*************************************************************************
615  template< typename MT2, bool SO2, bool DF2, bool NF2 >
616  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
617  //**********************************************************************************************
618 
619  //**Compile time checks*************************************************************************
633  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
634  //**********************************************************************************************
635 };
637 //*************************************************************************************************
638 
639 
640 
641 
642 //=================================================================================================
643 //
644 // CONSTRUCTORS
645 //
646 //=================================================================================================
647 
648 //*************************************************************************************************
652 template< typename MT // Type of the adapted dense matrix
653  , bool SO > // Storage order of the adapted dense matrix
654 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix()
655  : matrix_() // The adapted dense matrix
656 {
657  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
658 }
660 //*************************************************************************************************
661 
662 
663 //*************************************************************************************************
669 template< typename MT // Type of the adapted dense matrix
670  , bool SO > // Storage order of the adapted dense matrix
671 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( size_t n )
672  : matrix_( n, n ) // The adapted dense matrix
673 {
675 
676  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
677 }
679 //*************************************************************************************************
680 
681 
682 //*************************************************************************************************
703 template< typename MT // Type of the adapted dense matrix
704  , bool SO > // Storage order of the adapted dense matrix
705 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( ElementType* ptr, size_t n )
706  : matrix_( ptr, n, n ) // The adapted dense matrix
707 {
708  if( !isSymmetric( matrix_ ) ) {
709  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
710  }
711 
712  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
713 }
715 //*************************************************************************************************
716 
717 
718 //*************************************************************************************************
741 template< typename MT // Type of the adapted dense matrix
742  , bool SO > // Storage order of the adapted dense matrix
743 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn )
744  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
745 {
746  if( !isSymmetric( matrix_ ) ) {
747  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
748  }
749 
750  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
751 }
753 //*************************************************************************************************
754 
755 
756 //*************************************************************************************************
777 template< typename MT // Type of the adapted dense matrix
778  , bool SO > // Storage order of the adapted dense matrix
779 template< typename Deleter > // Type of the custom deleter
780 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( ElementType* ptr, size_t n, Deleter d )
781  : matrix_( ptr, n, n, d ) // The adapted dense matrix
782 {
783  if( !isSymmetric( matrix_ ) ) {
784  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
785  }
786 
787  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
788 }
790 //*************************************************************************************************
791 
792 
793 //*************************************************************************************************
815 template< typename MT // Type of the adapted dense matrix
816  , bool SO > // Storage order of the adapted dense matrix
817 template< typename Deleter > // Type of the custom deleter
818 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
819  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
820 {
821  if( !isSymmetric( matrix_ ) ) {
822  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
823  }
824 
825  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
826 }
828 //*************************************************************************************************
829 
830 
831 //*************************************************************************************************
837 template< typename MT // Type of the adapted dense matrix
838  , bool SO > // Storage order of the adapted dense matrix
839 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( const SymmetricMatrix& m )
840  : matrix_( m.matrix_ ) // The adapted dense matrix
841 {
842  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
843  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
844 }
846 //*************************************************************************************************
847 
848 
849 //*************************************************************************************************
859 template< typename MT // Type of the adapted dense matrix
860  , bool SO > // Storage order of the adapted dense matrix
861 template< typename MT2 > // Type of the foreign matrix
862 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( const Matrix<MT2,SO>& m )
863  : matrix_() // The adapted dense matrix
864 {
865  using blaze::resize;
866 
867  typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
868  typedef typename If< IsComputation<MT2>, RT, const MT2& >::Type Tmp;
869 
870  if( IsSymmetric<MT2>::value ) {
871  resize( matrix_, (~m).rows(), (~m).columns() );
872  assign( ~m );
873  }
874  else {
875  Tmp tmp( ~m );
876 
877  if( !isSymmetric( tmp ) ) {
878  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
879  }
880 
881  resize( matrix_, tmp.rows(), tmp.rows() );
882  assign( tmp );
883  }
884 
885  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
886  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
887 }
889 //*************************************************************************************************
890 
891 
892 //*************************************************************************************************
902 template< typename MT // Type of the adapted dense matrix
903  , bool SO > // Storage order of the adapted dense matrix
904 template< typename MT2 > // Type of the foreign matrix
905 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
906  : matrix_() // The adapted dense matrix
907 {
908  using blaze::resize;
909 
910  typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
911  typedef typename If< IsComputation<MT2>, RT, const MT2& >::Type Tmp;
912 
913  if( IsSymmetric<MT2>::value ) {
914  resize( matrix_, (~m).rows(), (~m).columns() );
915  assign( trans( ~m ) );
916  }
917  else {
918  Tmp tmp( ~m );
919 
920  if( !isSymmetric( tmp ) ) {
921  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of symmetric matrix" );
922  }
923 
924  resize( matrix_, tmp.rows(), tmp.rows() );
925  assign( trans( tmp ) );
926  }
927 
928  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
929  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
930 }
932 //*************************************************************************************************
933 
934 
935 
936 
937 //=================================================================================================
938 //
939 // DATA ACCESS FUNCTIONS
940 //
941 //=================================================================================================
942 
943 //*************************************************************************************************
958 template< typename MT // Type of the adapted dense matrix
959  , bool SO > // Storage order of the adapted dense matrix
961  SymmetricMatrix<MT,SO,true,false>::operator()( size_t i, size_t j )
962 {
963  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
964  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
965 
966  if( ( !SO && i > j ) || ( SO && i < j ) )
967  return matrix_(i,j);
968  else
969  return matrix_(j,i);
970 }
972 //*************************************************************************************************
973 
974 
975 //*************************************************************************************************
990 template< typename MT // Type of the adapted dense matrix
991  , bool SO > // Storage order of the adapted dense matrix
993  SymmetricMatrix<MT,SO,true,false>::operator()( size_t i, size_t j ) const
994 {
995  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
996  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
997 
998  if( ( !SO && i > j ) || ( SO && i < j ) )
999  return matrix_(i,j);
1000  else
1001  return matrix_(j,i);
1002 }
1004 //*************************************************************************************************
1005 
1006 
1007 //*************************************************************************************************
1023 template< typename MT // Type of the adapted dense matrix
1024  , bool SO > // Storage order of the adapted dense matrix
1026  SymmetricMatrix<MT,SO,true,false>::at( size_t i, size_t j )
1027 {
1028  if( i >= rows() ) {
1029  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1030  }
1031  if( j >= columns() ) {
1032  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1033  }
1034  return (*this)(i,j);
1035 }
1037 //*************************************************************************************************
1038 
1039 
1040 //*************************************************************************************************
1056 template< typename MT // Type of the adapted dense matrix
1057  , bool SO > // Storage order of the adapted dense matrix
1059  SymmetricMatrix<MT,SO,true,false>::at( size_t i, size_t j ) const
1060 {
1061  if( i >= rows() ) {
1062  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1063  }
1064  if( j >= columns() ) {
1065  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1066  }
1067  return (*this)(i,j);
1068 }
1070 //*************************************************************************************************
1071 
1072 
1073 //*************************************************************************************************
1087 template< typename MT // Type of the adapted dense matrix
1088  , bool SO > // Storage order of the adapted dense matrix
1089 inline typename SymmetricMatrix<MT,SO,true,false>::ConstPointer
1090  SymmetricMatrix<MT,SO,true,false>::data() const
1091 {
1092  return matrix_.data();
1093 }
1095 //*************************************************************************************************
1096 
1097 
1098 //*************************************************************************************************
1109 template< typename MT // Type of the adapted dense matrix
1110  , bool SO > // Storage order of the adapted dense matrix
1111 inline typename SymmetricMatrix<MT,SO,true,false>::ConstPointer
1112  SymmetricMatrix<MT,SO,true,false>::data( size_t i ) const
1113 {
1114  return matrix_.data(i);
1115 }
1117 //*************************************************************************************************
1118 
1119 
1120 //*************************************************************************************************
1132 template< typename MT // Type of the adapted dense matrix
1133  , bool SO > // Storage order of the adapted dense matrix
1136 {
1137  if( SO )
1138  return Iterator( matrix_, 0UL, i );
1139  else
1140  return Iterator( matrix_, i, 0UL );
1141 }
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1158 template< typename MT // Type of the adapted dense matrix
1159  , bool SO > // Storage order of the adapted dense matrix
1162 {
1163  if( SO )
1164  return ConstIterator( matrix_, 0UL, i );
1165  else
1166  return ConstIterator( matrix_, i, 0UL );
1167 }
1169 //*************************************************************************************************
1170 
1171 
1172 //*************************************************************************************************
1184 template< typename MT // Type of the adapted dense matrix
1185  , bool SO > // Storage order of the adapted dense matrix
1188 {
1189  if( SO )
1190  return ConstIterator( matrix_, 0UL, i );
1191  else
1192  return ConstIterator( matrix_, i, 0UL );
1193 }
1195 //*************************************************************************************************
1196 
1197 
1198 //*************************************************************************************************
1210 template< typename MT // Type of the adapted dense matrix
1211  , bool SO > // Storage order of the adapted dense matrix
1214 {
1215  if( SO )
1216  return Iterator( matrix_, rows(), i );
1217  else
1218  return Iterator( matrix_, i, columns() );
1219 }
1221 //*************************************************************************************************
1222 
1223 
1224 //*************************************************************************************************
1236 template< typename MT // Type of the adapted dense matrix
1237  , bool SO > // Storage order of the adapted dense matrix
1239  SymmetricMatrix<MT,SO,true,false>::end( size_t i ) const
1240 {
1241  if( SO )
1242  return ConstIterator( matrix_, rows(), i );
1243  else
1244  return ConstIterator( matrix_, i, columns() );
1245 }
1247 //*************************************************************************************************
1248 
1249 
1250 //*************************************************************************************************
1262 template< typename MT // Type of the adapted dense matrix
1263  , bool SO > // Storage order of the adapted dense matrix
1265  SymmetricMatrix<MT,SO,true,false>::cend( size_t i ) const
1266 {
1267  if( SO )
1268  return ConstIterator( matrix_, rows(), i );
1269  else
1270  return ConstIterator( matrix_, i, columns() );
1271 }
1273 //*************************************************************************************************
1274 
1275 
1276 
1277 
1278 //=================================================================================================
1279 //
1280 // ASSIGNMENT OPERATORS
1281 //
1282 //=================================================================================================
1283 
1284 //*************************************************************************************************
1294 template< typename MT // Type of the adapted dense matrix
1295  , bool SO > // Storage order of the adapted dense matrix
1296 inline SymmetricMatrix<MT,SO,true,false>&
1297  SymmetricMatrix<MT,SO,true,false>::operator=( const SymmetricMatrix& rhs )
1298 {
1299  using blaze::resize;
1300 
1301  if( &rhs == this ) return *this;
1302 
1303  resize( matrix_, rhs.rows(), rhs.columns() );
1304  assign( rhs );
1305 
1306  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1307  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1308 
1309  return *this;
1310 }
1312 //*************************************************************************************************
1313 
1314 
1315 //*************************************************************************************************
1329 template< typename MT // Type of the adapted dense matrix
1330  , bool SO > // Storage order of the adapted dense matrix
1331 template< typename MT2 > // Type of the right-hand side matrix
1332 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1333  SymmetricMatrix<MT,SO,true,false>::operator=( const Matrix<MT2,SO>& rhs )
1334 {
1335  using blaze::resize;
1336 
1337  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1338  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1339  }
1340 
1341  if( (~rhs).isAliased( this ) ) {
1342  SymmetricMatrix tmp( ~rhs );
1343  swap( tmp );
1344  }
1345  else {
1346  resize( matrix_, (~rhs).rows(), (~rhs).columns() );
1347  if( IsSparseMatrix<MT2>::value )
1348  reset();
1349  assign( ~rhs );
1350  }
1351 
1352  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1353  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1354 
1355  return *this;
1356 }
1358 //*************************************************************************************************
1359 
1360 
1361 //*************************************************************************************************
1375 template< typename MT // Type of the adapted dense matrix
1376  , bool SO > // Storage order of the adapted dense matrix
1377 template< typename MT2 > // Type of the right-hand side matrix
1378 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1379  SymmetricMatrix<MT,SO,true,false>::operator=( const Matrix<MT2,SO>& rhs )
1380 {
1381  using blaze::resize;
1382 
1383  typedef typename If< IsSymmetric<MT2>
1384  , typename MT2::CompositeType
1385  , typename MT2::ResultType >::Type Tmp;
1386 
1387  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1388  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1389  }
1390 
1391  Tmp tmp( ~rhs );
1392 
1393  if( !IsSymmetric<Tmp>::value && !isSymmetric( tmp ) ) {
1394  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1395  }
1396 
1397  BLAZE_INTERNAL_ASSERT( !tmp.canAlias( this ), "Aliasing detected" );
1398 
1399  resize( matrix_, tmp.rows(), tmp.columns() );
1400  if( IsSparseMatrix<Tmp>::value )
1401  reset();
1402  assign( tmp );
1403 
1404  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1405  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1406 
1407  return *this;
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 template< typename MT2 > // Type of the right-hand side matrix
1430 inline SymmetricMatrix<MT,SO,true,false>&
1431  SymmetricMatrix<MT,SO,true,false>::operator=( const Matrix<MT2,!SO>& rhs )
1432 {
1433  return this->operator=( trans( ~rhs ) );
1434 }
1436 //*************************************************************************************************
1437 
1438 
1439 //*************************************************************************************************
1452 template< typename MT // Type of the adapted dense matrix
1453  , bool SO > // Storage order of the adapted dense matrix
1454 template< typename MT2 > // Type of the right-hand side matrix
1455 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1456  SymmetricMatrix<MT,SO,true,false>::operator+=( const Matrix<MT2,SO>& rhs )
1457 {
1458  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1459  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1460  }
1461 
1462  addAssign( ~rhs );
1463 
1464  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1465  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1466 
1467  return *this;
1468 }
1470 //*************************************************************************************************
1471 
1472 
1473 //*************************************************************************************************
1486 template< typename MT // Type of the adapted dense matrix
1487  , bool SO > // Storage order of the adapted dense matrix
1488 template< typename MT2 > // Type of the right-hand side matrix
1489 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1490  SymmetricMatrix<MT,SO,true,false>::operator+=( const Matrix<MT2,SO>& rhs )
1491 {
1492  typedef typename If< IsSymmetric<MT2>
1493  , typename MT2::CompositeType
1494  , typename MT2::ResultType >::Type Tmp;
1495 
1496  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1497  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1498  }
1499 
1500  Tmp tmp( ~rhs );
1501 
1502  if( !IsSymmetric<Tmp>::value && !isSymmetric( tmp ) ) {
1503  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1504  }
1505 
1506  BLAZE_INTERNAL_ASSERT( !tmp.canAlias( this ), "Aliasing detected" );
1507 
1508  addAssign( tmp );
1509 
1510  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1511  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1512 
1513  return *this;
1514 }
1516 //*************************************************************************************************
1517 
1518 
1519 //*************************************************************************************************
1533 template< typename MT // Type of the adapted dense matrix
1534  , bool SO > // Storage order of the adapted dense matrix
1535 template< typename MT2 > // Type of the right-hand side matrix
1536 inline SymmetricMatrix<MT,SO,true,false>&
1537  SymmetricMatrix<MT,SO,true,false>::operator+=( const Matrix<MT2,!SO>& rhs )
1538 {
1539  return this->operator+=( trans( ~rhs ) );
1540 }
1542 //*************************************************************************************************
1543 
1544 
1545 //*************************************************************************************************
1558 template< typename MT // Type of the adapted dense matrix
1559  , bool SO > // Storage order of the adapted dense matrix
1560 template< typename MT2 > // Type of the right-hand side matrix
1561 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1562  SymmetricMatrix<MT,SO,true,false>::operator-=( const Matrix<MT2,SO>& rhs )
1563 {
1564  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) ) {
1565  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1566  }
1567 
1568  subAssign( ~rhs );
1569 
1570  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1571  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1572 
1573  return *this;
1574 }
1576 //*************************************************************************************************
1577 
1578 
1579 //*************************************************************************************************
1592 template< typename MT // Type of the adapted dense matrix
1593  , bool SO > // Storage order of the adapted dense matrix
1594 template< typename MT2 > // Type of the right-hand side matrix
1595 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1596  SymmetricMatrix<MT,SO,true,false>::operator-=( const Matrix<MT2,SO>& rhs )
1597 {
1598  typedef typename If< IsSymmetric<MT2>
1599  , typename MT2::CompositeType
1600  , typename MT2::ResultType >::Type Tmp;
1601 
1602  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1603  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1604  }
1605 
1606  Tmp tmp( ~rhs );
1607 
1608  if( !IsSymmetric<Tmp>::value && !isSymmetric( tmp ) ) {
1609  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1610  }
1611 
1612  BLAZE_INTERNAL_ASSERT( !tmp.canAlias( this ), "Aliasing detected" );
1613 
1614  subAssign( tmp );
1615 
1616  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1617  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1618 
1619  return *this;
1620 }
1622 //*************************************************************************************************
1623 
1624 
1625 //*************************************************************************************************
1639 template< typename MT // Type of the adapted dense matrix
1640  , bool SO > // Storage order of the adapted dense matrix
1641 template< typename MT2 > // Type of the right-hand side matrix
1642 inline SymmetricMatrix<MT,SO,true,false>&
1643  SymmetricMatrix<MT,SO,true,false>::operator-=( const Matrix<MT2,!SO>& rhs )
1644 {
1645  return this->operator-=( trans( ~rhs ) );
1646 }
1648 //*************************************************************************************************
1649 
1650 
1651 //*************************************************************************************************
1663 template< typename MT // Type of the adapted dense matrix
1664  , bool SO > // Storage order of the adapted dense matrix
1665 template< typename MT2 // Type of the right-hand side matrix
1666  , bool SO2 > // Storage order of the right-hand side matrix
1667 inline SymmetricMatrix<MT,SO,true,false>&
1668  SymmetricMatrix<MT,SO,true,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1669 {
1670  using blaze::resize;
1671 
1672  typedef typename MultTrait<MT,typename MT2::ResultType>::Type Tmp;
1673 
1675 
1676  if( matrix_.rows() != (~rhs).columns() ) {
1677  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1678  }
1679 
1680  Tmp tmp( (*this) * ~rhs );
1681 
1682  if( !isSymmetric( tmp ) ) {
1683  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to symmetric matrix" );
1684  }
1685 
1686  resize( matrix_, tmp.rows(), tmp.columns() );
1687  assign( tmp );
1688 
1689  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1690  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1691 
1692  return *this;
1693 }
1695 //*************************************************************************************************
1696 
1697 
1698 //*************************************************************************************************
1706 template< typename MT // Type of the adapted dense matrix
1707  , bool SO > // Storage order of the adapted dense matrix
1708 template< typename Other > // Data type of the right-hand side scalar
1709 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,false> >::Type&
1710  SymmetricMatrix<MT,SO,true,false>::operator*=( Other rhs )
1711 {
1712  if( SO ) {
1713  for( size_t j=0UL; j<columns(); ++j )
1714  for( size_t i=0UL; i<=j; ++i )
1715  matrix_(i,j) *= rhs;
1716  }
1717  else {
1718  for( size_t i=0UL; i<rows(); ++i )
1719  for( size_t j=0UL; j<=i; ++j )
1720  matrix_(i,j) *= rhs;
1721  }
1722 
1723  return *this;
1724 }
1726 //*************************************************************************************************
1727 
1728 
1729 //*************************************************************************************************
1737 template< typename MT // Type of the adapted dense matrix
1738  , bool SO > // Storage order of the adapted dense matrix
1739 template< typename Other > // Data type of the right-hand side scalar
1740 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,false> >::Type&
1741  SymmetricMatrix<MT,SO,true,false>::operator/=( Other rhs )
1742 {
1743  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1744 
1745  if( SO ) {
1746  for( size_t j=0UL; j<columns(); ++j )
1747  for( size_t i=0UL; i<=j; ++i )
1748  matrix_(i,j) /= rhs;
1749  }
1750  else {
1751  for( size_t i=0UL; i<rows(); ++i )
1752  for( size_t j=0UL; j<=i; ++j )
1753  matrix_(i,j) /= rhs;
1754  }
1755 
1756  return *this;
1757 }
1759 //*************************************************************************************************
1760 
1761 
1762 
1763 
1764 //=================================================================================================
1765 //
1766 // UTILITY FUNCTIONS
1767 //
1768 //=================================================================================================
1769 
1770 //*************************************************************************************************
1776 template< typename MT // Type of the adapted dense matrix
1777  , bool SO > // Storage order of the adapted dense matrix
1778 inline size_t SymmetricMatrix<MT,SO,true,false>::rows() const
1779 {
1780  return matrix_.rows();
1781 }
1783 //*************************************************************************************************
1784 
1785 
1786 //*************************************************************************************************
1792 template< typename MT // Type of the adapted dense matrix
1793  , bool SO > // Storage order of the adapted dense matrix
1794 inline size_t SymmetricMatrix<MT,SO,true,false>::columns() const
1795 {
1796  return matrix_.columns();
1797 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1814 template< typename MT // Type of the adapted dense matrix
1815  , bool SO > // Storage order of the adapted dense matrix
1816 inline size_t SymmetricMatrix<MT,SO,true,false>::spacing() const
1817 {
1818  return matrix_.spacing();
1819 }
1821 //*************************************************************************************************
1822 
1823 
1824 //*************************************************************************************************
1830 template< typename MT // Type of the adapted dense matrix
1831  , bool SO > // Storage order of the adapted dense matrix
1832 inline size_t SymmetricMatrix<MT,SO,true,false>::capacity() const
1833 {
1834  return matrix_.capacity();
1835 }
1837 //*************************************************************************************************
1838 
1839 
1840 //*************************************************************************************************
1851 template< typename MT // Type of the adapted dense matrix
1852  , bool SO > // Storage order of the adapted dense matrix
1853 inline size_t SymmetricMatrix<MT,SO,true,false>::capacity( size_t i ) const
1854 {
1855  return matrix_.capacity(i);
1856 }
1858 //*************************************************************************************************
1859 
1860 
1861 //*************************************************************************************************
1867 template< typename MT // Type of the adapted dense matrix
1868  , bool SO > // Storage order of the adapted dense matrix
1869 inline size_t SymmetricMatrix<MT,SO,true,false>::nonZeros() const
1870 {
1871  size_t nonzeros( 0UL );
1872 
1873  if( SO )
1874  {
1875  for( size_t j=0UL; j<columns(); ++j ) {
1876  for( size_t i=0UL; i<j; ++i ) {
1877  if( !isDefault( matrix_(i,j) ) )
1878  nonzeros += 2UL;
1879  }
1880  if( !isDefault( matrix_(j,j) ) )
1881  ++nonzeros;
1882  }
1883  }
1884  else
1885  {
1886  for( size_t i=0UL; i<rows(); ++i ) {
1887  for( size_t j=0UL; j<i; ++j ) {
1888  if( !isDefault( matrix_(i,j) ) )
1889  nonzeros += 2UL;
1890  }
1891  if( !isDefault( matrix_(i,i) ) )
1892  ++nonzeros;
1893  }
1894  }
1895 
1896  return nonzeros;
1897 }
1899 //*************************************************************************************************
1900 
1901 
1902 //*************************************************************************************************
1914 template< typename MT // Type of the adapted dense matrix
1915  , bool SO > // Storage order of the adapted dense matrix
1916 inline size_t SymmetricMatrix<MT,SO,true,false>::nonZeros( size_t i ) const
1917 {
1918  size_t nonzeros( 0UL );
1919 
1920  if( SO )
1921  {
1922  for( size_t j=0UL; j<i; ++j ) {
1923  if( !isDefault( matrix_(j,i) ) )
1924  ++nonzeros;
1925  }
1926  for( size_t j=i; j<rows(); ++j ) {
1927  if( !isDefault( matrix_(i,j) ) )
1928  ++nonzeros;
1929  }
1930  }
1931  else
1932  {
1933  for( size_t j=0UL; j<i; ++j ) {
1934  if( !isDefault( matrix_(i,j) ) )
1935  ++nonzeros;
1936  }
1937  for( size_t j=i; j<rows(); ++j ) {
1938  if( !isDefault( matrix_(j,i) ) )
1939  ++nonzeros;
1940  }
1941  }
1942 
1943  return nonzeros;
1944 }
1946 //*************************************************************************************************
1947 
1948 
1949 //*************************************************************************************************
1955 template< typename MT // Type of the adapted dense matrix
1956  , bool SO > // Storage order of the adapted dense matrix
1958 {
1959  using blaze::clear;
1960 
1961  if( SO ) {
1962  for( size_t j=0UL; j<columns(); ++j )
1963  for( size_t i=0UL; i<=j; ++i )
1964  clear( matrix_(i,j) );
1965  }
1966  else {
1967  for( size_t i=0UL; i<rows(); ++i )
1968  for( size_t j=0UL; j<=i; ++j )
1969  clear( matrix_(i,j) );
1970  }
1971 }
1973 //*************************************************************************************************
1974 
1975 
1976 //*************************************************************************************************
2016 template< typename MT // Type of the adapted dense matrix
2017  , bool SO > // Storage order of the adapted dense matrix
2018 inline void SymmetricMatrix<MT,SO,true,false>::reset( size_t i )
2019 {
2020  using blaze::clear;
2021 
2022  for( Iterator element=begin(i); element!=end(i); ++element )
2023  clear( *element );
2024 }
2026 //*************************************************************************************************
2027 
2028 
2029 //*************************************************************************************************
2041 template< typename MT // Type of the adapted dense matrix
2042  , bool SO > // Storage order of the adapted dense matrix
2044 {
2045  using blaze::clear;
2046 
2047  clear( matrix_ );
2048 }
2050 //*************************************************************************************************
2051 
2052 
2053 //*************************************************************************************************
2069 template< typename MT // Type of the adapted dense matrix
2070  , bool SO > // Storage order of the adapted dense matrix
2071 void SymmetricMatrix<MT,SO,true,false>::resize( size_t n, bool preserve )
2072 {
2074 
2075  UNUSED_PARAMETER( preserve );
2076 
2077  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
2078 
2079  const size_t oldsize( matrix_.rows() );
2080 
2081  matrix_.resize( n, n, true );
2082 
2083  if( n > oldsize ) {
2084  const size_t increment( n - oldsize );
2085  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2086  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2087  }
2088 }
2090 //*************************************************************************************************
2091 
2092 
2093 //*************************************************************************************************
2106 template< typename MT // Type of the adapted dense matrix
2107  , bool SO > // Storage order of the adapted dense matrix
2108 inline void SymmetricMatrix<MT,SO,true,false>::extend( size_t n, bool preserve )
2109 {
2111 
2112  UNUSED_PARAMETER( preserve );
2113 
2114  resize( rows() + n, true );
2115 }
2117 //*************************************************************************************************
2118 
2119 
2120 //*************************************************************************************************
2130 template< typename MT // Type of the adapted dense matrix
2131  , bool SO > // Storage order of the adapted dense matrix
2132 inline void SymmetricMatrix<MT,SO,true,false>::reserve( size_t elements )
2133 {
2134  matrix_.reserve( elements );
2135 }
2137 //*************************************************************************************************
2138 
2139 
2140 //*************************************************************************************************
2146 template< typename MT // Type of the adapted dense matrix
2147  , bool SO > // Storage order of the adapted dense matrix
2148 inline SymmetricMatrix<MT,SO,true,false>& SymmetricMatrix<MT,SO,true,false>::transpose()
2149 {
2150  return *this;
2151 }
2153 //*************************************************************************************************
2154 
2155 
2156 //*************************************************************************************************
2162 template< typename MT // Type of the adapted dense matrix
2163  , bool SO > // Storage order of the adapted dense matrix
2164 inline SymmetricMatrix<MT,SO,true,false>& SymmetricMatrix<MT,SO,true,false>::ctranspose()
2165 {
2166  if( SO ) {
2167  for( size_t j=0UL; j<columns(); ++j )
2168  for( size_t i=0UL; i<=j; ++i )
2169  conjugate( matrix_(i,j) );
2170  }
2171  else {
2172  for( size_t i=0UL; i<rows(); ++i )
2173  for( size_t j=0UL; j<=i; ++j )
2174  conjugate( matrix_(i,j) );
2175  }
2176 
2177  return *this;
2178 }
2180 //*************************************************************************************************
2181 
2182 
2183 //*************************************************************************************************
2190 template< typename MT // Type of the adapted dense matrix
2191  , bool SO > // Storage order of the adapted dense matrix
2192 template< typename Other > // Data type of the scalar value
2193 inline SymmetricMatrix<MT,SO,true,false>&
2194  SymmetricMatrix<MT,SO,true,false>::scale( const Other& scalar )
2195 {
2196  if( SO ) {
2197  for( size_t j=0UL; j<columns(); ++j )
2198  for( size_t i=0UL; i<=j; ++i )
2199  matrix_(i,j) *= scalar;
2200  }
2201  else {
2202  for( size_t i=0UL; i<rows(); ++i )
2203  for( size_t j=0UL; j<=i; ++j )
2204  matrix_(i,j) *= scalar;
2205  }
2206 
2207  return *this;
2208 }
2210 //*************************************************************************************************
2211 
2212 
2213 //*************************************************************************************************
2221 template< typename MT // Type of the adapted dense matrix
2222  , bool SO > // Storage order of the adapted dense matrix
2223 inline void SymmetricMatrix<MT,SO,true,false>::swap( SymmetricMatrix& m ) /* throw() */
2224 {
2225  using std::swap;
2226 
2227  swap( matrix_, m.matrix_ );
2228 }
2230 //*************************************************************************************************
2231 
2232 
2233 
2234 
2235 //=================================================================================================
2236 //
2237 // DEBUGGING FUNCTIONS
2238 //
2239 //=================================================================================================
2240 
2241 //*************************************************************************************************
2251 template< typename MT // Type of the adapted dense matrix
2252  , bool SO > // Storage order of the adapted dense matrix
2254 {
2255  using blaze::isIntact;
2256 
2257  return isIntact( matrix_ ) &&
2258  ( IsCustom<MT>::value || ( SO ? isUpper( matrix_ ) : isLower( matrix_ ) ) );
2259 }
2261 //*************************************************************************************************
2262 
2263 
2264 
2265 
2266 //=================================================================================================
2267 //
2268 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2269 //
2270 //=================================================================================================
2271 
2272 //*************************************************************************************************
2283 template< typename MT // Type of the adapted dense matrix
2284  , bool SO > // Storage order of the adapted dense matrix
2285 template< typename Other > // Data type of the foreign expression
2286 inline bool SymmetricMatrix<MT,SO,true,false>::canAlias( const Other* alias ) const
2287 {
2288  return matrix_.canAlias( alias );
2289 }
2291 //*************************************************************************************************
2292 
2293 
2294 //*************************************************************************************************
2305 template< typename MT // Type of the adapted dense matrix
2306  , bool SO > // Storage order of the adapted dense matrix
2307 template< typename Other > // Data type of the foreign expression
2308 inline bool SymmetricMatrix<MT,SO,true,false>::isAliased( const Other* alias ) const
2309 {
2310  return matrix_.isAliased( alias );
2311 }
2313 //*************************************************************************************************
2314 
2315 
2316 //*************************************************************************************************
2326 template< typename MT // Type of the adapted dense matrix
2327  , bool SO > // Storage order of the adapted dense matrix
2328 inline bool SymmetricMatrix<MT,SO,true,false>::isAligned() const
2329 {
2330  return matrix_.isAligned();
2331 }
2333 //*************************************************************************************************
2334 
2335 
2336 //*************************************************************************************************
2347 template< typename MT // Type of the adapted dense matrix
2348  , bool SO > // Storage order of the adapted dense matrix
2349 inline bool SymmetricMatrix<MT,SO,true,false>::canSMPAssign() const
2350 {
2351  return matrix_.canSMPAssign();
2352 }
2354 //*************************************************************************************************
2355 
2356 
2357 //*************************************************************************************************
2369 template< typename MT // Type of the adapted dense matrix
2370  , bool SO > // Storage order of the adapted dense matrix
2371 template< typename MT2 > // Type of the right-hand side dense matrix
2372 inline void SymmetricMatrix<MT,SO,true,false>::assign( DenseMatrix<MT2,SO>& rhs )
2373 {
2374  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2375  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2376 
2377  if( SO ) {
2378  for( size_t j=0UL; j<columns(); ++j )
2379  for( size_t i=0UL; i<=j; ++i )
2380  move( matrix_(i,j), (~rhs)(i,j) );
2381  }
2382  else {
2383  for( size_t i=0UL; i<rows(); ++i )
2384  for( size_t j=0UL; j<=i; ++j )
2385  move( matrix_(i,j), (~rhs)(i,j) );
2386  }
2387 }
2389 //*************************************************************************************************
2390 
2391 
2392 //*************************************************************************************************
2404 template< typename MT // Type of the adapted dense matrix
2405  , bool SO > // Storage order of the adapted dense matrix
2406 template< typename MT2 > // Type of the right-hand side dense matrix
2407 inline void SymmetricMatrix<MT,SO,true,false>::assign( const DenseMatrix<MT2,SO>& rhs )
2408 {
2409  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2410  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2411 
2412  if( SO ) {
2413  for( size_t j=0UL; j<columns(); ++j )
2414  for( size_t i=0UL; i<=j; ++i )
2415  matrix_(i,j) = (~rhs)(i,j);
2416  }
2417  else {
2418  for( size_t i=0UL; i<rows(); ++i )
2419  for( size_t j=0UL; j<=i; ++j )
2420  matrix_(i,j) = (~rhs)(i,j);
2421  }
2422 }
2424 //*************************************************************************************************
2425 
2426 
2427 //*************************************************************************************************
2439 template< typename MT // Type of the adapted dense matrix
2440  , bool SO > // Storage order of the adapted dense matrix
2441 template< typename MT2 > // Type of the right-hand side sparse matrix
2442 inline void SymmetricMatrix<MT,SO,true,false>::assign( const SparseMatrix<MT2,SO>& rhs )
2443 {
2444  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2445  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2446 
2447  typedef typename MT2::ConstIterator ConstIterator;
2448 
2449  if( SO ) {
2450  for( size_t j=0UL; j<columns(); ++j ) {
2451  const ConstIterator last( (~rhs).upperBound(j,j) );
2452  for( ConstIterator element=(~rhs).begin(j); element!=last; ++element )
2453  matrix_(element->index(),j) = element->value();
2454  }
2455  }
2456  else {
2457  for( size_t i=0UL; i<rows(); ++i ) {
2458  const ConstIterator last( (~rhs).upperBound(i,i) );
2459  for( ConstIterator element=(~rhs).begin(i); element!=last; ++element )
2460  matrix_(i,element->index()) = element->value();
2461  }
2462  }
2463 }
2465 //*************************************************************************************************
2466 
2467 
2468 //*************************************************************************************************
2480 template< typename MT // Type of the adapted dense matrix
2481  , bool SO > // Storage order of the adapted dense matrix
2482 template< typename MT2 > // Type of the right-hand side dense matrix
2483 inline void SymmetricMatrix<MT,SO,true,false>::addAssign( const DenseMatrix<MT2,SO>& rhs )
2484 {
2485  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2486  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2487 
2488  if( SO ) {
2489  for( size_t j=0UL; j<columns(); ++j )
2490  for( size_t i=0UL; i<=j; ++i )
2491  matrix_(i,j) += (~rhs)(i,j);
2492  }
2493  else {
2494  for( size_t i=0UL; i<rows(); ++i )
2495  for( size_t j=0UL; j<=i; ++j )
2496  matrix_(i,j) += (~rhs)(i,j);
2497  }
2498 }
2500 //*************************************************************************************************
2501 
2502 
2503 //*************************************************************************************************
2515 template< typename MT // Type of the adapted dense matrix
2516  , bool SO > // Storage order of the adapted dense matrix
2517 template< typename MT2 > // Type of the right-hand side sparse matrix
2518 inline void SymmetricMatrix<MT,SO,true,false>::addAssign( const SparseMatrix<MT2,SO>& rhs )
2519 {
2520  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2521  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2522 
2523  typedef typename MT2::ConstIterator ConstIterator;
2524 
2525  if( SO ) {
2526  for( size_t j=0UL; j<columns(); ++j ) {
2527  const ConstIterator last( (~rhs).upperBound(j,j) );
2528  for( ConstIterator element=(~rhs).begin(j); element!=last; ++element )
2529  matrix_(element->index(),j) += element->value();
2530  }
2531  }
2532  else {
2533  for( size_t i=0UL; i<rows(); ++i ) {
2534  const ConstIterator last( (~rhs).upperBound(i,i) );
2535  for( ConstIterator element=(~rhs).begin(i); element!=last; ++element )
2536  matrix_(i,element->index()) += element->value();
2537  }
2538  }
2539 }
2541 //*************************************************************************************************
2542 
2543 
2544 //*************************************************************************************************
2556 template< typename MT // Type of the adapted dense matrix
2557  , bool SO > // Storage order of the adapted dense matrix
2558 template< typename MT2 > // Type of the right-hand side dense matrix
2559 inline void SymmetricMatrix<MT,SO,true,false>::subAssign( const DenseMatrix<MT2,SO>& rhs )
2560 {
2561  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2562  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2563 
2564  if( SO ) {
2565  for( size_t j=0UL; j<columns(); ++j )
2566  for( size_t i=0UL; i<=j; ++i )
2567  matrix_(i,j) -= (~rhs)(i,j);
2568  }
2569  else {
2570  for( size_t i=0UL; i<rows(); ++i )
2571  for( size_t j=0UL; j<=i; ++j )
2572  matrix_(i,j) -= (~rhs)(i,j);
2573  }
2574 }
2576 //*************************************************************************************************
2577 
2578 
2579 //*************************************************************************************************
2591 template< typename MT // Type of the adapted dense matrix
2592  , bool SO > // Storage order of the adapted dense matrix
2593 template< typename MT2 > // Type of the right-hand side sparse matrix
2594 inline void SymmetricMatrix<MT,SO,true,false>::subAssign( const SparseMatrix<MT2,SO>& rhs )
2595 {
2596  BLAZE_INTERNAL_ASSERT( rows() == (~rhs).rows() , "Invalid number of rows" );
2597  BLAZE_INTERNAL_ASSERT( columns() == (~rhs).columns(), "Invalid number of columns" );
2598 
2599  typedef typename MT2::ConstIterator ConstIterator;
2600 
2601  if( SO ) {
2602  for( size_t j=0UL; j<columns(); ++j ) {
2603  const ConstIterator last( (~rhs).upperBound(j,j) );
2604  for( ConstIterator element=(~rhs).begin(j); element!=last; ++element )
2605  matrix_(element->index(),j) -= element->value();
2606  }
2607  }
2608  else {
2609  for( size_t i=0UL; i<rows(); ++i ) {
2610  const ConstIterator last( (~rhs).upperBound(i,i) );
2611  for( ConstIterator element=(~rhs).begin(i); element!=last; ++element )
2612  matrix_(i,element->index()) -= element->value();
2613  }
2614  }
2615 }
2617 //*************************************************************************************************
2618 
2619 } // namespace blaze
2620 
2621 #endif
Header file for all restructuring submatrix functions.
#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:116
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
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:7820
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:603
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:229
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:5016
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:292
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:250
Header file for the IsSparseMatrix type trait.
#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:81
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
Constraint on the data type.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:697
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4926
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:107
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:584
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2582
bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:442
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:116
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:378
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
Header file for the implementation of the base template of the SymmetricMatrix.
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1044
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Constraint on the data type.
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the DenseSubmatrix class template.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:4953
Header file for the DisableIf class template.
Header file for the IsCustom type trait.
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
Header file for the If class template.
Compile time assertion.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:4980
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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:116
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:610
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
BLAZE_ALWAYS_INLINE void conjugate(T &a)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Constraint on the data type.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:642
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1277
Constraints on the storage order of matrix types.
#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:118
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:187
#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:118
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:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the RemoveAdaptor type trait.
Header file for all forward declarations for expression class templates.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
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:527
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
const bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:107
#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:116
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for run time assertion macros.
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:118
#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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the RemoveReference type trait.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Header file for the move shim.
SubmatrixExprTrait< MT, unaligned >::Type 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:146
#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:79
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:944
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:118
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:2583
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
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:237
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
#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:116
Header file for exception macros.
#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:143
#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
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:558