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>
58 #include <blaze/math/Exception.h>
60 #include <blaze/math/shims/Clear.h>
72 #include <blaze/util/Assert.h>
77 #include <blaze/util/DisableIf.h>
78 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
100 template< typename MT // Type of the adapted sparse matrix
101  , bool SO > // Storage order of the adapted sparse matrix
102 class StrictlyLowerMatrix<MT,SO,false>
103  : public SparseMatrix< StrictlyLowerMatrix<MT,SO,false>, SO >
104 {
105  private:
106  //**Type definitions****************************************************************************
107  using OT = OppositeType_<MT>;
108  using TT = TransposeType_<MT>;
109  using ET = ElementType_<MT>;
110  //**********************************************************************************************
111 
112  public:
113  //**Type definitions****************************************************************************
114  using This = StrictlyLowerMatrix<MT,SO,false>;
115  using BaseType = SparseMatrix<This,SO>;
116  using ResultType = This;
117  using OppositeType = StrictlyLowerMatrix<OT,!SO,false>;
118  using TransposeType = StrictlyUpperMatrix<TT,!SO,false>;
119  using ElementType = ET;
120  using ReturnType = ReturnType_<MT>;
121  using CompositeType = const This&;
122  using Reference = StrictlyLowerProxy<MT>;
123  using ConstReference = ConstReference_<MT>;
124  using Iterator = Iterator_<MT>;
125  using ConstIterator = ConstIterator_<MT>;
126  //**********************************************************************************************
127 
128  //**Rebind struct definition********************************************************************
131  template< typename NewType > // Data type of the other matrix
132  struct Rebind {
134  using Other = StrictlyLowerMatrix< typename MT::template Rebind<NewType>::Other >;
135  };
136  //**********************************************************************************************
137 
138  //**Resize struct definition********************************************************************
141  template< size_t NewM // Number of rows of the other matrix
142  , size_t NewN > // Number of columns of the other matrix
143  struct Resize {
145  using Other = StrictlyLowerMatrix< typename MT::template Resize<NewM,NewN>::Other >;
146  };
147  //**********************************************************************************************
148 
149  //**Compilation flags***************************************************************************
151  enum : bool { smpAssignable = false };
152  //**********************************************************************************************
153 
154  //**Constructors********************************************************************************
157  explicit inline StrictlyLowerMatrix();
158  explicit inline StrictlyLowerMatrix( size_t n );
159  explicit inline StrictlyLowerMatrix( size_t n, size_t nonzeros );
160  explicit inline StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
161 
162  inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
163  inline StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept;
164 
165  template< typename MT2, bool SO2 >
166  inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
168  //**********************************************************************************************
169 
170  //**Destructor**********************************************************************************
171  // No explicitly declared destructor.
172  //**********************************************************************************************
173 
174  //**Data access functions***********************************************************************
177  inline Reference operator()( size_t i, size_t j );
178  inline ConstReference operator()( size_t i, size_t j ) const;
179  inline Reference at( size_t i, size_t j );
180  inline ConstReference at( size_t i, size_t j ) const;
181  inline Iterator begin ( size_t i );
182  inline ConstIterator begin ( size_t i ) const;
183  inline ConstIterator cbegin( size_t i ) const;
184  inline Iterator end ( size_t i );
185  inline ConstIterator end ( size_t i ) const;
186  inline ConstIterator cend ( size_t i ) const;
188  //**********************************************************************************************
189 
190  //**Assignment operators************************************************************************
193  inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
194  inline StrictlyLowerMatrix& operator=( StrictlyLowerMatrix&& rhs ) noexcept;
195 
196  template< typename MT2, bool SO2 >
197  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
198  operator=( const Matrix<MT2,SO2>& rhs );
199 
200  template< typename MT2, bool SO2 >
201  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
202  operator=( const Matrix<MT2,SO2>& rhs );
203 
204  template< typename MT2, bool SO2 >
205  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
206  operator+=( const Matrix<MT2,SO2>& rhs );
207 
208  template< typename MT2, bool SO2 >
209  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
210  operator+=( const Matrix<MT2,SO2>& rhs );
211 
212  template< typename MT2, bool SO2 >
213  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
214  operator-=( const Matrix<MT2,SO2>& rhs );
215 
216  template< typename MT2, bool SO2 >
217  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
218  operator-=( const Matrix<MT2,SO2>& rhs );
219 
220  template< typename MT2, bool SO2 >
221  inline StrictlyLowerMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
222 
223  template< typename MT2, bool SO2 >
224  inline StrictlyLowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
225 
226  template< typename Other >
227  inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix >& operator*=( Other rhs );
228 
229  template< typename Other >
230  inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix >& operator/=( Other rhs );
232  //**********************************************************************************************
233 
234  //**Utility functions***************************************************************************
237  inline size_t rows() const noexcept;
238  inline size_t columns() const noexcept;
239  inline size_t capacity() const noexcept;
240  inline size_t capacity( size_t i ) const noexcept;
241  inline size_t nonZeros() const;
242  inline size_t nonZeros( size_t i ) const;
243  inline void reset();
244  inline void reset( size_t i );
245  inline void clear();
246  inline void resize ( size_t n, bool preserve=true );
247  inline void reserve( size_t nonzeros );
248  inline void reserve( size_t i, size_t nonzeros );
249  inline void trim();
250  inline void trim( size_t i );
251  inline void shrinkToFit();
252  inline void swap( StrictlyLowerMatrix& m ) noexcept;
253 
254  static inline constexpr size_t maxNonZeros() noexcept;
255  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
257  //**********************************************************************************************
258 
259  //**Insertion functions*************************************************************************
262  inline Iterator set ( size_t i, size_t j, const ElementType& value );
263  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
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  //**Erase functions*****************************************************************************
272  inline void erase( size_t i, size_t j );
273  inline Iterator erase( size_t i, Iterator pos );
274  inline Iterator erase( size_t i, Iterator first, Iterator last );
275 
276  template< typename Pred >
277  inline void erase( Pred predicate );
278 
279  template< typename Pred >
280  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
282  //**********************************************************************************************
283 
284  //**Lookup functions****************************************************************************
287  inline Iterator find ( size_t i, size_t j );
288  inline ConstIterator find ( size_t i, size_t j ) const;
289  inline Iterator lowerBound( size_t i, size_t j );
290  inline ConstIterator lowerBound( size_t i, size_t j ) const;
291  inline Iterator upperBound( size_t i, size_t j );
292  inline ConstIterator upperBound( size_t i, size_t j ) const;
294  //**********************************************************************************************
295 
296  //**Numeric functions***************************************************************************
299  template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
300  template< typename Other > inline StrictlyLowerMatrix& scaleDiagonal( const Other& scale );
302  //**********************************************************************************************
303 
304  //**Debugging functions*************************************************************************
307  inline bool isIntact() const noexcept;
309  //**********************************************************************************************
310 
311  //**Expression template evaluation functions****************************************************
314  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
315  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
316 
317  inline bool canSMPAssign() const noexcept;
319  //**********************************************************************************************
320 
321  private:
322  //**Utility functions***************************************************************************
325  inline void resetUpper();
327  //**********************************************************************************************
328 
329  //**Member variables****************************************************************************
332  MT matrix_;
333 
334  //**********************************************************************************************
335 
336  //**Friend declarations*************************************************************************
337  template< typename MT2, bool SO2, bool DF2 >
338  friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
339  //**********************************************************************************************
340 
341  //**Compile time checks*************************************************************************
354  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
355  //**********************************************************************************************
356 };
358 //*************************************************************************************************
359 
360 
361 
362 
363 //=================================================================================================
364 //
365 // CONSTRUCTORS
366 //
367 //=================================================================================================
368 
369 //*************************************************************************************************
373 template< typename MT // Type of the adapted sparse matrix
374  , bool SO > // Storage order of the adapted sparse matrix
375 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix()
376  : matrix_() // The adapted sparse matrix
377 {
378  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
379 }
381 //*************************************************************************************************
382 
383 
384 //*************************************************************************************************
392 template< typename MT // Type of the adapted sparse matrix
393  , bool SO > // Storage order of the adapted sparse matrix
394 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n )
395  : matrix_( n, n, n ) // The adapted sparse matrix
396 {
398 
399  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
400 }
402 //*************************************************************************************************
403 
404 
405 //*************************************************************************************************
415 template< typename MT // Type of the adapted sparse matrix
416  , bool SO > // Storage order of the adapted sparse matrix
417 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, size_t nonzeros )
418  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
419 {
421 
422  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
423 }
425 //*************************************************************************************************
426 
427 
428 //*************************************************************************************************
442 template< typename MT // Type of the adapted sparse matrix
443  , bool SO > // Storage order of the adapted sparse matrix
444 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
445  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
446 {
448 
449  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
450 }
452 //*************************************************************************************************
453 
454 
455 //*************************************************************************************************
461 template< typename MT // Type of the adapted sparse matrix
462  , bool SO > // Storage order of the adapted sparse matrix
463 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
464  : matrix_( m.matrix_ ) // The adapted sparse matrix
465 {
466  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
467  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
468 }
470 //*************************************************************************************************
471 
472 
473 //*************************************************************************************************
479 template< typename MT // Type of the adapted sparse matrix
480  , bool SO > // Storage order of the adapted sparse matrix
481 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept
482  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
483 {
484  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
485  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
486 }
488 //*************************************************************************************************
489 
490 
491 //*************************************************************************************************
502 template< typename MT // Type of the adapted sparse matrix
503  , bool SO > // Storage order of the adapted sparse matrix
504 template< typename MT2 // Type of the foreign matrix
505  , bool SO2 > // Storage order of the foreign matrix
506 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
507  : matrix_( ~m ) // The adapted sparse matrix
508 {
509  if( IsUniTriangular<MT2>::value ||
510  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( matrix_ ) ) ) {
511  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
512  }
513 
514  if( !IsStrictlyLower<MT2>::value )
515  resetUpper();
516 
517  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
518  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
519 }
521 //*************************************************************************************************
522 
523 
524 
525 
526 //=================================================================================================
527 //
528 // DATA ACCESS FUNCTIONS
529 //
530 //=================================================================================================
531 
532 //*************************************************************************************************
548 template< typename MT // Type of the adapted sparse matrix
549  , bool SO > // Storage order of the adapted sparse matrix
551  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
552 {
553  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
554  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
555 
556  return Reference( matrix_, i, j );
557 }
559 //*************************************************************************************************
560 
561 
562 //*************************************************************************************************
578 template< typename MT // Type of the adapted sparse matrix
579  , bool SO > // Storage order of the adapted sparse matrix
581  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
582 {
583  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
584  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
585 
586  return matrix_(i,j);
587 }
589 //*************************************************************************************************
590 
591 
592 //*************************************************************************************************
609 template< typename MT // Type of the adapted sparse matrix
610  , bool SO > // Storage order of the adapted sparse matrix
612  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
613 {
614  if( i >= rows() ) {
615  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
616  }
617  if( j >= columns() ) {
618  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
619  }
620  return (*this)(i,j);
621 }
623 //*************************************************************************************************
624 
625 
626 //*************************************************************************************************
643 template< typename MT // Type of the adapted sparse matrix
644  , bool SO > // Storage order of the adapted sparse matrix
646  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
647 {
648  if( i >= rows() ) {
649  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
650  }
651  if( j >= columns() ) {
652  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
653  }
654  return (*this)(i,j);
655 }
657 //*************************************************************************************************
658 
659 
660 //*************************************************************************************************
672 template< typename MT // Type of the adapted sparse matrix
673  , bool SO > // Storage order of the adapted sparse matrix
676 {
677  return matrix_.begin(i);
678 }
680 //*************************************************************************************************
681 
682 
683 //*************************************************************************************************
695 template< typename MT // Type of the adapted sparse matrix
696  , bool SO > // Storage order of the adapted sparse matrix
699 {
700  return matrix_.begin(i);
701 }
703 //*************************************************************************************************
704 
705 
706 //*************************************************************************************************
718 template< typename MT // Type of the adapted sparse matrix
719  , bool SO > // Storage order of the adapted sparse matrix
722 {
723  return matrix_.cbegin(i);
724 }
726 //*************************************************************************************************
727 
728 
729 //*************************************************************************************************
741 template< typename MT // Type of the adapted sparse matrix
742  , bool SO > // Storage order of the adapted sparse matrix
745 {
746  return matrix_.end(i);
747 }
749 //*************************************************************************************************
750 
751 
752 //*************************************************************************************************
764 template< typename MT // Type of the adapted sparse matrix
765  , bool SO > // Storage order of the adapted sparse matrix
767  StrictlyLowerMatrix<MT,SO,false>::end( size_t i ) const
768 {
769  return matrix_.end(i);
770 }
772 //*************************************************************************************************
773 
774 
775 //*************************************************************************************************
787 template< typename MT // Type of the adapted sparse matrix
788  , bool SO > // Storage order of the adapted sparse matrix
791 {
792  return matrix_.cend(i);
793 }
795 //*************************************************************************************************
796 
797 
798 
799 
800 //=================================================================================================
801 //
802 // ASSIGNMENT OPERATORS
803 //
804 //=================================================================================================
805 
806 //*************************************************************************************************
816 template< typename MT // Type of the adapted sparse matrix
817  , bool SO > // Storage order of the adapted sparse matrix
818 inline StrictlyLowerMatrix<MT,SO,false>&
819  StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
820 {
821  matrix_ = rhs.matrix_;
822 
823  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
824  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
825 
826  return *this;
827 }
829 //*************************************************************************************************
830 
831 
832 //*************************************************************************************************
839 template< typename MT // Type of the adapted sparse matrix
840  , bool SO > // Storage order of the adapted sparse matrix
841 inline StrictlyLowerMatrix<MT,SO,false>&
842  StrictlyLowerMatrix<MT,SO,false>::operator=( StrictlyLowerMatrix&& rhs ) noexcept
843 {
844  matrix_ = std::move( rhs.matrix_ );
845 
846  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
847  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
848 
849  return *this;
850 }
852 //*************************************************************************************************
853 
854 
855 //*************************************************************************************************
868 template< typename MT // Type of the adapted sparse matrix
869  , bool SO > // Storage order of the adapted sparse matrix
870 template< typename MT2 // Type of the right-hand side matrix
871  , bool SO2 > // Storage order of the right-hand side matrix
872 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
873  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
874 {
875  if( IsUniTriangular<MT2>::value ||
876  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
877  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
878  }
879 
880  matrix_ = decllow( ~rhs );
881 
882  if( !IsStrictlyLower<MT2>::value )
883  resetUpper();
884 
885  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
886  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
887 
888  return *this;
889 }
891 //*************************************************************************************************
892 
893 
894 //*************************************************************************************************
907 template< typename MT // Type of the adapted sparse matrix
908  , bool SO > // Storage order of the adapted sparse matrix
909 template< typename MT2 // Type of the right-hand side matrix
910  , bool SO2 > // Storage order of the right-hand side matrix
911 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
912  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
913 {
914  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
915  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
916  }
917 
918  if( IsStrictlyLower<MT2>::value ) {
919  matrix_ = ~rhs;
920  }
921  else {
922  MT tmp( ~rhs );
923 
924  if( !isStrictlyLower( tmp ) ) {
925  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
926  }
927 
928  matrix_ = std::move( tmp );
929  }
930 
931  if( !IsStrictlyLower<MT2>::value )
932  resetUpper();
933 
934  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
935  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
936 
937  return *this;
938 }
940 //*************************************************************************************************
941 
942 
943 //*************************************************************************************************
956 template< typename MT // Type of the adapted sparse matrix
957  , bool SO > // Storage order of the adapted sparse matrix
958 template< typename MT2 // Type of the right-hand side matrix
959  , bool SO2 > // Storage order of the right-hand side matrix
960 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
961  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
962 {
963  if( IsUniTriangular<MT2>::value ||
964  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
965  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
966  }
967 
968  matrix_ += decllow( ~rhs );
969 
970  if( !IsStrictlyLower<MT2>::value )
971  resetUpper();
972 
973  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
974  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
975 
976  return *this;
977 }
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
995 template< typename MT // Type of the adapted sparse matrix
996  , bool SO > // Storage order of the adapted sparse matrix
997 template< typename MT2 // Type of the right-hand side matrix
998  , bool SO2 > // Storage order of the right-hand side matrix
999 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1000  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1001 {
1002  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1004  }
1005 
1006  if( IsStrictlyLower<MT2>::value ) {
1007  matrix_ += ~rhs;
1008  }
1009  else {
1010  const ResultType_<MT2> tmp( ~rhs );
1011 
1012  if( !isStrictlyLower( tmp ) ) {
1013  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1014  }
1015 
1016  matrix_ += decllow( tmp );
1017  }
1018 
1019  if( !IsStrictlyLower<MT2>::value )
1020  resetUpper();
1021 
1022  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1023  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1024 
1025  return *this;
1026 }
1028 //*************************************************************************************************
1029 
1030 
1031 //*************************************************************************************************
1044 template< typename MT // Type of the adapted sparse matrix
1045  , bool SO > // Storage order of the adapted sparse matrix
1046 template< typename MT2 // Type of the right-hand side matrix
1047  , bool SO2 > // Storage order of the right-hand side matrix
1048 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1049  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1050 {
1051  if( IsUniTriangular<MT2>::value ||
1052  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
1053  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1054  }
1055 
1056  matrix_ -= decllow( ~rhs );
1057 
1058  if( !IsStrictlyLower<MT2>::value )
1059  resetUpper();
1060 
1061  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1062  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1063 
1064  return *this;
1065 }
1067 //*************************************************************************************************
1068 
1069 
1070 //*************************************************************************************************
1083 template< typename MT // Type of the adapted sparse matrix
1084  , bool SO > // Storage order of the adapted sparse matrix
1085 template< typename MT2 // Type of the right-hand side matrix
1086  , bool SO2 > // Storage order of the right-hand side matrix
1087 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1088  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1089 {
1090  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1091  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1092  }
1093 
1094  if( IsStrictlyLower<MT2>::value ) {
1095  matrix_ -= ~rhs;
1096  }
1097  else {
1098  const ResultType_<MT2> tmp( ~rhs );
1099 
1100  if( !isStrictlyLower( tmp ) ) {
1101  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1102  }
1103 
1104  matrix_ -= decllow( tmp );
1105  }
1106 
1107  if( !IsStrictlyLower<MT2>::value )
1108  resetUpper();
1109 
1110  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1111  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1112 
1113  return *this;
1114 }
1116 //*************************************************************************************************
1117 
1118 
1119 //*************************************************************************************************
1131 template< typename MT // Type of the adapted sparse matrix
1132  , bool SO > // Storage order of the adapted sparse matrix
1133 template< typename MT2 // Type of the right-hand side matrix
1134  , bool SO2 > // Storage order of the right-hand side matrix
1135 inline StrictlyLowerMatrix<MT,SO,false>&
1136  StrictlyLowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1137 {
1138  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1139  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1140  }
1141 
1142  matrix_ %= ~rhs;
1143 
1144  if( !IsStrictlyLower<MT2>::value )
1145  resetUpper();
1146 
1147  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1148  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1149 
1150  return *this;
1151 }
1153 //*************************************************************************************************
1154 
1155 
1156 //*************************************************************************************************
1168 template< typename MT // Type of the adapted sparse matrix
1169  , bool SO > // Storage order of the adapted sparse matrix
1170 template< typename MT2 // Type of the right-hand side matrix
1171  , bool SO2 > // Storage order of the right-hand side matrix
1172 inline StrictlyLowerMatrix<MT,SO,false>&
1173  StrictlyLowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1174 {
1175  if( matrix_.rows() != (~rhs).columns() ) {
1176  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1177  }
1178 
1179  MT tmp( matrix_ * ~rhs );
1180 
1181  if( !isStrictlyLower( tmp ) ) {
1182  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1183  }
1184 
1185  matrix_ = std::move( tmp );
1186 
1187  if( !IsStrictlyLower<MT2>::value )
1188  resetUpper();
1189 
1190  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1191  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1192 
1193  return *this;
1194 }
1196 //*************************************************************************************************
1197 
1198 
1199 //*************************************************************************************************
1207 template< typename MT // Type of the adapted sparse matrix
1208  , bool SO > // Storage order of the adapted sparse matrix
1209 template< typename Other > // Data type of the right-hand side scalar
1210 inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >&
1212 {
1213  matrix_ *= rhs;
1214  return *this;
1215 }
1216 //*************************************************************************************************
1217 
1218 
1219 //*************************************************************************************************
1227 template< typename MT // Type of the adapted sparse matrix
1228  , bool SO > // Storage order of the adapted sparse matrix
1229 template< typename Other > // Data type of the right-hand side scalar
1230 inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >&
1232 {
1233  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1234 
1235  matrix_ /= rhs;
1236  return *this;
1237 }
1239 //*************************************************************************************************
1240 
1241 
1242 
1243 
1244 //=================================================================================================
1245 //
1246 // UTILITY FUNCTIONS
1247 //
1248 //=================================================================================================
1249 
1250 //*************************************************************************************************
1256 template< typename MT // Type of the adapted sparse matrix
1257  , bool SO > // Storage order of the adapted sparse matrix
1258 inline size_t StrictlyLowerMatrix<MT,SO,false>::rows() const noexcept
1259 {
1260  return matrix_.rows();
1261 }
1263 //*************************************************************************************************
1264 
1265 
1266 //*************************************************************************************************
1272 template< typename MT // Type of the adapted sparse matrix
1273  , bool SO > // Storage order of the adapted sparse matrix
1274 inline size_t StrictlyLowerMatrix<MT,SO,false>::columns() const noexcept
1275 {
1276  return matrix_.columns();
1277 }
1279 //*************************************************************************************************
1280 
1281 
1282 //*************************************************************************************************
1288 template< typename MT // Type of the adapted sparse matrix
1289  , bool SO > // Storage order of the adapted sparse matrix
1290 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity() const noexcept
1291 {
1292  return matrix_.capacity();
1293 }
1295 //*************************************************************************************************
1296 
1297 
1298 //*************************************************************************************************
1310 template< typename MT // Type of the adapted sparse matrix
1311  , bool SO > // Storage order of the adapted sparse matrix
1312 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1313 {
1314  return matrix_.capacity(i);
1315 }
1317 //*************************************************************************************************
1318 
1319 
1320 //*************************************************************************************************
1326 template< typename MT // Type of the adapted sparse matrix
1327  , bool SO > // Storage order of the adapted sparse matrix
1328 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros() const
1329 {
1330  return matrix_.nonZeros();
1331 }
1333 //*************************************************************************************************
1334 
1335 
1336 //*************************************************************************************************
1348 template< typename MT // Type of the adapted sparse matrix
1349  , bool SO > // Storage order of the adapted sparse matrix
1350 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1351 {
1352  return matrix_.nonZeros(i);
1353 }
1355 //*************************************************************************************************
1356 
1357 
1358 //*************************************************************************************************
1364 template< typename MT // Type of the adapted sparse matrix
1365  , bool SO > // Storage order of the adapted sparse matrix
1367 {
1368  if( SO ) {
1369  for( size_t j=0UL; j<columns(); ++j ) {
1370  matrix_.erase( j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1371  }
1372  }
1373  else {
1374  for( size_t i=1UL; i<rows(); ++i ) {
1375  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1376  }
1377  }
1378 }
1380 //*************************************************************************************************
1381 
1382 
1383 //*************************************************************************************************
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>::reset( size_t i )
1399 {
1400  if( SO ) {
1401  matrix_.erase( i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1402  }
1403  else {
1404  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1405  }
1406 }
1408 //*************************************************************************************************
1409 
1410 
1411 //*************************************************************************************************
1419 template< typename MT // Type of the adapted sparse matrix
1420  , bool SO > // Storage order of the adapted sparse matrix
1422 {
1423  using blaze::clear;
1424 
1425  if( IsResizable<MT>::value ) {
1426  clear( matrix_ );
1427  }
1428  else {
1429  reset();
1430  }
1431 }
1433 //*************************************************************************************************
1434 
1435 
1436 //*************************************************************************************************
1451 template< typename MT // Type of the adapted sparse matrix
1452  , bool SO > // Storage order of the adapted sparse matrix
1453 void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1454 {
1456 
1457  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1458 
1459  matrix_.resize( n, n, preserve );
1460 }
1462 //*************************************************************************************************
1463 
1464 
1465 //*************************************************************************************************
1476 template< typename MT // Type of the adapted sparse matrix
1477  , bool SO > // Storage order of the adapted sparse matrix
1478 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1479 {
1480  matrix_.reserve( nonzeros );
1481 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1501 template< typename MT // Type of the adapted sparse matrix
1502  , bool SO > // Storage order of the adapted sparse matrix
1503 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1504 {
1505  matrix_.reserve( i, nonzeros );
1506 }
1508 //*************************************************************************************************
1509 
1510 
1511 //*************************************************************************************************
1522 template< typename MT // Type of the adapted sparse matrix
1523  , bool SO > // Storage order of the adapted sparse matrix
1524 inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1525 {
1526  matrix_.trim();
1527 }
1529 //*************************************************************************************************
1530 
1531 
1532 //*************************************************************************************************
1544 template< typename MT // Type of the adapted sparse matrix
1545  , bool SO > // Storage order of the adapted sparse matrix
1546 inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1547 {
1548  matrix_.trim( i );
1549 }
1551 //*************************************************************************************************
1552 
1553 
1554 //*************************************************************************************************
1564 template< typename MT // Type of the adapted sparse matrix
1565  , bool SO > // Storage order of the adapted sparse matrix
1567 {
1568  matrix_.shrinkToFit();
1569 }
1571 //*************************************************************************************************
1572 
1573 
1574 //*************************************************************************************************
1581 template< typename MT // Type of the adapted sparse matrix
1582  , bool SO > // Storage order of the adapted sparse matrix
1583 inline void StrictlyLowerMatrix<MT,SO,false>::swap( StrictlyLowerMatrix& m ) noexcept
1584 {
1585  using std::swap;
1586 
1587  swap( matrix_, m.matrix_ );
1588 }
1590 //*************************************************************************************************
1591 
1592 
1593 //*************************************************************************************************
1605 template< typename MT // Type of the adapted dense matrix
1606  , bool SO > // Storage order of the adapted dense matrix
1607 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1608 {
1610 
1611  return maxNonZeros( Rows<MT>::value );
1612 }
1614 //*************************************************************************************************
1615 
1616 
1617 //*************************************************************************************************
1627 template< typename MT // Type of the adapted dense matrix
1628  , bool SO > // Storage order of the adapted dense matrix
1629 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1630 {
1631  return ( ( n - 1UL ) * n ) / 2UL;
1632 }
1634 //*************************************************************************************************
1635 
1636 
1637 //*************************************************************************************************
1643 template< typename MT // Type of the adapted dense matrix
1644  , bool SO > // Storage order of the adapted dense matrix
1645 inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1646 {
1647  if( SO ) {
1648  for( size_t j=1UL; j<columns(); ++j )
1649  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1650  }
1651  else {
1652  for( size_t i=0UL; i<rows(); ++i )
1653  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1654  }
1655 }
1657 //*************************************************************************************************
1658 
1659 
1660 
1661 
1662 //=================================================================================================
1663 //
1664 // INSERTION FUNCTIONS
1665 //
1666 //=================================================================================================
1667 
1668 //*************************************************************************************************
1684 template< typename MT // Type of the adapted sparse matrix
1685  , bool SO > // Storage order of the adapted sparse matrix
1687  StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1688 {
1689  if( i <= j ) {
1690  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1691  }
1692 
1693  return matrix_.set( i, j, value );
1694 }
1696 //*************************************************************************************************
1697 
1698 
1699 //*************************************************************************************************
1716 template< typename MT // Type of the adapted sparse matrix
1717  , bool SO > // Storage order of the adapted sparse matrix
1719  StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1720 {
1721  if( i <= j ) {
1722  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1723  }
1724 
1725  return matrix_.insert( i, j, value );
1726 }
1728 //*************************************************************************************************
1729 
1730 
1731 //*************************************************************************************************
1781 template< typename MT // Type of the adapted sparse matrix
1782  , bool SO > // Storage order of the adapted sparse matrix
1783 inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1784 {
1785  if( i <= j ) {
1786  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1787  }
1788 
1789  matrix_.append( i, j, value, check );
1790 }
1792 //*************************************************************************************************
1793 
1794 
1795 //*************************************************************************************************
1809 template< typename MT // Type of the adapted sparse matrix
1810  , bool SO > // Storage order of the adapted sparse matrix
1811 inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
1812 {
1813  matrix_.finalize( i );
1814 }
1816 //*************************************************************************************************
1817 
1818 
1819 
1820 
1821 //=================================================================================================
1822 //
1823 // ERASE FUNCTIONS
1824 //
1825 //=================================================================================================
1826 
1827 //*************************************************************************************************
1837 template< typename MT // Type of the adapted sparse matrix
1838  , bool SO > // Storage order of the adapted sparse matrix
1839 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1840 {
1841  matrix_.erase( i, j );
1842 }
1844 //*************************************************************************************************
1845 
1846 
1847 //*************************************************************************************************
1859 template< typename MT // Type of the adapted sparse matrix
1860  , bool SO > // Storage order of the adapted sparse matrix
1862  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1863 {
1864  return matrix_.erase( i, pos );
1865 }
1867 //*************************************************************************************************
1868 
1869 
1870 //*************************************************************************************************
1884 template< typename MT // Type of the adapted sparse matrix
1885  , bool SO > // Storage order of the adapted sparse matrix
1887  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1888 {
1889  return matrix_.erase( i, first, last );
1890 }
1892 //*************************************************************************************************
1893 
1894 
1895 //*************************************************************************************************
1917 template< typename MT // Type of the adapted sparse matrix
1918  , bool SO > // Storage order of the adapted sparse matrix
1919 template< typename Pred > // Type of the unary predicate
1920 inline void StrictlyLowerMatrix<MT,SO,false>::erase( Pred predicate )
1921 {
1922  matrix_.erase( predicate );
1923 
1924  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1925 }
1927 //*************************************************************************************************
1928 
1929 
1930 //*************************************************************************************************
1958 template< typename MT // Type of the adapted sparse matrix
1959  , bool SO > // Storage order of the adapted sparse matrix
1960 template< typename Pred > // Type of the unary predicate
1961 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1962 {
1963  matrix_.erase( i, first, last, predicate );
1964 
1965  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1966 }
1968 //*************************************************************************************************
1969 
1970 
1971 
1972 
1973 //=================================================================================================
1974 //
1975 // LOOKUP FUNCTIONS
1976 //
1977 //=================================================================================================
1978 
1979 //*************************************************************************************************
1995 template< typename MT // Type of the adapted sparse matrix
1996  , bool SO > // Storage order of the adapted sparse matrix
1998  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1999 {
2000  return matrix_.find( i, j );
2001 }
2003 //*************************************************************************************************
2004 
2005 
2006 //*************************************************************************************************
2022 template< typename MT // Type of the adapted sparse matrix
2023  , bool SO > // Storage order of the adapted sparse matrix
2025  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2026 {
2027  return matrix_.find( i, j );
2028 }
2030 //*************************************************************************************************
2031 
2032 
2033 //*************************************************************************************************
2049 template< typename MT // Type of the adapted sparse matrix
2050  , bool SO > // Storage order of the adapted sparse matrix
2052  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2053 {
2054  return matrix_.lowerBound( i, j );
2055 }
2057 //*************************************************************************************************
2058 
2059 
2060 //*************************************************************************************************
2076 template< typename MT // Type of the adapted sparse matrix
2077  , bool SO > // Storage order of the adapted sparse matrix
2079  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2080 {
2081  return matrix_.lowerBound( i, j );
2082 }
2084 //*************************************************************************************************
2085 
2086 
2087 //*************************************************************************************************
2103 template< typename MT // Type of the adapted sparse matrix
2104  , bool SO > // Storage order of the adapted sparse matrix
2106  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2107 {
2108  return matrix_.upperBound( i, j );
2109 }
2111 //*************************************************************************************************
2112 
2113 
2114 //*************************************************************************************************
2130 template< typename MT // Type of the adapted sparse matrix
2131  , bool SO > // Storage order of the adapted sparse matrix
2133  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2134 {
2135  return matrix_.upperBound( i, j );
2136 }
2138 //*************************************************************************************************
2139 
2140 
2141 
2142 
2143 //=================================================================================================
2144 //
2145 // NUMERIC FUNCTIONS
2146 //
2147 //=================================================================================================
2148 
2149 //*************************************************************************************************
2167 template< typename MT // Type of the adapted sparse matrix
2168  , bool SO > // Storage order of the adapted sparse matrix
2169 template< typename Other > // Data type of the scalar value
2170 inline StrictlyLowerMatrix<MT,SO,false>&
2171  StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
2172 {
2173  matrix_.scale( scalar );
2174  return *this;
2175 }
2177 //*************************************************************************************************
2178 
2179 
2180 //*************************************************************************************************
2190 template< typename MT // Type of the adapted sparse matrix
2191  , bool SO > // Storage order of the adapted sparse matrix
2192 template< typename Other > // Data type of the scalar value
2193 inline StrictlyLowerMatrix<MT,SO,false>&
2194  StrictlyLowerMatrix<MT,SO,false>::scaleDiagonal( const Other& scalar )
2195 {
2196  matrix_.scaleDiagonal( scalar );
2197  return *this;
2198 }
2200 //*************************************************************************************************
2201 
2202 
2203 
2204 
2205 //=================================================================================================
2206 //
2207 // DEBUGGING FUNCTIONS
2208 //
2209 //=================================================================================================
2210 
2211 //*************************************************************************************************
2221 template< typename MT // Type of the adapted sparse matrix
2222  , bool SO > // Storage order of the adapted sparse matrix
2223 inline bool StrictlyLowerMatrix<MT,SO,false>::isIntact() const noexcept
2224 {
2225  using blaze::isIntact;
2226 
2227  return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
2228 }
2230 //*************************************************************************************************
2231 
2232 
2233 
2234 
2235 //=================================================================================================
2236 //
2237 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2238 //
2239 //=================================================================================================
2240 
2241 //*************************************************************************************************
2252 template< typename MT // Type of the adapted sparse matrix
2253  , bool SO > // Storage order of the adapted sparse matrix
2254 template< typename Other > // Data type of the foreign expression
2255 inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2256 {
2257  return matrix_.canAlias( alias );
2258 }
2260 //*************************************************************************************************
2261 
2262 
2263 //*************************************************************************************************
2274 template< typename MT // Type of the adapted sparse matrix
2275  , bool SO > // Storage order of the adapted sparse matrix
2276 template< typename Other > // Data type of the foreign expression
2277 inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2278 {
2279  return matrix_.isAliased( alias );
2280 }
2282 //*************************************************************************************************
2283 
2284 
2285 //*************************************************************************************************
2296 template< typename MT // Type of the adapted sparse matrix
2297  , bool SO > // Storage order of the adapted sparse matrix
2298 inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2299 {
2300  return matrix_.canSMPAssign();
2301 }
2303 //*************************************************************************************************
2304 
2305 } // namespace blaze
2306 
2307 #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.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3079
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1245
#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:356
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:1411
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
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:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:609
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5845
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
#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:394
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
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:1393
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:1809
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:308
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:242
Constraint on the data type.
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.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_CONSTRAINT_MUST_BE_STATIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a static data type, i.e. a vector or matrix with dimensions fixed at compile time, a compilation error is created.
Definition: Static.h:61
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5924
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5907
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
#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.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
Constraint on the data type.
decltype(auto) decllow(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as lower.
Definition: DMatDeclLowExpr.h:1027
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
Header file for the SparseElement base class.
Header file for the IsUniTriangular type trait.
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:548
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:264
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:580
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
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:1357
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
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:270
Constraint on the data type.
Constraint on the data type.
Header file for the StrictlyLowerProxy class.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(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.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
#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
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
#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:1375
#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:742
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