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 <utility>
44 #include <vector>
48 #include <blaze/math/Aliases.h>
57 #include <blaze/math/Exception.h>
59 #include <blaze/math/Functions.h>
60 #include <blaze/math/shims/Clear.h>
71 #include <blaze/util/Assert.h>
76 #include <blaze/util/DisableIf.h>
77 #include <blaze/util/EnableIf.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 OppositeType_<MT> OT;
107  typedef TransposeType_<MT> TT;
108  typedef ElementType_<MT> ET;
109  //**********************************************************************************************
110 
111  public:
112  //**Type definitions****************************************************************************
113  typedef StrictlyLowerMatrix<MT,SO,false> This;
114  typedef SparseMatrix<This,SO> BaseType;
115  typedef This ResultType;
116  typedef StrictlyLowerMatrix<OT,!SO,false> OppositeType;
117  typedef StrictlyUpperMatrix<TT,!SO,false> TransposeType;
118  typedef ET ElementType;
119  typedef ReturnType_<MT> ReturnType;
120  typedef const This& CompositeType;
121  typedef StrictlyLowerProxy<MT> Reference;
122  typedef ConstReference_<MT> ConstReference;
123  typedef Iterator_<MT> Iterator;
124  typedef ConstIterator_<MT> ConstIterator;
125  //**********************************************************************************************
126 
127  //**Rebind struct definition********************************************************************
130  template< typename NewType > // Data type of the other matrix
131  struct Rebind {
133  typedef StrictlyLowerMatrix< typename MT::template Rebind<NewType>::Other > Other;
134  };
135  //**********************************************************************************************
136 
137  //**Resize struct definition********************************************************************
140  template< size_t NewM // Number of rows of the other matrix
141  , size_t NewN > // Number of columns of the other matrix
142  struct Resize {
144  typedef StrictlyLowerMatrix< typename MT::template Resize<NewM,NewN>::Other > Other;
145  };
146  //**********************************************************************************************
147 
148  //**Compilation flags***************************************************************************
150  enum : bool { smpAssignable = false };
151  //**********************************************************************************************
152 
153  //**Constructors********************************************************************************
156  explicit inline StrictlyLowerMatrix();
157  explicit inline StrictlyLowerMatrix( size_t n );
158  explicit inline StrictlyLowerMatrix( size_t n, size_t nonzeros );
159  explicit inline StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
160 
161  inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
162  inline StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept;
163 
164  template< typename MT2, bool SO2 >
165  inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
167  //**********************************************************************************************
168 
169  //**Destructor**********************************************************************************
170  // No explicitly declared destructor.
171  //**********************************************************************************************
172 
173  //**Data access functions***********************************************************************
176  inline Reference operator()( size_t i, size_t j );
177  inline ConstReference operator()( size_t i, size_t j ) const;
178  inline Reference at( size_t i, size_t j );
179  inline ConstReference at( size_t i, size_t j ) const;
180  inline Iterator begin ( size_t i );
181  inline ConstIterator begin ( size_t i ) const;
182  inline ConstIterator cbegin( size_t i ) const;
183  inline Iterator end ( size_t i );
184  inline ConstIterator end ( size_t i ) const;
185  inline ConstIterator cend ( size_t i ) const;
187  //**********************************************************************************************
188 
189  //**Assignment operators************************************************************************
192  inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
193  inline StrictlyLowerMatrix& operator=( StrictlyLowerMatrix&& rhs ) noexcept;
194 
195  template< typename MT2, bool SO2 >
196  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
197  operator=( const Matrix<MT2,SO2>& rhs );
198 
199  template< typename MT2, bool SO2 >
200  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
201  operator=( const Matrix<MT2,SO2>& rhs );
202 
203  template< typename MT2, bool SO2 >
204  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
205  operator+=( const Matrix<MT2,SO2>& rhs );
206 
207  template< typename MT2, bool SO2 >
208  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
209  operator+=( const Matrix<MT2,SO2>& rhs );
210 
211  template< typename MT2, bool SO2 >
212  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
213  operator-=( const Matrix<MT2,SO2>& rhs );
214 
215  template< typename MT2, bool SO2 >
216  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
217  operator-=( const Matrix<MT2,SO2>& rhs );
218 
219  template< typename MT2, bool SO2 >
220  inline StrictlyLowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
221 
222  template< typename Other >
223  inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix >& operator*=( Other rhs );
224 
225  template< typename Other >
226  inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix >& operator/=( Other rhs );
228  //**********************************************************************************************
229 
230  //**Utility functions***************************************************************************
233  inline size_t rows() const noexcept;
234  inline size_t columns() const noexcept;
235  inline size_t capacity() const noexcept;
236  inline size_t capacity( size_t i ) const noexcept;
237  inline size_t nonZeros() const;
238  inline size_t nonZeros( size_t i ) const;
239  inline void reset();
240  inline void reset( size_t i );
241  inline void clear();
242  inline void resize ( size_t n, bool preserve=true );
243  inline void reserve( size_t nonzeros );
244  inline void reserve( size_t i, size_t nonzeros );
245  inline void trim();
246  inline void trim( size_t i );
247  inline void swap( StrictlyLowerMatrix& m ) noexcept;
248 
249  static inline constexpr size_t maxNonZeros() noexcept;
250  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
252  //**********************************************************************************************
253 
254  //**Insertion functions*************************************************************************
257  inline Iterator set ( size_t i, size_t j, const ElementType& value );
258  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
259  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
260  inline void finalize( size_t i );
262  //**********************************************************************************************
263 
264  //**Erase functions*****************************************************************************
267  inline void erase( size_t i, size_t j );
268  inline Iterator erase( size_t i, Iterator pos );
269  inline Iterator erase( size_t i, Iterator first, Iterator last );
270 
271  template< typename Pred >
272  inline void erase( Pred predicate );
273 
274  template< typename Pred >
275  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
277  //**********************************************************************************************
278 
279  //**Lookup functions****************************************************************************
282  inline Iterator find ( size_t i, size_t j );
283  inline ConstIterator find ( size_t i, size_t j ) const;
284  inline Iterator lowerBound( size_t i, size_t j );
285  inline ConstIterator lowerBound( size_t i, size_t j ) const;
286  inline Iterator upperBound( size_t i, size_t j );
287  inline ConstIterator upperBound( size_t i, size_t j ) const;
289  //**********************************************************************************************
290 
291  //**Numeric functions***************************************************************************
294  template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
295  template< typename Other > inline StrictlyLowerMatrix& scaleDiagonal( const Other& scale );
297  //**********************************************************************************************
298 
299  //**Debugging functions*************************************************************************
302  inline bool isIntact() const noexcept;
304  //**********************************************************************************************
305 
306  //**Expression template evaluation functions****************************************************
309  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
310  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
311 
312  inline bool canSMPAssign() const noexcept;
314  //**********************************************************************************************
315 
316  private:
317  //**Utility functions***************************************************************************
320  inline void resetUpper();
322  //**********************************************************************************************
323 
324  //**Member variables****************************************************************************
327  MT matrix_;
328 
329  //**********************************************************************************************
330 
331  //**Friend declarations*************************************************************************
332  template< typename MT2, bool SO2, bool DF2 >
333  friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
334  //**********************************************************************************************
335 
336  //**Compile time checks*************************************************************************
349  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
350  //**********************************************************************************************
351 };
353 //*************************************************************************************************
354 
355 
356 
357 
358 //=================================================================================================
359 //
360 // CONSTRUCTORS
361 //
362 //=================================================================================================
363 
364 //*************************************************************************************************
368 template< typename MT // Type of the adapted sparse matrix
369  , bool SO > // Storage order of the adapted sparse matrix
370 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix()
371  : matrix_() // The adapted sparse matrix
372 {
373  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
374 }
376 //*************************************************************************************************
377 
378 
379 //*************************************************************************************************
387 template< typename MT // Type of the adapted sparse matrix
388  , bool SO > // Storage order of the adapted sparse matrix
389 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n )
390  : matrix_( n, n, n ) // The adapted sparse matrix
391 {
393 
394  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
395 }
397 //*************************************************************************************************
398 
399 
400 //*************************************************************************************************
410 template< typename MT // Type of the adapted sparse matrix
411  , bool SO > // Storage order of the adapted sparse matrix
412 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, size_t nonzeros )
413  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
414 {
416 
417  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
418 }
420 //*************************************************************************************************
421 
422 
423 //*************************************************************************************************
437 template< typename MT // Type of the adapted sparse matrix
438  , bool SO > // Storage order of the adapted sparse matrix
439 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
440  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
441 {
443 
444  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
445 }
447 //*************************************************************************************************
448 
449 
450 //*************************************************************************************************
456 template< typename MT // Type of the adapted sparse matrix
457  , bool SO > // Storage order of the adapted sparse matrix
458 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
459  : matrix_( m.matrix_ ) // The adapted sparse matrix
460 {
461  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
462  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
463 }
465 //*************************************************************************************************
466 
467 
468 //*************************************************************************************************
474 template< typename MT // Type of the adapted sparse matrix
475  , bool SO > // Storage order of the adapted sparse matrix
476 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept
477  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
478 {
479  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
480  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
481 }
483 //*************************************************************************************************
484 
485 
486 //*************************************************************************************************
497 template< typename MT // Type of the adapted sparse matrix
498  , bool SO > // Storage order of the adapted sparse matrix
499 template< typename MT2 // Type of the foreign matrix
500  , bool SO2 > // Storage order of the foreign matrix
501 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
502  : matrix_( ~m ) // The adapted sparse matrix
503 {
504  if( IsUniTriangular<MT2>::value ||
505  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( matrix_ ) ) ) {
506  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
507  }
508 
509  if( !IsStrictlyLower<MT2>::value )
510  resetUpper();
511 
512  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
513  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
514 }
516 //*************************************************************************************************
517 
518 
519 
520 
521 //=================================================================================================
522 //
523 // DATA ACCESS FUNCTIONS
524 //
525 //=================================================================================================
526 
527 //*************************************************************************************************
543 template< typename MT // Type of the adapted sparse matrix
544  , bool SO > // Storage order of the adapted sparse matrix
546  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
547 {
548  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
549  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
550 
551  return Reference( matrix_, i, j );
552 }
554 //*************************************************************************************************
555 
556 
557 //*************************************************************************************************
573 template< typename MT // Type of the adapted sparse matrix
574  , bool SO > // Storage order of the adapted sparse matrix
576  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
577 {
578  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
579  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
580 
581  return matrix_(i,j);
582 }
584 //*************************************************************************************************
585 
586 
587 //*************************************************************************************************
604 template< typename MT // Type of the adapted sparse matrix
605  , bool SO > // Storage order of the adapted sparse matrix
607  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
608 {
609  if( i >= rows() ) {
610  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
611  }
612  if( j >= columns() ) {
613  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
614  }
615  return (*this)(i,j);
616 }
618 //*************************************************************************************************
619 
620 
621 //*************************************************************************************************
638 template< typename MT // Type of the adapted sparse matrix
639  , bool SO > // Storage order of the adapted sparse matrix
641  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
642 {
643  if( i >= rows() ) {
644  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
645  }
646  if( j >= columns() ) {
647  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
648  }
649  return (*this)(i,j);
650 }
652 //*************************************************************************************************
653 
654 
655 //*************************************************************************************************
667 template< typename MT // Type of the adapted sparse matrix
668  , bool SO > // Storage order of the adapted sparse matrix
671 {
672  return matrix_.begin(i);
673 }
675 //*************************************************************************************************
676 
677 
678 //*************************************************************************************************
690 template< typename MT // Type of the adapted sparse matrix
691  , bool SO > // Storage order of the adapted sparse matrix
694 {
695  return matrix_.begin(i);
696 }
698 //*************************************************************************************************
699 
700 
701 //*************************************************************************************************
713 template< typename MT // Type of the adapted sparse matrix
714  , bool SO > // Storage order of the adapted sparse matrix
717 {
718  return matrix_.cbegin(i);
719 }
721 //*************************************************************************************************
722 
723 
724 //*************************************************************************************************
736 template< typename MT // Type of the adapted sparse matrix
737  , bool SO > // Storage order of the adapted sparse matrix
740 {
741  return matrix_.end(i);
742 }
744 //*************************************************************************************************
745 
746 
747 //*************************************************************************************************
759 template< typename MT // Type of the adapted sparse matrix
760  , bool SO > // Storage order of the adapted sparse matrix
762  StrictlyLowerMatrix<MT,SO,false>::end( size_t i ) const
763 {
764  return matrix_.end(i);
765 }
767 //*************************************************************************************************
768 
769 
770 //*************************************************************************************************
782 template< typename MT // Type of the adapted sparse matrix
783  , bool SO > // Storage order of the adapted sparse matrix
786 {
787  return matrix_.cend(i);
788 }
790 //*************************************************************************************************
791 
792 
793 
794 
795 //=================================================================================================
796 //
797 // ASSIGNMENT OPERATORS
798 //
799 //=================================================================================================
800 
801 //*************************************************************************************************
811 template< typename MT // Type of the adapted sparse matrix
812  , bool SO > // Storage order of the adapted sparse matrix
813 inline StrictlyLowerMatrix<MT,SO,false>&
814  StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
815 {
816  matrix_ = rhs.matrix_;
817 
818  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
819  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
820 
821  return *this;
822 }
824 //*************************************************************************************************
825 
826 
827 //*************************************************************************************************
834 template< typename MT // Type of the adapted sparse matrix
835  , bool SO > // Storage order of the adapted sparse matrix
836 inline StrictlyLowerMatrix<MT,SO,false>&
837  StrictlyLowerMatrix<MT,SO,false>::operator=( StrictlyLowerMatrix&& rhs ) noexcept
838 {
839  matrix_ = std::move( rhs.matrix_ );
840 
841  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
842  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
843 
844  return *this;
845 }
847 //*************************************************************************************************
848 
849 
850 //*************************************************************************************************
863 template< typename MT // Type of the adapted sparse matrix
864  , bool SO > // Storage order of the adapted sparse matrix
865 template< typename MT2 // Type of the right-hand side matrix
866  , bool SO2 > // Storage order of the right-hand side matrix
867 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
868  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
869 {
870  if( IsUniTriangular<MT2>::value ||
871  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
872  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
873  }
874 
875  matrix_ = ~rhs;
876 
877  if( !IsStrictlyLower<MT2>::value )
878  resetUpper();
879 
880  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
881  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
882 
883  return *this;
884 }
886 //*************************************************************************************************
887 
888 
889 //*************************************************************************************************
902 template< typename MT // Type of the adapted sparse matrix
903  , bool SO > // Storage order of the adapted sparse matrix
904 template< typename MT2 // Type of the right-hand side matrix
905  , bool SO2 > // Storage order of the right-hand side matrix
906 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
907  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
908 {
909  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
910  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
911  }
912 
913  if( IsStrictlyLower<MT2>::value ) {
914  matrix_ = ~rhs;
915  }
916  else {
917  MT tmp( ~rhs );
918 
919  if( !isStrictlyLower( tmp ) ) {
920  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
921  }
922 
923  matrix_ = std::move( tmp );
924  }
925 
926  if( !IsStrictlyLower<MT2>::value )
927  resetUpper();
928 
929  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
930  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
931 
932  return *this;
933 }
935 //*************************************************************************************************
936 
937 
938 //*************************************************************************************************
951 template< typename MT // Type of the adapted sparse matrix
952  , bool SO > // Storage order of the adapted sparse matrix
953 template< typename MT2 // Type of the right-hand side matrix
954  , bool SO2 > // Storage order of the right-hand side matrix
955 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
956  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
957 {
958  if( IsUniTriangular<MT2>::value ||
959  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
960  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
961  }
962 
963  matrix_ += ~rhs;
964 
965  if( !IsStrictlyLower<MT2>::value )
966  resetUpper();
967 
968  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
969  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
970 
971  return *this;
972 }
974 //*************************************************************************************************
975 
976 
977 //*************************************************************************************************
990 template< typename MT // Type of the adapted sparse matrix
991  , bool SO > // Storage order of the adapted sparse matrix
992 template< typename MT2 // Type of the right-hand side matrix
993  , bool SO2 > // Storage order of the right-hand side matrix
994 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
995  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
996 {
997  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
998  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
999  }
1000 
1001  if( IsStrictlyLower<MT2>::value ) {
1002  matrix_ += ~rhs;
1003  }
1004  else {
1005  const ResultType_<MT2> tmp( ~rhs );
1006 
1007  if( !isStrictlyLower( tmp ) ) {
1008  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1009  }
1010 
1011  matrix_ += tmp;
1012  }
1013 
1014  if( !IsStrictlyLower<MT2>::value )
1015  resetUpper();
1016 
1017  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1018  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1019 
1020  return *this;
1021 }
1023 //*************************************************************************************************
1024 
1025 
1026 //*************************************************************************************************
1039 template< typename MT // Type of the adapted sparse matrix
1040  , bool SO > // Storage order of the adapted sparse matrix
1041 template< typename MT2 // Type of the right-hand side matrix
1042  , bool SO2 > // Storage order of the right-hand side matrix
1043 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1044  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1045 {
1046  if( IsUniTriangular<MT2>::value ||
1047  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
1048  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1049  }
1050 
1051  matrix_ -= ~rhs;
1052 
1053  if( !IsStrictlyLower<MT2>::value )
1054  resetUpper();
1055 
1056  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1057  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1058 
1059  return *this;
1060 }
1062 //*************************************************************************************************
1063 
1064 
1065 //*************************************************************************************************
1078 template< typename MT // Type of the adapted sparse matrix
1079  , bool SO > // Storage order of the adapted sparse matrix
1080 template< typename MT2 // Type of the right-hand side matrix
1081  , bool SO2 > // Storage order of the right-hand side matrix
1082 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1083  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1084 {
1085  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1086  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1087  }
1088 
1089  if( IsStrictlyLower<MT2>::value ) {
1090  matrix_ -= ~rhs;
1091  }
1092  else {
1093  const ResultType_<MT2> tmp( ~rhs );
1094 
1095  if( !isStrictlyLower( tmp ) ) {
1096  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1097  }
1098 
1099  matrix_ -= tmp;
1100  }
1101 
1102  if( !IsStrictlyLower<MT2>::value )
1103  resetUpper();
1104 
1105  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1106  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1107 
1108  return *this;
1109 }
1111 //*************************************************************************************************
1112 
1113 
1114 //*************************************************************************************************
1126 template< typename MT // Type of the adapted sparse matrix
1127  , bool SO > // Storage order of the adapted sparse matrix
1128 template< typename MT2 // Type of the right-hand side matrix
1129  , bool SO2 > // Storage order of the right-hand side matrix
1130 inline StrictlyLowerMatrix<MT,SO,false>&
1131  StrictlyLowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1132 {
1133  if( matrix_.rows() != (~rhs).columns() ) {
1134  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1135  }
1136 
1137  MT tmp( matrix_ * ~rhs );
1138 
1139  if( !isStrictlyLower( tmp ) ) {
1140  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1141  }
1142 
1143  matrix_ = std::move( tmp );
1144 
1145  if( !IsStrictlyLower<MT2>::value )
1146  resetUpper();
1147 
1148  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1149  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1150 
1151  return *this;
1152 }
1154 //*************************************************************************************************
1155 
1156 
1157 //*************************************************************************************************
1165 template< typename MT // Type of the adapted sparse matrix
1166  , bool SO > // Storage order of the adapted sparse matrix
1167 template< typename Other > // Data type of the right-hand side scalar
1168 inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >&
1170 {
1171  matrix_ *= rhs;
1172  return *this;
1173 }
1174 //*************************************************************************************************
1175 
1176 
1177 //*************************************************************************************************
1185 template< typename MT // Type of the adapted sparse matrix
1186  , bool SO > // Storage order of the adapted sparse matrix
1187 template< typename Other > // Data type of the right-hand side scalar
1188 inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >&
1190 {
1191  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1192 
1193  matrix_ /= rhs;
1194  return *this;
1195 }
1197 //*************************************************************************************************
1198 
1199 
1200 
1201 
1202 //=================================================================================================
1203 //
1204 // UTILITY FUNCTIONS
1205 //
1206 //=================================================================================================
1207 
1208 //*************************************************************************************************
1214 template< typename MT // Type of the adapted sparse matrix
1215  , bool SO > // Storage order of the adapted sparse matrix
1216 inline size_t StrictlyLowerMatrix<MT,SO,false>::rows() const noexcept
1217 {
1218  return matrix_.rows();
1219 }
1221 //*************************************************************************************************
1222 
1223 
1224 //*************************************************************************************************
1230 template< typename MT // Type of the adapted sparse matrix
1231  , bool SO > // Storage order of the adapted sparse matrix
1232 inline size_t StrictlyLowerMatrix<MT,SO,false>::columns() const noexcept
1233 {
1234  return matrix_.columns();
1235 }
1237 //*************************************************************************************************
1238 
1239 
1240 //*************************************************************************************************
1246 template< typename MT // Type of the adapted sparse matrix
1247  , bool SO > // Storage order of the adapted sparse matrix
1248 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity() const noexcept
1249 {
1250  return matrix_.capacity();
1251 }
1253 //*************************************************************************************************
1254 
1255 
1256 //*************************************************************************************************
1268 template< typename MT // Type of the adapted sparse matrix
1269  , bool SO > // Storage order of the adapted sparse matrix
1270 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1271 {
1272  return matrix_.capacity(i);
1273 }
1275 //*************************************************************************************************
1276 
1277 
1278 //*************************************************************************************************
1284 template< typename MT // Type of the adapted sparse matrix
1285  , bool SO > // Storage order of the adapted sparse matrix
1286 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros() const
1287 {
1288  return matrix_.nonZeros();
1289 }
1291 //*************************************************************************************************
1292 
1293 
1294 //*************************************************************************************************
1306 template< typename MT // Type of the adapted sparse matrix
1307  , bool SO > // Storage order of the adapted sparse matrix
1308 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1309 {
1310  return matrix_.nonZeros(i);
1311 }
1313 //*************************************************************************************************
1314 
1315 
1316 //*************************************************************************************************
1322 template< typename MT // Type of the adapted sparse matrix
1323  , bool SO > // Storage order of the adapted sparse matrix
1325 {
1326  if( SO ) {
1327  for( size_t j=0UL; j<columns(); ++j ) {
1328  matrix_.erase( j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1329  }
1330  }
1331  else {
1332  for( size_t i=1UL; i<rows(); ++i ) {
1333  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1334  }
1335  }
1336 }
1338 //*************************************************************************************************
1339 
1340 
1341 //*************************************************************************************************
1354 template< typename MT // Type of the adapted sparse matrix
1355  , bool SO > // Storage order of the adapted sparse matrix
1356 inline void StrictlyLowerMatrix<MT,SO,false>::reset( size_t i )
1357 {
1358  if( SO ) {
1359  matrix_.erase( i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1360  }
1361  else {
1362  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1363  }
1364 }
1366 //*************************************************************************************************
1367 
1368 
1369 //*************************************************************************************************
1377 template< typename MT // Type of the adapted sparse matrix
1378  , bool SO > // Storage order of the adapted sparse matrix
1380 {
1381  using blaze::clear;
1382 
1383  if( IsResizable<MT>::value ) {
1384  clear( matrix_ );
1385  }
1386  else {
1387  reset();
1388  }
1389 }
1391 //*************************************************************************************************
1392 
1393 
1394 //*************************************************************************************************
1409 template< typename MT // Type of the adapted sparse matrix
1410  , bool SO > // Storage order of the adapted sparse matrix
1411 void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1412 {
1414 
1415  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1416 
1417  matrix_.resize( n, n, preserve );
1418 }
1420 //*************************************************************************************************
1421 
1422 
1423 //*************************************************************************************************
1434 template< typename MT // Type of the adapted sparse matrix
1435  , bool SO > // Storage order of the adapted sparse matrix
1436 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1437 {
1438  matrix_.reserve( nonzeros );
1439 }
1441 //*************************************************************************************************
1442 
1443 
1444 //*************************************************************************************************
1459 template< typename MT // Type of the adapted sparse matrix
1460  , bool SO > // Storage order of the adapted sparse matrix
1461 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1462 {
1463  matrix_.reserve( i, nonzeros );
1464 }
1466 //*************************************************************************************************
1467 
1468 
1469 //*************************************************************************************************
1480 template< typename MT // Type of the adapted sparse matrix
1481  , bool SO > // Storage order of the adapted sparse matrix
1482 inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1483 {
1484  matrix_.trim();
1485 }
1487 //*************************************************************************************************
1488 
1489 
1490 //*************************************************************************************************
1502 template< typename MT // Type of the adapted sparse matrix
1503  , bool SO > // Storage order of the adapted sparse matrix
1504 inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1505 {
1506  matrix_.trim( i );
1507 }
1509 //*************************************************************************************************
1510 
1511 
1512 //*************************************************************************************************
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>::swap( StrictlyLowerMatrix& m ) noexcept
1522 {
1523  using std::swap;
1524 
1525  swap( matrix_, m.matrix_ );
1526 }
1528 //*************************************************************************************************
1529 
1530 
1531 //*************************************************************************************************
1543 template< typename MT // Type of the adapted dense matrix
1544  , bool SO > // Storage order of the adapted dense matrix
1545 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1546 {
1548 
1549  return maxNonZeros( Rows<MT>::value );
1550 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1565 template< typename MT // Type of the adapted dense matrix
1566  , bool SO > // Storage order of the adapted dense matrix
1567 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1568 {
1569  return ( ( n - 1UL ) * n ) / 2UL;
1570 }
1572 //*************************************************************************************************
1573 
1574 
1575 //*************************************************************************************************
1581 template< typename MT // Type of the adapted dense matrix
1582  , bool SO > // Storage order of the adapted dense matrix
1583 inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1584 {
1585  if( SO ) {
1586  for( size_t j=1UL; j<columns(); ++j )
1587  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1588  }
1589  else {
1590  for( size_t i=0UL; i<rows(); ++i )
1591  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1592  }
1593 }
1595 //*************************************************************************************************
1596 
1597 
1598 
1599 
1600 //=================================================================================================
1601 //
1602 // INSERTION FUNCTIONS
1603 //
1604 //=================================================================================================
1605 
1606 //*************************************************************************************************
1622 template< typename MT // Type of the adapted sparse matrix
1623  , bool SO > // Storage order of the adapted sparse matrix
1625  StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1626 {
1627  if( i <= j ) {
1628  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1629  }
1630 
1631  return matrix_.set( i, j, value );
1632 }
1634 //*************************************************************************************************
1635 
1636 
1637 //*************************************************************************************************
1654 template< typename MT // Type of the adapted sparse matrix
1655  , bool SO > // Storage order of the adapted sparse matrix
1657  StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1658 {
1659  if( i <= j ) {
1660  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1661  }
1662 
1663  return matrix_.insert( i, j, value );
1664 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1719 template< typename MT // Type of the adapted sparse matrix
1720  , bool SO > // Storage order of the adapted sparse matrix
1721 inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1722 {
1723  if( i <= j ) {
1724  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1725  }
1726 
1727  matrix_.append( i, j, value, check );
1728 }
1730 //*************************************************************************************************
1731 
1732 
1733 //*************************************************************************************************
1747 template< typename MT // Type of the adapted sparse matrix
1748  , bool SO > // Storage order of the adapted sparse matrix
1749 inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
1750 {
1751  matrix_.finalize( i );
1752 }
1754 //*************************************************************************************************
1755 
1756 
1757 
1758 
1759 //=================================================================================================
1760 //
1761 // ERASE FUNCTIONS
1762 //
1763 //=================================================================================================
1764 
1765 //*************************************************************************************************
1775 template< typename MT // Type of the adapted sparse matrix
1776  , bool SO > // Storage order of the adapted sparse matrix
1777 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1778 {
1779  matrix_.erase( i, j );
1780 }
1782 //*************************************************************************************************
1783 
1784 
1785 //*************************************************************************************************
1797 template< typename MT // Type of the adapted sparse matrix
1798  , bool SO > // Storage order of the adapted sparse matrix
1800  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1801 {
1802  return matrix_.erase( i, pos );
1803 }
1805 //*************************************************************************************************
1806 
1807 
1808 //*************************************************************************************************
1822 template< typename MT // Type of the adapted sparse matrix
1823  , bool SO > // Storage order of the adapted sparse matrix
1825  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1826 {
1827  return matrix_.erase( i, first, last );
1828 }
1830 //*************************************************************************************************
1831 
1832 
1833 //*************************************************************************************************
1855 template< typename MT // Type of the adapted sparse matrix
1856  , bool SO > // Storage order of the adapted sparse matrix
1857 template< typename Pred > // Type of the unary predicate
1858 inline void StrictlyLowerMatrix<MT,SO,false>::erase( Pred predicate )
1859 {
1860  matrix_.erase( predicate );
1861 
1862  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1863 }
1865 //*************************************************************************************************
1866 
1867 
1868 //*************************************************************************************************
1896 template< typename MT // Type of the adapted sparse matrix
1897  , bool SO > // Storage order of the adapted sparse matrix
1898 template< typename Pred > // Type of the unary predicate
1899 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1900 {
1901  matrix_.erase( i, first, last, predicate );
1902 
1903  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1904 }
1906 //*************************************************************************************************
1907 
1908 
1909 
1910 
1911 //=================================================================================================
1912 //
1913 // LOOKUP FUNCTIONS
1914 //
1915 //=================================================================================================
1916 
1917 //*************************************************************************************************
1933 template< typename MT // Type of the adapted sparse matrix
1934  , bool SO > // Storage order of the adapted sparse matrix
1936  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1937 {
1938  return matrix_.find( i, j );
1939 }
1941 //*************************************************************************************************
1942 
1943 
1944 //*************************************************************************************************
1960 template< typename MT // Type of the adapted sparse matrix
1961  , bool SO > // Storage order of the adapted sparse matrix
1963  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
1964 {
1965  return matrix_.find( i, j );
1966 }
1968 //*************************************************************************************************
1969 
1970 
1971 //*************************************************************************************************
1987 template< typename MT // Type of the adapted sparse matrix
1988  , bool SO > // Storage order of the adapted sparse matrix
1990  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
1991 {
1992  return matrix_.lowerBound( i, j );
1993 }
1995 //*************************************************************************************************
1996 
1997 
1998 //*************************************************************************************************
2014 template< typename MT // Type of the adapted sparse matrix
2015  , bool SO > // Storage order of the adapted sparse matrix
2017  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2018 {
2019  return matrix_.lowerBound( i, j );
2020 }
2022 //*************************************************************************************************
2023 
2024 
2025 //*************************************************************************************************
2041 template< typename MT // Type of the adapted sparse matrix
2042  , bool SO > // Storage order of the adapted sparse matrix
2044  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2045 {
2046  return matrix_.upperBound( i, j );
2047 }
2049 //*************************************************************************************************
2050 
2051 
2052 //*************************************************************************************************
2068 template< typename MT // Type of the adapted sparse matrix
2069  , bool SO > // Storage order of the adapted sparse matrix
2071  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2072 {
2073  return matrix_.upperBound( i, j );
2074 }
2076 //*************************************************************************************************
2077 
2078 
2079 
2080 
2081 //=================================================================================================
2082 //
2083 // NUMERIC FUNCTIONS
2084 //
2085 //=================================================================================================
2086 
2087 //*************************************************************************************************
2094 template< typename MT // Type of the adapted sparse matrix
2095  , bool SO > // Storage order of the adapted sparse matrix
2096 template< typename Other > // Data type of the scalar value
2097 inline StrictlyLowerMatrix<MT,SO,false>&
2098  StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
2099 {
2100  matrix_.scale( scalar );
2101  return *this;
2102 }
2104 //*************************************************************************************************
2105 
2106 
2107 //*************************************************************************************************
2114 template< typename MT // Type of the adapted sparse matrix
2115  , bool SO > // Storage order of the adapted sparse matrix
2116 template< typename Other > // Data type of the scalar value
2117 inline StrictlyLowerMatrix<MT,SO,false>&
2118  StrictlyLowerMatrix<MT,SO,false>::scaleDiagonal( const Other& scalar )
2119 {
2120  matrix_.scaleDiagonal( scalar );
2121  return *this;
2122 }
2124 //*************************************************************************************************
2125 
2126 
2127 
2128 
2129 //=================================================================================================
2130 //
2131 // DEBUGGING FUNCTIONS
2132 //
2133 //=================================================================================================
2134 
2135 //*************************************************************************************************
2145 template< typename MT // Type of the adapted sparse matrix
2146  , bool SO > // Storage order of the adapted sparse matrix
2147 inline bool StrictlyLowerMatrix<MT,SO,false>::isIntact() const noexcept
2148 {
2149  using blaze::isIntact;
2150 
2151  return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
2152 }
2154 //*************************************************************************************************
2155 
2156 
2157 
2158 
2159 //=================================================================================================
2160 //
2161 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2162 //
2163 //=================================================================================================
2164 
2165 //*************************************************************************************************
2176 template< typename MT // Type of the adapted sparse matrix
2177  , bool SO > // Storage order of the adapted sparse matrix
2178 template< typename Other > // Data type of the foreign expression
2179 inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2180 {
2181  return matrix_.canAlias( alias );
2182 }
2184 //*************************************************************************************************
2185 
2186 
2187 //*************************************************************************************************
2198 template< typename MT // Type of the adapted sparse matrix
2199  , bool SO > // Storage order of the adapted sparse matrix
2200 template< typename Other > // Data type of the foreign expression
2201 inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2202 {
2203  return matrix_.isAliased( alias );
2204 }
2206 //*************************************************************************************************
2207 
2208 
2209 //*************************************************************************************************
2220 template< typename MT // Type of the adapted sparse matrix
2221  , bool SO > // Storage order of the adapted sparse matrix
2222 inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2223 {
2224  return matrix_.canSMPAssign();
2225 }
2227 //*************************************************************************************************
2228 
2229 } // namespace blaze
2230 
2231 #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:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for mathematical functions.
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1238
#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.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:352
Header file for basic type definitions.
Header file for the implementation of the base template of the StrictlyLowerMatrix.
#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:63
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
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:194
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5556
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#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:79
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:390
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1802
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2931
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:304
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:238
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
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5635
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5618
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#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:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the Columns type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:336
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:2932
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#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:81
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:544
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:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
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:553
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
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:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
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:81
#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:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:267
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 &#39;resize&#39; member fu...
Definition: Resizable.h:81
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
#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 &#39;res...
Definition: Resizable.h:61
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:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
#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:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
#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:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:677
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:61