Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <algorithm>
44 #include <vector>
57 #include <blaze/math/Functions.h>
58 #include <blaze/math/shims/Clear.h>
60 #include <blaze/math/shims/Move.h>
70 #include <blaze/util/Assert.h>
75 #include <blaze/util/DisableIf.h>
76 #include <blaze/util/EnableIf.h>
77 #include <blaze/util/Exception.h>
80 #include <blaze/util/Types.h>
81 
82 
83 namespace blaze {
84 
85 //=================================================================================================
86 //
87 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
88 //
89 //=================================================================================================
90 
91 //*************************************************************************************************
99 template< typename MT // Type of the adapted sparse matrix
100  , bool SO > // Storage order of the adapted sparse matrix
101 class StrictlyLowerMatrix<MT,SO,false>
102  : public SparseMatrix< StrictlyLowerMatrix<MT,SO,false>, SO >
103 {
104  private:
105  //**Type definitions****************************************************************************
106  typedef typename MT::OppositeType OT;
107  typedef typename MT::TransposeType TT;
108  typedef typename MT::ElementType ET;
109  //**********************************************************************************************
110 
111  public:
112  //**Type definitions****************************************************************************
113  typedef StrictlyLowerMatrix<MT,SO,false> This;
114  typedef This ResultType;
115  typedef StrictlyLowerMatrix<OT,!SO,false> OppositeType;
116  typedef StrictlyUpperMatrix<TT,!SO,false> TransposeType;
117  typedef ET ElementType;
118  typedef typename MT::ReturnType ReturnType;
119  typedef const This& CompositeType;
120  typedef StrictlyLowerProxy<MT> Reference;
121  typedef typename MT::ConstReference ConstReference;
122  typedef typename MT::Iterator Iterator;
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 StrictlyLowerMatrix< typename MT::template Rebind<ET>::Other > Other;
133  };
134  //**********************************************************************************************
135 
136  //**Compilation flags***************************************************************************
138  enum { smpAssignable = 0 };
139  //**********************************************************************************************
140 
141  //**Constructors********************************************************************************
144  explicit inline StrictlyLowerMatrix();
145  explicit inline StrictlyLowerMatrix( size_t n );
146  explicit inline StrictlyLowerMatrix( size_t n, size_t nonzeros );
147  explicit inline StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
148 
149  inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
150  template< typename MT2, bool SO2 > inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
152  //**********************************************************************************************
153 
154  //**Destructor**********************************************************************************
155  // No explicitly declared destructor.
156  //**********************************************************************************************
157 
158  //**Data access functions***********************************************************************
161  inline Reference operator()( size_t i, size_t j );
162  inline ConstReference operator()( size_t i, size_t j ) const;
163  inline Reference at( size_t i, size_t j );
164  inline ConstReference at( size_t i, size_t j ) const;
165  inline Iterator begin ( size_t i );
166  inline ConstIterator begin ( size_t i ) const;
167  inline ConstIterator cbegin( size_t i ) const;
168  inline Iterator end ( size_t i );
169  inline ConstIterator end ( size_t i ) const;
170  inline ConstIterator cend ( size_t i ) const;
172  //**********************************************************************************************
173 
174  //**Assignment operators************************************************************************
177  inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
178 
179  template< typename MT2, bool SO2 >
180  inline typename DisableIf< IsComputation<MT2>, StrictlyLowerMatrix& >::Type
181  operator=( const Matrix<MT2,SO2>& rhs );
182 
183  template< typename MT2, bool SO2 >
184  inline typename EnableIf< IsComputation<MT2>, StrictlyLowerMatrix& >::Type
185  operator=( const Matrix<MT2,SO2>& rhs );
186 
187  template< typename MT2, bool SO2 >
188  inline typename DisableIf< IsComputation<MT2>, StrictlyLowerMatrix& >::Type
189  operator+=( const Matrix<MT2,SO2>& rhs );
190 
191  template< typename MT2, bool SO2 >
192  inline typename EnableIf< IsComputation<MT2>, StrictlyLowerMatrix& >::Type
193  operator+=( const Matrix<MT2,SO2>& rhs );
194 
195  template< typename MT2, bool SO2 >
196  inline typename DisableIf< IsComputation<MT2>, StrictlyLowerMatrix& >::Type
197  operator-=( const Matrix<MT2,SO2>& rhs );
198 
199  template< typename MT2, bool SO2 >
200  inline typename EnableIf< IsComputation<MT2>, StrictlyLowerMatrix& >::Type
201  operator-=( const Matrix<MT2,SO2>& rhs );
202 
203  template< typename MT2, bool SO2 >
204  inline StrictlyLowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
205 
206  template< typename Other >
207  inline typename EnableIf< IsNumeric<Other>, StrictlyLowerMatrix >::Type&
208  operator*=( Other rhs );
209 
210  template< typename Other >
211  inline typename EnableIf< IsNumeric<Other>, StrictlyLowerMatrix >::Type&
212  operator/=( Other rhs );
214  //**********************************************************************************************
215 
216  //**Utility functions***************************************************************************
219  inline size_t rows() const;
220  inline size_t columns() const;
221  inline size_t capacity() const;
222  inline size_t capacity( size_t i ) const;
223  inline size_t nonZeros() const;
224  inline size_t nonZeros( size_t i ) const;
225  inline void reset();
226  inline void reset( size_t i );
227  inline void clear();
228  inline Iterator set( size_t i, size_t j, const ElementType& value );
229  inline Iterator insert( size_t i, size_t j, const ElementType& value );
230  inline void erase( size_t i, size_t j );
231  inline Iterator erase( size_t i, Iterator pos );
232  inline Iterator erase( size_t i, Iterator first, Iterator last );
233  inline void resize ( size_t n, bool preserve=true );
234  inline void reserve( size_t nonzeros );
235  inline void reserve( size_t i, size_t nonzeros );
236  inline void trim();
237  inline void trim( size_t i );
238 
239  template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
240  template< typename Other > inline StrictlyLowerMatrix& scaleDiagonal( Other scale );
241 
242  inline void swap( StrictlyLowerMatrix& m ) /* throw() */;
243 
244  static inline size_t maxNonZeros();
245  static inline size_t maxNonZeros( size_t n );
247  //**********************************************************************************************
248 
249  //**Lookup functions****************************************************************************
252  inline Iterator find ( size_t i, size_t j );
253  inline ConstIterator find ( size_t i, size_t j ) const;
254  inline Iterator lowerBound( size_t i, size_t j );
255  inline ConstIterator lowerBound( size_t i, size_t j ) const;
256  inline Iterator upperBound( size_t i, size_t j );
257  inline ConstIterator upperBound( size_t i, size_t j ) const;
259  //**********************************************************************************************
260 
261  //**Low-level utility functions*****************************************************************
264  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
265  inline void finalize( size_t i );
267  //**********************************************************************************************
268 
269  //**Debugging functions*************************************************************************
272  inline bool isIntact() const;
274  //**********************************************************************************************
275 
276  //**Expression template evaluation functions****************************************************
279  template< typename Other > inline bool canAlias ( const Other* alias ) const;
280  template< typename Other > inline bool isAliased( const Other* alias ) const;
281 
282  inline bool canSMPAssign() const;
284  //**********************************************************************************************
285 
286  private:
287  //**Utility functions***************************************************************************
290  inline void resetUpper();
292  //**********************************************************************************************
293 
294  //**Member variables****************************************************************************
297  MT matrix_;
298 
299  //**********************************************************************************************
300 
301  //**Friend declarations*************************************************************************
302  template< typename MT2, bool SO2, bool DF2 >
303  friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
304  //**********************************************************************************************
305 
306  //**Compile time checks*************************************************************************
319  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
320  //**********************************************************************************************
321 };
323 //*************************************************************************************************
324 
325 
326 
327 
328 //=================================================================================================
329 //
330 // CONSTRUCTORS
331 //
332 //=================================================================================================
333 
334 //*************************************************************************************************
338 template< typename MT // Type of the adapted sparse matrix
339  , bool SO > // Storage order of the adapted sparse matrix
340 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix()
341  : matrix_() // The adapted sparse matrix
342 {
343  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
344 }
346 //*************************************************************************************************
347 
348 
349 //*************************************************************************************************
357 template< typename MT // Type of the adapted sparse matrix
358  , bool SO > // Storage order of the adapted sparse matrix
359 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n )
360  : matrix_( n, n, n ) // The adapted sparse matrix
361 {
363 
364  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
365 }
367 //*************************************************************************************************
368 
369 
370 //*************************************************************************************************
380 template< typename MT // Type of the adapted sparse matrix
381  , bool SO > // Storage order of the adapted sparse matrix
382 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, size_t nonzeros )
383  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
384 {
386 
387  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
388 }
390 //*************************************************************************************************
391 
392 
393 //*************************************************************************************************
407 template< typename MT // Type of the adapted sparse matrix
408  , bool SO > // Storage order of the adapted sparse matrix
409 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
410  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
411 {
413 
414  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
415 }
417 //*************************************************************************************************
418 
419 
420 //*************************************************************************************************
426 template< typename MT // Type of the adapted sparse matrix
427  , bool SO > // Storage order of the adapted sparse matrix
428 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
429  : matrix_( m.matrix_ ) // The adapted sparse matrix
430 {
431  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
432  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
433 }
435 //*************************************************************************************************
436 
437 
438 //*************************************************************************************************
449 template< typename MT // Type of the adapted sparse matrix
450  , bool SO > // Storage order of the adapted sparse matrix
451 template< typename MT2 // Type of the foreign matrix
452  , bool SO2 > // Storage order of the foreign matrix
453 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
454  : matrix_( ~m ) // The adapted sparse matrix
455 {
456  if( IsUniTriangular<MT2>::value ||
457  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( matrix_ ) ) ) {
458  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
459  }
460 
461  if( !IsStrictlyLower<MT2>::value )
462  resetUpper();
463 
464  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
465  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
466 }
468 //*************************************************************************************************
469 
470 
471 
472 
473 //=================================================================================================
474 //
475 // DATA ACCESS FUNCTIONS
476 //
477 //=================================================================================================
478 
479 //*************************************************************************************************
495 template< typename MT // Type of the adapted sparse matrix
496  , bool SO > // Storage order of the adapted sparse matrix
498  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
499 {
500  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
501  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
502 
503  return Reference( matrix_, i, j );
504 }
506 //*************************************************************************************************
507 
508 
509 //*************************************************************************************************
525 template< typename MT // Type of the adapted sparse matrix
526  , bool SO > // Storage order of the adapted sparse matrix
528  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
529 {
530  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
531  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
532 
533  return matrix_(i,j);
534 }
536 //*************************************************************************************************
537 
538 
539 //*************************************************************************************************
556 template< typename MT // Type of the adapted sparse matrix
557  , bool SO > // Storage order of the adapted sparse matrix
559  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
560 {
561  if( i >= rows() ) {
562  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
563  }
564  if( j >= columns() ) {
565  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
566  }
567  return (*this)(i,j);
568 }
570 //*************************************************************************************************
571 
572 
573 //*************************************************************************************************
590 template< typename MT // Type of the adapted sparse matrix
591  , bool SO > // Storage order of the adapted sparse matrix
593  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
594 {
595  if( i >= rows() ) {
596  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
597  }
598  if( j >= columns() ) {
599  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
600  }
601  return (*this)(i,j);
602 }
604 //*************************************************************************************************
605 
606 
607 //*************************************************************************************************
619 template< typename MT // Type of the adapted sparse matrix
620  , bool SO > // Storage order of the adapted sparse matrix
623 {
624  return matrix_.begin(i);
625 }
627 //*************************************************************************************************
628 
629 
630 //*************************************************************************************************
642 template< typename MT // Type of the adapted sparse matrix
643  , bool SO > // Storage order of the adapted sparse matrix
646 {
647  return matrix_.begin(i);
648 }
650 //*************************************************************************************************
651 
652 
653 //*************************************************************************************************
665 template< typename MT // Type of the adapted sparse matrix
666  , bool SO > // Storage order of the adapted sparse matrix
669 {
670  return matrix_.cbegin(i);
671 }
673 //*************************************************************************************************
674 
675 
676 //*************************************************************************************************
688 template< typename MT // Type of the adapted sparse matrix
689  , bool SO > // Storage order of the adapted sparse matrix
692 {
693  return matrix_.end(i);
694 }
696 //*************************************************************************************************
697 
698 
699 //*************************************************************************************************
711 template< typename MT // Type of the adapted sparse matrix
712  , bool SO > // Storage order of the adapted sparse matrix
714  StrictlyLowerMatrix<MT,SO,false>::end( size_t i ) const
715 {
716  return matrix_.end(i);
717 }
719 //*************************************************************************************************
720 
721 
722 //*************************************************************************************************
734 template< typename MT // Type of the adapted sparse matrix
735  , bool SO > // Storage order of the adapted sparse matrix
738 {
739  return matrix_.cend(i);
740 }
742 //*************************************************************************************************
743 
744 
745 
746 
747 //=================================================================================================
748 //
749 // ASSIGNMENT OPERATORS
750 //
751 //=================================================================================================
752 
753 //*************************************************************************************************
763 template< typename MT // Type of the adapted sparse matrix
764  , bool SO > // Storage order of the adapted sparse matrix
765 inline StrictlyLowerMatrix<MT,SO,false>&
766  StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
767 {
768  matrix_ = rhs.matrix_;
769 
770  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
771  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
772 
773  return *this;
774 }
776 //*************************************************************************************************
777 
778 
779 //*************************************************************************************************
792 template< typename MT // Type of the adapted sparse matrix
793  , bool SO > // Storage order of the adapted sparse matrix
794 template< typename MT2 // Type of the right-hand side matrix
795  , bool SO2 > // Storage order of the right-hand side matrix
796 inline typename DisableIf< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >::Type
797  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
798 {
799  if( IsUniTriangular<MT2>::value ||
800  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
801  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
802  }
803 
804  matrix_ = ~rhs;
805 
806  if( !IsStrictlyLower<MT2>::value )
807  resetUpper();
808 
809  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
810  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
811 
812  return *this;
813 }
815 //*************************************************************************************************
816 
817 
818 //*************************************************************************************************
831 template< typename MT // Type of the adapted sparse matrix
832  , bool SO > // Storage order of the adapted sparse matrix
833 template< typename MT2 // Type of the right-hand side matrix
834  , bool SO2 > // Storage order of the right-hand side matrix
835 inline typename EnableIf< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >::Type
836  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
837 {
838  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
839  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
840  }
841 
842  if( IsStrictlyLower<MT2>::value ) {
843  matrix_ = ~rhs;
844  }
845  else {
846  MT tmp( ~rhs );
847 
848  if( !isStrictlyLower( tmp ) ) {
849  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
850  }
851 
852  move( matrix_, tmp );
853  }
854 
855  if( !IsStrictlyLower<MT2>::value )
856  resetUpper();
857 
858  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
859  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
860 
861  return *this;
862 }
864 //*************************************************************************************************
865 
866 
867 //*************************************************************************************************
880 template< typename MT // Type of the adapted sparse matrix
881  , bool SO > // Storage order of the adapted sparse matrix
882 template< typename MT2 // Type of the right-hand side matrix
883  , bool SO2 > // Storage order of the right-hand side matrix
884 inline typename DisableIf< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >::Type
885  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
886 {
887  if( IsUniTriangular<MT2>::value ||
888  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
889  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
890  }
891 
892  matrix_ += ~rhs;
893 
894  if( !IsStrictlyLower<MT2>::value )
895  resetUpper();
896 
897  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
898  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
899 
900  return *this;
901 }
903 //*************************************************************************************************
904 
905 
906 //*************************************************************************************************
919 template< typename MT // Type of the adapted sparse matrix
920  , bool SO > // Storage order of the adapted sparse matrix
921 template< typename MT2 // Type of the right-hand side matrix
922  , bool SO2 > // Storage order of the right-hand side matrix
923 inline typename EnableIf< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >::Type
924  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
925 {
926  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
927  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
928  }
929 
930  if( IsStrictlyLower<MT2>::value ) {
931  matrix_ += ~rhs;
932  }
933  else {
934  typename MT2::ResultType tmp( ~rhs );
935 
936  if( !isStrictlyLower( tmp ) ) {
937  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
938  }
939 
940  matrix_ += tmp;
941  }
942 
943  if( !IsStrictlyLower<MT2>::value )
944  resetUpper();
945 
946  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
947  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
948 
949  return *this;
950 }
952 //*************************************************************************************************
953 
954 
955 //*************************************************************************************************
968 template< typename MT // Type of the adapted sparse matrix
969  , bool SO > // Storage order of the adapted sparse matrix
970 template< typename MT2 // Type of the right-hand side matrix
971  , bool SO2 > // Storage order of the right-hand side matrix
972 inline typename DisableIf< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >::Type
973  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
974 {
975  if( IsUniTriangular<MT2>::value ||
976  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
977  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
978  }
979 
980  matrix_ -= ~rhs;
981 
982  if( !IsStrictlyLower<MT2>::value )
983  resetUpper();
984 
985  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
986  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
987 
988  return *this;
989 }
991 //*************************************************************************************************
992 
993 
994 //*************************************************************************************************
1007 template< typename MT // Type of the adapted sparse matrix
1008  , bool SO > // Storage order of the adapted sparse matrix
1009 template< typename MT2 // Type of the right-hand side matrix
1010  , bool SO2 > // Storage order of the right-hand side matrix
1011 inline typename EnableIf< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >::Type
1012  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1013 {
1014  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1015  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1016  }
1017 
1018  if( IsStrictlyLower<MT2>::value ) {
1019  matrix_ -= ~rhs;
1020  }
1021  else {
1022  typename MT2::ResultType tmp( ~rhs );
1023 
1024  if( !isStrictlyLower( tmp ) ) {
1025  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1026  }
1027 
1028  matrix_ -= tmp;
1029  }
1030 
1031  if( !IsStrictlyLower<MT2>::value )
1032  resetUpper();
1033 
1034  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1035  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1036 
1037  return *this;
1038 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1055 template< typename MT // Type of the adapted sparse matrix
1056  , bool SO > // Storage order of the adapted sparse matrix
1057 template< typename MT2 // Type of the right-hand side matrix
1058  , bool SO2 > // Storage order of the right-hand side matrix
1059 inline StrictlyLowerMatrix<MT,SO,false>&
1060  StrictlyLowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1061 {
1062  if( matrix_.rows() != (~rhs).columns() ) {
1063  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1064  }
1065 
1066  MT tmp( matrix_ * ~rhs );
1067 
1068  if( !isStrictlyLower( tmp ) ) {
1069  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1070  }
1071 
1072  move( matrix_, tmp );
1073 
1074  if( !IsStrictlyLower<MT2>::value )
1075  resetUpper();
1076 
1077  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1078  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1079 
1080  return *this;
1081 }
1083 //*************************************************************************************************
1084 
1085 
1086 //*************************************************************************************************
1094 template< typename MT // Type of the adapted sparse matrix
1095  , bool SO > // Storage order of the adapted sparse matrix
1096 template< typename Other > // Data type of the right-hand side scalar
1097 inline typename EnableIf< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >::Type&
1098  StrictlyLowerMatrix<MT,SO,false>::operator*=( Other rhs )
1099 {
1100  matrix_ *= rhs;
1101  return *this;
1102 }
1103 //*************************************************************************************************
1104 
1105 
1106 //*************************************************************************************************
1114 template< typename MT // Type of the adapted sparse matrix
1115  , bool SO > // Storage order of the adapted sparse matrix
1116 template< typename Other > // Data type of the right-hand side scalar
1117 inline typename EnableIf< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >::Type&
1118  StrictlyLowerMatrix<MT,SO,false>::operator/=( Other rhs )
1119 {
1120  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1121 
1122  matrix_ /= rhs;
1123  return *this;
1124 }
1126 //*************************************************************************************************
1127 
1128 
1129 
1130 
1131 //=================================================================================================
1132 //
1133 // UTILITY FUNCTIONS
1134 //
1135 //=================================================================================================
1136 
1137 //*************************************************************************************************
1143 template< typename MT // Type of the adapted sparse matrix
1144  , bool SO > // Storage order of the adapted sparse matrix
1145 inline size_t StrictlyLowerMatrix<MT,SO,false>::rows() const
1146 {
1147  return matrix_.rows();
1148 }
1150 //*************************************************************************************************
1151 
1152 
1153 //*************************************************************************************************
1159 template< typename MT // Type of the adapted sparse matrix
1160  , bool SO > // Storage order of the adapted sparse matrix
1161 inline size_t StrictlyLowerMatrix<MT,SO,false>::columns() const
1162 {
1163  return matrix_.columns();
1164 }
1166 //*************************************************************************************************
1167 
1168 
1169 //*************************************************************************************************
1175 template< typename MT // Type of the adapted sparse matrix
1176  , bool SO > // Storage order of the adapted sparse matrix
1177 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity() const
1178 {
1179  return matrix_.capacity();
1180 }
1182 //*************************************************************************************************
1183 
1184 
1185 //*************************************************************************************************
1197 template< typename MT // Type of the adapted sparse matrix
1198  , bool SO > // Storage order of the adapted sparse matrix
1199 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity( size_t i ) const
1200 {
1201  return matrix_.capacity(i);
1202 }
1204 //*************************************************************************************************
1205 
1206 
1207 //*************************************************************************************************
1213 template< typename MT // Type of the adapted sparse matrix
1214  , bool SO > // Storage order of the adapted sparse matrix
1215 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros() const
1216 {
1217  return matrix_.nonZeros();
1218 }
1220 //*************************************************************************************************
1221 
1222 
1223 //*************************************************************************************************
1235 template< typename MT // Type of the adapted sparse matrix
1236  , bool SO > // Storage order of the adapted sparse matrix
1237 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1238 {
1239  return matrix_.nonZeros(i);
1240 }
1242 //*************************************************************************************************
1243 
1244 
1245 //*************************************************************************************************
1251 template< typename MT // Type of the adapted sparse matrix
1252  , bool SO > // Storage order of the adapted sparse matrix
1254 {
1255  if( SO ) {
1256  for( size_t j=0UL; j<columns(); ++j ) {
1257  matrix_.erase( j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1258  }
1259  }
1260  else {
1261  for( size_t i=1UL; i<rows(); ++i ) {
1262  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1263  }
1264  }
1265 }
1267 //*************************************************************************************************
1268 
1269 
1270 //*************************************************************************************************
1283 template< typename MT // Type of the adapted sparse matrix
1284  , bool SO > // Storage order of the adapted sparse matrix
1285 inline void StrictlyLowerMatrix<MT,SO,false>::reset( size_t i )
1286 {
1287  if( SO ) {
1288  matrix_.erase( i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1289  }
1290  else {
1291  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1292  }
1293 }
1295 //*************************************************************************************************
1296 
1297 
1298 //*************************************************************************************************
1306 template< typename MT // Type of the adapted sparse matrix
1307  , bool SO > // Storage order of the adapted sparse matrix
1309 {
1310  using blaze::clear;
1311 
1312  if( IsResizable<MT>::value ) {
1313  clear( matrix_ );
1314  }
1315  else {
1316  reset();
1317  }
1318 }
1320 //*************************************************************************************************
1321 
1322 
1323 //*************************************************************************************************
1339 template< typename MT // Type of the adapted sparse matrix
1340  , bool SO > // Storage order of the adapted sparse matrix
1342  StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1343 {
1344  if( i <= j ) {
1345  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1346  }
1347 
1348  return matrix_.set( i, j, value );
1349 }
1351 //*************************************************************************************************
1352 
1353 
1354 //*************************************************************************************************
1371 template< typename MT // Type of the adapted sparse matrix
1372  , bool SO > // Storage order of the adapted sparse matrix
1374  StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1375 {
1376  if( i <= j ) {
1377  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1378  }
1379 
1380  return matrix_.insert( i, j, value );
1381 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1396 template< typename MT // Type of the adapted sparse matrix
1397  , bool SO > // Storage order of the adapted sparse matrix
1398 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1399 {
1400  matrix_.erase( i, j );
1401 }
1403 //*************************************************************************************************
1404 
1405 
1406 //*************************************************************************************************
1418 template< typename MT // Type of the adapted sparse matrix
1419  , bool SO > // Storage order of the adapted sparse matrix
1421  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1422 {
1423  return matrix_.erase( i, pos );
1424 }
1426 //*************************************************************************************************
1427 
1428 
1429 //*************************************************************************************************
1443 template< typename MT // Type of the adapted sparse matrix
1444  , bool SO > // Storage order of the adapted sparse matrix
1446  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1447 {
1448  return matrix_.erase( i, first, last );
1449 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1469 template< typename MT // Type of the adapted sparse matrix
1470  , bool SO > // Storage order of the adapted sparse matrix
1471 void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1472 {
1474 
1475  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1476 
1477  matrix_.resize( n, n, preserve );
1478 }
1480 //*************************************************************************************************
1481 
1482 
1483 //*************************************************************************************************
1494 template< typename MT // Type of the adapted sparse matrix
1495  , bool SO > // Storage order of the adapted sparse matrix
1496 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1497 {
1498  matrix_.reserve( nonzeros );
1499 }
1501 //*************************************************************************************************
1502 
1503 
1504 //*************************************************************************************************
1519 template< typename MT // Type of the adapted sparse matrix
1520  , bool SO > // Storage order of the adapted sparse matrix
1521 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1522 {
1523  matrix_.reserve( i, nonzeros );
1524 }
1526 //*************************************************************************************************
1527 
1528 
1529 //*************************************************************************************************
1540 template< typename MT // Type of the adapted sparse matrix
1541  , bool SO > // Storage order of the adapted sparse matrix
1542 inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1543 {
1544  matrix_.trim();
1545 }
1547 //*************************************************************************************************
1548 
1549 
1550 //*************************************************************************************************
1562 template< typename MT // Type of the adapted sparse matrix
1563  , bool SO > // Storage order of the adapted sparse matrix
1564 inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1565 {
1566  matrix_.trim( i );
1567 }
1569 //*************************************************************************************************
1570 
1571 
1572 //*************************************************************************************************
1579 template< typename MT // Type of the adapted sparse matrix
1580  , bool SO > // Storage order of the adapted sparse matrix
1581 template< typename Other > // Data type of the scalar value
1582 inline StrictlyLowerMatrix<MT,SO,false>&
1583  StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
1584 {
1585  matrix_.scale( scalar );
1586  return *this;
1587 }
1589 //*************************************************************************************************
1590 
1591 
1592 //*************************************************************************************************
1599 template< typename MT // Type of the adapted sparse matrix
1600  , bool SO > // Storage order of the adapted sparse matrix
1601 template< typename Other > // Data type of the scalar value
1602 inline StrictlyLowerMatrix<MT,SO,false>&
1603  StrictlyLowerMatrix<MT,SO,false>::scaleDiagonal( Other scalar )
1604 {
1605  matrix_.scaleDiagonal( scalar );
1606  return *this;
1607 }
1609 //*************************************************************************************************
1610 
1611 
1612 //*************************************************************************************************
1620 template< typename MT // Type of the adapted sparse matrix
1621  , bool SO > // Storage order of the adapted sparse matrix
1622 inline void StrictlyLowerMatrix<MT,SO,false>::swap( StrictlyLowerMatrix& m ) /* throw() */
1623 {
1624  using std::swap;
1625 
1626  swap( matrix_, m.matrix_ );
1627 }
1629 //*************************************************************************************************
1630 
1631 
1632 //*************************************************************************************************
1644 template< typename MT // Type of the adapted dense matrix
1645  , bool SO > // Storage order of the adapted dense matrix
1646 inline size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros()
1647 {
1649 
1650  return maxNonZeros( Rows<MT>::value );
1651 }
1653 //*************************************************************************************************
1654 
1655 
1656 //*************************************************************************************************
1666 template< typename MT // Type of the adapted dense matrix
1667  , bool SO > // Storage order of the adapted dense matrix
1668 inline size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n )
1669 {
1670  return ( ( n - 1UL ) * n ) / 2UL;
1671 }
1673 //*************************************************************************************************
1674 
1675 
1676 //*************************************************************************************************
1682 template< typename MT // Type of the adapted dense matrix
1683  , bool SO > // Storage order of the adapted dense matrix
1684 inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1685 {
1686  if( SO ) {
1687  for( size_t j=1UL; j<columns(); ++j )
1688  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1689  }
1690  else {
1691  for( size_t i=0UL; i<rows(); ++i )
1692  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1693  }
1694 }
1696 //*************************************************************************************************
1697 
1698 
1699 
1700 
1701 //=================================================================================================
1702 //
1703 // LOOKUP FUNCTIONS
1704 //
1705 //=================================================================================================
1706 
1707 //*************************************************************************************************
1723 template< typename MT // Type of the adapted sparse matrix
1724  , bool SO > // Storage order of the adapted sparse matrix
1726  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1727 {
1728  return matrix_.find( i, j );
1729 }
1731 //*************************************************************************************************
1732 
1733 
1734 //*************************************************************************************************
1750 template< typename MT // Type of the adapted sparse matrix
1751  , bool SO > // Storage order of the adapted sparse matrix
1753  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
1754 {
1755  return matrix_.find( i, j );
1756 }
1758 //*************************************************************************************************
1759 
1760 
1761 //*************************************************************************************************
1777 template< typename MT // Type of the adapted sparse matrix
1778  , bool SO > // Storage order of the adapted sparse matrix
1780  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
1781 {
1782  return matrix_.lowerBound( i, j );
1783 }
1785 //*************************************************************************************************
1786 
1787 
1788 //*************************************************************************************************
1804 template< typename MT // Type of the adapted sparse matrix
1805  , bool SO > // Storage order of the adapted sparse matrix
1807  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
1808 {
1809  return matrix_.lowerBound( i, j );
1810 }
1812 //*************************************************************************************************
1813 
1814 
1815 //*************************************************************************************************
1831 template< typename MT // Type of the adapted sparse matrix
1832  , bool SO > // Storage order of the adapted sparse matrix
1834  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
1835 {
1836  return matrix_.upperBound( i, j );
1837 }
1839 //*************************************************************************************************
1840 
1841 
1842 //*************************************************************************************************
1858 template< typename MT // Type of the adapted sparse matrix
1859  , bool SO > // Storage order of the adapted sparse matrix
1861  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
1862 {
1863  return matrix_.upperBound( i, j );
1864 }
1866 //*************************************************************************************************
1867 
1868 
1869 
1870 
1871 //=================================================================================================
1872 //
1873 // LOW-LEVEL UTILITY FUNCTIONS
1874 //
1875 //=================================================================================================
1876 
1877 //*************************************************************************************************
1927 template< typename MT // Type of the adapted sparse matrix
1928  , bool SO > // Storage order of the adapted sparse matrix
1929 inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1930 {
1931  if( i <= j ) {
1932  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1933  }
1934 
1935  matrix_.append( i, j, value, check );
1936 }
1938 //*************************************************************************************************
1939 
1940 
1941 //*************************************************************************************************
1955 template< typename MT // Type of the adapted sparse matrix
1956  , bool SO > // Storage order of the adapted sparse matrix
1957 inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
1958 {
1959  matrix_.finalize( i );
1960 }
1962 //*************************************************************************************************
1963 
1964 
1965 
1966 
1967 //=================================================================================================
1968 //
1969 // DEBUGGING FUNCTIONS
1970 //
1971 //=================================================================================================
1972 
1973 //*************************************************************************************************
1983 template< typename MT // Type of the adapted sparse matrix
1984  , bool SO > // Storage order of the adapted sparse matrix
1986 {
1987  using blaze::isIntact;
1988 
1989  return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
1990 }
1992 //*************************************************************************************************
1993 
1994 
1995 
1996 
1997 //=================================================================================================
1998 //
1999 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2000 //
2001 //=================================================================================================
2002 
2003 //*************************************************************************************************
2014 template< typename MT // Type of the adapted sparse matrix
2015  , bool SO > // Storage order of the adapted sparse matrix
2016 template< typename Other > // Data type of the foreign expression
2017 inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const
2018 {
2019  return matrix_.canAlias( alias );
2020 }
2022 //*************************************************************************************************
2023 
2024 
2025 //*************************************************************************************************
2036 template< typename MT // Type of the adapted sparse matrix
2037  , bool SO > // Storage order of the adapted sparse matrix
2038 template< typename Other > // Data type of the foreign expression
2039 inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const
2040 {
2041  return matrix_.isAliased( alias );
2042 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2058 template< typename MT // Type of the adapted sparse matrix
2059  , bool SO > // Storage order of the adapted sparse matrix
2060 inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const
2061 {
2062  return matrix_.canSMPAssign();
2063 }
2065 //*************************************************************************************************
2066 
2067 } // namespace blaze
2068 
2069 #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
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
const MT::ElementType max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1729
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_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 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.
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:603
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:229
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:5016
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:292
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:250
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1201
#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:81
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:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4926
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2582
#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:378
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
Constraint on the data type.
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.
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Compile time assertion.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:4980
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the Columns type trait.
Constraint on the data type.
Header file for the SparseElement base class.
Header file for the IsUniTriangular type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
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:187
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:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
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:527
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:2587
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#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:2591
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
Header file for the StrictlyLowerProxy class.
#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:256
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
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:116
Header file for exception macros.
#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.
Header file for the implementation of the base template of the StrictlyLowerMatrix.
#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