Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_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>
72 #include <blaze/system/Inline.h>
73 #include <blaze/util/Assert.h>
80 #include <blaze/util/DisableIf.h>
81 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/FalseType.h>
84 #include <blaze/util/TrueType.h>
85 #include <blaze/util/Types.h>
86 #include <blaze/util/Unused.h>
87 
88 
89 namespace blaze {
90 
91 //=================================================================================================
92 //
93 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
105 template< typename MT // Type of the adapted dense matrix
106  , bool SO > // Storage order of the adapted dense matrix
107 class UniLowerMatrix<MT,SO,true>
108  : public DenseMatrix< UniLowerMatrix<MT,SO,true>, SO >
109 {
110  private:
111  //**Type definitions****************************************************************************
112  typedef typename MT::OppositeType OT;
113  typedef typename MT::TransposeType TT;
114  typedef typename MT::ElementType ET;
115  typedef IntrinsicTrait<ET> IT;
116  //**********************************************************************************************
117 
118  public:
119  //**Type definitions****************************************************************************
120  typedef UniLowerMatrix<MT,SO,true> This;
121  typedef This ResultType;
122  typedef UniLowerMatrix<OT,!SO,true> OppositeType;
123  typedef UniUpperMatrix<TT,!SO,true> TransposeType;
124  typedef ET ElementType;
125  typedef typename MT::IntrinsicType IntrinsicType;
126  typedef typename MT::ReturnType ReturnType;
127  typedef const This& CompositeType;
128  typedef UniLowerProxy<MT> Reference;
129  typedef typename MT::ConstReference ConstReference;
130  typedef typename MT::Pointer Pointer;
131  typedef typename MT::ConstPointer ConstPointer;
132  typedef typename MT::ConstIterator ConstIterator;
133  //**********************************************************************************************
134 
135  //**Rebind struct definition********************************************************************
138  template< typename ET > // Data type of the other matrix
139  struct Rebind {
141  typedef UniLowerMatrix< typename MT::template Rebind<ET>::Other > Other;
142  };
143  //**********************************************************************************************
144 
145  //**Iterator class definition*******************************************************************
148  class Iterator
149  {
150  public:
151  //**Type definitions*************************************************************************
152  typedef std::random_access_iterator_tag IteratorCategory;
153  typedef typename MT::ElementType ValueType;
154  typedef UniLowerProxy<MT> PointerType;
155  typedef UniLowerProxy<MT> ReferenceType;
156  typedef ptrdiff_t DifferenceType;
157 
158  // STL iterator requirements
159  typedef IteratorCategory iterator_category;
160  typedef ValueType value_type;
161  typedef PointerType pointer;
162  typedef ReferenceType reference;
163  typedef DifferenceType difference_type;
164  //*******************************************************************************************
165 
166  //**Constructor******************************************************************************
169  inline Iterator()
170  : matrix_( NULL ) // Reference to the adapted dense matrix
171  , row_ ( 0UL ) // The current row index of the iterator
172  , column_( 0UL ) // The current column index of the iterator
173  {}
174  //*******************************************************************************************
175 
176  //**Constructor******************************************************************************
183  inline Iterator( MT& matrix, size_t row, size_t column )
184  : matrix_( &matrix ) // Reference to the adapted dense matrix
185  , row_ ( row ) // The current row-index of the iterator
186  , column_( column ) // The current column-index of the iterator
187  {}
188  //*******************************************************************************************
189 
190  //**Addition assignment operator*************************************************************
196  inline Iterator& operator+=( size_t inc ) {
197  ( SO )?( row_ += inc ):( column_ += inc );
198  return *this;
199  }
200  //*******************************************************************************************
201 
202  //**Subtraction assignment operator**********************************************************
208  inline Iterator& operator-=( size_t dec ) {
209  ( SO )?( row_ -= dec ):( column_ -= dec );
210  return *this;
211  }
212  //*******************************************************************************************
213 
214  //**Prefix increment operator****************************************************************
219  inline Iterator& operator++() {
220  ( SO )?( ++row_ ):( ++column_ );
221  return *this;
222  }
223  //*******************************************************************************************
224 
225  //**Postfix increment operator***************************************************************
230  inline const Iterator operator++( int ) {
231  const Iterator tmp( *this );
232  ++(*this);
233  return tmp;
234  }
235  //*******************************************************************************************
236 
237  //**Prefix decrement operator****************************************************************
242  inline Iterator& operator--() {
243  ( SO )?( --row_ ):( --column_ );
244  return *this;
245  }
246  //*******************************************************************************************
247 
248  //**Postfix decrement operator***************************************************************
253  inline const Iterator operator--( int ) {
254  const Iterator tmp( *this );
255  --(*this);
256  return tmp;
257  }
258  //*******************************************************************************************
259 
260  //**Element access operator******************************************************************
265  inline ReferenceType operator*() const {
266  return ReferenceType( *matrix_, row_, column_ );
267  }
268  //*******************************************************************************************
269 
270  //**Element access operator******************************************************************
275  inline PointerType operator->() const {
276  return PointerType( *matrix_, row_, column_ );
277  }
278  //*******************************************************************************************
279 
280  //**Conversion operator**********************************************************************
285  inline operator ConstIterator() const {
286  if( SO )
287  return matrix_->begin( column_ ) + row_;
288  else
289  return matrix_->begin( row_ ) + column_;
290  }
291  //*******************************************************************************************
292 
293  //**Equality operator************************************************************************
300  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) {
301  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
302  }
303  //*******************************************************************************************
304 
305  //**Equality operator************************************************************************
312  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
313  return ( ConstIterator( lhs ) == rhs );
314  }
315  //*******************************************************************************************
316 
317  //**Equality operator************************************************************************
324  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
325  return ( lhs == ConstIterator( rhs ) );
326  }
327  //*******************************************************************************************
328 
329  //**Inequality operator**********************************************************************
336  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) {
337  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
338  }
339  //*******************************************************************************************
340 
341  //**Inequality operator**********************************************************************
348  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
349  return ( ConstIterator( lhs ) != rhs );
350  }
351  //*******************************************************************************************
352 
353  //**Inequality operator**********************************************************************
360  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
361  return ( lhs != ConstIterator( rhs ) );
362  }
363  //*******************************************************************************************
364 
365  //**Less-than operator***********************************************************************
372  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) {
373  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
374  }
375  //*******************************************************************************************
376 
377  //**Less-than operator***********************************************************************
384  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
385  return ( ConstIterator( lhs ) < rhs );
386  }
387  //*******************************************************************************************
388 
389  //**Less-than operator***********************************************************************
396  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
397  return ( lhs < ConstIterator( rhs ) );
398  }
399  //*******************************************************************************************
400 
401  //**Greater-than operator********************************************************************
408  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) {
409  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
410  }
411  //*******************************************************************************************
412 
413  //**Greater-than operator********************************************************************
420  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
421  return ( ConstIterator( lhs ) > rhs );
422  }
423  //*******************************************************************************************
424 
425  //**Greater-than operator********************************************************************
432  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
433  return ( lhs > ConstIterator( rhs ) );
434  }
435  //*******************************************************************************************
436 
437  //**Less-or-equal-than operator**************************************************************
444  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) {
445  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
446  }
447  //*******************************************************************************************
448 
449  //**Less-or-equal-than operator**************************************************************
456  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
457  return ( ConstIterator( lhs ) <= rhs );
458  }
459  //*******************************************************************************************
460 
461  //**Less-or-equal-than operator**************************************************************
468  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
469  return ( lhs <= ConstIterator( rhs ) );
470  }
471  //*******************************************************************************************
472 
473  //**Greater-or-equal-than operator***********************************************************
480  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) {
481  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
482  }
483  //*******************************************************************************************
484 
485  //**Greater-or-equal-than operator***********************************************************
492  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
493  return ( ConstIterator( lhs ) >= rhs );
494  }
495  //*******************************************************************************************
496 
497  //**Greater-or-equal-than operator***********************************************************
504  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
505  return ( lhs >= ConstIterator( rhs ) );
506  }
507  //*******************************************************************************************
508 
509  //**Subtraction operator*********************************************************************
515  inline DifferenceType operator-( const Iterator& rhs ) const {
516  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
517  }
518  //*******************************************************************************************
519 
520  //**Addition operator************************************************************************
527  friend inline const Iterator operator+( const Iterator& it, size_t inc ) {
528  if( SO )
529  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
530  else
531  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
532  }
533  //*******************************************************************************************
534 
535  //**Addition operator************************************************************************
542  friend inline const Iterator operator+( size_t inc, const Iterator& it ) {
543  if( SO )
544  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
545  else
546  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
547  }
548  //*******************************************************************************************
549 
550  //**Subtraction operator*********************************************************************
557  friend inline const Iterator operator-( const Iterator& it, size_t dec ) {
558  if( SO )
559  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
560  else
561  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
562  }
563  //*******************************************************************************************
564 
565  private:
566  //**Member variables*************************************************************************
567  MT* matrix_;
568  size_t row_;
569  size_t column_;
570  //*******************************************************************************************
571  };
572  //**********************************************************************************************
573 
574  //**Compilation flags***************************************************************************
576  enum { vectorizable = MT::vectorizable };
577 
579  enum { smpAssignable = MT::smpAssignable };
580  //**********************************************************************************************
581 
582  //**Constructors********************************************************************************
585  explicit inline UniLowerMatrix();
586  template< typename A1 > explicit inline UniLowerMatrix( const A1& a1 );
587  explicit inline UniLowerMatrix( size_t n, const ElementType& init );
588  inline UniLowerMatrix( const UniLowerMatrix& m );
590  //**********************************************************************************************
591 
592  //**Destructor**********************************************************************************
593  // No explicitly declared destructor.
594  //**********************************************************************************************
595 
596  //**Data access functions***********************************************************************
599  inline Reference operator()( size_t i, size_t j );
600  inline ConstReference operator()( size_t i, size_t j ) const;
601  inline ConstPointer data () const;
602  inline ConstPointer data ( size_t i ) const;
603  inline Iterator begin ( size_t i );
604  inline ConstIterator begin ( size_t i ) const;
605  inline ConstIterator cbegin( size_t i ) const;
606  inline Iterator end ( size_t i );
607  inline ConstIterator end ( size_t i ) const;
608  inline ConstIterator cend ( size_t i ) const;
610  //**********************************************************************************************
611 
612  //**Assignment operators************************************************************************
615  inline UniLowerMatrix& operator=( const ElementType& rhs );
616  inline UniLowerMatrix& operator=( const UniLowerMatrix& rhs );
617 
618  template< typename MT2, bool SO2 >
619  inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
620  operator=( const Matrix<MT2,SO2>& rhs );
621 
622  template< typename MT2, bool SO2 >
623  inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
624  operator=( const Matrix<MT2,SO2>& rhs );
625 
626  template< typename MT2, bool SO2 >
627  inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
628  operator+=( const Matrix<MT2,SO2>& rhs );
629 
630  template< typename MT2, bool SO2 >
631  inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
632  operator+=( const Matrix<MT2,SO2>& rhs );
633 
634  template< typename MT2, bool SO2 >
635  inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
636  operator-=( const Matrix<MT2,SO2>& rhs );
637 
638  template< typename MT2, bool SO2 >
639  inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
640  operator-=( const Matrix<MT2,SO2>& rhs );
641 
642  template< typename MT2, bool SO2 >
643  inline UniLowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
645  //**********************************************************************************************
646 
647  //**Utility functions***************************************************************************
650  inline size_t rows() const;
651  inline size_t columns() const;
652  inline size_t spacing() const;
653  inline size_t capacity() const;
654  inline size_t capacity( size_t i ) const;
655  inline size_t nonZeros() const;
656  inline size_t nonZeros( size_t i ) const;
657  inline void reset();
658  inline void reset( size_t i );
659  inline void clear();
660  void resize ( size_t n, bool preserve=true );
661  inline void extend ( size_t n, bool preserve=true );
662  inline void reserve( size_t elements );
663  inline void swap( UniLowerMatrix& m ) /* throw() */;
664 
665  static inline size_t maxNonZeros();
666  static inline size_t maxNonZeros( size_t n );
668  //**********************************************************************************************
669 
670  //**Expression template evaluation functions****************************************************
673  template< typename Other > inline bool canAlias ( const Other* alias ) const;
674  template< typename Other > inline bool isAliased( const Other* alias ) const;
675 
676  inline bool isAligned () const;
677  inline bool canSMPAssign() const;
678 
679  BLAZE_ALWAYS_INLINE IntrinsicType load ( size_t i, size_t j ) const;
680  BLAZE_ALWAYS_INLINE IntrinsicType loadu( size_t i, size_t j ) const;
682  //**********************************************************************************************
683 
684  private:
685  //**Construction functions**********************************************************************
688  inline const MT construct( size_t n , TrueType );
689  inline const MT construct( const ElementType& value, FalseType );
690 
691  template< typename MT2, bool SO2, typename T >
692  inline const MT construct( const Matrix<MT2,SO2>& m, T );
694  //**********************************************************************************************
695 
696  //**Member variables****************************************************************************
699  MT matrix_;
700 
701  //**********************************************************************************************
702 
703  //**Friend declarations*************************************************************************
704  template< typename MT2, bool SO2, bool DF2 >
705  friend MT2& derestrict( UniLowerMatrix<MT2,SO2,DF2>& m );
706  //**********************************************************************************************
707 
708  //**Compile time checks*************************************************************************
721  BLAZE_STATIC_ASSERT( IsResizable<MT>::value || IsSquare<MT>::value );
722  //**********************************************************************************************
723 };
725 //*************************************************************************************************
726 
727 
728 
729 
730 //=================================================================================================
731 //
732 // CONSTRUCTORS
733 //
734 //=================================================================================================
735 
736 //*************************************************************************************************
740 template< typename MT // Type of the adapted dense matrix
741  , bool SO > // Storage order of the adapted dense matrix
742 inline UniLowerMatrix<MT,SO,true>::UniLowerMatrix()
743  : matrix_() // The adapted dense matrix
744 {
745  for( size_t i=0UL; i<Rows<MT>::value; ++i )
746  matrix_(i,i) = ElementType(1);
747 
748  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
749 }
751 //*************************************************************************************************
752 
753 
754 //*************************************************************************************************
772 template< typename MT // Type of the adapted dense matrix
773  , bool SO > // Storage order of the adapted dense matrix
774 template< typename A1 > // Type of the constructor argument
775 inline UniLowerMatrix<MT,SO,true>::UniLowerMatrix( const A1& a1 )
776  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
777 {
778  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
779 }
781 //*************************************************************************************************
782 
783 
784 //*************************************************************************************************
791 template< typename MT // Type of the adapted dense matrix
792  , bool SO > // Storage order of the adapted dense matrix
793 inline UniLowerMatrix<MT,SO,true>::UniLowerMatrix( size_t n, const ElementType& init )
794  : matrix_( n, n, ElementType() ) // The adapted dense matrix
795 {
797 
798  if( SO ) {
799  for( size_t j=0UL; j<columns(); ++j ) {
800  matrix_(j,j) = ElementType(1);
801  for( size_t i=j+1UL; i<rows(); ++i )
802  matrix_(i,j) = init;
803  }
804  }
805  else {
806  for( size_t i=0UL; i<rows(); ++i ) {
807  for( size_t j=0UL; j<i; ++j )
808  matrix_(i,j) = init;
809  matrix_(i,i) = ElementType(1);
810  }
811  }
812 
813  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower 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 UniLowerMatrix<MT,SO,true>::UniLowerMatrix( const UniLowerMatrix& m )
828  : matrix_( m.matrix_ ) // The adapted dense matrix
829 {
830  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower 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  UniLowerMatrix<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  UniLowerMatrix<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 UniLowerMatrix<MT,SO,true>::ConstPointer
914  UniLowerMatrix<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 UniLowerMatrix<MT,SO,true>::ConstPointer
934  UniLowerMatrix<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
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  UniLowerMatrix<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  UniLowerMatrix<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
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  UniLowerMatrix<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  UniLowerMatrix<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 UniLowerMatrix<MT,SO,true>&
1104  UniLowerMatrix<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+1UL; i<rows(); ++i )
1109  matrix_(i,j) = rhs;
1110  }
1111  else {
1112  for( size_t i=1UL; 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 UniLowerMatrix<MT,SO,true>&
1136  UniLowerMatrix<MT,SO,true>::operator=( const UniLowerMatrix& 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>, UniLowerMatrix<MT,SO,true>& >::Type
1164  UniLowerMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1165 {
1166  if( IsStrictlyTriangular<MT2>::value || ( !IsUniLower<MT2>::value && !isUniLower( ~rhs ) ) )
1167  throw std::invalid_argument( "Invalid assignment to unilower 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>, UniLowerMatrix<MT,SO,true>& >::Type
1195  UniLowerMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1196 {
1197  if( IsStrictlyTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1198  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1199 
1200  if( IsUniLower<MT2>::value ) {
1201  matrix_ = ~rhs;
1202  }
1203  else {
1204  MT tmp( ~rhs );
1205 
1206  if( !isUniLower( tmp ) )
1207  throw std::invalid_argument( "Invalid assignment to unilower 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>, UniLowerMatrix<MT,SO,true>& >::Type
1236  UniLowerMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1237 {
1238  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1239  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) )
1240  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1241 
1242  matrix_ += ~rhs;
1243 
1244  return *this;
1245 }
1247 //*************************************************************************************************
1248 
1249 
1250 //*************************************************************************************************
1263 template< typename MT // Type of the adapted dense matrix
1264  , bool SO > // Storage order of the adapted dense matrix
1265 template< typename MT2 // Type of the right-hand side matrix
1266  , bool SO2 > // Storage order of the right-hand side matrix
1267 inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,true>& >::Type
1268  UniLowerMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1269 {
1270  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1271  ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1272  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1273 
1274  if( IsStrictlyLower<MT2>::value ) {
1275  matrix_ += ~rhs;
1276  }
1277  else {
1278  typename MT2::ResultType tmp( ~rhs );
1279 
1280  if( !isStrictlyLower( tmp ) )
1281  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1282 
1283  matrix_ += tmp;
1284  }
1285 
1286  return *this;
1287 }
1289 //*************************************************************************************************
1290 
1291 
1292 //*************************************************************************************************
1305 template< typename MT // Type of the adapted dense matrix
1306  , bool SO > // Storage order of the adapted dense matrix
1307 template< typename MT2 // Type of the right-hand side matrix
1308  , bool SO2 > // Storage order of the right-hand side matrix
1309 inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,true>& >::Type
1310  UniLowerMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1311 {
1312  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1313  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) )
1314  throw std::invalid_argument( "Invalid assignment to unilower 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>, UniLowerMatrix<MT,SO,true>& >::Type
1342  UniLowerMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1343 {
1344  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1345  ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1346  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1347 
1348  if( IsStrictlyLower<MT2>::value ) {
1349  matrix_ -= ~rhs;
1350  }
1351  else {
1352  typename MT2::ResultType tmp( ~rhs );
1353 
1354  if( !isStrictlyLower( tmp ) )
1355  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1356 
1357  matrix_ -= tmp;
1358  }
1359 
1360  return *this;
1361 }
1363 //*************************************************************************************************
1364 
1365 
1366 //*************************************************************************************************
1378 template< typename MT // Type of the adapted dense matrix
1379  , bool SO > // Storage order of the adapted dense matrix
1380 template< typename MT2 // Type of the right-hand side matrix
1381  , bool SO2 > // Storage order of the right-hand side matrix
1382 inline UniLowerMatrix<MT,SO,true>&
1383  UniLowerMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1384 {
1385  if( matrix_.rows() != (~rhs).columns() )
1386  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1387 
1388  MT tmp( matrix_ * ~rhs );
1389 
1390  if( !isUniLower( tmp ) )
1391  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1392 
1393  move( matrix_, tmp );
1394 
1395  return *this;
1396 }
1398 //*************************************************************************************************
1399 
1400 
1401 
1402 
1403 //=================================================================================================
1404 //
1405 // UTILITY FUNCTIONS
1406 //
1407 //=================================================================================================
1408 
1409 //*************************************************************************************************
1415 template< typename MT // Type of the adapted dense matrix
1416  , bool SO > // Storage order of the adapted dense matrix
1417 inline size_t UniLowerMatrix<MT,SO,true>::rows() const
1418 {
1419  return matrix_.rows();
1420 }
1422 //*************************************************************************************************
1423 
1424 
1425 //*************************************************************************************************
1431 template< typename MT // Type of the adapted dense matrix
1432  , bool SO > // Storage order of the adapted dense matrix
1433 inline size_t UniLowerMatrix<MT,SO,true>::columns() const
1434 {
1435  return matrix_.columns();
1436 }
1438 //*************************************************************************************************
1439 
1440 
1441 //*************************************************************************************************
1452 template< typename MT // Type of the adapted dense matrix
1453  , bool SO > // Storage order of the adapted dense matrix
1454 inline size_t UniLowerMatrix<MT,SO,true>::spacing() const
1455 {
1456  return matrix_.spacing();
1457 }
1459 //*************************************************************************************************
1460 
1461 
1462 //*************************************************************************************************
1468 template< typename MT // Type of the adapted dense matrix
1469  , bool SO > // Storage order of the adapted dense matrix
1470 inline size_t UniLowerMatrix<MT,SO,true>::capacity() const
1471 {
1472  return matrix_.capacity();
1473 }
1475 //*************************************************************************************************
1476 
1477 
1478 //*************************************************************************************************
1490 template< typename MT // Type of the adapted dense matrix
1491  , bool SO > // Storage order of the adapted dense matrix
1492 inline size_t UniLowerMatrix<MT,SO,true>::capacity( size_t i ) const
1493 {
1494  return matrix_.capacity(i);
1495 }
1497 //*************************************************************************************************
1498 
1499 
1500 //*************************************************************************************************
1506 template< typename MT // Type of the adapted dense matrix
1507  , bool SO > // Storage order of the adapted dense matrix
1508 inline size_t UniLowerMatrix<MT,SO,true>::nonZeros() const
1509 {
1510  return matrix_.nonZeros();
1511 }
1513 //*************************************************************************************************
1514 
1515 
1516 //*************************************************************************************************
1528 template< typename MT // Type of the adapted dense matrix
1529  , bool SO > // Storage order of the adapted dense matrix
1530 inline size_t UniLowerMatrix<MT,SO,true>::nonZeros( size_t i ) const
1531 {
1532  return matrix_.nonZeros(i);
1533 }
1535 //*************************************************************************************************
1536 
1537 
1538 //*************************************************************************************************
1544 template< typename MT // Type of the adapted dense matrix
1545  , bool SO > // Storage order of the adapted dense matrix
1547 {
1548  using blaze::clear;
1549 
1550  if( SO ) {
1551  for( size_t j=0UL; j<columns(); ++j )
1552  for( size_t i=j+1UL; i<rows(); ++i )
1553  clear( matrix_(i,j) );
1554  }
1555  else {
1556  for( size_t i=1UL; i<rows(); ++i )
1557  for( size_t j=0UL; j<i; ++j )
1558  clear( matrix_(i,j) );
1559  }
1560 }
1562 //*************************************************************************************************
1563 
1564 
1565 //*************************************************************************************************
1578 template< typename MT // Type of the adapted dense matrix
1579  , bool SO > // Storage order of the adapted dense matrix
1580 inline void UniLowerMatrix<MT,SO,true>::reset( size_t i )
1581 {
1582  using blaze::clear;
1583 
1584  if( SO ) {
1585  for( size_t j=i+1UL; j<rows(); ++j )
1586  clear( matrix_(j,i) );
1587  }
1588  else {
1589  for( size_t j=0UL; j<i; ++j )
1590  clear( matrix_(i,j) );
1591  }
1592 }
1594 //*************************************************************************************************
1595 
1596 
1597 //*************************************************************************************************
1609 template< typename MT // Type of the adapted dense matrix
1610  , bool SO > // Storage order of the adapted dense matrix
1612 {
1613  using blaze::clear;
1614 
1615  if( IsResizable<MT>::value ) {
1616  clear( matrix_ );
1617  }
1618  else {
1619  reset();
1620  }
1621 }
1623 //*************************************************************************************************
1624 
1625 
1626 //*************************************************************************************************
1662 template< typename MT // Type of the adapted dense matrix
1663  , bool SO > // Storage order of the adapted dense matrix
1664 void UniLowerMatrix<MT,SO,true>::resize( size_t n, bool preserve )
1665 {
1667 
1668  UNUSED_PARAMETER( preserve );
1669 
1670  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
1671 
1672  const size_t oldsize( matrix_.rows() );
1673 
1674  matrix_.resize( n, n, true );
1675 
1676  if( n > oldsize )
1677  {
1678  const size_t increment( n - oldsize );
1679  submatrix( matrix_, 0UL, oldsize, n-1UL, increment ).reset();
1680 
1681  for( size_t i=oldsize; i<n; ++i )
1682  matrix_(i,i) = ElementType(1);
1683  }
1684 }
1686 //*************************************************************************************************
1687 
1688 
1689 //*************************************************************************************************
1702 template< typename MT // Type of the adapted dense matrix
1703  , bool SO > // Storage order of the adapted dense matrix
1704 inline void UniLowerMatrix<MT,SO,true>::extend( size_t n, bool preserve )
1705 {
1707 
1708  UNUSED_PARAMETER( preserve );
1709 
1710  resize( rows() + n, true );
1711 }
1712 //*************************************************************************************************
1713 
1714 
1715 //*************************************************************************************************
1725 template< typename MT // Type of the adapted dense matrix
1726  , bool SO > // Storage order of the adapted dense matrix
1727 inline void UniLowerMatrix<MT,SO,true>::reserve( size_t elements )
1728 {
1729  matrix_.reserve( elements );
1730 }
1732 //*************************************************************************************************
1733 
1734 
1735 //*************************************************************************************************
1743 template< typename MT // Type of the adapted dense matrix
1744  , bool SO > // Storage order of the adapted dense matrix
1745 inline void UniLowerMatrix<MT,SO,true>::swap( UniLowerMatrix& m ) /* throw() */
1746 {
1747  using std::swap;
1748 
1749  swap( matrix_, m.matrix_ );
1750 }
1752 //*************************************************************************************************
1753 
1754 
1755 //*************************************************************************************************
1767 template< typename MT // Type of the adapted dense matrix
1768  , bool SO > // Storage order of the adapted dense matrix
1769 inline size_t UniLowerMatrix<MT,SO,true>::maxNonZeros()
1770 {
1772 
1773  return maxNonZeros( Rows<MT>::value );
1774 }
1776 //*************************************************************************************************
1777 
1778 
1779 //*************************************************************************************************
1789 template< typename MT // Type of the adapted dense matrix
1790  , bool SO > // Storage order of the adapted dense matrix
1791 inline size_t UniLowerMatrix<MT,SO,true>::maxNonZeros( size_t n )
1792 {
1793  return ( ( n + 1UL ) * n ) / 2UL;
1794 }
1796 //*************************************************************************************************
1797 
1798 
1799 
1800 
1801 //=================================================================================================
1802 //
1803 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1804 //
1805 //=================================================================================================
1806 
1807 //*************************************************************************************************
1818 template< typename MT // Type of the adapted dense matrix
1819  , bool SO > // Storage order of the adapted dense matrix
1820 template< typename Other > // Data type of the foreign expression
1821 inline bool UniLowerMatrix<MT,SO,true>::canAlias( const Other* alias ) const
1822 {
1823  return matrix_.canAlias( alias );
1824 }
1826 //*************************************************************************************************
1827 
1828 
1829 //*************************************************************************************************
1840 template< typename MT // Type of the adapted dense matrix
1841  , bool SO > // Storage order of the adapted dense matrix
1842 template< typename Other > // Data type of the foreign expression
1843 inline bool UniLowerMatrix<MT,SO,true>::isAliased( const Other* alias ) const
1844 {
1845  return matrix_.isAliased( alias );
1846 }
1848 //*************************************************************************************************
1849 
1850 
1851 //*************************************************************************************************
1861 template< typename MT // Type of the adapted dense matrix
1862  , bool SO > // Storage order of the adapted dense matrix
1863 inline bool UniLowerMatrix<MT,SO,true>::isAligned() const
1864 {
1865  return matrix_.isAligned();
1866 }
1868 //*************************************************************************************************
1869 
1870 
1871 //*************************************************************************************************
1882 template< typename MT // Type of the adapted dense matrix
1883  , bool SO > // Storage order of the adapted dense matrix
1884 inline bool UniLowerMatrix<MT,SO,true>::canSMPAssign() const
1885 {
1886  return matrix_.canSMPAssign();
1887 }
1889 //*************************************************************************************************
1890 
1891 
1892 //*************************************************************************************************
1908 template< typename MT // Type of the adapted dense matrix
1909  , bool SO > // Storage order of the adapted dense matrix
1910 BLAZE_ALWAYS_INLINE typename UniLowerMatrix<MT,SO,true>::IntrinsicType
1911  UniLowerMatrix<MT,SO,true>::load( size_t i, size_t j ) const
1912 {
1913  return matrix_.load( i, j );
1914 }
1916 //*************************************************************************************************
1917 
1918 
1919 //*************************************************************************************************
1935 template< typename MT // Type of the adapted dense matrix
1936  , bool SO > // Storage order of the adapted dense matrix
1937 BLAZE_ALWAYS_INLINE typename UniLowerMatrix<MT,SO,true>::IntrinsicType
1938  UniLowerMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const
1939 {
1940  return matrix_.loadu( i, j );
1941 }
1943 //*************************************************************************************************
1944 
1945 
1946 
1947 
1948 //=================================================================================================
1949 //
1950 // CONSTRUCTION FUNCTIONS
1951 //
1952 //=================================================================================================
1953 
1954 //*************************************************************************************************
1961 template< typename MT // Type of the adapted dense matrix
1962  , bool SO > // Storage order of the adapted dense matrix
1963 inline const MT UniLowerMatrix<MT,SO,true>::construct( size_t n, TrueType )
1964 {
1966 
1967  MT tmp( n, n, ElementType() );
1968 
1969  for( size_t i=0UL; i<n; ++i )
1970  tmp(i,i) = ElementType(1);
1971 
1972  return tmp;
1973 }
1975 //*************************************************************************************************
1976 
1977 
1978 //*************************************************************************************************
1985 template< typename MT // Type of the adapted dense matrix
1986  , bool SO > // Storage order of the adapted dense matrix
1987 inline const MT UniLowerMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
1988 {
1991 
1992  MT tmp;
1993 
1994  if( SO ) {
1995  for( size_t j=0UL; j<tmp.columns(); ++j ) {
1996  tmp(j,j) = ElementType(1);
1997  for( size_t i=j+1UL; i<tmp.rows(); ++i )
1998  tmp(i,j) = init;
1999  }
2000  }
2001  else {
2002  for( size_t i=0UL; i<tmp.rows(); ++i ) {
2003  for( size_t j=0UL; j<i; ++j )
2004  tmp(i,j) = init;
2005  tmp(i,i) = ElementType(1);
2006  }
2007  }
2008 
2009  return tmp;
2010 }
2012 //*************************************************************************************************
2013 
2014 
2015 //*************************************************************************************************
2026 template< typename MT // Type of the adapted dense matrix
2027  , bool SO > // Storage order of the adapted dense matrix
2028 template< typename MT2 // Type of the foreign matrix
2029  , bool SO2 // Storage order of the foreign matrix
2030  , typename T > // Type of the third argument
2031 inline const MT UniLowerMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2032 {
2033  const MT tmp( ~m );
2034 
2035  if( IsStrictlyTriangular<MT2>::value || ( !IsUniLower<MT2>::value && !isUniLower( tmp ) ) )
2036  throw std::invalid_argument( "Invalid setup of unilower matrix" );
2037 
2038  return tmp;
2039 }
2041 //*************************************************************************************************
2042 
2043 } // namespace blaze
2044 
2045 #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
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h: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 isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1121
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.
Header file for the IsUniLower type trait.
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 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.
Header file for the IsStrictlyTriangular 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
bool isUniLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower unitriangular matrix.
Definition: DenseMatrix.h:1041
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 the IsStrictlyLower type trait.
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 UniLowerProxy class.
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_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
#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
Header file for the IsUpper type trait.
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.
Header file for the implementation of the base template of the UniLowerMatrix.