Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_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>
69 #include <blaze/system/Inline.h>
70 #include <blaze/util/Assert.h>
76 #include <blaze/util/DisableIf.h>
77 #include <blaze/util/EnableIf.h>
78 #include <blaze/util/FalseType.h>
80 #include <blaze/util/TrueType.h>
81 #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 StrictlyUpperMatrix<MT,SO,true>
104  : public DenseMatrix< StrictlyUpperMatrix<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 StrictlyUpperMatrix<MT,SO,true> This;
117  typedef This ResultType;
118  typedef StrictlyUpperMatrix<OT,!SO,true> OppositeType;
119  typedef StrictlyLowerMatrix<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 StrictlyUpperProxy<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 StrictlyUpperMatrix< 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 StrictlyUpperProxy<MT> PointerType;
151  typedef StrictlyUpperProxy<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 StrictlyUpperMatrix();
582  template< typename A1 > explicit inline StrictlyUpperMatrix( const A1& a1 );
583  explicit inline StrictlyUpperMatrix( size_t n, const ElementType& init );
584  inline StrictlyUpperMatrix( const StrictlyUpperMatrix& 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 StrictlyUpperMatrix& operator=( const ElementType& rhs );
612  inline StrictlyUpperMatrix& operator=( const StrictlyUpperMatrix& rhs );
613 
614  template< typename MT2, bool SO2 >
615  inline typename DisableIf< IsComputation<MT2>, StrictlyUpperMatrix& >::Type
616  operator=( const Matrix<MT2,SO2>& rhs );
617 
618  template< typename MT2, bool SO2 >
619  inline typename EnableIf< IsComputation<MT2>, StrictlyUpperMatrix& >::Type
620  operator=( const Matrix<MT2,SO2>& rhs );
621 
622  template< typename MT2, bool SO2 >
623  inline typename DisableIf< IsComputation<MT2>, StrictlyUpperMatrix& >::Type
624  operator+=( const Matrix<MT2,SO2>& rhs );
625 
626  template< typename MT2, bool SO2 >
627  inline typename EnableIf< IsComputation<MT2>, StrictlyUpperMatrix& >::Type
628  operator+=( const Matrix<MT2,SO2>& rhs );
629 
630  template< typename MT2, bool SO2 >
631  inline typename DisableIf< IsComputation<MT2>, StrictlyUpperMatrix& >::Type
632  operator-=( const Matrix<MT2,SO2>& rhs );
633 
634  template< typename MT2, bool SO2 >
635  inline typename EnableIf< IsComputation<MT2>, StrictlyUpperMatrix& >::Type
636  operator-=( const Matrix<MT2,SO2>& rhs );
637 
638  template< typename MT2, bool SO2 >
639  inline StrictlyUpperMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
640 
641  template< typename Other >
642  inline typename EnableIf< IsNumeric<Other>, StrictlyUpperMatrix >::Type&
643  operator*=( Other rhs );
644 
645  template< typename Other >
646  inline typename EnableIf< IsNumeric<Other>, StrictlyUpperMatrix >::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 
668  template< typename Other > inline StrictlyUpperMatrix& scale( const Other& scalar );
669 
670  inline void swap( StrictlyUpperMatrix& m ) /* throw() */;
671 
672  static inline size_t maxNonZeros();
673  static inline size_t maxNonZeros( size_t n );
675  //**********************************************************************************************
676 
677  //**Expression template evaluation functions****************************************************
680  template< typename Other > inline bool canAlias ( const Other* alias ) const;
681  template< typename Other > inline bool isAliased( const Other* alias ) const;
682 
683  inline bool isAligned () const;
684  inline bool canSMPAssign() const;
685 
686  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t i, size_t j ) const;
687  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t i, size_t j ) const;
689  //**********************************************************************************************
690 
691  private:
692  //**Construction functions**********************************************************************
695  inline const MT construct( size_t n , TrueType );
696  inline const MT construct( const ElementType& value, FalseType );
697 
698  template< typename MT2, bool SO2, typename T >
699  inline const MT construct( const Matrix<MT2,SO2>& m, T );
701  //**********************************************************************************************
702 
703  //**Member variables****************************************************************************
706  MT matrix_;
707 
708  //**********************************************************************************************
709 
710  //**Friend declarations*************************************************************************
711  template< typename MT2, bool SO2, bool DF2 >
712  friend MT2& derestrict( StrictlyUpperMatrix<MT2,SO2,DF2>& m );
713  //**********************************************************************************************
714 
715  //**Compile time checks*************************************************************************
727  BLAZE_STATIC_ASSERT( IsResizable<MT>::value || IsSquare<MT>::value );
728  //**********************************************************************************************
729 };
731 //*************************************************************************************************
732 
733 
734 
735 
736 //=================================================================================================
737 //
738 // CONSTRUCTORS
739 //
740 //=================================================================================================
741 
742 //*************************************************************************************************
746 template< typename MT // Type of the adapted dense matrix
747  , bool SO > // Storage order of the adapted dense matrix
748 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix()
749  : matrix_() // The adapted dense matrix
750 {
751  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
752 }
754 //*************************************************************************************************
755 
756 
757 //*************************************************************************************************
775 template< typename MT // Type of the adapted dense matrix
776  , bool SO > // Storage order of the adapted dense matrix
777 template< typename A1 > // Type of the constructor argument
778 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( const A1& a1 )
779  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
780 {
781  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
782 }
784 //*************************************************************************************************
785 
786 
787 //*************************************************************************************************
794 template< typename MT // Type of the adapted dense matrix
795  , bool SO > // Storage order of the adapted dense matrix
796 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( size_t n, const ElementType& init )
797  : matrix_( n, n, ElementType() ) // The adapted dense matrix
798 {
800 
801  if( SO ) {
802  for( size_t j=0UL; j<columns(); ++j ) {
803  for( size_t i=0UL; i<j; ++i )
804  matrix_(i,j) = init;
805  }
806  }
807  else {
808  for( size_t i=0UL; i<rows(); ++i ) {
809  for( size_t j=i+1UL; j<columns(); ++j )
810  matrix_(i,j) = init;
811  }
812  }
813 
814  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
815 }
817 //*************************************************************************************************
818 
819 
820 //*************************************************************************************************
826 template< typename MT // Type of the adapted dense matrix
827  , bool SO > // Storage order of the adapted dense matrix
828 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( const StrictlyUpperMatrix& m )
829  : matrix_( m.matrix_ ) // The adapted dense matrix
830 {
831  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
832 }
834 //*************************************************************************************************
835 
836 
837 
838 
839 //=================================================================================================
840 //
841 // DATA ACCESS FUNCTIONS
842 //
843 //=================================================================================================
844 
845 //*************************************************************************************************
858 template< typename MT // Type of the adapted dense matrix
859  , bool SO > // Storage order of the adapted dense matrix
861  StrictlyUpperMatrix<MT,SO,true>::operator()( size_t i, size_t j )
862 {
863  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
864  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
865 
866  return Reference( matrix_, i, j );
867 }
869 //*************************************************************************************************
870 
871 
872 //*************************************************************************************************
885 template< typename MT // Type of the adapted dense matrix
886  , bool SO > // Storage order of the adapted dense matrix
888  StrictlyUpperMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
889 {
890  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
891  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
892 
893  return matrix_(i,j);
894 }
896 //*************************************************************************************************
897 
898 
899 //*************************************************************************************************
912 template< typename MT // Type of the adapted dense matrix
913  , bool SO > // Storage order of the adapted dense matrix
914 inline typename StrictlyUpperMatrix<MT,SO,true>::ConstPointer
915  StrictlyUpperMatrix<MT,SO,true>::data() const
916 {
917  return matrix_.data();
918 }
920 //*************************************************************************************************
921 
922 
923 //*************************************************************************************************
932 template< typename MT // Type of the adapted dense matrix
933  , bool SO > // Storage order of the adapted dense matrix
934 inline typename StrictlyUpperMatrix<MT,SO,true>::ConstPointer
935  StrictlyUpperMatrix<MT,SO,true>::data( size_t i ) const
936 {
937  return matrix_.data(i);
938 }
940 //*************************************************************************************************
941 
942 
943 //*************************************************************************************************
955 template< typename MT // Type of the adapted dense matrix
956  , bool SO > // Storage order of the adapted dense matrix
959 {
960  if( SO )
961  return Iterator( matrix_, 0UL, i );
962  else
963  return Iterator( matrix_, i, 0UL );
964 }
966 //*************************************************************************************************
967 
968 
969 //*************************************************************************************************
981 template< typename MT // Type of the adapted dense matrix
982  , bool SO > // Storage order of the adapted dense matrix
985 {
986  return matrix_.begin(i);
987 }
989 //*************************************************************************************************
990 
991 
992 //*************************************************************************************************
1004 template< typename MT // Type of the adapted dense matrix
1005  , bool SO > // Storage order of the adapted dense matrix
1007  StrictlyUpperMatrix<MT,SO,true>::cbegin( size_t i ) const
1008 {
1009  return matrix_.cbegin(i);
1010 }
1012 //*************************************************************************************************
1013 
1014 
1015 //*************************************************************************************************
1027 template< typename MT // Type of the adapted dense matrix
1028  , bool SO > // Storage order of the adapted dense matrix
1031 {
1032  if( SO )
1033  return Iterator( matrix_, rows(), i );
1034  else
1035  return Iterator( matrix_, i, columns() );
1036 }
1038 //*************************************************************************************************
1039 
1040 
1041 //*************************************************************************************************
1053 template< typename MT // Type of the adapted dense matrix
1054  , bool SO > // Storage order of the adapted dense matrix
1056  StrictlyUpperMatrix<MT,SO,true>::end( size_t i ) const
1057 {
1058  return matrix_.end(i);
1059 }
1061 //*************************************************************************************************
1062 
1063 
1064 //*************************************************************************************************
1076 template< typename MT // Type of the adapted dense matrix
1077  , bool SO > // Storage order of the adapted dense matrix
1079  StrictlyUpperMatrix<MT,SO,true>::cend( size_t i ) const
1080 {
1081  return matrix_.cend(i);
1082 }
1084 //*************************************************************************************************
1085 
1086 
1087 
1088 
1089 //=================================================================================================
1090 //
1091 // ASSIGNMENT OPERATORS
1092 //
1093 //=================================================================================================
1094 
1095 //*************************************************************************************************
1102 template< typename MT // Type of the adapted dense matrix
1103  , bool SO > // Storage order of the adapted dense matrix
1104 inline StrictlyUpperMatrix<MT,SO,true>&
1105  StrictlyUpperMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1106 {
1107  if( SO ) {
1108  for( size_t j=1UL; j<columns(); ++j )
1109  for( size_t i=0UL; i<j; ++i )
1110  matrix_(i,j) = rhs;
1111  }
1112  else {
1113  for( size_t i=0UL; i<rows(); ++i )
1114  for( size_t j=i+1UL; j<columns(); ++j )
1115  matrix_(i,j) = rhs;
1116  }
1117 
1118  return *this;
1119 }
1121 //*************************************************************************************************
1122 
1123 
1124 //*************************************************************************************************
1134 template< typename MT // Type of the adapted dense matrix
1135  , bool SO > // Storage order of the adapted dense matrix
1136 inline StrictlyUpperMatrix<MT,SO,true>&
1137  StrictlyUpperMatrix<MT,SO,true>::operator=( const StrictlyUpperMatrix& rhs )
1138 {
1139  matrix_ = rhs.matrix_;
1140 
1141  return *this;
1142 }
1144 //*************************************************************************************************
1145 
1146 
1147 //*************************************************************************************************
1160 template< typename MT // Type of the adapted dense matrix
1161  , bool SO > // Storage order of the adapted dense matrix
1162 template< typename MT2 // Type of the right-hand side matrix
1163  , bool SO2 > // Storage order of the right-hand side matrix
1164 inline typename DisableIf< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >::Type
1165  StrictlyUpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1166 {
1167  if( IsUniTriangular<MT2>::value ||
1168  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) )
1169  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1170 
1171  matrix_ = ~rhs;
1172 
1173  return *this;
1174 }
1176 //*************************************************************************************************
1177 
1178 
1179 //*************************************************************************************************
1192 template< typename MT // Type of the adapted dense matrix
1193  , bool SO > // Storage order of the adapted dense matrix
1194 template< typename MT2 // Type of the right-hand side matrix
1195  , bool SO2 > // Storage order of the right-hand side matrix
1196 inline typename EnableIf< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >::Type
1197  StrictlyUpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1198 {
1199  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1200  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1201 
1202  if( IsStrictlyUpper<MT2>::value ) {
1203  matrix_ = ~rhs;
1204  }
1205  else {
1206  MT tmp( ~rhs );
1207 
1208  if( !isStrictlyUpper( tmp ) )
1209  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1210 
1211  move( matrix_, tmp );
1212  }
1213 
1214  return *this;
1215 }
1217 //*************************************************************************************************
1218 
1219 
1220 //*************************************************************************************************
1233 template< typename MT // Type of the adapted dense matrix
1234  , bool SO > // Storage order of the adapted dense matrix
1235 template< typename MT2 // Type of the right-hand side matrix
1236  , bool SO2 > // Storage order of the right-hand side matrix
1237 inline typename DisableIf< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >::Type
1238  StrictlyUpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1239 {
1240  if( IsUniTriangular<MT2>::value ||
1241  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) )
1242  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1243 
1244  matrix_ += ~rhs;
1245 
1246  return *this;
1247 }
1249 //*************************************************************************************************
1250 
1251 
1252 //*************************************************************************************************
1265 template< typename MT // Type of the adapted dense matrix
1266  , bool SO > // Storage order of the adapted dense matrix
1267 template< typename MT2 // Type of the right-hand side matrix
1268  , bool SO2 > // Storage order of the right-hand side matrix
1269 inline typename EnableIf< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >::Type
1270  StrictlyUpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1271 {
1272  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1273  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1274 
1275  if( IsStrictlyUpper<MT2>::value ) {
1276  matrix_ += ~rhs;
1277  }
1278  else {
1279  typename MT2::ResultType tmp( ~rhs );
1280 
1281  if( !isStrictlyUpper( tmp ) )
1282  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1283 
1284  matrix_ += tmp;
1285  }
1286 
1287  return *this;
1288 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1306 template< typename MT // Type of the adapted dense matrix
1307  , bool SO > // Storage order of the adapted dense matrix
1308 template< typename MT2 // Type of the right-hand side matrix
1309  , bool SO2 > // Storage order of the right-hand side matrix
1310 inline typename DisableIf< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >::Type
1311  StrictlyUpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1312 {
1313  if( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) )
1314  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1315 
1316  matrix_ -= ~rhs;
1317 
1318  return *this;
1319 }
1321 //*************************************************************************************************
1322 
1323 
1324 //*************************************************************************************************
1337 template< typename MT // Type of the adapted dense matrix
1338  , bool SO > // Storage order of the adapted dense matrix
1339 template< typename MT2 // Type of the right-hand side matrix
1340  , bool SO2 > // Storage order of the right-hand side matrix
1341 inline typename EnableIf< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >::Type
1342  StrictlyUpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1343 {
1344  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) )
1345  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1346 
1347  if( IsStrictlyUpper<MT2>::value ) {
1348  matrix_ -= ~rhs;
1349  }
1350  else {
1351  typename MT2::ResultType tmp( ~rhs );
1352 
1353  if( !isStrictlyUpper( tmp ) )
1354  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1355 
1356  matrix_ -= tmp;
1357  }
1358 
1359  return *this;
1360 }
1362 //*************************************************************************************************
1363 
1364 
1365 //*************************************************************************************************
1377 template< typename MT // Type of the adapted dense matrix
1378  , bool SO > // Storage order of the adapted dense matrix
1379 template< typename MT2 // Type of the right-hand side matrix
1380  , bool SO2 > // Storage order of the right-hand side matrix
1381 inline StrictlyUpperMatrix<MT,SO,true>&
1382  StrictlyUpperMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1383 {
1384  if( matrix_.rows() != (~rhs).columns() )
1385  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1386 
1387  MT tmp( matrix_ * ~rhs );
1388 
1389  if( !isStrictlyUpper( tmp ) )
1390  throw std::invalid_argument( "Invalid assignment to strictly upper matrix" );
1391 
1392  move( matrix_, tmp );
1393 
1394  return *this;
1395 }
1397 //*************************************************************************************************
1398 
1399 
1400 //*************************************************************************************************
1408 template< typename MT // Type of the adapted dense matrix
1409  , bool SO > // Storage order of the adapted dense matrix
1410 template< typename Other > // Data type of the right-hand side scalar
1411 inline typename EnableIf< IsNumeric<Other>, StrictlyUpperMatrix<MT,SO,true> >::Type&
1412  StrictlyUpperMatrix<MT,SO,true>::operator*=( Other rhs )
1413 {
1414  matrix_ *= rhs;
1415  return *this;
1416 }
1417 //*************************************************************************************************
1418 
1419 
1420 //*************************************************************************************************
1428 template< typename MT // Type of the adapted dense matrix
1429  , bool SO > // Storage order of the adapted dense matrix
1430 template< typename Other > // Data type of the right-hand side scalar
1431 inline typename EnableIf< IsNumeric<Other>, StrictlyUpperMatrix<MT,SO,true> >::Type&
1432  StrictlyUpperMatrix<MT,SO,true>::operator/=( Other rhs )
1433 {
1434  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1435 
1436  matrix_ /= rhs;
1437  return *this;
1438 }
1440 //*************************************************************************************************
1441 
1442 
1443 
1444 
1445 //=================================================================================================
1446 //
1447 // UTILITY FUNCTIONS
1448 //
1449 //=================================================================================================
1450 
1451 //*************************************************************************************************
1457 template< typename MT // Type of the adapted dense matrix
1458  , bool SO > // Storage order of the adapted dense matrix
1459 inline size_t StrictlyUpperMatrix<MT,SO,true>::rows() const
1460 {
1461  return matrix_.rows();
1462 }
1464 //*************************************************************************************************
1465 
1466 
1467 //*************************************************************************************************
1473 template< typename MT // Type of the adapted dense matrix
1474  , bool SO > // Storage order of the adapted dense matrix
1475 inline size_t StrictlyUpperMatrix<MT,SO,true>::columns() const
1476 {
1477  return matrix_.columns();
1478 }
1480 //*************************************************************************************************
1481 
1482 
1483 //*************************************************************************************************
1494 template< typename MT // Type of the adapted dense matrix
1495  , bool SO > // Storage order of the adapted dense matrix
1496 inline size_t StrictlyUpperMatrix<MT,SO,true>::spacing() const
1497 {
1498  return matrix_.spacing();
1499 }
1501 //*************************************************************************************************
1502 
1503 
1504 //*************************************************************************************************
1510 template< typename MT // Type of the adapted dense matrix
1511  , bool SO > // Storage order of the adapted dense matrix
1512 inline size_t StrictlyUpperMatrix<MT,SO,true>::capacity() const
1513 {
1514  return matrix_.capacity();
1515 }
1517 //*************************************************************************************************
1518 
1519 
1520 //*************************************************************************************************
1532 template< typename MT // Type of the adapted dense matrix
1533  , bool SO > // Storage order of the adapted dense matrix
1534 inline size_t StrictlyUpperMatrix<MT,SO,true>::capacity( size_t i ) const
1535 {
1536  return matrix_.capacity(i);
1537 }
1539 //*************************************************************************************************
1540 
1541 
1542 //*************************************************************************************************
1548 template< typename MT // Type of the adapted dense matrix
1549  , bool SO > // Storage order of the adapted dense matrix
1550 inline size_t StrictlyUpperMatrix<MT,SO,true>::nonZeros() const
1551 {
1552  return matrix_.nonZeros();
1553 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1570 template< typename MT // Type of the adapted dense matrix
1571  , bool SO > // Storage order of the adapted dense matrix
1572 inline size_t StrictlyUpperMatrix<MT,SO,true>::nonZeros( size_t i ) const
1573 {
1574  return matrix_.nonZeros(i);
1575 }
1577 //*************************************************************************************************
1578 
1579 
1580 //*************************************************************************************************
1586 template< typename MT // Type of the adapted dense matrix
1587  , bool SO > // Storage order of the adapted dense matrix
1589 {
1590  using blaze::clear;
1591 
1592  if( SO ) {
1593  for( size_t j=1UL; j<columns(); ++j )
1594  for( size_t i=0UL; i<j; ++i )
1595  clear( matrix_(i,j) );
1596  }
1597  else {
1598  for( size_t i=0UL; i<rows(); ++i )
1599  for( size_t j=i+1UL; j<columns(); ++j )
1600  clear( matrix_(i,j) );
1601  }
1602 }
1604 //*************************************************************************************************
1605 
1606 
1607 //*************************************************************************************************
1620 template< typename MT // Type of the adapted dense matrix
1621  , bool SO > // Storage order of the adapted dense matrix
1622 inline void StrictlyUpperMatrix<MT,SO,true>::reset( size_t i )
1623 {
1624  using blaze::clear;
1625 
1626  if( SO ) {
1627  for( size_t j=0UL; j<i; ++j )
1628  clear( matrix_(j,i) );
1629  }
1630  else {
1631  for( size_t j=i+1UL; j<columns(); ++j )
1632  clear( matrix_(i,j) );
1633  }
1634 }
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1651 template< typename MT // Type of the adapted dense matrix
1652  , bool SO > // Storage order of the adapted dense matrix
1654 {
1655  using blaze::clear;
1656 
1657  if( IsResizable<MT>::value ) {
1658  clear( matrix_ );
1659  }
1660  else {
1661  reset();
1662  }
1663 }
1665 //*************************************************************************************************
1666 
1667 
1668 //*************************************************************************************************
1704 template< typename MT // Type of the adapted dense matrix
1705  , bool SO > // Storage order of the adapted dense matrix
1706 void StrictlyUpperMatrix<MT,SO,true>::resize( size_t n, bool preserve )
1707 {
1709 
1710  UNUSED_PARAMETER( preserve );
1711 
1712  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1713 
1714  const size_t oldsize( matrix_.rows() );
1715 
1716  matrix_.resize( n, n, true );
1717 
1718  if( n > oldsize )
1719  {
1720  const size_t increment( n - oldsize );
1721  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
1722  }
1723 }
1725 //*************************************************************************************************
1726 
1727 
1728 //*************************************************************************************************
1741 template< typename MT // Type of the adapted dense matrix
1742  , bool SO > // Storage order of the adapted dense matrix
1743 inline void StrictlyUpperMatrix<MT,SO,true>::extend( size_t n, bool preserve )
1744 {
1746 
1747  UNUSED_PARAMETER( preserve );
1748 
1749  resize( rows() + n, true );
1750 }
1751 //*************************************************************************************************
1752 
1753 
1754 //*************************************************************************************************
1764 template< typename MT // Type of the adapted dense matrix
1765  , bool SO > // Storage order of the adapted dense matrix
1766 inline void StrictlyUpperMatrix<MT,SO,true>::reserve( size_t elements )
1767 {
1768  matrix_.reserve( elements );
1769 }
1771 //*************************************************************************************************
1772 
1773 
1774 //*************************************************************************************************
1781 template< typename MT // Type of the adapted dense matrix
1782  , bool SO > // Storage order of the adapted dense matrix
1783 template< typename Other > // Data type of the scalar value
1784 inline StrictlyUpperMatrix<MT,SO,true>&
1785  StrictlyUpperMatrix<MT,SO,true>::scale( const Other& scalar )
1786 {
1787  matrix_.scale( scalar );
1788  return *this;
1789 }
1791 //*************************************************************************************************
1792 
1793 
1794 //*************************************************************************************************
1802 template< typename MT // Type of the adapted dense matrix
1803  , bool SO > // Storage order of the adapted dense matrix
1804 inline void StrictlyUpperMatrix<MT,SO,true>::swap( StrictlyUpperMatrix& m ) /* throw() */
1805 {
1806  using std::swap;
1807 
1808  swap( matrix_, m.matrix_ );
1809 }
1811 //*************************************************************************************************
1812 
1813 
1814 //*************************************************************************************************
1826 template< typename MT // Type of the adapted dense matrix
1827  , bool SO > // Storage order of the adapted dense matrix
1828 inline size_t StrictlyUpperMatrix<MT,SO,true>::maxNonZeros()
1829 {
1831 
1832  return maxNonZeros( Rows<MT>::value );
1833 }
1835 //*************************************************************************************************
1836 
1837 
1838 //*************************************************************************************************
1848 template< typename MT // Type of the adapted dense matrix
1849  , bool SO > // Storage order of the adapted dense matrix
1850 inline size_t StrictlyUpperMatrix<MT,SO,true>::maxNonZeros( size_t n )
1851 {
1852  return ( ( n - 1UL ) * n ) / 2UL;
1853 }
1855 //*************************************************************************************************
1856 
1857 
1858 
1859 
1860 //=================================================================================================
1861 //
1862 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1863 //
1864 //=================================================================================================
1865 
1866 //*************************************************************************************************
1877 template< typename MT // Type of the adapted dense matrix
1878  , bool SO > // Storage order of the adapted dense matrix
1879 template< typename Other > // Data type of the foreign expression
1880 inline bool StrictlyUpperMatrix<MT,SO,true>::canAlias( const Other* alias ) const
1881 {
1882  return matrix_.canAlias( alias );
1883 }
1885 //*************************************************************************************************
1886 
1887 
1888 //*************************************************************************************************
1899 template< typename MT // Type of the adapted dense matrix
1900  , bool SO > // Storage order of the adapted dense matrix
1901 template< typename Other > // Data type of the foreign expression
1902 inline bool StrictlyUpperMatrix<MT,SO,true>::isAliased( const Other* alias ) const
1903 {
1904  return matrix_.isAliased( alias );
1905 }
1907 //*************************************************************************************************
1908 
1909 
1910 //*************************************************************************************************
1920 template< typename MT // Type of the adapted dense matrix
1921  , bool SO > // Storage order of the adapted dense matrix
1922 inline bool StrictlyUpperMatrix<MT,SO,true>::isAligned() const
1923 {
1924  return matrix_.isAligned();
1925 }
1927 //*************************************************************************************************
1928 
1929 
1930 //*************************************************************************************************
1941 template< typename MT // Type of the adapted dense matrix
1942  , bool SO > // Storage order of the adapted dense matrix
1943 inline bool StrictlyUpperMatrix<MT,SO,true>::canSMPAssign() const
1944 {
1945  return matrix_.canSMPAssign();
1946 }
1948 //*************************************************************************************************
1949 
1950 
1951 //*************************************************************************************************
1967 template< typename MT // Type of the adapted dense matrix
1968  , bool SO > // Storage order of the adapted dense matrix
1969 BLAZE_ALWAYS_INLINE typename StrictlyUpperMatrix<MT,SO,true>::IntrinsicType
1970  StrictlyUpperMatrix<MT,SO,true>::load( size_t i, size_t j ) const
1971 {
1972  return matrix_.load( i, j );
1973 }
1975 //*************************************************************************************************
1976 
1977 
1978 //*************************************************************************************************
1994 template< typename MT // Type of the adapted dense matrix
1995  , bool SO > // Storage order of the adapted dense matrix
1996 BLAZE_ALWAYS_INLINE typename StrictlyUpperMatrix<MT,SO,true>::IntrinsicType
1997  StrictlyUpperMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const
1998 {
1999  return matrix_.loadu( i, j );
2000 }
2002 //*************************************************************************************************
2003 
2004 
2005 
2006 
2007 //=================================================================================================
2008 //
2009 // CONSTRUCTION FUNCTIONS
2010 //
2011 //=================================================================================================
2012 
2013 //*************************************************************************************************
2020 template< typename MT // Type of the adapted dense matrix
2021  , bool SO > // Storage order of the adapted dense matrix
2022 inline const MT StrictlyUpperMatrix<MT,SO,true>::construct( size_t n, TrueType )
2023 {
2025 
2026  return MT( n, n, ElementType() );
2027 }
2029 //*************************************************************************************************
2030 
2031 
2032 //*************************************************************************************************
2039 template< typename MT // Type of the adapted dense matrix
2040  , bool SO > // Storage order of the adapted dense matrix
2041 inline const MT StrictlyUpperMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2042 {
2045 
2046  MT tmp;
2047 
2048  if( SO ) {
2049  for( size_t j=0UL; j<columns(); ++j ) {
2050  for( size_t i=0UL; i<j; ++i )
2051  tmp(i,j) = init;
2052  }
2053  }
2054  else {
2055  for( size_t i=0UL; i<rows(); ++i ) {
2056  for( size_t j=i+1UL; j<columns(); ++j )
2057  tmp(i,j) = init;
2058  }
2059  }
2060 
2061  return tmp;
2062 }
2064 //*************************************************************************************************
2065 
2066 
2067 //*************************************************************************************************
2078 template< typename MT // Type of the adapted dense matrix
2079  , bool SO > // Storage order of the adapted dense matrix
2080 template< typename MT2 // Type of the foreign matrix
2081  , bool SO2 // Storage order of the foreign matrix
2082  , typename T > // Type of the third argument
2083 inline const MT StrictlyUpperMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2084 {
2085  const MT tmp( ~m );
2086 
2087  if( IsUniTriangular<MT2>::value ||
2088  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( tmp ) ) )
2089  throw std::invalid_argument( "Invalid setup of strictly upper matrix" );
2090 
2091  return tmp;
2092 }
2094 //*************************************************************************************************
2095 
2096 } // namespace blaze
2097 
2098 #endif
Header file for the StrictlyUpperProxy class.
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
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1354
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
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 IsStrictlyUpper 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
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 IsUniTriangular type trait.
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
Header file for the implementation of the base template of the StrictlyUpperMatrix.
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 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.