Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_LOWERMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_LOWERMATRIX_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <stdexcept>
57 #include <blaze/math/Intrinsics.h>
58 #include <blaze/math/shims/Clear.h>
60 #include <blaze/math/shims/Move.h>
68 #include <blaze/system/Inline.h>
69 #include <blaze/util/Assert.h>
75 #include <blaze/util/DisableIf.h>
76 #include <blaze/util/EnableIf.h>
77 #include <blaze/util/FalseType.h>
79 #include <blaze/util/TrueType.h>
80 #include <blaze/util/Types.h>
82 #include <blaze/util/Unused.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
101 template< typename MT // Type of the adapted dense matrix
102  , bool SO > // Storage order of the adapted dense matrix
103 class LowerMatrix<MT,SO,true>
104  : public DenseMatrix< LowerMatrix<MT,SO,true>, SO >
105 {
106  private:
107  //**Type definitions****************************************************************************
108  typedef typename MT::OppositeType OT;
109  typedef typename MT::TransposeType TT;
110  typedef typename MT::ElementType ET;
111  typedef IntrinsicTrait<ET> IT;
112  //**********************************************************************************************
113 
114  public:
115  //**Type definitions****************************************************************************
116  typedef LowerMatrix<MT,SO,true> This;
117  typedef This ResultType;
118  typedef LowerMatrix<OT,!SO,true> OppositeType;
119  typedef UpperMatrix<TT,!SO,true> TransposeType;
120  typedef ET ElementType;
121  typedef typename MT::IntrinsicType IntrinsicType;
122  typedef typename MT::ReturnType ReturnType;
123  typedef const This& CompositeType;
124  typedef LowerProxy<MT> Reference;
125  typedef typename MT::ConstReference ConstReference;
126  typedef typename MT::Pointer Pointer;
127  typedef typename MT::ConstPointer ConstPointer;
128  typedef typename MT::ConstIterator ConstIterator;
129  //**********************************************************************************************
130 
131  //**Rebind struct definition********************************************************************
134  template< typename ET > // Data type of the other matrix
135  struct Rebind {
137  typedef LowerMatrix< typename MT::template Rebind<ET>::Other > Other;
138  };
139  //**********************************************************************************************
140 
141  //**Iterator class definition*******************************************************************
144  class Iterator
145  {
146  public:
147  //**Type definitions*************************************************************************
148  typedef std::random_access_iterator_tag IteratorCategory;
149  typedef typename MT::ElementType ValueType;
150  typedef LowerProxy<MT> PointerType;
151  typedef LowerProxy<MT> ReferenceType;
152  typedef ptrdiff_t DifferenceType;
153 
154  // STL iterator requirements
155  typedef IteratorCategory iterator_category;
156  typedef ValueType value_type;
157  typedef PointerType pointer;
158  typedef ReferenceType reference;
159  typedef DifferenceType difference_type;
160  //*******************************************************************************************
161 
162  //**Constructor******************************************************************************
165  inline Iterator()
166  : matrix_( NULL ) // Reference to the adapted dense matrix
167  , row_ ( 0UL ) // The current row index of the iterator
168  , column_( 0UL ) // The current column index of the iterator
169  {}
170  //*******************************************************************************************
171 
172  //**Constructor******************************************************************************
179  inline Iterator( MT& matrix, size_t row, size_t column )
180  : matrix_( &matrix ) // Reference to the adapted dense matrix
181  , row_ ( row ) // The current row-index of the iterator
182  , column_( column ) // The current column-index of the iterator
183  {}
184  //*******************************************************************************************
185 
186  //**Addition assignment operator*************************************************************
192  inline Iterator& operator+=( size_t inc ) {
193  ( SO )?( row_ += inc ):( column_ += inc );
194  return *this;
195  }
196  //*******************************************************************************************
197 
198  //**Subtraction assignment operator**********************************************************
204  inline Iterator& operator-=( size_t dec ) {
205  ( SO )?( row_ -= dec ):( column_ -= dec );
206  return *this;
207  }
208  //*******************************************************************************************
209 
210  //**Prefix increment operator****************************************************************
215  inline Iterator& operator++() {
216  ( SO )?( ++row_ ):( ++column_ );
217  return *this;
218  }
219  //*******************************************************************************************
220 
221  //**Postfix increment operator***************************************************************
226  inline const Iterator operator++( int ) {
227  const Iterator tmp( *this );
228  ++(*this);
229  return tmp;
230  }
231  //*******************************************************************************************
232 
233  //**Prefix decrement operator****************************************************************
238  inline Iterator& operator--() {
239  ( SO )?( --row_ ):( --column_ );
240  return *this;
241  }
242  //*******************************************************************************************
243 
244  //**Postfix decrement operator***************************************************************
249  inline const Iterator operator--( int ) {
250  const Iterator tmp( *this );
251  --(*this);
252  return tmp;
253  }
254  //*******************************************************************************************
255 
256  //**Element access operator******************************************************************
261  inline ReferenceType operator*() const {
262  return ReferenceType( *matrix_, row_, column_ );
263  }
264  //*******************************************************************************************
265 
266  //**Element access operator******************************************************************
271  inline PointerType operator->() const {
272  return PointerType( *matrix_, row_, column_ );
273  }
274  //*******************************************************************************************
275 
276  //**Conversion operator**********************************************************************
281  inline operator ConstIterator() const {
282  if( SO )
283  return matrix_->begin( column_ ) + row_;
284  else
285  return matrix_->begin( row_ ) + column_;
286  }
287  //*******************************************************************************************
288 
289  //**Equality operator************************************************************************
296  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) {
297  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
298  }
299  //*******************************************************************************************
300 
301  //**Equality operator************************************************************************
308  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
309  return ( ConstIterator( lhs ) == rhs );
310  }
311  //*******************************************************************************************
312 
313  //**Equality operator************************************************************************
320  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
321  return ( lhs == ConstIterator( rhs ) );
322  }
323  //*******************************************************************************************
324 
325  //**Inequality operator**********************************************************************
332  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) {
333  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
334  }
335  //*******************************************************************************************
336 
337  //**Inequality operator**********************************************************************
344  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
345  return ( ConstIterator( lhs ) != rhs );
346  }
347  //*******************************************************************************************
348 
349  //**Inequality operator**********************************************************************
356  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
357  return ( lhs != ConstIterator( rhs ) );
358  }
359  //*******************************************************************************************
360 
361  //**Less-than operator***********************************************************************
368  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) {
369  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
370  }
371  //*******************************************************************************************
372 
373  //**Less-than operator***********************************************************************
380  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
381  return ( ConstIterator( lhs ) < rhs );
382  }
383  //*******************************************************************************************
384 
385  //**Less-than operator***********************************************************************
392  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
393  return ( lhs < ConstIterator( rhs ) );
394  }
395  //*******************************************************************************************
396 
397  //**Greater-than operator********************************************************************
404  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) {
405  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
406  }
407  //*******************************************************************************************
408 
409  //**Greater-than operator********************************************************************
416  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
417  return ( ConstIterator( lhs ) > rhs );
418  }
419  //*******************************************************************************************
420 
421  //**Greater-than operator********************************************************************
428  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
429  return ( lhs > ConstIterator( rhs ) );
430  }
431  //*******************************************************************************************
432 
433  //**Less-or-equal-than operator**************************************************************
440  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) {
441  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
442  }
443  //*******************************************************************************************
444 
445  //**Less-or-equal-than operator**************************************************************
452  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
453  return ( ConstIterator( lhs ) <= rhs );
454  }
455  //*******************************************************************************************
456 
457  //**Less-or-equal-than operator**************************************************************
464  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
465  return ( lhs <= ConstIterator( rhs ) );
466  }
467  //*******************************************************************************************
468 
469  //**Greater-or-equal-than operator***********************************************************
476  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) {
477  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
478  }
479  //*******************************************************************************************
480 
481  //**Greater-or-equal-than operator***********************************************************
488  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
489  return ( ConstIterator( lhs ) >= rhs );
490  }
491  //*******************************************************************************************
492 
493  //**Greater-or-equal-than operator***********************************************************
500  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
501  return ( lhs >= ConstIterator( rhs ) );
502  }
503  //*******************************************************************************************
504 
505  //**Subtraction operator*********************************************************************
511  inline DifferenceType operator-( const Iterator& rhs ) const {
512  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
513  }
514  //*******************************************************************************************
515 
516  //**Addition operator************************************************************************
523  friend inline const Iterator operator+( const Iterator& it, size_t inc ) {
524  if( SO )
525  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
526  else
527  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
528  }
529  //*******************************************************************************************
530 
531  //**Addition operator************************************************************************
538  friend inline const Iterator operator+( size_t inc, const Iterator& it ) {
539  if( SO )
540  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
541  else
542  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
543  }
544  //*******************************************************************************************
545 
546  //**Subtraction operator*********************************************************************
553  friend inline const Iterator operator-( const Iterator& it, size_t dec ) {
554  if( SO )
555  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
556  else
557  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
558  }
559  //*******************************************************************************************
560 
561  private:
562  //**Member variables*************************************************************************
563  MT* matrix_;
564  size_t row_;
565  size_t column_;
566  //*******************************************************************************************
567  };
568  //**********************************************************************************************
569 
570  //**Compilation flags***************************************************************************
572  enum { vectorizable = MT::vectorizable };
573 
575  enum { smpAssignable = MT::smpAssignable };
576  //**********************************************************************************************
577 
578  //**Constructors********************************************************************************
581  explicit inline LowerMatrix();
582  template< typename A1 > explicit inline LowerMatrix( const A1& a1 );
583  explicit inline LowerMatrix( size_t n, const ElementType& init );
584  inline LowerMatrix( const LowerMatrix& m );
586  //**********************************************************************************************
587 
588  //**Destructor**********************************************************************************
589  // No explicitly declared destructor.
590  //**********************************************************************************************
591 
592  //**Data access functions***********************************************************************
595  inline Reference operator()( size_t i, size_t j );
596  inline ConstReference operator()( size_t i, size_t j ) const;
597  inline ConstPointer data () const;
598  inline ConstPointer data ( size_t i ) const;
599  inline Iterator begin ( size_t i );
600  inline ConstIterator begin ( size_t i ) const;
601  inline ConstIterator cbegin( size_t i ) const;
602  inline Iterator end ( size_t i );
603  inline ConstIterator end ( size_t i ) const;
604  inline ConstIterator cend ( size_t i ) const;
606  //**********************************************************************************************
607 
608  //**Assignment operators************************************************************************
611  inline LowerMatrix& operator=( const ElementType& rhs );
612  inline LowerMatrix& operator=( const LowerMatrix& rhs );
613 
614  template< typename MT2, bool SO2 >
615  inline typename DisableIf< IsComputation<MT2>, LowerMatrix& >::Type
616  operator=( const Matrix<MT2,SO2>& rhs );
617 
618  template< typename MT2, bool SO2 >
619  inline typename EnableIf< IsComputation<MT2>, LowerMatrix& >::Type
620  operator=( const Matrix<MT2,SO2>& rhs );
621 
622  template< typename MT2, bool SO2 >
623  inline typename DisableIf< IsComputation<MT2>, LowerMatrix& >::Type
624  operator+=( const Matrix<MT2,SO2>& rhs );
625 
626  template< typename MT2, bool SO2 >
627  inline typename EnableIf< IsComputation<MT2>, LowerMatrix& >::Type
628  operator+=( const Matrix<MT2,SO2>& rhs );
629 
630  template< typename MT2, bool SO2 >
631  inline typename DisableIf< IsComputation<MT2>, LowerMatrix& >::Type
632  operator-=( const Matrix<MT2,SO2>& rhs );
633 
634  template< typename MT2, bool SO2 >
635  inline typename EnableIf< IsComputation<MT2>, LowerMatrix& >::Type
636  operator-=( const Matrix<MT2,SO2>& rhs );
637 
638  template< typename MT2, bool SO2 >
639  inline LowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
640 
641  template< typename Other >
642  inline typename EnableIf< IsNumeric<Other>, LowerMatrix >::Type&
643  operator*=( Other rhs );
644 
645  template< typename Other >
646  inline typename EnableIf< IsNumeric<Other>, LowerMatrix >::Type&
647  operator/=( Other rhs );
649  //**********************************************************************************************
650 
651  //**Utility functions***************************************************************************
654  inline size_t rows() const;
655  inline size_t columns() const;
656  inline size_t spacing() const;
657  inline size_t capacity() const;
658  inline size_t capacity( size_t i ) const;
659  inline size_t nonZeros() const;
660  inline size_t nonZeros( size_t i ) const;
661  inline void reset();
662  inline void reset( size_t i );
663  inline void clear();
664  void resize ( size_t n, bool preserve=true );
665  inline void extend ( size_t n, bool preserve=true );
666  inline void reserve( size_t elements );
667  template< typename Other > inline LowerMatrix& scale( const Other& scalar );
668  inline void swap( LowerMatrix& m ) /* throw() */;
669 
670  static inline size_t maxNonZeros();
671  static inline size_t maxNonZeros( size_t n );
673  //**********************************************************************************************
674 
675  //**Expression template evaluation functions****************************************************
678  template< typename Other > inline bool canAlias ( const Other* alias ) const;
679  template< typename Other > inline bool isAliased( const Other* alias ) const;
680 
681  inline bool isAligned () const;
682  inline bool canSMPAssign() const;
683 
684  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t i, size_t j ) const;
685  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t i, size_t j ) const;
687  //**********************************************************************************************
688 
689  private:
690  //**Construction functions**********************************************************************
693  inline const MT construct( size_t n , TrueType );
694  inline const MT construct( const ElementType& value, FalseType );
695 
696  template< typename MT2, bool SO2, typename T >
697  inline const MT construct( const Matrix<MT2,SO2>& m, T );
699  //**********************************************************************************************
700 
701  //**Member variables****************************************************************************
704  MT matrix_;
705 
706  //**********************************************************************************************
707 
708  //**Friend declarations*************************************************************************
709  template< typename MT2, bool SO2, bool DF2 >
710  friend bool isDefault( const LowerMatrix<MT2,SO2,DF2>& m );
711 
712  template< typename MT2, bool SO2, bool DF2 >
713  friend MT2& derestrict( LowerMatrix<MT2,SO2,DF2>& m );
714  //**********************************************************************************************
715 
716  //**Compile time checks*************************************************************************
728  BLAZE_STATIC_ASSERT( IsResizable<MT>::value || IsSquare<MT>::value );
729  //**********************************************************************************************
730 };
732 //*************************************************************************************************
733 
734 
735 
736 
737 //=================================================================================================
738 //
739 // CONSTRUCTORS
740 //
741 //=================================================================================================
742 
743 //*************************************************************************************************
747 template< typename MT // Type of the adapted dense matrix
748  , bool SO > // Storage order of the adapted dense matrix
749 inline LowerMatrix<MT,SO,true>::LowerMatrix()
750  : matrix_() // The adapted dense matrix
751 {
752  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
753 }
755 //*************************************************************************************************
756 
757 
758 //*************************************************************************************************
776 template< typename MT // Type of the adapted dense matrix
777  , bool SO > // Storage order of the adapted dense matrix
778 template< typename A1 > // Type of the constructor argument
779 inline LowerMatrix<MT,SO,true>::LowerMatrix( const A1& a1 )
780  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
781 {
782  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
783 }
785 //*************************************************************************************************
786 
787 
788 //*************************************************************************************************
795 template< typename MT // Type of the adapted dense matrix
796  , bool SO > // Storage order of the adapted dense matrix
797 inline LowerMatrix<MT,SO,true>::LowerMatrix( size_t n, const ElementType& init )
798  : matrix_( n, n, ElementType() ) // The adapted dense matrix
799 {
801 
802  if( SO ) {
803  for( size_t j=0UL; j<columns(); ++j )
804  for( size_t i=j; i<rows(); ++i )
805  matrix_(i,j) = init;
806  }
807  else {
808  for( size_t i=0UL; i<rows(); ++i )
809  for( size_t j=0UL; j<=i; ++j )
810  matrix_(i,j) = init;
811  }
812 
813  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
814 }
816 //*************************************************************************************************
817 
818 
819 //*************************************************************************************************
825 template< typename MT // Type of the adapted dense matrix
826  , bool SO > // Storage order of the adapted dense matrix
827 inline LowerMatrix<MT,SO,true>::LowerMatrix( const LowerMatrix& m )
828  : matrix_( m.matrix_ ) // The adapted dense matrix
829 {
830  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
831 }
833 //*************************************************************************************************
834 
835 
836 
837 
838 //=================================================================================================
839 //
840 // DATA ACCESS FUNCTIONS
841 //
842 //=================================================================================================
843 
844 //*************************************************************************************************
857 template< typename MT // Type of the adapted dense matrix
858  , bool SO > // Storage order of the adapted dense matrix
860  LowerMatrix<MT,SO,true>::operator()( size_t i, size_t j )
861 {
862  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
863  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
864 
865  return Reference( matrix_, i, j );
866 }
868 //*************************************************************************************************
869 
870 
871 //*************************************************************************************************
884 template< typename MT // Type of the adapted dense matrix
885  , bool SO > // Storage order of the adapted dense matrix
887  LowerMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
888 {
889  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
890  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
891 
892  return matrix_(i,j);
893 }
895 //*************************************************************************************************
896 
897 
898 //*************************************************************************************************
911 template< typename MT // Type of the adapted dense matrix
912  , bool SO > // Storage order of the adapted dense matrix
913 inline typename LowerMatrix<MT,SO,true>::ConstPointer
914  LowerMatrix<MT,SO,true>::data() const
915 {
916  return matrix_.data();
917 }
919 //*************************************************************************************************
920 
921 
922 //*************************************************************************************************
931 template< typename MT // Type of the adapted dense matrix
932  , bool SO > // Storage order of the adapted dense matrix
933 inline typename LowerMatrix<MT,SO,true>::ConstPointer
934  LowerMatrix<MT,SO,true>::data( size_t i ) const
935 {
936  return matrix_.data(i);
937 }
939 //*************************************************************************************************
940 
941 
942 //*************************************************************************************************
954 template< typename MT // Type of the adapted dense matrix
955  , bool SO > // Storage order of the adapted dense matrix
956 inline typename LowerMatrix<MT,SO,true>::Iterator
958 {
959  if( SO )
960  return Iterator( matrix_, 0UL, i );
961  else
962  return Iterator( matrix_, i, 0UL );
963 }
965 //*************************************************************************************************
966 
967 
968 //*************************************************************************************************
980 template< typename MT // Type of the adapted dense matrix
981  , bool SO > // Storage order of the adapted dense matrix
983  LowerMatrix<MT,SO,true>::begin( size_t i ) const
984 {
985  return matrix_.begin(i);
986 }
988 //*************************************************************************************************
989 
990 
991 //*************************************************************************************************
1003 template< typename MT // Type of the adapted dense matrix
1004  , bool SO > // Storage order of the adapted dense matrix
1006  LowerMatrix<MT,SO,true>::cbegin( size_t i ) const
1007 {
1008  return matrix_.cbegin(i);
1009 }
1011 //*************************************************************************************************
1012 
1013 
1014 //*************************************************************************************************
1026 template< typename MT // Type of the adapted dense matrix
1027  , bool SO > // Storage order of the adapted dense matrix
1028 inline typename LowerMatrix<MT,SO,true>::Iterator
1029  LowerMatrix<MT,SO,true>::end( size_t i )
1030 {
1031  if( SO )
1032  return Iterator( matrix_, rows(), i );
1033  else
1034  return Iterator( matrix_, i, columns() );
1035 }
1037 //*************************************************************************************************
1038 
1039 
1040 //*************************************************************************************************
1052 template< typename MT // Type of the adapted dense matrix
1053  , bool SO > // Storage order of the adapted dense matrix
1055  LowerMatrix<MT,SO,true>::end( size_t i ) const
1056 {
1057  return matrix_.end(i);
1058 }
1060 //*************************************************************************************************
1061 
1062 
1063 //*************************************************************************************************
1075 template< typename MT // Type of the adapted dense matrix
1076  , bool SO > // Storage order of the adapted dense matrix
1078  LowerMatrix<MT,SO,true>::cend( size_t i ) const
1079 {
1080  return matrix_.cend(i);
1081 }
1083 //*************************************************************************************************
1084 
1085 
1086 
1087 
1088 //=================================================================================================
1089 //
1090 // ASSIGNMENT OPERATORS
1091 //
1092 //=================================================================================================
1093 
1094 //*************************************************************************************************
1101 template< typename MT // Type of the adapted dense matrix
1102  , bool SO > // Storage order of the adapted dense matrix
1103 inline LowerMatrix<MT,SO,true>&
1104  LowerMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1105 {
1106  if( SO ) {
1107  for( size_t j=0UL; j<columns(); ++j )
1108  for( size_t i=j; i<rows(); ++i )
1109  matrix_(i,j) = rhs;
1110  }
1111  else {
1112  for( size_t i=0UL; i<rows(); ++i )
1113  for( size_t j=0UL; j<=i; ++j )
1114  matrix_(i,j) = rhs;
1115  }
1116 
1117  return *this;
1118 }
1120 //*************************************************************************************************
1121 
1122 
1123 //*************************************************************************************************
1133 template< typename MT // Type of the adapted dense matrix
1134  , bool SO > // Storage order of the adapted dense matrix
1135 inline LowerMatrix<MT,SO,true>&
1136  LowerMatrix<MT,SO,true>::operator=( const LowerMatrix& rhs )
1137 {
1138  matrix_ = rhs.matrix_;
1139 
1140  return *this;
1141 }
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1159 template< typename MT // Type of the adapted dense matrix
1160  , bool SO > // Storage order of the adapted dense matrix
1161 template< typename MT2 // Type of the right-hand side matrix
1162  , bool SO2 > // Storage order of the right-hand side matrix
1163 inline typename DisableIf< IsComputation<MT2>, LowerMatrix<MT,SO,true>& >::Type
1164  LowerMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1165 {
1166  if( !IsLower<MT2>::value && !isLower( ~rhs ) )
1167  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1168 
1169  matrix_ = ~rhs;
1170 
1171  return *this;
1172 }
1174 //*************************************************************************************************
1175 
1176 
1177 //*************************************************************************************************
1190 template< typename MT // Type of the adapted dense matrix
1191  , bool SO > // Storage order of the adapted dense matrix
1192 template< typename MT2 // Type of the right-hand side matrix
1193  , bool SO2 > // Storage order of the right-hand side matrix
1194 inline typename EnableIf< IsComputation<MT2>, LowerMatrix<MT,SO,true>& >::Type
1195  LowerMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1196 {
1197  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1198  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1199 
1200  if( IsLower<MT2>::value ) {
1201  matrix_ = ~rhs;
1202  }
1203  else {
1204  MT tmp( ~rhs );
1205 
1206  if( !isLower( tmp ) )
1207  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1208 
1209  move( matrix_, tmp );
1210  }
1211 
1212  return *this;
1213 }
1215 //*************************************************************************************************
1216 
1217 
1218 //*************************************************************************************************
1231 template< typename MT // Type of the adapted dense matrix
1232  , bool SO > // Storage order of the adapted dense matrix
1233 template< typename MT2 // Type of the right-hand side matrix
1234  , bool SO2 > // Storage order of the right-hand side matrix
1235 inline typename DisableIf< IsComputation<MT2>, LowerMatrix<MT,SO,true>& >::Type
1236  LowerMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1237 {
1238  if( !IsLower<MT2>::value && !isLower( ~rhs ) )
1239  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1240 
1241  matrix_ += ~rhs;
1242 
1243  return *this;
1244 }
1246 //*************************************************************************************************
1247 
1248 
1249 //*************************************************************************************************
1262 template< typename MT // Type of the adapted dense matrix
1263  , bool SO > // Storage order of the adapted dense matrix
1264 template< typename MT2 // Type of the right-hand side matrix
1265  , bool SO2 > // Storage order of the right-hand side matrix
1266 inline typename EnableIf< IsComputation<MT2>, LowerMatrix<MT,SO,true>& >::Type
1267  LowerMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1268 {
1269  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1270  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1271 
1272  if( IsLower<MT2>::value ) {
1273  matrix_ += ~rhs;
1274  }
1275  else {
1276  typename MT2::ResultType tmp( ~rhs );
1277 
1278  if( !isLower( tmp ) )
1279  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1280 
1281  matrix_ += tmp;
1282  }
1283 
1284  return *this;
1285 }
1287 //*************************************************************************************************
1288 
1289 
1290 //*************************************************************************************************
1303 template< typename MT // Type of the adapted dense matrix
1304  , bool SO > // Storage order of the adapted dense matrix
1305 template< typename MT2 // Type of the right-hand side matrix
1306  , bool SO2 > // Storage order of the right-hand side matrix
1307 inline typename DisableIf< IsComputation<MT2>, LowerMatrix<MT,SO,true>& >::Type
1308  LowerMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1309 {
1310  if( !IsLower<MT2>::value && !isLower( ~rhs ) )
1311  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1312 
1313  matrix_ -= ~rhs;
1314 
1315  return *this;
1316 }
1318 //*************************************************************************************************
1319 
1320 
1321 //*************************************************************************************************
1334 template< typename MT // Type of the adapted dense matrix
1335  , bool SO > // Storage order of the adapted dense matrix
1336 template< typename MT2 // Type of the right-hand side matrix
1337  , bool SO2 > // Storage order of the right-hand side matrix
1338 inline typename EnableIf< IsComputation<MT2>, LowerMatrix<MT,SO,true>& >::Type
1339  LowerMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1340 {
1341  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1342  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1343 
1344  if( IsLower<MT2>::value ) {
1345  matrix_ -= ~rhs;
1346  }
1347  else {
1348  typename MT2::ResultType tmp( ~rhs );
1349 
1350  if( !isLower( tmp ) )
1351  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1352 
1353  matrix_ -= tmp;
1354  }
1355 
1356  return *this;
1357 }
1359 //*************************************************************************************************
1360 
1361 
1362 //*************************************************************************************************
1374 template< typename MT // Type of the adapted dense matrix
1375  , bool SO > // Storage order of the adapted dense matrix
1376 template< typename MT2 // Type of the right-hand side matrix
1377  , bool SO2 > // Storage order of the right-hand side matrix
1378 inline LowerMatrix<MT,SO,true>&
1379  LowerMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1380 {
1381  if( matrix_.rows() != (~rhs).columns() )
1382  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1383 
1384  MT tmp( matrix_ * ~rhs );
1385 
1386  if( !isLower( tmp ) )
1387  throw std::invalid_argument( "Invalid assignment to lower matrix" );
1388 
1389  move( matrix_, tmp );
1390 
1391  return *this;
1392 }
1394 //*************************************************************************************************
1395 
1396 
1397 //*************************************************************************************************
1405 template< typename MT // Type of the adapted dense matrix
1406  , bool SO > // Storage order of the adapted dense matrix
1407 template< typename Other > // Data type of the right-hand side scalar
1408 inline typename EnableIf< IsNumeric<Other>, LowerMatrix<MT,SO,true> >::Type&
1409  LowerMatrix<MT,SO,true>::operator*=( Other rhs )
1410 {
1411  matrix_ *= rhs;
1412  return *this;
1413 }
1414 //*************************************************************************************************
1415 
1416 
1417 //*************************************************************************************************
1425 template< typename MT // Type of the adapted dense matrix
1426  , bool SO > // Storage order of the adapted dense matrix
1427 template< typename Other > // Data type of the right-hand side scalar
1428 inline typename EnableIf< IsNumeric<Other>, LowerMatrix<MT,SO,true> >::Type&
1429  LowerMatrix<MT,SO,true>::operator/=( Other rhs )
1430 {
1431  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1432 
1433  matrix_ /= rhs;
1434  return *this;
1435 }
1437 //*************************************************************************************************
1438 
1439 
1440 
1441 
1442 //=================================================================================================
1443 //
1444 // UTILITY FUNCTIONS
1445 //
1446 //=================================================================================================
1447 
1448 //*************************************************************************************************
1454 template< typename MT // Type of the adapted dense matrix
1455  , bool SO > // Storage order of the adapted dense matrix
1456 inline size_t LowerMatrix<MT,SO,true>::rows() const
1457 {
1458  return matrix_.rows();
1459 }
1461 //*************************************************************************************************
1462 
1463 
1464 //*************************************************************************************************
1470 template< typename MT // Type of the adapted dense matrix
1471  , bool SO > // Storage order of the adapted dense matrix
1472 inline size_t LowerMatrix<MT,SO,true>::columns() const
1473 {
1474  return matrix_.columns();
1475 }
1477 //*************************************************************************************************
1478 
1479 
1480 //*************************************************************************************************
1491 template< typename MT // Type of the adapted dense matrix
1492  , bool SO > // Storage order of the adapted dense matrix
1493 inline size_t LowerMatrix<MT,SO,true>::spacing() const
1494 {
1495  return matrix_.spacing();
1496 }
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 LowerMatrix<MT,SO,true>::capacity() const
1510 {
1511  return matrix_.capacity();
1512 }
1514 //*************************************************************************************************
1515 
1516 
1517 //*************************************************************************************************
1529 template< typename MT // Type of the adapted dense matrix
1530  , bool SO > // Storage order of the adapted dense matrix
1531 inline size_t LowerMatrix<MT,SO,true>::capacity( size_t i ) const
1532 {
1533  return matrix_.capacity(i);
1534 }
1536 //*************************************************************************************************
1537 
1538 
1539 //*************************************************************************************************
1545 template< typename MT // Type of the adapted dense matrix
1546  , bool SO > // Storage order of the adapted dense matrix
1547 inline size_t LowerMatrix<MT,SO,true>::nonZeros() const
1548 {
1549  return matrix_.nonZeros();
1550 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1567 template< typename MT // Type of the adapted dense matrix
1568  , bool SO > // Storage order of the adapted dense matrix
1569 inline size_t LowerMatrix<MT,SO,true>::nonZeros( size_t i ) const
1570 {
1571  return matrix_.nonZeros(i);
1572 }
1574 //*************************************************************************************************
1575 
1576 
1577 //*************************************************************************************************
1583 template< typename MT // Type of the adapted dense matrix
1584  , bool SO > // Storage order of the adapted dense matrix
1585 inline void LowerMatrix<MT,SO,true>::reset()
1586 {
1587  using blaze::clear;
1588 
1589  if( SO ) {
1590  for( size_t j=0UL; j<columns(); ++j )
1591  for( size_t i=j; i<rows(); ++i )
1592  clear( matrix_(i,j) );
1593  }
1594  else {
1595  for( size_t i=0UL; i<rows(); ++i )
1596  for( size_t j=0UL; j<=i; ++j )
1597  clear( matrix_(i,j) );
1598  }
1599 }
1601 //*************************************************************************************************
1602 
1603 
1604 //*************************************************************************************************
1617 template< typename MT // Type of the adapted dense matrix
1618  , bool SO > // Storage order of the adapted dense matrix
1619 inline void LowerMatrix<MT,SO,true>::reset( size_t i )
1620 {
1621  using blaze::clear;
1622 
1623  if( SO ) {
1624  for( size_t j=i; j<rows(); ++j )
1625  clear( matrix_(j,i) );
1626  }
1627  else {
1628  for( size_t j=0UL; j<=i; ++j )
1629  clear( matrix_(i,j) );
1630  }
1631 }
1633 //*************************************************************************************************
1634 
1635 
1636 //*************************************************************************************************
1648 template< typename MT // Type of the adapted dense matrix
1649  , bool SO > // Storage order of the adapted dense matrix
1650 inline void LowerMatrix<MT,SO,true>::clear()
1651 {
1652  using blaze::clear;
1653 
1654  if( IsResizable<MT>::value ) {
1655  clear( matrix_ );
1656  }
1657  else {
1658  reset();
1659  }
1660 }
1662 //*************************************************************************************************
1663 
1664 
1665 //*************************************************************************************************
1701 template< typename MT // Type of the adapted dense matrix
1702  , bool SO > // Storage order of the adapted dense matrix
1703 void LowerMatrix<MT,SO,true>::resize( size_t n, bool preserve )
1704 {
1706 
1707  UNUSED_PARAMETER( preserve );
1708 
1709  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1710 
1711  const size_t oldsize( matrix_.rows() );
1712 
1713  matrix_.resize( n, n, true );
1714 
1715  if( n > oldsize ) {
1716  const size_t increment( n - oldsize );
1717  submatrix( matrix_, 0UL, oldsize, n-1UL, increment ).reset();
1718  }
1719 }
1721 //*************************************************************************************************
1722 
1723 
1724 //*************************************************************************************************
1737 template< typename MT // Type of the adapted dense matrix
1738  , bool SO > // Storage order of the adapted dense matrix
1739 inline void LowerMatrix<MT,SO,true>::extend( size_t n, bool preserve )
1740 {
1742 
1743  UNUSED_PARAMETER( preserve );
1744 
1745  resize( rows() + n, true );
1746 }
1747 //*************************************************************************************************
1748 
1749 
1750 //*************************************************************************************************
1760 template< typename MT // Type of the adapted dense matrix
1761  , bool SO > // Storage order of the adapted dense matrix
1762 inline void LowerMatrix<MT,SO,true>::reserve( size_t elements )
1763 {
1764  matrix_.reserve( elements );
1765 }
1767 //*************************************************************************************************
1768 
1769 
1770 //*************************************************************************************************
1777 template< typename MT // Type of the adapted dense matrix
1778  , bool SO > // Storage order of the adapted dense matrix
1779 template< typename Other > // Data type of the scalar value
1780 inline LowerMatrix<MT,SO,true>& LowerMatrix<MT,SO,true>::scale( const Other& scalar )
1781 {
1782  matrix_.scale( scalar );
1783  return *this;
1784 }
1786 //*************************************************************************************************
1787 
1788 
1789 //*************************************************************************************************
1797 template< typename MT // Type of the adapted dense matrix
1798  , bool SO > // Storage order of the adapted dense matrix
1799 inline void LowerMatrix<MT,SO,true>::swap( LowerMatrix& m ) /* throw() */
1800 {
1801  using std::swap;
1802 
1803  swap( matrix_, m.matrix_ );
1804 }
1806 //*************************************************************************************************
1807 
1808 
1809 //*************************************************************************************************
1821 template< typename MT // Type of the adapted dense matrix
1822  , bool SO > // Storage order of the adapted dense matrix
1823 inline size_t LowerMatrix<MT,SO,true>::maxNonZeros()
1824 {
1826 
1827  return maxNonZeros( Rows<MT>::value );
1828 }
1830 //*************************************************************************************************
1831 
1832 
1833 //*************************************************************************************************
1843 template< typename MT // Type of the adapted dense matrix
1844  , bool SO > // Storage order of the adapted dense matrix
1845 inline size_t LowerMatrix<MT,SO,true>::maxNonZeros( size_t n )
1846 {
1847  return ( ( n + 1UL ) * n ) / 2UL;
1848 }
1850 //*************************************************************************************************
1851 
1852 
1853 
1854 
1855 //=================================================================================================
1856 //
1857 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1858 //
1859 //=================================================================================================
1860 
1861 //*************************************************************************************************
1872 template< typename MT // Type of the adapted dense matrix
1873  , bool SO > // Storage order of the adapted dense matrix
1874 template< typename Other > // Data type of the foreign expression
1875 inline bool LowerMatrix<MT,SO,true>::canAlias( const Other* alias ) const
1876 {
1877  return matrix_.canAlias( alias );
1878 }
1880 //*************************************************************************************************
1881 
1882 
1883 //*************************************************************************************************
1894 template< typename MT // Type of the adapted dense matrix
1895  , bool SO > // Storage order of the adapted dense matrix
1896 template< typename Other > // Data type of the foreign expression
1897 inline bool LowerMatrix<MT,SO,true>::isAliased( const Other* alias ) const
1898 {
1899  return matrix_.isAliased( alias );
1900 }
1902 //*************************************************************************************************
1903 
1904 
1905 //*************************************************************************************************
1915 template< typename MT // Type of the adapted dense matrix
1916  , bool SO > // Storage order of the adapted dense matrix
1917 inline bool LowerMatrix<MT,SO,true>::isAligned() const
1918 {
1919  return matrix_.isAligned();
1920 }
1922 //*************************************************************************************************
1923 
1924 
1925 //*************************************************************************************************
1936 template< typename MT // Type of the adapted dense matrix
1937  , bool SO > // Storage order of the adapted dense matrix
1938 inline bool LowerMatrix<MT,SO,true>::canSMPAssign() const
1939 {
1940  return matrix_.canSMPAssign();
1941 }
1943 //*************************************************************************************************
1944 
1945 
1946 //*************************************************************************************************
1962 template< typename MT // Type of the adapted dense matrix
1963  , bool SO > // Storage order of the adapted dense matrix
1964 BLAZE_ALWAYS_INLINE typename LowerMatrix<MT,SO,true>::IntrinsicType
1965  LowerMatrix<MT,SO,true>::load( size_t i, size_t j ) const
1966 {
1967  return matrix_.load( i, j );
1968 }
1970 //*************************************************************************************************
1971 
1972 
1973 //*************************************************************************************************
1989 template< typename MT // Type of the adapted dense matrix
1990  , bool SO > // Storage order of the adapted dense matrix
1991 BLAZE_ALWAYS_INLINE typename LowerMatrix<MT,SO,true>::IntrinsicType
1992  LowerMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const
1993 {
1994  return matrix_.loadu( i, j );
1995 }
1997 //*************************************************************************************************
1998 
1999 
2000 
2001 
2002 //=================================================================================================
2003 //
2004 // CONSTRUCTION FUNCTIONS
2005 //
2006 //=================================================================================================
2007 
2008 //*************************************************************************************************
2015 template< typename MT // Type of the adapted dense matrix
2016  , bool SO > // Storage order of the adapted dense matrix
2017 inline const MT LowerMatrix<MT,SO,true>::construct( size_t n, TrueType )
2018 {
2020 
2021  return MT( n, n, ElementType() );
2022 }
2024 //*************************************************************************************************
2025 
2026 
2027 //*************************************************************************************************
2034 template< typename MT // Type of the adapted dense matrix
2035  , bool SO > // Storage order of the adapted dense matrix
2036 inline const MT LowerMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2037 {
2040 
2041  MT tmp;
2042 
2043  if( SO ) {
2044  for( size_t j=0UL; j<tmp.columns(); ++j )
2045  for( size_t i=j; i<tmp.rows(); ++i )
2046  tmp(i,j) = init;
2047  }
2048  else {
2049  for( size_t i=0UL; i<tmp.rows(); ++i )
2050  for( size_t j=0UL; j<=i; ++j )
2051  tmp(i,j) = init;
2052  }
2053 
2054  return tmp;
2055 }
2057 //*************************************************************************************************
2058 
2059 
2060 //*************************************************************************************************
2071 template< typename MT // Type of the adapted dense matrix
2072  , bool SO > // Storage order of the adapted dense matrix
2073 template< typename MT2 // Type of the foreign matrix
2074  , bool SO2 // Storage order of the foreign matrix
2075  , typename T > // Type of the third argument
2076 inline const MT LowerMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2077 {
2078  const MT tmp( ~m );
2079 
2080  if( !IsLower<MT2>::value && !isLower( tmp ) )
2081  throw std::invalid_argument( "Invalid setup of lower matrix" );
2082 
2083  return tmp;
2084 }
2086 //*************************************************************************************************
2087 
2088 } // namespace blaze
2089 
2090 #endif
Constraint on the data type.
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_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: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
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
Header file for the FalseType type/value trait base class.
#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.
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
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE(T)
Constraint on the data type.In case the given data type T is not a square matrix type, a compilation error is created.
Definition: Square.h:78
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2503
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:964
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 IsSquare type trait.
Constraint on the data type.
Constraint on the data type.
Header file for the DenseSubmatrix class template.
Header file for the DisableIf class template.
Header file for the implementation of the base template of the LowerMatrix.
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
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
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
Header file for the IsLower type trait.
Header file for the LowerProxy class.
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
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
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.
Header file for all adaptor forward declarations.
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.
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_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
void move(DynamicMatrix< Type, SO > &dst, DynamicMatrix< Type, SO > &src)
Moving the contents of one dynamic matrix to another.
Definition: DynamicMatrix.h:4934
#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
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a 'resize' member fu...
Definition: Resizable.h:118
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
Header file for the IsComputation type trait class.
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
#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
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
#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 the TrueType type/value trait base class.