DenseNumeric.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <iterator>
45 #include <stdexcept>
58 #include <blaze/math/Functions.h>
59 #include <blaze/math/Intrinsics.h>
60 #include <blaze/math/shims/Clear.h>
61 #include <blaze/math/shims/Move.h>
70 #include <blaze/math/views/Row.h>
72 #include <blaze/system/Inline.h>
73 #include <blaze/util/Assert.h>
79 #include <blaze/util/DisableIf.h>
80 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/mpl/If.h>
83 #include <blaze/util/Types.h>
85 #include <blaze/util/Unused.h>
86 
87 
88 namespace blaze {
89 
90 //=================================================================================================
91 //
92 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES WITH NUMERIC ELEMENT TYPE
93 //
94 //=================================================================================================
95 
96 //*************************************************************************************************
104 template< typename MT // Type of the adapted dense matrix
105  , bool SO > // Storage order of the adapted dense matrix
106 class SymmetricMatrix<MT,SO,true,true>
107  : public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
108 {
109  private:
110  //**Type definitions****************************************************************************
111  typedef typename MT::OppositeType OT;
112  typedef typename MT::TransposeType TT;
113  typedef typename MT::ElementType ET;
114  typedef IntrinsicTrait<ET> IT;
115  //**********************************************************************************************
116 
117  public:
118  //**Type definitions****************************************************************************
119  typedef SymmetricMatrix<MT,SO,true,true> This;
120  typedef This ResultType;
121  typedef SymmetricMatrix<OT,!SO,true,true> OppositeType;
122  typedef SymmetricMatrix<TT,!SO,true,true> TransposeType;
123  typedef ET ElementType;
124  typedef typename MT::IntrinsicType IntrinsicType;
125  typedef typename MT::ReturnType ReturnType;
126  typedef const This& CompositeType;
127  typedef NumericProxy<MT> Reference;
128  typedef typename MT::ConstReference ConstReference;
129  typedef typename MT::Pointer Pointer;
130  typedef typename MT::ConstPointer ConstPointer;
131  typedef typename MT::ConstIterator ConstIterator;
132  //**********************************************************************************************
133 
134  //**Rebind struct definition********************************************************************
137  template< typename ET > // Data type of the other matrix
138  struct Rebind {
140  typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
141  };
142  //**********************************************************************************************
143 
144  //**Iterator class definition*******************************************************************
147  class Iterator
148  {
149  public:
150  //**Type definitions*************************************************************************
151  typedef std::random_access_iterator_tag IteratorCategory;
152  typedef typename MT::ElementType ValueType;
153  typedef NumericProxy<MT> PointerType;
154  typedef NumericProxy<MT> ReferenceType;
155  typedef ptrdiff_t DifferenceType;
156 
157  // STL iterator requirements
158  typedef IteratorCategory iterator_category;
159  typedef ValueType value_type;
160  typedef PointerType pointer;
161  typedef ReferenceType reference;
162  typedef DifferenceType difference_type;
163  //*******************************************************************************************
164 
165  //**Constructor******************************************************************************
168  inline Iterator()
169  : matrix_( NULL ) // Reference to the adapted dense matrix
170  , row_ ( 0UL ) // The current row index of the iterator
171  , column_( 0UL ) // The current column index of the iterator
172  {}
173  //*******************************************************************************************
174 
175  //**Constructor******************************************************************************
182  inline Iterator( MT& matrix, size_t row, size_t column )
183  : matrix_( &matrix ) // Reference to the adapted dense matrix
184  , row_ ( row ) // The current row index of the iterator
185  , column_( column ) // The current column index of the iterator
186  {}
187  //*******************************************************************************************
188 
189  //**Addition assignment operator*************************************************************
195  inline Iterator& operator+=( size_t inc ) {
196  ( SO )?( row_ += inc ):( column_ += inc );
197  return *this;
198  }
199  //*******************************************************************************************
200 
201  //**Subtraction assignment operator**********************************************************
207  inline Iterator& operator-=( size_t dec ) {
208  ( SO )?( row_ -= dec ):( column_ -= dec );
209  return *this;
210  }
211  //*******************************************************************************************
212 
213  //**Prefix increment operator****************************************************************
218  inline Iterator& operator++() {
219  ( SO )?( ++row_ ):( ++column_ );
220  return *this;
221  }
222  //*******************************************************************************************
223 
224  //**Postfix increment operator***************************************************************
229  inline const Iterator operator++( int ) {
230  const Iterator tmp( *this );
231  ++(*this);
232  return tmp;
233  }
234  //*******************************************************************************************
235 
236  //**Prefix decrement operator****************************************************************
241  inline Iterator& operator--() {
242  ( SO )?( --row_ ):( --column_ );
243  return *this;
244  }
245  //*******************************************************************************************
246 
247  //**Postfix decrement operator***************************************************************
252  inline const Iterator operator--( int ) {
253  const Iterator tmp( *this );
254  --(*this);
255  return tmp;
256  }
257  //*******************************************************************************************
258 
259  //**Element access operator******************************************************************
264  inline ReferenceType operator*() const {
265  return ReferenceType( *matrix_, row_, column_ );
266  }
267  //*******************************************************************************************
268 
269  //**Element access operator******************************************************************
274  inline PointerType operator->() const {
275  return PointerType( *matrix_, row_, column_ );
276  }
277  //*******************************************************************************************
278 
279  //**Conversion operator**********************************************************************
284  inline operator ConstIterator() const {
285  if( SO )
286  return matrix_->begin( column_ ) + row_;
287  else
288  return matrix_->begin( row_ ) + column_;
289  }
290  //*******************************************************************************************
291 
292  //**Equality operator************************************************************************
299  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) {
300  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
301  }
302  //*******************************************************************************************
303 
304  //**Equality operator************************************************************************
311  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
312  return ( ConstIterator( lhs ) == rhs );
313  }
314  //*******************************************************************************************
315 
316  //**Equality operator************************************************************************
323  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
324  return ( lhs == ConstIterator( rhs ) );
325  }
326  //*******************************************************************************************
327 
328  //**Inequality operator**********************************************************************
335  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) {
336  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
337  }
338  //*******************************************************************************************
339 
340  //**Inequality operator**********************************************************************
347  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
348  return ( ConstIterator( lhs ) != rhs );
349  }
350  //*******************************************************************************************
351 
352  //**Inequality operator**********************************************************************
359  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
360  return ( lhs != ConstIterator( rhs ) );
361  }
362  //*******************************************************************************************
363 
364  //**Less-than operator***********************************************************************
371  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) {
372  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
373  }
374  //*******************************************************************************************
375 
376  //**Less-than operator***********************************************************************
383  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
384  return ( ConstIterator( lhs ) < rhs );
385  }
386  //*******************************************************************************************
387 
388  //**Less-than operator***********************************************************************
395  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
396  return ( lhs < ConstIterator( rhs ) );
397  }
398  //*******************************************************************************************
399 
400  //**Greater-than operator********************************************************************
407  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) {
408  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
409  }
410  //*******************************************************************************************
411 
412  //**Greater-than operator********************************************************************
419  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
420  return ( ConstIterator( lhs ) > rhs );
421  }
422  //*******************************************************************************************
423 
424  //**Greater-than operator********************************************************************
431  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
432  return ( lhs > ConstIterator( rhs ) );
433  }
434  //*******************************************************************************************
435 
436  //**Less-or-equal-than operator**************************************************************
443  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) {
444  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
445  }
446  //*******************************************************************************************
447 
448  //**Less-or-equal-than operator**************************************************************
455  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
456  return ( ConstIterator( lhs ) <= rhs );
457  }
458  //*******************************************************************************************
459 
460  //**Less-or-equal-than operator**************************************************************
467  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
468  return ( lhs <= ConstIterator( rhs ) );
469  }
470  //*******************************************************************************************
471 
472  //**Greater-or-equal-than operator***********************************************************
479  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) {
480  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
481  }
482  //*******************************************************************************************
483 
484  //**Greater-or-equal-than operator***********************************************************
491  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
492  return ( ConstIterator( lhs ) >= rhs );
493  }
494  //*******************************************************************************************
495 
496  //**Greater-or-equal-than operator***********************************************************
503  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
504  return ( lhs >= ConstIterator( rhs ) );
505  }
506  //*******************************************************************************************
507 
508  //**Subtraction operator*********************************************************************
514  inline DifferenceType operator-( const Iterator& rhs ) const {
515  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
516  }
517  //*******************************************************************************************
518 
519  //**Addition operator************************************************************************
526  friend inline const Iterator operator+( const Iterator& it, size_t inc ) {
527  if( SO )
528  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
529  else
530  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
531  }
532  //*******************************************************************************************
533 
534  //**Addition operator************************************************************************
541  friend inline const Iterator operator+( size_t inc, const Iterator& it ) {
542  if( SO )
543  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
544  else
545  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
546  }
547  //*******************************************************************************************
548 
549  //**Subtraction operator*********************************************************************
556  friend inline const Iterator operator-( const Iterator& it, size_t dec ) {
557  if( SO )
558  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
559  else
560  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
561  }
562  //*******************************************************************************************
563 
564  private:
565  //**Member variables*************************************************************************
566  MT* matrix_;
567  size_t row_;
568  size_t column_;
569  //*******************************************************************************************
570  };
571  //**********************************************************************************************
572 
573  //**Compilation flags***************************************************************************
575  enum { vectorizable = MT::vectorizable };
576 
578  enum { smpAssignable = MT::smpAssignable };
579  //**********************************************************************************************
580 
581  //**Constructors********************************************************************************
584  explicit inline SymmetricMatrix();
585  explicit inline SymmetricMatrix( size_t n );
586 
587  inline SymmetricMatrix( const SymmetricMatrix& m );
588  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,SO>& m );
589  template< typename MT2 > inline SymmetricMatrix( const Matrix<MT2,!SO>& m );
591  //**********************************************************************************************
592 
593  //**Destructor**********************************************************************************
594  // No explicitly declared destructor.
595  //**********************************************************************************************
596 
597  //**Data access functions***********************************************************************
600  inline Reference operator()( size_t i, size_t j );
601  inline ConstReference operator()( size_t i, size_t j ) const;
602  inline ConstPointer data () const;
603  inline ConstPointer data ( size_t i ) const;
604  inline Iterator begin ( size_t i );
605  inline ConstIterator begin ( size_t i ) const;
606  inline ConstIterator cbegin( size_t i ) const;
607  inline Iterator end ( size_t i );
608  inline ConstIterator end ( size_t i ) const;
609  inline ConstIterator cend ( size_t i ) const;
611  //**********************************************************************************************
612 
613  //**Assignment operators************************************************************************
616  inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
617 
618  template< typename MT2 >
619  inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
620  operator=( const Matrix<MT2,SO>& rhs );
621 
622  template< typename MT2 >
623  inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
624  operator=( const Matrix<MT2,SO>& rhs );
625 
626  template< typename MT2 >
627  inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
628 
629  template< typename MT2 >
630  inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
631  operator+=( const Matrix<MT2,SO>& rhs );
632 
633  template< typename MT2 >
634  inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
635  operator+=( const Matrix<MT2,SO>& rhs );
636 
637  template< typename MT2 >
638  inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
639 
640  template< typename MT2 >
641  inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
642  operator-=( const Matrix<MT2,SO>& rhs );
643 
644  template< typename MT2 >
645  inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
646  operator-=( const Matrix<MT2,SO>& rhs );
647 
648  template< typename MT2 >
649  inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
650 
651  template< typename MT2, bool SO2 >
652  inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
653 
654  template< typename Other >
655  inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
656  operator*=( Other rhs );
657 
658  template< typename Other >
659  inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
660  operator/=( Other rhs );
662  //**********************************************************************************************
663 
664  //**Utility functions***************************************************************************
667  inline size_t rows() const;
668  inline size_t columns() const;
669  inline size_t spacing() const;
670  inline size_t capacity() const;
671  inline size_t capacity( size_t i ) const;
672  inline size_t nonZeros() const;
673  inline size_t nonZeros( size_t i ) const;
674  inline void reset();
675  inline void reset( size_t i );
676  inline void clear();
677  void resize ( size_t n, bool preserve=true );
678  inline void extend ( size_t n, bool preserve=true );
679  inline void reserve( size_t elements );
680  inline SymmetricMatrix& transpose();
681  template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
682  inline void swap( SymmetricMatrix& m ) /* throw() */;
684  //**********************************************************************************************
685 
686  //**Expression template evaluation functions****************************************************
689  template< typename Other > inline bool canAlias ( const Other* alias ) const;
690  template< typename Other > inline bool isAliased( const Other* alias ) const;
691 
692  inline bool isAligned () const;
693  inline bool canSMPAssign() const;
694 
695  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t i, size_t j ) const;
696  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t i, size_t j ) const;
697 
698  inline void store ( size_t i, size_t j, const IntrinsicType& value );
699  inline void storeu( size_t i, size_t j, const IntrinsicType& value );
700  inline void stream( size_t i, size_t j, const IntrinsicType& value );
702  //**********************************************************************************************
703 
704  private:
705  //**Member variables****************************************************************************
708  MT matrix_;
709 
710  //**********************************************************************************************
711 
712  //**Friend declarations*************************************************************************
713  template< typename MT2, bool SO2, bool DF2, bool NF2 >
714  friend bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
715  //**********************************************************************************************
716 
717  //**Compile time checks*************************************************************************
730  BLAZE_STATIC_ASSERT( IsResizable<MT>::value || IsSquare<MT>::value );
731  //**********************************************************************************************
732 };
734 //*************************************************************************************************
735 
736 
737 
738 
739 //=================================================================================================
740 //
741 // CONSTRUCTORS
742 //
743 //=================================================================================================
744 
745 //*************************************************************************************************
749 template< typename MT // Type of the adapted dense matrix
750  , bool SO > // Storage order of the adapted dense matrix
751 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
752  : matrix_() // The adapted dense matrix
753 {
754  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
755 }
757 //*************************************************************************************************
758 
759 
760 //*************************************************************************************************
766 template< typename MT // Type of the adapted dense matrix
767  , bool SO > // Storage order of the adapted dense matrix
768 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( size_t n )
769  : matrix_( n, n, ElementType() ) // The adapted dense matrix
770 {
772 
773  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
774 }
776 //*************************************************************************************************
777 
778 
779 //*************************************************************************************************
785 template< typename MT // Type of the adapted dense matrix
786  , bool SO > // Storage order of the adapted dense matrix
787 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const SymmetricMatrix& m )
788  : matrix_( m.matrix_ ) // The adapted dense matrix
789 {
790  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
791 }
793 //*************************************************************************************************
794 
795 
796 //*************************************************************************************************
806 template< typename MT // Type of the adapted dense matrix
807  , bool SO > // Storage order of the adapted dense matrix
808 template< typename MT2 > // Type of the foreign matrix
809 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,SO>& m )
810  : matrix_( ~m ) // The adapted dense matrix
811 {
812  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) )
813  throw std::invalid_argument( "Invalid setup of symmetric matrix" );
814 
815  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
816 }
818 //*************************************************************************************************
819 
820 
821 //*************************************************************************************************
831 template< typename MT // Type of the adapted dense matrix
832  , bool SO > // Storage order of the adapted dense matrix
833 template< typename MT2 > // Type of the foreign matrix
834 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( const Matrix<MT2,!SO>& m )
835  : matrix_( trans( ~m ) ) // The adapted dense matrix
836 {
837  if( !IsSymmetric<MT2>::value && !isSymmetric( matrix_ ) )
838  throw std::invalid_argument( "Invalid setup of symmetric matrix" );
839 
840  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
841 }
843 //*************************************************************************************************
844 
845 
846 
847 
848 //=================================================================================================
849 //
850 // DATA ACCESS FUNCTIONS
851 //
852 //=================================================================================================
853 
854 //*************************************************************************************************
866 template< typename MT // Type of the adapted dense matrix
867  , bool SO > // Storage order of the adapted dense matrix
869  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j )
870 {
871  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
872  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
873 
874  return Reference( matrix_, i, j );
875 }
877 //*************************************************************************************************
878 
879 
880 //*************************************************************************************************
892 template< typename MT // Type of the adapted dense matrix
893  , bool SO > // Storage order of the adapted dense matrix
895  SymmetricMatrix<MT,SO,true,true>::operator()( size_t i, size_t j ) const
896 {
897  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
898  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
899 
900  return matrix_(i,j);
901 }
903 //*************************************************************************************************
904 
905 
906 //*************************************************************************************************
920 template< typename MT // Type of the adapted dense matrix
921  , bool SO > // Storage order of the adapted dense matrix
922 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
923  SymmetricMatrix<MT,SO,true,true>::data() const
924 {
925  return matrix_.data();
926 }
928 //*************************************************************************************************
929 
930 
931 //*************************************************************************************************
942 template< typename MT // Type of the adapted dense matrix
943  , bool SO > // Storage order of the adapted dense matrix
944 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
945  SymmetricMatrix<MT,SO,true,true>::data( size_t i ) const
946 {
947  return matrix_.data(i);
948 }
950 //*************************************************************************************************
951 
952 
953 //*************************************************************************************************
965 template< typename MT // Type of the adapted dense matrix
966  , bool SO > // Storage order of the adapted dense matrix
969 {
970  if( SO )
971  return Iterator( matrix_, 0UL, i );
972  else
973  return Iterator( matrix_, i, 0UL );
974 }
976 //*************************************************************************************************
977 
978 
979 //*************************************************************************************************
991 template< typename MT // Type of the adapted dense matrix
992  , bool SO > // Storage order of the adapted dense matrix
995 {
996  return matrix_.begin(i);
997 }
999 //*************************************************************************************************
1000 
1001 
1002 //*************************************************************************************************
1014 template< typename MT // Type of the adapted dense matrix
1015  , bool SO > // Storage order of the adapted dense matrix
1018 {
1019  return matrix_.cbegin(i);
1020 }
1022 //*************************************************************************************************
1023 
1024 
1025 //*************************************************************************************************
1037 template< typename MT // Type of the adapted dense matrix
1038  , bool SO > // Storage order of the adapted dense matrix
1041 {
1042  if( SO )
1043  return Iterator( matrix_, rows(), i );
1044  else
1045  return Iterator( matrix_, i, columns() );
1046 }
1048 //*************************************************************************************************
1049 
1050 
1051 //*************************************************************************************************
1063 template< typename MT // Type of the adapted dense matrix
1064  , bool SO > // Storage order of the adapted dense matrix
1066  SymmetricMatrix<MT,SO,true,true>::end( size_t i ) const
1067 {
1068  return matrix_.end(i);
1069 }
1071 //*************************************************************************************************
1072 
1073 
1074 //*************************************************************************************************
1086 template< typename MT // Type of the adapted dense matrix
1087  , bool SO > // Storage order of the adapted dense matrix
1089  SymmetricMatrix<MT,SO,true,true>::cend( size_t i ) const
1090 {
1091  return matrix_.cend(i);
1092 }
1094 //*************************************************************************************************
1095 
1096 
1097 
1098 
1099 //=================================================================================================
1100 //
1101 // ASSIGNMENT OPERATORS
1102 //
1103 //=================================================================================================
1104 
1105 //*************************************************************************************************
1115 template< typename MT // Type of the adapted dense matrix
1116  , bool SO > // Storage order of the adapted dense matrix
1117 inline SymmetricMatrix<MT,SO,true,true>&
1118  SymmetricMatrix<MT,SO,true,true>::operator=( const SymmetricMatrix& rhs )
1119 {
1120  matrix_ = rhs.matrix_;
1121 
1122  return *this;
1123 }
1125 //*************************************************************************************************
1126 
1127 
1128 //*************************************************************************************************
1141 template< typename MT // Type of the adapted dense matrix
1142  , bool SO > // Storage order of the adapted dense matrix
1143 template< typename MT2 > // Type of the right-hand side matrix
1144 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >::Type
1145  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1146 {
1147  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) )
1148  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1149 
1150  matrix_ = ~rhs;
1151 
1152  return *this;
1153 }
1155 //*************************************************************************************************
1156 
1157 
1158 //*************************************************************************************************
1171 template< typename MT // Type of the adapted dense matrix
1172  , bool SO > // Storage order of the adapted dense matrix
1173 template< typename MT2 > // Type of the right-hand side matrix
1174 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >::Type
1175  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,SO>& rhs )
1176 {
1177  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1178  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1179 
1180  if( IsSymmetric<MT2>::value ) {
1181  matrix_ = ~rhs;
1182  }
1183  else {
1184  MT tmp( ~rhs );
1185 
1186  if( !isSymmetric( tmp ) )
1187  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1188 
1189  move( matrix_, tmp );
1190  }
1191 
1192  return *this;
1193 }
1195 //*************************************************************************************************
1196 
1197 
1198 //*************************************************************************************************
1211 template< typename MT // Type of the adapted dense matrix
1212  , bool SO > // Storage order of the adapted dense matrix
1213 template< typename MT2 > // Type of the right-hand side matrix
1214 inline SymmetricMatrix<MT,SO,true,true>&
1215  SymmetricMatrix<MT,SO,true,true>::operator=( const Matrix<MT2,!SO>& rhs )
1216 {
1217  return this->operator=( trans( ~rhs ) );
1218 }
1220 //*************************************************************************************************
1221 
1222 
1223 //*************************************************************************************************
1236 template< typename MT // Type of the adapted dense matrix
1237  , bool SO > // Storage order of the adapted dense matrix
1238 template< typename MT2 > // Type of the right-hand side matrix
1239 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >::Type
1240  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1241 {
1242  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) )
1243  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1244 
1245  matrix_ += ~rhs;
1246 
1247  return *this;
1248 }
1250 //*************************************************************************************************
1251 
1252 
1253 //*************************************************************************************************
1266 template< typename MT // Type of the adapted dense matrix
1267  , bool SO > // Storage order of the adapted dense matrix
1268 template< typename MT2 > // Type of the right-hand side matrix
1269 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >::Type
1270  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,SO>& rhs )
1271 {
1272  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1273  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1274 
1275  if( IsSymmetric<MT2>::value ) {
1276  matrix_ += ~rhs;
1277  }
1278  else {
1279  typename MT2::ResultType tmp( ~rhs );
1280 
1281  if( !isSymmetric( tmp ) )
1282  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1283 
1284  matrix_ += tmp;
1285  }
1286 
1287  return *this;
1288 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1307 template< typename MT // Type of the adapted dense matrix
1308  , bool SO > // Storage order of the adapted dense matrix
1309 template< typename MT2 > // Type of the right-hand side matrix
1310 inline SymmetricMatrix<MT,SO,true,true>&
1311  SymmetricMatrix<MT,SO,true,true>::operator+=( const Matrix<MT2,!SO>& rhs )
1312 {
1313  return this->operator+=( trans( ~rhs ) );
1314 }
1316 //*************************************************************************************************
1317 
1318 
1319 //*************************************************************************************************
1332 template< typename MT // Type of the adapted dense matrix
1333  , bool SO > // Storage order of the adapted dense matrix
1334 template< typename MT2 > // Type of the right-hand side matrix
1335 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >::Type
1336  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
1337 {
1338  if( !IsSymmetric<MT2>::value && !isSymmetric( ~rhs ) )
1339  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1340 
1341  matrix_ -= ~rhs;
1342 
1343  return *this;
1344 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1362 template< typename MT // Type of the adapted dense matrix
1363  , bool SO > // Storage order of the adapted dense matrix
1364 template< typename MT2 > // Type of the right-hand side matrix
1365 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,true>& >::Type
1366  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,SO>& rhs )
1367 {
1368  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1369  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1370 
1371  if( IsSymmetric<MT2>::value ) {
1372  matrix_ -= ~rhs;
1373  }
1374  else {
1375  typename MT2::ResultType tmp( ~rhs );
1376 
1377  if( !isSymmetric( tmp ) )
1378  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1379 
1380  matrix_ -= tmp;
1381  }
1382 
1383  return *this;
1384 }
1386 //*************************************************************************************************
1387 
1388 
1389 //*************************************************************************************************
1403 template< typename MT // Type of the adapted dense matrix
1404  , bool SO > // Storage order of the adapted dense matrix
1405 template< typename MT2 > // Type of the right-hand side matrix
1406 inline SymmetricMatrix<MT,SO,true,true>&
1407  SymmetricMatrix<MT,SO,true,true>::operator-=( const Matrix<MT2,!SO>& rhs )
1408 {
1409  return this->operator-=( trans( ~rhs ) );
1410 }
1412 //*************************************************************************************************
1413 
1414 
1415 //*************************************************************************************************
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  , bool SO2 > // Storage order of the right-hand side matrix
1431 inline SymmetricMatrix<MT,SO,true,true>&
1432  SymmetricMatrix<MT,SO,true,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1433 {
1434  if( matrix_.rows() != (~rhs).columns() )
1435  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1436 
1437  MT tmp( matrix_ * ~rhs );
1438 
1439  if( !isSymmetric( tmp ) )
1440  throw std::invalid_argument( "Invalid assignment to symmetric matrix" );
1441 
1442  move( matrix_, tmp );
1443 
1444  return *this;
1445 }
1447 //*************************************************************************************************
1448 
1449 
1450 //*************************************************************************************************
1458 template< typename MT // Type of the adapted dense matrix
1459  , bool SO > // Storage order of the adapted dense matrix
1460 template< typename Other > // Data type of the right-hand side scalar
1461 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >::Type&
1462  SymmetricMatrix<MT,SO,true,true>::operator*=( Other rhs )
1463 {
1464  matrix_ *= rhs;
1465  return *this;
1466 }
1467 //*************************************************************************************************
1468 
1469 
1470 //*************************************************************************************************
1478 template< typename MT // Type of the adapted dense matrix
1479  , bool SO > // Storage order of the adapted dense matrix
1480 template< typename Other > // Data type of the right-hand side scalar
1481 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,true> >::Type&
1482  SymmetricMatrix<MT,SO,true,true>::operator/=( Other rhs )
1483 {
1484  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1485 
1486  matrix_ /= rhs;
1487  return *this;
1488 }
1490 //*************************************************************************************************
1491 
1492 
1493 
1494 
1495 //=================================================================================================
1496 //
1497 // UTILITY FUNCTIONS
1498 //
1499 //=================================================================================================
1500 
1501 //*************************************************************************************************
1507 template< typename MT // Type of the adapted dense matrix
1508  , bool SO > // Storage order of the adapted dense matrix
1509 inline size_t SymmetricMatrix<MT,SO,true,true>::rows() const
1510 {
1511  return matrix_.rows();
1512 }
1514 //*************************************************************************************************
1515 
1516 
1517 //*************************************************************************************************
1523 template< typename MT // Type of the adapted dense matrix
1524  , bool SO > // Storage order of the adapted dense matrix
1525 inline size_t SymmetricMatrix<MT,SO,true,true>::columns() const
1526 {
1527  return matrix_.columns();
1528 }
1530 //*************************************************************************************************
1531 
1532 
1533 //*************************************************************************************************
1545 template< typename MT // Type of the adapted dense matrix
1546  , bool SO > // Storage order of the adapted dense matrix
1547 inline size_t SymmetricMatrix<MT,SO,true,true>::spacing() const
1548 {
1549  return matrix_.spacing();
1550 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1561 template< typename MT // Type of the adapted dense matrix
1562  , bool SO > // Storage order of the adapted dense matrix
1563 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity() const
1564 {
1565  return matrix_.capacity();
1566 }
1568 //*************************************************************************************************
1569 
1570 
1571 //*************************************************************************************************
1582 template< typename MT // Type of the adapted dense matrix
1583  , bool SO > // Storage order of the adapted dense matrix
1584 inline size_t SymmetricMatrix<MT,SO,true,true>::capacity( size_t i ) const
1585 {
1586  return matrix_.capacity(i);
1587 }
1589 //*************************************************************************************************
1590 
1591 
1592 //*************************************************************************************************
1598 template< typename MT // Type of the adapted dense matrix
1599  , bool SO > // Storage order of the adapted dense matrix
1600 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros() const
1601 {
1602  return matrix_.nonZeros();
1603 }
1605 //*************************************************************************************************
1606 
1607 
1608 //*************************************************************************************************
1620 template< typename MT // Type of the adapted dense matrix
1621  , bool SO > // Storage order of the adapted dense matrix
1622 inline size_t SymmetricMatrix<MT,SO,true,true>::nonZeros( size_t i ) const
1623 {
1624  return matrix_.nonZeros(i);
1625 }
1627 //*************************************************************************************************
1628 
1629 
1630 //*************************************************************************************************
1636 template< typename MT // Type of the adapted dense matrix
1637  , bool SO > // Storage order of the adapted dense matrix
1639 {
1640  matrix_.reset();
1641 }
1643 //*************************************************************************************************
1644 
1645 
1646 //*************************************************************************************************
1682 template< typename MT // Type of the adapted dense matrix
1683  , bool SO > // Storage order of the adapted dense matrix
1684 inline void SymmetricMatrix<MT,SO,true,true>::reset( size_t i )
1685 {
1686  row ( matrix_, i ).reset();
1687  column( matrix_, i ).reset();
1688 }
1690 //*************************************************************************************************
1691 
1692 
1693 //*************************************************************************************************
1705 template< typename MT // Type of the adapted dense matrix
1706  , bool SO > // Storage order of the adapted dense matrix
1708 {
1709  using blaze::clear;
1710 
1711  clear( matrix_ );
1712 }
1714 //*************************************************************************************************
1715 
1716 
1717 //*************************************************************************************************
1752 template< typename MT // Type of the adapted dense matrix
1753  , bool SO > // Storage order of the adapted dense matrix
1754 void SymmetricMatrix<MT,SO,true,true>::resize( size_t n, bool preserve )
1755 {
1757 
1758  UNUSED_PARAMETER( preserve );
1759 
1760  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square symmetric matrix detected" );
1761 
1762  const size_t oldsize( matrix_.rows() );
1763 
1764  matrix_.resize( n, n, true );
1765 
1766  if( n > oldsize ) {
1767  const size_t increment( n - oldsize );
1768  submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
1769  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
1770  }
1771 }
1773 //*************************************************************************************************
1774 
1775 
1776 //*************************************************************************************************
1789 template< typename MT // Type of the adapted dense matrix
1790  , bool SO > // Storage order of the adapted dense matrix
1791 inline void SymmetricMatrix<MT,SO,true,true>::extend( size_t n, bool preserve )
1792 {
1794 
1795  UNUSED_PARAMETER( preserve );
1796 
1797  resize( rows() + n, true );
1798 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1812 template< typename MT // Type of the adapted dense matrix
1813  , bool SO > // Storage order of the adapted dense matrix
1814 inline void SymmetricMatrix<MT,SO,true,true>::reserve( size_t elements )
1815 {
1816  matrix_.reserve( elements );
1817 }
1819 //*************************************************************************************************
1820 
1821 
1822 //*************************************************************************************************
1828 template< typename MT // Type of the adapted dense matrix
1829  , bool SO > // Storage order of the adapted dense matrix
1830 inline SymmetricMatrix<MT,SO,true,true>& SymmetricMatrix<MT,SO,true,true>::transpose()
1831 {
1832  return *this;
1833 }
1835 //*************************************************************************************************
1836 
1837 
1838 //*************************************************************************************************
1845 template< typename MT // Type of the adapted dense matrix
1846  , bool SO > // Storage order of the adapted dense matrix
1847 template< typename Other > // Data type of the scalar value
1848 inline SymmetricMatrix<MT,SO,true,true>&
1849  SymmetricMatrix<MT,SO,true,true>::scale( const Other& scalar )
1850 {
1851  matrix_.scale( scalar );
1852  return *this;
1853 }
1855 //*************************************************************************************************
1856 
1857 
1858 //*************************************************************************************************
1866 template< typename MT // Type of the adapted dense matrix
1867  , bool SO > // Storage order of the adapted dense matrix
1868 inline void SymmetricMatrix<MT,SO,true,true>::swap( SymmetricMatrix& m ) /* throw() */
1869 {
1870  using std::swap;
1871 
1872  swap( matrix_, m.matrix_ );
1873 }
1875 //*************************************************************************************************
1876 
1877 
1878 
1879 
1880 //=================================================================================================
1881 //
1882 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1883 //
1884 //=================================================================================================
1885 
1886 //*************************************************************************************************
1897 template< typename MT // Type of the adapted dense matrix
1898  , bool SO > // Storage order of the adapted dense matrix
1899 template< typename Other > // Data type of the foreign expression
1900 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias( const Other* alias ) const
1901 {
1902  return matrix_.canAlias( alias );
1903 }
1905 //*************************************************************************************************
1906 
1907 
1908 //*************************************************************************************************
1919 template< typename MT // Type of the adapted dense matrix
1920  , bool SO > // Storage order of the adapted dense matrix
1921 template< typename Other > // Data type of the foreign expression
1922 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased( const Other* alias ) const
1923 {
1924  return matrix_.isAliased( alias );
1925 }
1927 //*************************************************************************************************
1928 
1929 
1930 //*************************************************************************************************
1940 template< typename MT // Type of the adapted dense matrix
1941  , bool SO > // Storage order of the adapted dense matrix
1942 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const
1943 {
1944  return matrix_.isAligned();
1945 }
1947 //*************************************************************************************************
1948 
1949 
1950 //*************************************************************************************************
1961 template< typename MT // Type of the adapted dense matrix
1962  , bool SO > // Storage order of the adapted dense matrix
1963 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const
1964 {
1965  return matrix_.canSMPAssign();
1966 }
1968 //*************************************************************************************************
1969 
1970 
1971 //*************************************************************************************************
1987 template< typename MT // Type of the adapted dense matrix
1988  , bool SO > // Storage order of the adapted dense matrix
1989 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::IntrinsicType
1990  SymmetricMatrix<MT,SO,true,true>::load( size_t i, size_t j ) const
1991 {
1992  return matrix_.load( i, j );
1993 }
1995 //*************************************************************************************************
1996 
1997 
1998 //*************************************************************************************************
2014 template< typename MT // Type of the adapted dense matrix
2015  , bool SO > // Storage order of the adapted dense matrix
2016 BLAZE_ALWAYS_INLINE typename SymmetricMatrix<MT,SO,true,true>::IntrinsicType
2017  SymmetricMatrix<MT,SO,true,true>::loadu( size_t i, size_t j ) const
2018 {
2019  return matrix_.loadu( i, j );
2020 }
2022 //*************************************************************************************************
2023 
2024 
2025 //*************************************************************************************************
2042 template< typename MT // Type of the adapted dense matrix
2043  , bool SO > // Storage order of the adapted dense matrix
2044 inline void SymmetricMatrix<MT,SO,true,true>::store( size_t i, size_t j, const IntrinsicType& value )
2045 {
2046  matrix_.store( i, j, value );
2047 
2048  if( SO ) {
2049  const size_t kend( min( i+IT::size, rows() ) );
2050  for( size_t k=i; k<kend; ++k )
2051  matrix_(j,k) = matrix_(k,j);
2052  }
2053  else {
2054  const size_t kend( min( j+IT::size, columns() ) );
2055  for( size_t k=j; k<kend; ++k )
2056  matrix_(k,i) = matrix_(i,k);
2057  }
2058 }
2060 //*************************************************************************************************
2061 
2062 
2063 //*************************************************************************************************
2080 template< typename MT // Type of the adapted dense matrix
2081  , bool SO > // Storage order of the adapted dense matrix
2082 inline void SymmetricMatrix<MT,SO,true,true>::storeu( size_t i, size_t j, const IntrinsicType& value )
2083 {
2084  matrix_.storeu( i, j, value );
2085 
2086  if( SO ) {
2087  const size_t kend( min( i+IT::size, rows() ) );
2088  for( size_t k=i; k<kend; ++k )
2089  matrix_(j,k) = matrix_(k,j);
2090  }
2091  else {
2092  const size_t kend( min( j+IT::size, columns() ) );
2093  for( size_t k=j; k<kend; ++k )
2094  matrix_(k,i) = matrix_(i,k);
2095  }
2096 }
2098 //*************************************************************************************************
2099 
2100 
2101 //*************************************************************************************************
2118 template< typename MT // Type of the adapted dense matrix
2119  , bool SO > // Storage order of the adapted dense matrix
2120 inline void SymmetricMatrix<MT,SO,true,true>::stream( size_t i, size_t j, const IntrinsicType& value )
2121 {
2122  matrix_.stream( i, j, value );
2123 
2124  if( SO ) {
2125  const size_t kend( min( i+IT::size, rows() ) );
2126  for( size_t k=i; k<kend; ++k )
2127  matrix_(j,k) = matrix_(k,j);
2128  }
2129  else {
2130  const size_t kend( min( j+IT::size, columns() ) );
2131  for( size_t k=j; k<kend; ++k )
2132  matrix_(k,i) = matrix_(i,k);
2133  }
2134 }
2136 //*************************************************************************************************
2137 
2138 } // namespace blaze
2139 
2140 #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
Constraint on the data type.
Header file for mathematical functions.
#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 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:8247
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:902
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:237
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:4825
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type stream(T *address, const sse_int16_t &value)
Aligned, non-temporal store of a vector of 2-byte integral values.
Definition: Stream.h:76
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:300
bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:404
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:258
#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:242
#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:692
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:348
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4762
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:103
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
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2501
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:386
Constraint on the data type.
Header file for the NumericProxy class.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2503
Header file for the implementation of the base template of the SymmetricMatrix.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
Header file for the DenseColumn class template.
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the DenseSubmatrix class template.
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:76
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:4807
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type store(T *address, const sse_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Store.h:80
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1602
Header file for the DenseMatrix base class.
Constraint on the data type.
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2504
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:195
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:535
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
Header file for all forward declarations for expression class templates.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
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:841
Header file for all restructuring column functions.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
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:103
#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:2506
Header file for run time assertion macros.
Header file for the DenseRow class template.
Constraint on the data type.
Constraint on the data type.
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const sse_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:77
#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:2510
Constraint on the data type.
Constraint on the data type.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:200
Header file for all intrinsic functionality.
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:143
bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:328
#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:937
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:2502
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
#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
Header file for the IsResizable type trait.
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for all restructuring row functions.