Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_UNILOWERMATRIX_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <stdexcept>
45 #include <vector>
57 #include <blaze/math/Functions.h>
58 #include <blaze/math/shims/Clear.h>
60 #include <blaze/math/shims/Move.h>
72 #include <blaze/util/Assert.h>
78 #include <blaze/util/DisableIf.h>
79 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
100 template< typename MT // Type of the adapted sparse matrix
101  , bool SO > // Storage order of the adapted sparse matrix
102 class UniLowerMatrix<MT,SO,false>
103  : public SparseMatrix< UniLowerMatrix<MT,SO,false>, SO >
104 {
105  private:
106  //**Type definitions****************************************************************************
107  typedef typename MT::OppositeType OT;
108  typedef typename MT::TransposeType TT;
109  typedef typename MT::ElementType ET;
110  //**********************************************************************************************
111 
112  public:
113  //**Type definitions****************************************************************************
114  typedef UniLowerMatrix<MT,SO,false> This;
115  typedef This ResultType;
116  typedef UniLowerMatrix<OT,!SO,false> OppositeType;
117  typedef UniUpperMatrix<TT,!SO,false> TransposeType;
118  typedef ET ElementType;
119  typedef typename MT::ReturnType ReturnType;
120  typedef const This& CompositeType;
121  typedef UniLowerProxy<MT> Reference;
122  typedef typename MT::ConstReference ConstReference;
123  typedef typename MT::ConstIterator ConstIterator;
124  //**********************************************************************************************
125 
126  //**Rebind struct definition********************************************************************
129  template< typename ET > // Data type of the other matrix
130  struct Rebind {
132  typedef UniLowerMatrix< typename MT::template Rebind<ET>::Other > Other;
133  };
134  //**********************************************************************************************
135 
136  //**UniLowerValue class definition*************************************************************
139  class UniLowerValue
140  {
141  private:
142  //**struct BuiltinType***********************************************************************
145  template< typename T >
146  struct BuiltinType { typedef INVALID_TYPE Type; };
147  //*******************************************************************************************
148 
149  //**struct ComplexType***********************************************************************
152  template< typename T >
153  struct ComplexType { typedef typename T::value_type Type; };
154  //*******************************************************************************************
155 
156  public:
157  //**Type definitions*************************************************************************
159  typedef typename If< IsComplex<ElementType>
160  , ComplexType<ElementType>
161  , BuiltinType<ElementType> >::Type::Type ValueType;
162 
163  typedef ValueType value_type;
164  //*******************************************************************************************
165 
166  //**Constructor******************************************************************************
172  inline UniLowerValue( ElementType& value, bool diagonal )
173  : value_ ( &value ) // The represented value.
174  , diagonal_( diagonal ) // true in case the element is on the diagonal, false if not
175  {}
176  //*******************************************************************************************
177 
178  //*******************************************************************************************
185  inline UniLowerValue& operator=( const UniLowerValue& uv ) {
186  if( diagonal_ )
187  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
188  *value_ = *uv.value;
189  return *this;
190  }
191  //*******************************************************************************************
192 
193  //*******************************************************************************************
200  template< typename T > inline UniLowerValue& operator=( const T& v ) {
201  if( diagonal_ )
202  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
203  *value_ = v;
204  return *this;
205  }
206  //*******************************************************************************************
207 
208  //*******************************************************************************************
215  template< typename T > inline UniLowerValue& operator+=( const T& v ) {
216  if( diagonal_ )
217  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
218  *value_ += v;
219  return *this;
220  }
221  //*******************************************************************************************
222 
223  //*******************************************************************************************
230  template< typename T > inline UniLowerValue& operator-=( const T& v ) {
231  if( diagonal_ )
232  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
233  *value_ -= v;
234  return *this;
235  }
236  //*******************************************************************************************
237 
238  //*******************************************************************************************
245  template< typename T > inline UniLowerValue& operator*=( const T& v ) {
246  if( diagonal_ )
247  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
248  *value_ *= v;
249  return *this;
250  }
251  //*******************************************************************************************
252 
253  //*******************************************************************************************
260  template< typename T > inline UniLowerValue& operator/=( const T& v ) {
261  if( diagonal_ )
262  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
263  *value_ /= v;
264  return *this;
265  }
266  //*******************************************************************************************
267 
268  //*******************************************************************************************
273  inline operator ElementType() const {
274  return *value_;
275  }
276  //*******************************************************************************************
277 
278  //*******************************************************************************************
286  inline ValueType real() const {
287  return value_->real();
288  }
289  //*******************************************************************************************
290 
291  //*******************************************************************************************
301  inline void real( ValueType value ) const {
302  if( diagonal_ )
303  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
304  value_->real( value );
305  }
306  //*******************************************************************************************
307 
308  //*******************************************************************************************
316  inline ValueType imag() const {
317  return value_->imag();
318  }
319  //*******************************************************************************************
320 
321  //*******************************************************************************************
331  inline void imag( ValueType value ) const {
332  if( diagonal_ )
333  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
334  value_->imag( value );
335  }
336  //*******************************************************************************************
337 
338  private:
339  //**Member variables*************************************************************************
340  ElementType* value_;
341  bool diagonal_;
342  //*******************************************************************************************
343  };
344  //**********************************************************************************************
345 
346  //**UniLowerElement class definition************************************************************
349  class UniLowerElement : private SparseElement
350  {
351  private:
352  //**Type definitions*************************************************************************
353  typedef typename MT::Iterator IteratorType;
354  //*******************************************************************************************
355 
356  public:
357  //**Type definitions*************************************************************************
358  typedef UniLowerValue ValueType;
359  typedef size_t IndexType;
360  typedef UniLowerValue Reference;
361  typedef const UniLowerValue ConstReference;
362  typedef UniLowerElement* Pointer;
363  //*******************************************************************************************
364 
365  //**Constructor******************************************************************************
371  inline UniLowerElement( IteratorType pos, bool diagonal )
372  : pos_ ( pos ) // Iterator to the current lower unitriangular matrix element
373  , diagonal_( diagonal ) // true in case the element is on the diagonal, false if not
374  {}
375  //*******************************************************************************************
376 
377  //**Assignment operator**********************************************************************
384  template< typename T > inline UniLowerElement& operator=( const T& v ) {
385  if( diagonal_ )
386  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
387  *pos_ = v;
388  return *this;
389  }
390  //*******************************************************************************************
391 
392  //**Addition assignment operator*************************************************************
399  template< typename T > inline UniLowerElement& operator+=( const T& v ) {
400  if( diagonal_ )
401  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
402  *pos_ += v;
403  return *this;
404  }
405  //*******************************************************************************************
406 
407  //**Subtraction assignment operator**********************************************************
414  template< typename T > inline UniLowerElement& operator-=( const T& v ) {
415  if( diagonal_ )
416  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
417  *pos_ -= v;
418  return *this;
419  }
420  //*******************************************************************************************
421 
422  //**Multiplication assignment operator*******************************************************
429  template< typename T > inline UniLowerElement& operator*=( const T& v ) {
430  if( diagonal_ )
431  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
432  *pos_ *= v;
433  return *this;
434  }
435  //*******************************************************************************************
436 
437  //**Division assignment operator*************************************************************
444  template< typename T > inline UniLowerElement& operator/=( const T& v ) {
445  if( diagonal_ )
446  throw std::invalid_argument( "Invalid assignment to diagonal matrix element" );
447  *pos_ /= v;
448  return *this;
449  }
450  //*******************************************************************************************
451 
452  //**Element access operator******************************************************************
457  inline Pointer operator->() {
458  return this;
459  }
460  //*******************************************************************************************
461 
462  //**Value function***************************************************************************
467  inline Reference value() const {
468  return Reference( pos_->value(), diagonal_ );
469  }
470  //*******************************************************************************************
471 
472  //**Index function***************************************************************************
477  inline IndexType index() const {
478  return pos_->index();
479  }
480  //*******************************************************************************************
481 
482  private:
483  //**Member variables*************************************************************************
484  IteratorType pos_;
485  bool diagonal_;
486  //*******************************************************************************************
487  };
488  //**********************************************************************************************
489 
490  //**Iterator class definition*******************************************************************
493  class Iterator
494  {
495  public:
496  //**Type definitions*************************************************************************
497  typedef typename MT::Iterator IteratorType;
498 
499  typedef std::forward_iterator_tag IteratorCategory;
500  typedef UniLowerElement ValueType;
501  typedef ValueType PointerType;
502  typedef ValueType ReferenceType;
503  typedef ptrdiff_t DifferenceType;
504 
505  // STL iterator requirements
506  typedef IteratorCategory iterator_category;
507  typedef ValueType value_type;
508  typedef PointerType pointer;
509  typedef ReferenceType reference;
510  typedef DifferenceType difference_type;
511  //*******************************************************************************************
512 
513  //**Default constructor**********************************************************************
516  inline Iterator()
517  : pos_ ( ) // Iterator to the current lower unitriangular matrix element
518  , index_ ( 0UL ) // The row/column index of the iterator
519  {}
520  //*******************************************************************************************
521 
522  //**Constructor******************************************************************************
528  inline Iterator( IteratorType pos, size_t index )
529  : pos_ ( pos ) // Iterator to the current lower unitriangular matrix element
530  , index_( index ) // The row/column index of the iterator
531  {}
532  //*******************************************************************************************
533 
534  //**Prefix increment operator****************************************************************
539  inline Iterator& operator++() {
540  ++pos_;
541  return *this;
542  }
543  //*******************************************************************************************
544 
545  //**Postfix increment operator***************************************************************
550  inline const Iterator operator++( int ) {
551  const Iterator tmp( *this );
552  ++(*this);
553  return tmp;
554  }
555  //*******************************************************************************************
556 
557  //**Element access operator******************************************************************
562  inline ReferenceType operator*() const {
563  return ReferenceType( pos_, pos_->index() == index_ );
564  }
565  //*******************************************************************************************
566 
567  //**Element access operator******************************************************************
572  inline PointerType operator->() const {
573  return PointerType( pos_, pos_->index() == index_ );
574  }
575  //*******************************************************************************************
576 
577  //**Conversion operator**********************************************************************
582  inline operator ConstIterator() const {
583  return pos_;
584  }
585  //*******************************************************************************************
586 
587  //**Equality operator************************************************************************
593  inline bool operator==( const Iterator& rhs ) const {
594  return pos_ == rhs.pos_;
595  }
596  //*******************************************************************************************
597 
598  //**Inequality operator**********************************************************************
604  inline bool operator!=( const Iterator& rhs ) const {
605  return !( *this == rhs );
606  }
607  //*******************************************************************************************
608 
609  //**Subtraction operator*********************************************************************
615  inline DifferenceType operator-( const Iterator& rhs ) const {
616  return pos_ - rhs.pos_;
617  }
618  //*******************************************************************************************
619 
620  //**Base function****************************************************************************
625  inline IteratorType base() const {
626  return pos_;
627  }
628  //*******************************************************************************************
629 
630  private:
631  //**Member variables*************************************************************************
632  IteratorType pos_;
633  size_t index_;
634  //*******************************************************************************************
635  };
636  //**********************************************************************************************
637 
638  //**Compilation flags***************************************************************************
640  enum { smpAssignable = 0 };
641  //**********************************************************************************************
642 
643  //**Constructors********************************************************************************
646  explicit inline UniLowerMatrix();
647  explicit inline UniLowerMatrix( size_t n );
648  explicit inline UniLowerMatrix( size_t n, size_t nonzeros );
649  explicit inline UniLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
650 
651  inline UniLowerMatrix( const UniLowerMatrix& m );
652  template< typename MT2, bool SO2 > inline UniLowerMatrix( const Matrix<MT2,SO2>& m );
654  //**********************************************************************************************
655 
656  //**Destructor**********************************************************************************
657  // No explicitly declared destructor.
658  //**********************************************************************************************
659 
660  //**Data access functions***********************************************************************
663  inline Reference operator()( size_t i, size_t j );
664  inline ConstReference operator()( size_t i, size_t j ) const;
665  inline Iterator begin ( size_t i );
666  inline ConstIterator begin ( size_t i ) const;
667  inline ConstIterator cbegin( size_t i ) const;
668  inline Iterator end ( size_t i );
669  inline ConstIterator end ( size_t i ) const;
670  inline ConstIterator cend ( size_t i ) const;
672  //**********************************************************************************************
673 
674  //**Assignment operators************************************************************************
677  inline UniLowerMatrix& operator=( const UniLowerMatrix& rhs );
678 
679  template< typename MT2, bool SO2 >
680  inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
681  operator=( const Matrix<MT2,SO2>& rhs );
682 
683  template< typename MT2, bool SO2 >
684  inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
685  operator=( const Matrix<MT2,SO2>& rhs );
686 
687  template< typename MT2, bool SO2 >
688  inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
689  operator+=( const Matrix<MT2,SO2>& rhs );
690 
691  template< typename MT2, bool SO2 >
692  inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
693  operator+=( const Matrix<MT2,SO2>& rhs );
694 
695  template< typename MT2, bool SO2 >
696  inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
697  operator-=( const Matrix<MT2,SO2>& rhs );
698 
699  template< typename MT2, bool SO2 >
700  inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix& >::Type
701  operator-=( const Matrix<MT2,SO2>& rhs );
702 
703  template< typename MT2, bool SO2 >
704  inline UniLowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
706  //**********************************************************************************************
707 
708  //**Utility functions***************************************************************************
711  inline size_t rows() const;
712  inline size_t columns() const;
713  inline size_t capacity() const;
714  inline size_t capacity( size_t i ) const;
715  inline size_t nonZeros() const;
716  inline size_t nonZeros( size_t i ) const;
717  inline void reset();
718  inline void reset( size_t i );
719  inline void clear();
720  inline Iterator set( size_t i, size_t j, const ElementType& value );
721  inline Iterator insert( size_t i, size_t j, const ElementType& value );
722  inline void erase( size_t i, size_t j );
723  inline Iterator erase( size_t i, Iterator pos );
724  inline Iterator erase( size_t i, Iterator first, Iterator last );
725  inline void resize ( size_t n, bool preserve=true );
726  inline void reserve( size_t nonzeros );
727  inline void reserve( size_t i, size_t nonzeros );
728  inline void trim();
729  inline void trim( size_t i );
730  inline void swap( UniLowerMatrix& m ) /* throw() */;
731 
732  static inline size_t maxNonZeros();
733  static inline size_t maxNonZeros( size_t n );
735  //**********************************************************************************************
736 
737  //**Lookup functions****************************************************************************
740  inline Iterator find ( size_t i, size_t j );
741  inline ConstIterator find ( size_t i, size_t j ) const;
742  inline Iterator lowerBound( size_t i, size_t j );
743  inline ConstIterator lowerBound( size_t i, size_t j ) const;
744  inline Iterator upperBound( size_t i, size_t j );
745  inline ConstIterator upperBound( size_t i, size_t j ) const;
747  //**********************************************************************************************
748 
749  //**Low-level utility functions*****************************************************************
752  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
753  inline void finalize( size_t i );
755  //**********************************************************************************************
756 
757  //**Expression template evaluation functions****************************************************
760  template< typename Other > inline bool canAlias ( const Other* alias ) const;
761  template< typename Other > inline bool isAliased( const Other* alias ) const;
762 
763  inline bool canSMPAssign() const;
765  //**********************************************************************************************
766 
767  private:
768  //**Utility functions***************************************************************************
771  inline void resetUpper();
773  //**********************************************************************************************
774 
775  //**Member variables****************************************************************************
778  MT matrix_;
779 
780  //**********************************************************************************************
781 
782  //**Friend declarations*************************************************************************
783  template< typename MT2, bool SO2, bool DF2 >
784  friend MT2& derestrict( UniLowerMatrix<MT2,SO2,DF2>& m );
785  //**********************************************************************************************
786 
787  //**Compile time checks*************************************************************************
800  BLAZE_STATIC_ASSERT( IsResizable<MT>::value || IsSquare<MT>::value );
801  //**********************************************************************************************
802 };
804 //*************************************************************************************************
805 
806 
807 
808 
809 //=================================================================================================
810 //
811 // CONSTRUCTORS
812 //
813 //=================================================================================================
814 
815 //*************************************************************************************************
819 template< typename MT // Type of the adapted sparse matrix
820  , bool SO > // Storage order of the adapted sparse matrix
821 inline UniLowerMatrix<MT,SO,false>::UniLowerMatrix()
822  : matrix_() // The adapted sparse matrix
823 {
824  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
825 }
827 //*************************************************************************************************
828 
829 
830 //*************************************************************************************************
838 template< typename MT // Type of the adapted sparse matrix
839  , bool SO > // Storage order of the adapted sparse matrix
840 inline UniLowerMatrix<MT,SO,false>::UniLowerMatrix( size_t n )
841  : matrix_( n, n, n ) // The adapted sparse matrix
842 {
844 
845  for( size_t i=0UL; i<n; ++i ) {
846  matrix_.append( i, i, ElementType(1) );
847  matrix_.finalize( i );
848  }
849 
850  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
851 }
853 //*************************************************************************************************
854 
855 
856 //*************************************************************************************************
866 template< typename MT // Type of the adapted sparse matrix
867  , bool SO > // Storage order of the adapted sparse matrix
868 inline UniLowerMatrix<MT,SO,false>::UniLowerMatrix( size_t n, size_t nonzeros )
869  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
870 {
872 
873  for( size_t i=0UL; i<n; ++i ) {
874  matrix_.append( i, i, ElementType(1) );
875  matrix_.finalize( i );
876  }
877 
878  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
879 }
881 //*************************************************************************************************
882 
883 
884 //*************************************************************************************************
898 template< typename MT // Type of the adapted sparse matrix
899  , bool SO > // Storage order of the adapted sparse matrix
900 inline UniLowerMatrix<MT,SO,false>::UniLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
901  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
902 {
904 
905  for( size_t i=0UL; i<n; ++i )
906  {
907  if( nonzeros[i] == 0UL )
908  throw std::invalid_argument( "Invalid capacity specification" );
909 
910  matrix_.append( i, i, ElementType(1) );
911  matrix_.finalize( i );
912  }
913 
914  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
915 }
917 //*************************************************************************************************
918 
919 
920 //*************************************************************************************************
926 template< typename MT // Type of the adapted sparse matrix
927  , bool SO > // Storage order of the adapted sparse matrix
928 inline UniLowerMatrix<MT,SO,false>::UniLowerMatrix( const UniLowerMatrix& m )
929  : matrix_( m.matrix_ ) // The adapted sparse matrix
930 {
931  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
932 }
934 //*************************************************************************************************
935 
936 
937 //*************************************************************************************************
947 template< typename MT // Type of the adapted sparse matrix
948  , bool SO > // Storage order of the adapted sparse matrix
949 template< typename MT2 // Type of the foreign matrix
950  , bool SO2 > // Storage order of the foreign matrix
951 inline UniLowerMatrix<MT,SO,false>::UniLowerMatrix( const Matrix<MT2,SO2>& m )
952  : matrix_( ~m ) // The adapted sparse matrix
953 {
954  if( !IsUniLower<MT2>::value && !isUniLower( matrix_ ) )
955  throw std::invalid_argument( "Invalid setup of unilower matrix" );
956 
957  if( !IsUniLower<MT2>::value )
958  resetUpper();
959 
960  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
961 }
963 //*************************************************************************************************
964 
965 
966 
967 
968 //=================================================================================================
969 //
970 // DATA ACCESS FUNCTIONS
971 //
972 //=================================================================================================
973 
974 //*************************************************************************************************
986 template< typename MT // Type of the adapted sparse matrix
987  , bool SO > // Storage order of the adapted sparse matrix
989  UniLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
990 {
991  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
992  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
993 
994  return Reference( matrix_, i, j );
995 }
997 //*************************************************************************************************
998 
999 
1000 //*************************************************************************************************
1012 template< typename MT // Type of the adapted sparse matrix
1013  , bool SO > // Storage order of the adapted sparse matrix
1015  UniLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
1016 {
1017  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1018  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1019 
1020  return matrix_(i,j);
1021 }
1023 //*************************************************************************************************
1024 
1025 
1026 //*************************************************************************************************
1038 template< typename MT // Type of the adapted sparse matrix
1039  , bool SO > // Storage order of the adapted sparse matrix
1042 {
1043  return Iterator( matrix_.begin(i), i );
1044 }
1046 //*************************************************************************************************
1047 
1048 
1049 //*************************************************************************************************
1061 template< typename MT // Type of the adapted sparse matrix
1062  , bool SO > // Storage order of the adapted sparse matrix
1064  UniLowerMatrix<MT,SO,false>::begin( size_t i ) const
1065 {
1066  return matrix_.begin(i);
1067 }
1069 //*************************************************************************************************
1070 
1071 
1072 //*************************************************************************************************
1084 template< typename MT // Type of the adapted sparse matrix
1085  , bool SO > // Storage order of the adapted sparse matrix
1087  UniLowerMatrix<MT,SO,false>::cbegin( size_t i ) const
1088 {
1089  return matrix_.cbegin(i);
1090 }
1092 //*************************************************************************************************
1093 
1094 
1095 //*************************************************************************************************
1107 template< typename MT // Type of the adapted sparse matrix
1108  , bool SO > // Storage order of the adapted sparse matrix
1111 {
1112  return Iterator( matrix_.end(i), i );
1113 }
1115 //*************************************************************************************************
1116 
1117 
1118 //*************************************************************************************************
1130 template< typename MT // Type of the adapted sparse matrix
1131  , bool SO > // Storage order of the adapted sparse matrix
1133  UniLowerMatrix<MT,SO,false>::end( size_t i ) const
1134 {
1135  return matrix_.end(i);
1136 }
1138 //*************************************************************************************************
1139 
1140 
1141 //*************************************************************************************************
1153 template< typename MT // Type of the adapted sparse matrix
1154  , bool SO > // Storage order of the adapted sparse matrix
1156  UniLowerMatrix<MT,SO,false>::cend( size_t i ) const
1157 {
1158  return matrix_.cend(i);
1159 }
1161 //*************************************************************************************************
1162 
1163 
1164 
1165 
1166 //=================================================================================================
1167 //
1168 // ASSIGNMENT OPERATORS
1169 //
1170 //=================================================================================================
1171 
1172 //*************************************************************************************************
1182 template< typename MT // Type of the adapted sparse matrix
1183  , bool SO > // Storage order of the adapted sparse matrix
1184 inline UniLowerMatrix<MT,SO,false>&
1185  UniLowerMatrix<MT,SO,false>::operator=( const UniLowerMatrix& rhs )
1186 {
1187  matrix_ = rhs.matrix_;
1188 
1189  return *this;
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 //*************************************************************************************************
1208 template< typename MT // Type of the adapted sparse matrix
1209  , bool SO > // Storage order of the adapted sparse matrix
1210 template< typename MT2 // Type of the right-hand side matrix
1211  , bool SO2 > // Storage order of the right-hand side matrix
1212 inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,false>& >::Type
1213  UniLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
1214 {
1215  if( IsStrictlyTriangular<MT2>::value || ( !IsUniLower<MT2>::value && !isUniLower( ~rhs ) ) )
1216  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1217 
1218  matrix_ = ~rhs;
1219 
1220  if( !IsUniLower<MT2>::value )
1221  resetUpper();
1222 
1223  return *this;
1224 }
1226 //*************************************************************************************************
1227 
1228 
1229 //*************************************************************************************************
1242 template< typename MT // Type of the adapted sparse matrix
1243  , bool SO > // Storage order of the adapted sparse matrix
1244 template< typename MT2 // Type of the right-hand side matrix
1245  , bool SO2 > // Storage order of the right-hand side matrix
1246 inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,false>& >::Type
1247  UniLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
1248 {
1249  if( IsStrictlyTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1250  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1251 
1252  if( IsUniLower<MT2>::value ) {
1253  matrix_ = ~rhs;
1254  }
1255  else {
1256  MT tmp( ~rhs );
1257 
1258  if( !isUniLower( tmp ) )
1259  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1260 
1261  move( matrix_, tmp );
1262  }
1263 
1264  if( !IsUniLower<MT2>::value )
1265  resetUpper();
1266 
1267  return *this;
1268 }
1270 //*************************************************************************************************
1271 
1272 
1273 //*************************************************************************************************
1286 template< typename MT // Type of the adapted sparse matrix
1287  , bool SO > // Storage order of the adapted sparse matrix
1288 template< typename MT2 // Type of the right-hand side matrix
1289  , bool SO2 > // Storage order of the right-hand side matrix
1290 inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,false>& >::Type
1291  UniLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1292 {
1293  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1294  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) )
1295  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1296 
1297  matrix_ += ~rhs;
1298 
1299  if( !IsStrictlyLower<MT2>::value )
1300  resetUpper();
1301 
1302  return *this;
1303 }
1305 //*************************************************************************************************
1306 
1307 
1308 //*************************************************************************************************
1321 template< typename MT // Type of the adapted sparse matrix
1322  , bool SO > // Storage order of the adapted sparse matrix
1323 template< typename MT2 // Type of the right-hand side matrix
1324  , bool SO2 > // Storage order of the right-hand side matrix
1325 inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,false>& >::Type
1326  UniLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1327 {
1328  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1329  ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1330  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1331 
1332  if( IsStrictlyLower<MT2>::value ) {
1333  matrix_ += ~rhs;
1334  }
1335  else {
1336  typename MT2::ResultType tmp( ~rhs );
1337 
1338  if( !isStrictlyLower( tmp ) )
1339  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1340 
1341  matrix_ += tmp;
1342  }
1343 
1344  if( !IsStrictlyLower<MT2>::value )
1345  resetUpper();
1346 
1347  return *this;
1348 }
1350 //*************************************************************************************************
1351 
1352 
1353 //*************************************************************************************************
1366 template< typename MT // Type of the adapted sparse matrix
1367  , bool SO > // Storage order of the adapted sparse matrix
1368 template< typename MT2 // Type of the right-hand side matrix
1369  , bool SO2 > // Storage order of the right-hand side matrix
1370 inline typename DisableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,false>& >::Type
1371  UniLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1372 {
1373  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1374  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) )
1375  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1376 
1377  matrix_ -= ~rhs;
1378 
1379  if( !IsStrictlyLower<MT2>::value )
1380  resetUpper();
1381 
1382  return *this;
1383 }
1385 //*************************************************************************************************
1386 
1387 
1388 //*************************************************************************************************
1401 template< typename MT // Type of the adapted sparse matrix
1402  , bool SO > // Storage order of the adapted sparse matrix
1403 template< typename MT2 // Type of the right-hand side matrix
1404  , bool SO2 > // Storage order of the right-hand side matrix
1405 inline typename EnableIf< IsComputation<MT2>, UniLowerMatrix<MT,SO,false>& >::Type
1406  UniLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1407 {
1408  if( IsUpper<MT2>::value || IsUniTriangular<MT2>::value ||
1409  ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) )
1410  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1411 
1412  if( IsStrictlyLower<MT2>::value ) {
1413  matrix_ -= ~rhs;
1414  }
1415  else {
1416  typename MT2::ResultType tmp( ~rhs );
1417 
1418  if( !isStrictlyLower( tmp ) )
1419  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1420 
1421  matrix_ -= tmp;
1422  }
1423 
1424  if( !IsStrictlyLower<MT2>::value )
1425  resetUpper();
1426 
1427  return *this;
1428 }
1430 //*************************************************************************************************
1431 
1432 
1433 //*************************************************************************************************
1445 template< typename MT // Type of the adapted sparse matrix
1446  , bool SO > // Storage order of the adapted sparse matrix
1447 template< typename MT2 // Type of the right-hand side matrix
1448  , bool SO2 > // Storage order of the right-hand side matrix
1449 inline UniLowerMatrix<MT,SO,false>&
1450  UniLowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1451 {
1452  if( matrix_.rows() != (~rhs).columns() )
1453  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1454 
1455  MT tmp( matrix_ * ~rhs );
1456 
1457  if( !isUniLower( tmp ) )
1458  throw std::invalid_argument( "Invalid assignment to unilower matrix" );
1459 
1460  move( matrix_, tmp );
1461 
1462  if( !IsUniLower<MT2>::value )
1463  resetUpper();
1464 
1465  return *this;
1466 }
1468 //*************************************************************************************************
1469 
1470 
1471 
1472 
1473 //=================================================================================================
1474 //
1475 // UTILITY FUNCTIONS
1476 //
1477 //=================================================================================================
1478 
1479 //*************************************************************************************************
1485 template< typename MT // Type of the adapted sparse matrix
1486  , bool SO > // Storage order of the adapted sparse matrix
1487 inline size_t UniLowerMatrix<MT,SO,false>::rows() const
1488 {
1489  return matrix_.rows();
1490 }
1492 //*************************************************************************************************
1493 
1494 
1495 //*************************************************************************************************
1501 template< typename MT // Type of the adapted sparse matrix
1502  , bool SO > // Storage order of the adapted sparse matrix
1503 inline size_t UniLowerMatrix<MT,SO,false>::columns() const
1504 {
1505  return matrix_.columns();
1506 }
1508 //*************************************************************************************************
1509 
1510 
1511 //*************************************************************************************************
1517 template< typename MT // Type of the adapted sparse matrix
1518  , bool SO > // Storage order of the adapted sparse matrix
1519 inline size_t UniLowerMatrix<MT,SO,false>::capacity() const
1520 {
1521  return matrix_.capacity();
1522 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1539 template< typename MT // Type of the adapted sparse matrix
1540  , bool SO > // Storage order of the adapted sparse matrix
1541 inline size_t UniLowerMatrix<MT,SO,false>::capacity( size_t i ) const
1542 {
1543  return matrix_.capacity(i);
1544 }
1546 //*************************************************************************************************
1547 
1548 
1549 //*************************************************************************************************
1555 template< typename MT // Type of the adapted sparse matrix
1556  , bool SO > // Storage order of the adapted sparse matrix
1557 inline size_t UniLowerMatrix<MT,SO,false>::nonZeros() const
1558 {
1559  return matrix_.nonZeros();
1560 }
1562 //*************************************************************************************************
1563 
1564 
1565 //*************************************************************************************************
1577 template< typename MT // Type of the adapted sparse matrix
1578  , bool SO > // Storage order of the adapted sparse matrix
1579 inline size_t UniLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1580 {
1581  return matrix_.nonZeros(i);
1582 }
1584 //*************************************************************************************************
1585 
1586 
1587 //*************************************************************************************************
1593 template< typename MT // Type of the adapted sparse matrix
1594  , bool SO > // Storage order of the adapted sparse matrix
1596 {
1597  if( SO ) {
1598  for( size_t j=0UL; j<columns(); ++j ) {
1599  matrix_.erase( j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1600  }
1601  }
1602  else {
1603  for( size_t i=1UL; i<rows(); ++i ) {
1604  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1605  }
1606  }
1607 }
1609 //*************************************************************************************************
1610 
1611 
1612 //*************************************************************************************************
1625 template< typename MT // Type of the adapted sparse matrix
1626  , bool SO > // Storage order of the adapted sparse matrix
1627 inline void UniLowerMatrix<MT,SO,false>::reset( size_t i )
1628 {
1629  if( SO ) {
1630  matrix_.erase( i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1631  }
1632  else {
1633  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1634  }
1635 }
1637 //*************************************************************************************************
1638 
1639 
1640 //*************************************************************************************************
1648 template< typename MT // Type of the adapted sparse matrix
1649  , bool SO > // Storage order of the adapted sparse matrix
1651 {
1652  using blaze::clear;
1653 
1654  if( IsResizable<MT>::value ) {
1655  clear( matrix_ );
1656  }
1657  else {
1658  reset();
1659  }
1660 }
1662 //*************************************************************************************************
1663 
1664 
1665 //*************************************************************************************************
1681 template< typename MT // Type of the adapted sparse matrix
1682  , bool SO > // Storage order of the adapted sparse matrix
1684  UniLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1685 {
1686  if( i <= j )
1687  throw std::invalid_argument( "Invalid access to diagonal or upper matrix element" );
1688 
1689  return Iterator( matrix_.set( i, j, value ), ( SO ? j : i ) );
1690 }
1692 //*************************************************************************************************
1693 
1694 
1695 //*************************************************************************************************
1712 template< typename MT // Type of the adapted sparse matrix
1713  , bool SO > // Storage order of the adapted sparse matrix
1715  UniLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1716 {
1717  if( i <= j )
1718  throw std::invalid_argument( "Invalid access to diagonal or upper matrix element" );
1719 
1720  return Iterator( matrix_.insert( i, j, value ), ( SO ? j : i ) );
1721 }
1723 //*************************************************************************************************
1724 
1725 
1726 //*************************************************************************************************
1738 template< typename MT // Type of the adapted sparse matrix
1739  , bool SO > // Storage order of the adapted sparse matrix
1740 inline void UniLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1741 {
1742  if( i == j )
1743  throw std::invalid_argument( "Invalid access to diagonal matrix element" );
1744 
1745  matrix_.erase( i, j );
1746 }
1748 //*************************************************************************************************
1749 
1750 
1751 //*************************************************************************************************
1765 template< typename MT // Type of the adapted sparse matrix
1766  , bool SO > // Storage order of the adapted sparse matrix
1768  UniLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1769 {
1770  if( pos != matrix_.end(i) && pos->index() == i )
1771  throw std::invalid_argument( "Invalid access to diagonal matrix element" );
1772 
1773  return Iterator( matrix_.erase( i, pos.base() ), i );
1774 }
1776 //*************************************************************************************************
1777 
1778 
1779 //*************************************************************************************************
1794 template< typename MT // Type of the adapted sparse matrix
1795  , bool SO > // Storage order of the adapted sparse matrix
1797  UniLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1798 {
1799  for( Iterator element=first; element!=last; ++element ) {
1800  if( element->index() == i )
1801  throw std::invalid_argument( "Invalid access to diagonal matrix element" );
1802  }
1803 
1804  return Iterator( matrix_.erase( i, first.base(), last.base() ), i );
1805 }
1807 //*************************************************************************************************
1808 
1809 
1810 //*************************************************************************************************
1825 template< typename MT // Type of the adapted sparse matrix
1826  , bool SO > // Storage order of the adapted sparse matrix
1827 void UniLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1828 {
1830 
1831  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square unilower matrix detected" );
1832 
1833  const size_t oldsize( matrix_.rows() );
1834 
1835  matrix_.resize( n, n, preserve );
1836 
1837  if( n > oldsize ) {
1838  for( size_t i=oldsize; i<n; ++i )
1839  matrix_.insert( i, i, ElementType(1) );
1840  }
1841 }
1843 //*************************************************************************************************
1844 
1845 
1846 //*************************************************************************************************
1857 template< typename MT // Type of the adapted sparse matrix
1858  , bool SO > // Storage order of the adapted sparse matrix
1859 inline void UniLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1860 {
1861  matrix_.reserve( nonzeros );
1862 }
1864 //*************************************************************************************************
1865 
1866 
1867 //*************************************************************************************************
1881 template< typename MT // Type of the adapted sparse matrix
1882  , bool SO > // Storage order of the adapted sparse matrix
1883 inline void UniLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1884 {
1885  matrix_.reserve( i, nonzeros );
1886 }
1888 //*************************************************************************************************
1889 
1890 
1891 //*************************************************************************************************
1902 template< typename MT // Type of the adapted sparse matrix
1903  , bool SO > // Storage order of the adapted sparse matrix
1904 inline void UniLowerMatrix<MT,SO,false>::trim()
1905 {
1906  matrix_.trim();
1907 }
1909 //*************************************************************************************************
1910 
1911 
1912 //*************************************************************************************************
1924 template< typename MT // Type of the adapted sparse matrix
1925  , bool SO > // Storage order of the adapted sparse matrix
1926 inline void UniLowerMatrix<MT,SO,false>::trim( size_t i )
1927 {
1928  matrix_.trim( i );
1929 }
1931 //*************************************************************************************************
1932 
1933 
1934 //*************************************************************************************************
1942 template< typename MT // Type of the adapted sparse matrix
1943  , bool SO > // Storage order of the adapted sparse matrix
1944 inline void UniLowerMatrix<MT,SO,false>::swap( UniLowerMatrix& m ) /* throw() */
1945 {
1946  using std::swap;
1947 
1948  swap( matrix_, m.matrix_ );
1949 }
1951 //*************************************************************************************************
1952 
1953 
1954 //*************************************************************************************************
1965 template< typename MT // Type of the adapted dense matrix
1966  , bool SO > // Storage order of the adapted dense matrix
1967 inline size_t UniLowerMatrix<MT,SO,false>::maxNonZeros()
1968 {
1970 
1971  return maxNonZeros( Rows<MT>::value );
1972 }
1974 //*************************************************************************************************
1975 
1976 
1977 //*************************************************************************************************
1987 template< typename MT // Type of the adapted dense matrix
1988  , bool SO > // Storage order of the adapted dense matrix
1989 inline size_t UniLowerMatrix<MT,SO,false>::maxNonZeros( size_t n )
1990 {
1991  return ( ( n + 1UL ) * n ) / 2UL;
1992 }
1994 //*************************************************************************************************
1995 
1996 
1997 //*************************************************************************************************
2003 template< typename MT // Type of the adapted dense matrix
2004  , bool SO > // Storage order of the adapted dense matrix
2005 inline void UniLowerMatrix<MT,SO,false>::resetUpper()
2006 {
2007  if( SO ) {
2008  for( size_t j=1UL; j<columns(); ++j )
2009  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
2010  }
2011  else {
2012  for( size_t i=0UL; i<rows(); ++i )
2013  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
2014  }
2015 }
2017 //*************************************************************************************************
2018 
2019 
2020 
2021 
2022 //=================================================================================================
2023 //
2024 // LOOKUP FUNCTIONS
2025 //
2026 //=================================================================================================
2027 
2028 //*************************************************************************************************
2044 template< typename MT // Type of the adapted sparse matrix
2045  , bool SO > // Storage order of the adapted sparse matrix
2047  UniLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
2048 {
2049  return Iterator( matrix_.find( i, j ), ( SO ? j : i ) );
2050 }
2052 //*************************************************************************************************
2053 
2054 
2055 //*************************************************************************************************
2071 template< typename MT // Type of the adapted sparse matrix
2072  , bool SO > // Storage order of the adapted sparse matrix
2074  UniLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2075 {
2076  return matrix_.find( i, j );
2077 }
2079 //*************************************************************************************************
2080 
2081 
2082 //*************************************************************************************************
2098 template< typename MT // Type of the adapted sparse matrix
2099  , bool SO > // Storage order of the adapted sparse matrix
2101  UniLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2102 {
2103  return Iterator( matrix_.lowerBound( i, j ), ( SO ? j : i ) );
2104 }
2106 //*************************************************************************************************
2107 
2108 
2109 //*************************************************************************************************
2125 template< typename MT // Type of the adapted sparse matrix
2126  , bool SO > // Storage order of the adapted sparse matrix
2128  UniLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2129 {
2130  return matrix_.lowerBound( i, j );
2131 }
2133 //*************************************************************************************************
2134 
2135 
2136 //*************************************************************************************************
2152 template< typename MT // Type of the adapted sparse matrix
2153  , bool SO > // Storage order of the adapted sparse matrix
2155  UniLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2156 {
2157  return Iterator( matrix_.upperBound( i, j ), ( SO ? j : i ) );
2158 }
2160 //*************************************************************************************************
2161 
2162 
2163 //*************************************************************************************************
2179 template< typename MT // Type of the adapted sparse matrix
2180  , bool SO > // Storage order of the adapted sparse matrix
2182  UniLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2183 {
2184  return matrix_.upperBound( i, j );
2185 }
2187 //*************************************************************************************************
2188 
2189 
2190 
2191 
2192 //=================================================================================================
2193 //
2194 // LOW-LEVEL UTILITY FUNCTIONS
2195 //
2196 //=================================================================================================
2197 
2198 //*************************************************************************************************
2248 template< typename MT // Type of the adapted sparse matrix
2249  , bool SO > // Storage order of the adapted sparse matrix
2250 inline void UniLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
2251 {
2252  if( i <= j )
2253  throw std::invalid_argument( "Invalid access to diagonal or upper matrix element" );
2254 
2255  if( !check || !isDefault( value ) )
2256  matrix_.insert( i, j, value );
2257 }
2259 //*************************************************************************************************
2260 
2261 
2262 //*************************************************************************************************
2276 template< typename MT // Type of the adapted sparse matrix
2277  , bool SO > // Storage order of the adapted sparse matrix
2278 inline void UniLowerMatrix<MT,SO,false>::finalize( size_t i )
2279 {
2280  matrix_.trim( i );
2281 }
2283 //*************************************************************************************************
2284 
2285 
2286 
2287 
2288 //=================================================================================================
2289 //
2290 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2291 //
2292 //=================================================================================================
2293 
2294 //*************************************************************************************************
2305 template< typename MT // Type of the adapted sparse matrix
2306  , bool SO > // Storage order of the adapted sparse matrix
2307 template< typename Other > // Data type of the foreign expression
2308 inline bool UniLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const
2309 {
2310  return matrix_.canAlias( alias );
2311 }
2313 //*************************************************************************************************
2314 
2315 
2316 //*************************************************************************************************
2327 template< typename MT // Type of the adapted sparse matrix
2328  , bool SO > // Storage order of the adapted sparse matrix
2329 template< typename Other > // Data type of the foreign expression
2330 inline bool UniLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const
2331 {
2332  return matrix_.isAliased( alias );
2333 }
2335 //*************************************************************************************************
2336 
2337 
2338 //*************************************************************************************************
2349 template< typename MT // Type of the adapted sparse matrix
2350  , bool SO > // Storage order of the adapted sparse matrix
2351 inline bool UniLowerMatrix<MT,SO,false>::canSMPAssign() const
2352 {
2353  return matrix_.canSMPAssign();
2354 }
2356 //*************************************************************************************************
2357 
2358 } // namespace blaze
2359 
2360 #endif
#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
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1649
Constraint on the data type.
Header file for mathematical functions.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8247
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:902
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:237
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:4825
BLAZE_ALWAYS_INLINE 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
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
#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
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
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2501
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:116
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:386
Constraint on the data type.
Header file for the 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 SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:4789
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
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
Constraint on the data type.
Header file for the SparseElement base class.
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.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:841
Header file for the UniLowerProxy class.
Header file for the IsNumeric type trait.
Header file for all adaptor forward declarations.
#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
#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.
double real
Floating point data type of the Blaze library.This type definition offers the possibility to switch t...
Definition: Precision.h:47
#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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
Header file for the move shim.
#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.
#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.
#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.
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
Header file for the implementation of the base template of the UniLowerMatrix.