Blaze  3.6
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>
61 #include <blaze/math/Exception.h>
64 #include <blaze/math/shims/Clear.h>
75 #include <blaze/util/Assert.h>
80 #include <blaze/util/DisableIf.h>
81 #include <blaze/util/EnableIf.h>
83 #include <blaze/util/Types.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
102 template< typename MT // Type of the adapted sparse matrix
103  , bool SO > // Storage order of the adapted sparse matrix
104 class StrictlyLowerMatrix<MT,SO,false>
105  : public SparseMatrix< StrictlyLowerMatrix<MT,SO,false>, SO >
106 {
107  private:
108  //**Type definitions****************************************************************************
109  using OT = OppositeType_t<MT>;
110  using TT = TransposeType_t<MT>;
111  using ET = ElementType_t<MT>;
112  //**********************************************************************************************
113 
114  public:
115  //**Type definitions****************************************************************************
116  using This = StrictlyLowerMatrix<MT,SO,false>;
117  using BaseType = SparseMatrix<This,SO>;
118  using ResultType = This;
119  using OppositeType = StrictlyLowerMatrix<OT,!SO,false>;
120  using TransposeType = StrictlyUpperMatrix<TT,!SO,false>;
121  using ElementType = ET;
122  using ReturnType = ReturnType_t<MT>;
123  using CompositeType = const This&;
124  using Reference = StrictlyLowerProxy<MT>;
125  using ConstReference = ConstReference_t<MT>;
126  using Iterator = Iterator_t<MT>;
127  using ConstIterator = ConstIterator_t<MT>;
128  //**********************************************************************************************
129 
130  //**Rebind struct definition********************************************************************
133  template< typename NewType > // Data type of the other matrix
134  struct Rebind {
136  using Other = StrictlyLowerMatrix< typename MT::template Rebind<NewType>::Other >;
137  };
138  //**********************************************************************************************
139 
140  //**Resize struct definition********************************************************************
143  template< size_t NewM // Number of rows of the other matrix
144  , size_t NewN > // Number of columns of the other matrix
145  struct Resize {
147  using Other = StrictlyLowerMatrix< typename MT::template Resize<NewM,NewN>::Other >;
148  };
149  //**********************************************************************************************
150 
151  //**Compilation flags***************************************************************************
153  static constexpr bool smpAssignable = false;
154  //**********************************************************************************************
155 
156  //**Constructors********************************************************************************
159  explicit inline StrictlyLowerMatrix();
160  explicit inline StrictlyLowerMatrix( size_t n );
161  explicit inline StrictlyLowerMatrix( size_t n, size_t nonzeros );
162  explicit inline StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
163  inline StrictlyLowerMatrix( initializer_list< initializer_list<ElementType> > list );
164 
165  inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
166  inline StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept;
167 
168  template< typename MT2, bool SO2 >
169  inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
171  //**********************************************************************************************
172 
173  //**Destructor**********************************************************************************
176  ~StrictlyLowerMatrix() = default;
178  //**********************************************************************************************
179 
180  //**Data access functions***********************************************************************
183  inline Reference operator()( size_t i, size_t j );
184  inline ConstReference operator()( size_t i, size_t j ) const;
185  inline Reference at( size_t i, size_t j );
186  inline ConstReference at( size_t i, size_t j ) const;
187  inline Iterator begin ( size_t i );
188  inline ConstIterator begin ( size_t i ) const;
189  inline ConstIterator cbegin( size_t i ) const;
190  inline Iterator end ( size_t i );
191  inline ConstIterator end ( size_t i ) const;
192  inline ConstIterator cend ( size_t i ) const;
194  //**********************************************************************************************
195 
196  //**Assignment operators************************************************************************
199  inline StrictlyLowerMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
200 
201  inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
202  inline StrictlyLowerMatrix& operator=( StrictlyLowerMatrix&& rhs ) noexcept;
203 
204  template< typename MT2, bool SO2 >
205  inline auto operator=( const Matrix<MT2,SO2>& rhs )
206  -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
207 
208  template< typename MT2, bool SO2 >
209  inline auto operator=( const Matrix<MT2,SO2>& rhs )
210  -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
211 
212  template< typename MT2, bool SO2 >
213  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
214  -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
215 
216  template< typename MT2, bool SO2 >
217  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
218  -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
219 
220  template< typename MT2, bool SO2 >
221  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
222  -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
223 
224  template< typename MT2, bool SO2 >
225  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
226  -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
227 
228  template< typename MT2, bool SO2 >
229  inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> StrictlyLowerMatrix&;
231  //**********************************************************************************************
232 
233  //**Utility functions***************************************************************************
236  inline size_t rows() const noexcept;
237  inline size_t columns() const noexcept;
238  inline size_t capacity() const noexcept;
239  inline size_t capacity( size_t i ) const noexcept;
240  inline size_t nonZeros() const;
241  inline size_t nonZeros( size_t i ) const;
242  inline void reset();
243  inline void reset( size_t i );
244  inline void clear();
245  inline void resize ( size_t n, bool preserve=true );
246  inline void reserve( size_t nonzeros );
247  inline void reserve( size_t i, size_t nonzeros );
248  inline void trim();
249  inline void trim( size_t i );
250  inline void shrinkToFit();
251  inline void swap( StrictlyLowerMatrix& m ) noexcept;
252 
253  static inline constexpr size_t maxNonZeros() noexcept;
254  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
256  //**********************************************************************************************
257 
258  //**Insertion functions*************************************************************************
261  inline Iterator set ( size_t i, size_t j, const ElementType& value );
262  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
263  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
264  inline void finalize( size_t i );
266  //**********************************************************************************************
267 
268  //**Erase functions*****************************************************************************
271  inline void erase( size_t i, size_t j );
272  inline Iterator erase( size_t i, Iterator pos );
273  inline Iterator erase( size_t i, Iterator first, Iterator last );
274 
275  template< typename Pred >
276  inline void erase( Pred predicate );
277 
278  template< typename Pred >
279  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
281  //**********************************************************************************************
282 
283  //**Lookup functions****************************************************************************
286  inline Iterator find ( size_t i, size_t j );
287  inline ConstIterator find ( size_t i, size_t j ) const;
288  inline Iterator lowerBound( size_t i, size_t j );
289  inline ConstIterator lowerBound( size_t i, size_t j ) const;
290  inline Iterator upperBound( size_t i, size_t j );
291  inline ConstIterator upperBound( size_t i, size_t j ) const;
293  //**********************************************************************************************
294 
295  //**Numeric functions***************************************************************************
298  template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
300  //**********************************************************************************************
301 
302  //**Debugging functions*************************************************************************
305  inline bool isIntact() const noexcept;
307  //**********************************************************************************************
308 
309  //**Expression template evaluation functions****************************************************
312  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
313  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
314 
315  inline bool canSMPAssign() const noexcept;
317  //**********************************************************************************************
318 
319  private:
320  //**Utility functions***************************************************************************
323  inline void resetUpper();
325  //**********************************************************************************************
326 
327  //**Member variables****************************************************************************
330  MT matrix_;
331 
332  //**********************************************************************************************
333 
334  //**Friend declarations*************************************************************************
335  template< typename MT2, bool SO2, bool DF2 >
336  friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
337  //**********************************************************************************************
338 
339  //**Compile time checks*************************************************************************
354  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
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 ) // 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 //*************************************************************************************************
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( initializer_list< initializer_list<ElementType> > list )
482  : matrix_( list ) // The adapted sparse matrix
483 {
484  if( !isStrictlyLower( matrix_ ) ) {
485  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
486  }
487 
488  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
489 }
491 //*************************************************************************************************
492 
493 
494 //*************************************************************************************************
500 template< typename MT // Type of the adapted sparse matrix
501  , bool SO > // Storage order of the adapted sparse matrix
502 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
503  : matrix_( m.matrix_ ) // The adapted sparse matrix
504 {
505  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
506  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
507 }
509 //*************************************************************************************************
510 
511 
512 //*************************************************************************************************
518 template< typename MT // Type of the adapted sparse matrix
519  , bool SO > // Storage order of the adapted sparse matrix
520 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept
521  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
522 {
523  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
524  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
525 }
527 //*************************************************************************************************
528 
529 
530 //*************************************************************************************************
541 template< typename MT // Type of the adapted sparse matrix
542  , bool SO > // Storage order of the adapted sparse matrix
543 template< typename MT2 // Type of the foreign matrix
544  , bool SO2 > // Storage order of the foreign matrix
545 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
546  : matrix_( ~m ) // The adapted sparse matrix
547 {
548  if( IsUniTriangular_v<MT2> ||
549  ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( matrix_ ) ) ) {
550  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
551  }
552 
553  if( !IsStrictlyLower_v<MT2> )
554  resetUpper();
555 
556  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
557  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
558 }
560 //*************************************************************************************************
561 
562 
563 
564 
565 //=================================================================================================
566 //
567 // DATA ACCESS FUNCTIONS
568 //
569 //=================================================================================================
570 
571 //*************************************************************************************************
587 template< typename MT // Type of the adapted sparse matrix
588  , bool SO > // Storage order of the adapted sparse matrix
589 inline typename StrictlyLowerMatrix<MT,SO,false>::Reference
590  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
591 {
592  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
593  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
594 
595  return Reference( matrix_, i, j );
596 }
598 //*************************************************************************************************
599 
600 
601 //*************************************************************************************************
617 template< typename MT // Type of the adapted sparse matrix
618  , bool SO > // Storage order of the adapted sparse matrix
619 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstReference
620  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
621 {
622  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
623  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
624 
625  return matrix_(i,j);
626 }
628 //*************************************************************************************************
629 
630 
631 //*************************************************************************************************
648 template< typename MT // Type of the adapted sparse matrix
649  , bool SO > // Storage order of the adapted sparse matrix
650 inline typename StrictlyLowerMatrix<MT,SO,false>::Reference
651  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
652 {
653  if( i >= rows() ) {
654  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
655  }
656  if( j >= columns() ) {
657  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
658  }
659  return (*this)(i,j);
660 }
662 //*************************************************************************************************
663 
664 
665 //*************************************************************************************************
682 template< typename MT // Type of the adapted sparse matrix
683  , bool SO > // Storage order of the adapted sparse matrix
684 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstReference
685  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
686 {
687  if( i >= rows() ) {
688  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
689  }
690  if( j >= columns() ) {
691  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
692  }
693  return (*this)(i,j);
694 }
696 //*************************************************************************************************
697 
698 
699 //*************************************************************************************************
711 template< typename MT // Type of the adapted sparse matrix
712  , bool SO > // Storage order of the adapted sparse matrix
713 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
715 {
716  return matrix_.begin(i);
717 }
719 //*************************************************************************************************
720 
721 
722 //*************************************************************************************************
734 template< typename MT // Type of the adapted sparse matrix
735  , bool SO > // Storage order of the adapted sparse matrix
736 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
738 {
739  return matrix_.begin(i);
740 }
742 //*************************************************************************************************
743 
744 
745 //*************************************************************************************************
757 template< typename MT // Type of the adapted sparse matrix
758  , bool SO > // Storage order of the adapted sparse matrix
759 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
761 {
762  return matrix_.cbegin(i);
763 }
765 //*************************************************************************************************
766 
767 
768 //*************************************************************************************************
780 template< typename MT // Type of the adapted sparse matrix
781  , bool SO > // Storage order of the adapted sparse matrix
782 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
784 {
785  return matrix_.end(i);
786 }
788 //*************************************************************************************************
789 
790 
791 //*************************************************************************************************
803 template< typename MT // Type of the adapted sparse matrix
804  , bool SO > // Storage order of the adapted sparse matrix
805 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
806  StrictlyLowerMatrix<MT,SO,false>::end( size_t i ) const
807 {
808  return matrix_.end(i);
809 }
811 //*************************************************************************************************
812 
813 
814 //*************************************************************************************************
826 template< typename MT // Type of the adapted sparse matrix
827  , bool SO > // Storage order of the adapted sparse matrix
828 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
830 {
831  return matrix_.cend(i);
832 }
834 //*************************************************************************************************
835 
836 
837 
838 
839 //=================================================================================================
840 //
841 // ASSIGNMENT OPERATORS
842 //
843 //=================================================================================================
844 
845 //*************************************************************************************************
870 template< typename MT // Type of the adapted sparse matrix
871  , bool SO > // Storage order of the adapted sparse matrix
872 inline StrictlyLowerMatrix<MT,SO,false>&
873  StrictlyLowerMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
874 {
875  const InitializerMatrix<ElementType> tmp( list, list.size() );
876 
877  if( !isStrictlyLower( tmp ) ) {
878  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
879  }
880 
881  matrix_ = list;
882 
883  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
884  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
885 
886  return *this;
887 }
889 //*************************************************************************************************
890 
891 
892 //*************************************************************************************************
902 template< typename MT // Type of the adapted sparse matrix
903  , bool SO > // Storage order of the adapted sparse matrix
904 inline StrictlyLowerMatrix<MT,SO,false>&
905  StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
906 {
907  matrix_ = rhs.matrix_;
908 
909  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
910  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
911 
912  return *this;
913 }
915 //*************************************************************************************************
916 
917 
918 //*************************************************************************************************
925 template< typename MT // Type of the adapted sparse matrix
926  , bool SO > // Storage order of the adapted sparse matrix
927 inline StrictlyLowerMatrix<MT,SO,false>&
928  StrictlyLowerMatrix<MT,SO,false>::operator=( StrictlyLowerMatrix&& rhs ) noexcept
929 {
930  matrix_ = std::move( rhs.matrix_ );
931 
932  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
933  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
934 
935  return *this;
936 }
938 //*************************************************************************************************
939 
940 
941 //*************************************************************************************************
954 template< typename MT // Type of the adapted sparse matrix
955  , bool SO > // Storage order of the adapted sparse matrix
956 template< typename MT2 // Type of the right-hand side matrix
957  , bool SO2 > // Storage order of the right-hand side matrix
958 inline auto StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
959  -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
960 {
961  if( IsUniTriangular_v<MT2> ||
962  ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( ~rhs ) ) ) {
963  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
964  }
965 
966  matrix_ = decllow( ~rhs );
967 
968  if( !IsStrictlyLower_v<MT2> )
969  resetUpper();
970 
971  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
972  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
973 
974  return *this;
975 }
977 //*************************************************************************************************
978 
979 
980 //*************************************************************************************************
993 template< typename MT // Type of the adapted sparse matrix
994  , bool SO > // Storage order of the adapted sparse matrix
995 template< typename MT2 // Type of the right-hand side matrix
996  , bool SO2 > // Storage order of the right-hand side matrix
997 inline auto StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
998  -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
999 {
1000  if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) ) {
1001  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1002  }
1003 
1004  if( IsStrictlyLower_v<MT2> ) {
1005  matrix_ = ~rhs;
1006  }
1007  else {
1008  MT tmp( ~rhs );
1009 
1010  if( !isStrictlyLower( tmp ) ) {
1011  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1012  }
1013 
1014  matrix_ = std::move( tmp );
1015  }
1016 
1017  if( !IsStrictlyLower_v<MT2> )
1018  resetUpper();
1019 
1020  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1021  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1022 
1023  return *this;
1024 }
1026 //*************************************************************************************************
1027 
1028 
1029 //*************************************************************************************************
1042 template< typename MT // Type of the adapted sparse matrix
1043  , bool SO > // Storage order of the adapted sparse matrix
1044 template< typename MT2 // Type of the right-hand side matrix
1045  , bool SO2 > // Storage order of the right-hand side matrix
1046 inline auto StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1047  -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1048 {
1049  if( IsUniTriangular_v<MT2> ||
1050  ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( ~rhs ) ) ) {
1051  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1052  }
1053 
1054  matrix_ += decllow( ~rhs );
1055 
1056  if( !IsStrictlyLower_v<MT2> )
1057  resetUpper();
1058 
1059  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1060  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1061 
1062  return *this;
1063 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1081 template< typename MT // Type of the adapted sparse matrix
1082  , bool SO > // Storage order of the adapted sparse matrix
1083 template< typename MT2 // Type of the right-hand side matrix
1084  , bool SO2 > // Storage order of the right-hand side matrix
1085 inline auto StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1086  -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1087 {
1088  if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) ) {
1089  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1090  }
1091 
1092  if( IsStrictlyLower_v<MT2> ) {
1093  matrix_ += ~rhs;
1094  }
1095  else {
1096  const ResultType_t<MT2> tmp( ~rhs );
1097 
1098  if( !isStrictlyLower( tmp ) ) {
1099  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1100  }
1101 
1102  matrix_ += decllow( tmp );
1103  }
1104 
1105  if( !IsStrictlyLower_v<MT2> )
1106  resetUpper();
1107 
1108  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1109  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1110 
1111  return *this;
1112 }
1114 //*************************************************************************************************
1115 
1116 
1117 //*************************************************************************************************
1130 template< typename MT // Type of the adapted sparse matrix
1131  , bool SO > // Storage order of the adapted sparse matrix
1132 template< typename MT2 // Type of the right-hand side matrix
1133  , bool SO2 > // Storage order of the right-hand side matrix
1134 inline auto StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1135  -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1136 {
1137  if( IsUniTriangular_v<MT2> ||
1138  ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( ~rhs ) ) ) {
1139  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1140  }
1141 
1142  matrix_ -= decllow( ~rhs );
1143 
1144  if( !IsStrictlyLower_v<MT2> )
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 //*************************************************************************************************
1169 template< typename MT // Type of the adapted sparse matrix
1170  , bool SO > // Storage order of the adapted sparse matrix
1171 template< typename MT2 // Type of the right-hand side matrix
1172  , bool SO2 > // Storage order of the right-hand side matrix
1173 inline auto StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1174  -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1175 {
1176  if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) ) {
1177  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1178  }
1179 
1180  if( IsStrictlyLower_v<MT2> ) {
1181  matrix_ -= ~rhs;
1182  }
1183  else {
1184  const ResultType_t<MT2> tmp( ~rhs );
1185 
1186  if( !isStrictlyLower( tmp ) ) {
1187  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1188  }
1189 
1190  matrix_ -= decllow( tmp );
1191  }
1192 
1193  if( !IsStrictlyLower_v<MT2> )
1194  resetUpper();
1195 
1196  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1197  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1198 
1199  return *this;
1200 }
1202 //*************************************************************************************************
1203 
1204 
1205 //*************************************************************************************************
1217 template< typename MT // Type of the adapted sparse matrix
1218  , bool SO > // Storage order of the adapted sparse matrix
1219 template< typename MT2 // Type of the right-hand side matrix
1220  , bool SO2 > // Storage order of the right-hand side matrix
1221 inline auto StrictlyLowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1222  -> StrictlyLowerMatrix&
1223 {
1224  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1225  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1226  }
1227 
1228  matrix_ %= ~rhs;
1229 
1230  if( !IsStrictlyLower_v<MT2> )
1231  resetUpper();
1232 
1233  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1234  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1235 
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  using blaze::erase;
1369 
1370  if( SO ) {
1371  for( size_t j=0UL; j<columns(); ++j ) {
1372  erase( matrix_, j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1373  }
1374  }
1375  else {
1376  for( size_t i=1UL; i<rows(); ++i ) {
1377  erase( matrix_, i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1378  }
1379  }
1380 }
1382 //*************************************************************************************************
1383 
1384 
1385 //*************************************************************************************************
1398 template< typename MT // Type of the adapted sparse matrix
1399  , bool SO > // Storage order of the adapted sparse matrix
1400 inline void StrictlyLowerMatrix<MT,SO,false>::reset( size_t i )
1401 {
1402  using blaze::erase;
1403 
1404  if( SO ) {
1405  erase( matrix_, i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1406  }
1407  else {
1408  erase( matrix_, i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1409  }
1410 }
1412 //*************************************************************************************************
1413 
1414 
1415 //*************************************************************************************************
1423 template< typename MT // Type of the adapted sparse matrix
1424  , bool SO > // Storage order of the adapted sparse matrix
1426 {
1427  using blaze::clear;
1428 
1429  if( IsResizable_v<MT> ) {
1430  clear( matrix_ );
1431  }
1432  else {
1433  reset();
1434  }
1435 }
1437 //*************************************************************************************************
1438 
1439 
1440 //*************************************************************************************************
1455 template< typename MT // Type of the adapted sparse matrix
1456  , bool SO > // Storage order of the adapted sparse matrix
1457 void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1458 {
1460 
1461  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1462 
1463  matrix_.resize( n, n, preserve );
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>::reserve( size_t nonzeros )
1483 {
1484  matrix_.reserve( nonzeros );
1485 }
1487 //*************************************************************************************************
1488 
1489 
1490 //*************************************************************************************************
1505 template< typename MT // Type of the adapted sparse matrix
1506  , bool SO > // Storage order of the adapted sparse matrix
1507 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1508 {
1509  matrix_.reserve( i, nonzeros );
1510 }
1512 //*************************************************************************************************
1513 
1514 
1515 //*************************************************************************************************
1526 template< typename MT // Type of the adapted sparse matrix
1527  , bool SO > // Storage order of the adapted sparse matrix
1528 inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1529 {
1530  matrix_.trim();
1531 }
1533 //*************************************************************************************************
1534 
1535 
1536 //*************************************************************************************************
1548 template< typename MT // Type of the adapted sparse matrix
1549  , bool SO > // Storage order of the adapted sparse matrix
1550 inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1551 {
1552  matrix_.trim( i );
1553 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1568 template< typename MT // Type of the adapted sparse matrix
1569  , bool SO > // Storage order of the adapted sparse matrix
1571 {
1572  matrix_.shrinkToFit();
1573 }
1575 //*************************************************************************************************
1576 
1577 
1578 //*************************************************************************************************
1585 template< typename MT // Type of the adapted sparse matrix
1586  , bool SO > // Storage order of the adapted sparse matrix
1587 inline void StrictlyLowerMatrix<MT,SO,false>::swap( StrictlyLowerMatrix& m ) noexcept
1588 {
1589  using std::swap;
1590 
1591  swap( matrix_, m.matrix_ );
1592 }
1594 //*************************************************************************************************
1595 
1596 
1597 //*************************************************************************************************
1609 template< typename MT // Type of the adapted dense matrix
1610  , bool SO > // Storage order of the adapted dense matrix
1611 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1612 {
1614 
1615  return maxNonZeros( Size_v<MT,0UL> );
1616 }
1618 //*************************************************************************************************
1619 
1620 
1621 //*************************************************************************************************
1631 template< typename MT // Type of the adapted dense matrix
1632  , bool SO > // Storage order of the adapted dense matrix
1633 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1634 {
1635  return ( ( n - 1UL ) * n ) / 2UL;
1636 }
1638 //*************************************************************************************************
1639 
1640 
1641 //*************************************************************************************************
1647 template< typename MT // Type of the adapted dense matrix
1648  , bool SO > // Storage order of the adapted dense matrix
1649 inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1650 {
1651  using blaze::erase;
1652 
1653  if( SO ) {
1654  for( size_t j=1UL; j<columns(); ++j )
1655  erase( matrix_, j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1656  }
1657  else {
1658  for( size_t i=0UL; i<rows(); ++i )
1659  erase( matrix_, i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1660  }
1661 }
1663 //*************************************************************************************************
1664 
1665 
1666 
1667 
1668 //=================================================================================================
1669 //
1670 // INSERTION FUNCTIONS
1671 //
1672 //=================================================================================================
1673 
1674 //*************************************************************************************************
1690 template< typename MT // Type of the adapted sparse matrix
1691  , bool SO > // Storage order of the adapted sparse matrix
1692 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1693  StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1694 {
1695  if( i <= j ) {
1696  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1697  }
1698 
1699  return matrix_.set( i, j, value );
1700 }
1702 //*************************************************************************************************
1703 
1704 
1705 //*************************************************************************************************
1722 template< typename MT // Type of the adapted sparse matrix
1723  , bool SO > // Storage order of the adapted sparse matrix
1724 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1725  StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1726 {
1727  if( i <= j ) {
1728  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1729  }
1730 
1731  return matrix_.insert( i, j, value );
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 //*************************************************************************************************
1787 template< typename MT // Type of the adapted sparse matrix
1788  , bool SO > // Storage order of the adapted sparse matrix
1789 inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1790 {
1791  if( i <= j ) {
1792  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1793  }
1794 
1795  matrix_.append( i, j, value, check );
1796 }
1798 //*************************************************************************************************
1799 
1800 
1801 //*************************************************************************************************
1815 template< typename MT // Type of the adapted sparse matrix
1816  , bool SO > // Storage order of the adapted sparse matrix
1817 inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
1818 {
1819  matrix_.finalize( i );
1820 }
1822 //*************************************************************************************************
1823 
1824 
1825 
1826 
1827 //=================================================================================================
1828 //
1829 // ERASE FUNCTIONS
1830 //
1831 //=================================================================================================
1832 
1833 //*************************************************************************************************
1843 template< typename MT // Type of the adapted sparse matrix
1844  , bool SO > // Storage order of the adapted sparse matrix
1845 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1846 {
1847  using blaze::erase;
1848 
1849  erase( matrix_, i, j );
1850 }
1852 //*************************************************************************************************
1853 
1854 
1855 //*************************************************************************************************
1867 template< typename MT // Type of the adapted sparse matrix
1868  , bool SO > // Storage order of the adapted sparse matrix
1869 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1870  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1871 {
1872  using blaze::erase;
1873 
1874  return erase( matrix_, i, pos );
1875 }
1877 //*************************************************************************************************
1878 
1879 
1880 //*************************************************************************************************
1894 template< typename MT // Type of the adapted sparse matrix
1895  , bool SO > // Storage order of the adapted sparse matrix
1896 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1897  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1898 {
1899  using blaze::erase;
1900 
1901  return erase( matrix_, i, first, last );
1902 }
1904 //*************************************************************************************************
1905 
1906 
1907 //*************************************************************************************************
1929 template< typename MT // Type of the adapted sparse matrix
1930  , bool SO > // Storage order of the adapted sparse matrix
1931 template< typename Pred > // Type of the unary predicate
1932 inline void StrictlyLowerMatrix<MT,SO,false>::erase( Pred predicate )
1933 {
1934  using blaze::erase;
1935 
1936  erase( matrix_, predicate );
1937 
1938  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1939 }
1941 //*************************************************************************************************
1942 
1943 
1944 //*************************************************************************************************
1972 template< typename MT // Type of the adapted sparse matrix
1973  , bool SO > // Storage order of the adapted sparse matrix
1974 template< typename Pred > // Type of the unary predicate
1975 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1976 {
1977  using blaze::erase;
1978 
1979  erase( matrix_, i, first, last, predicate );
1980 
1981  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1982 }
1984 //*************************************************************************************************
1985 
1986 
1987 
1988 
1989 //=================================================================================================
1990 //
1991 // LOOKUP FUNCTIONS
1992 //
1993 //=================================================================================================
1994 
1995 //*************************************************************************************************
2011 template< typename MT // Type of the adapted sparse matrix
2012  , bool SO > // Storage order of the adapted sparse matrix
2013 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
2014  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
2015 {
2016  return matrix_.find( i, j );
2017 }
2019 //*************************************************************************************************
2020 
2021 
2022 //*************************************************************************************************
2038 template< typename MT // Type of the adapted sparse matrix
2039  , bool SO > // Storage order of the adapted sparse matrix
2040 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
2041  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2042 {
2043  return matrix_.find( i, j );
2044 }
2046 //*************************************************************************************************
2047 
2048 
2049 //*************************************************************************************************
2065 template< typename MT // Type of the adapted sparse matrix
2066  , bool SO > // Storage order of the adapted sparse matrix
2067 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
2068  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2069 {
2070  return matrix_.lowerBound( i, j );
2071 }
2073 //*************************************************************************************************
2074 
2075 
2076 //*************************************************************************************************
2092 template< typename MT // Type of the adapted sparse matrix
2093  , bool SO > // Storage order of the adapted sparse matrix
2094 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
2095  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2096 {
2097  return matrix_.lowerBound( i, j );
2098 }
2100 //*************************************************************************************************
2101 
2102 
2103 //*************************************************************************************************
2119 template< typename MT // Type of the adapted sparse matrix
2120  , bool SO > // Storage order of the adapted sparse matrix
2121 inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
2122  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2123 {
2124  return matrix_.upperBound( i, j );
2125 }
2127 //*************************************************************************************************
2128 
2129 
2130 //*************************************************************************************************
2146 template< typename MT // Type of the adapted sparse matrix
2147  , bool SO > // Storage order of the adapted sparse matrix
2148 inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
2149  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2150 {
2151  return matrix_.upperBound( i, j );
2152 }
2154 //*************************************************************************************************
2155 
2156 
2157 
2158 
2159 //=================================================================================================
2160 //
2161 // NUMERIC FUNCTIONS
2162 //
2163 //=================================================================================================
2164 
2165 //*************************************************************************************************
2183 template< typename MT // Type of the adapted sparse matrix
2184  , bool SO > // Storage order of the adapted sparse matrix
2185 template< typename Other > // Data type of the scalar value
2186 inline StrictlyLowerMatrix<MT,SO,false>&
2187  StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
2188 {
2189  matrix_.scale( scalar );
2190  return *this;
2191 }
2193 //*************************************************************************************************
2194 
2195 
2196 
2197 
2198 //=================================================================================================
2199 //
2200 // DEBUGGING FUNCTIONS
2201 //
2202 //=================================================================================================
2203 
2204 //*************************************************************************************************
2214 template< typename MT // Type of the adapted sparse matrix
2215  , bool SO > // Storage order of the adapted sparse matrix
2216 inline bool StrictlyLowerMatrix<MT,SO,false>::isIntact() const noexcept
2217 {
2218  using blaze::isIntact;
2219 
2220  return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
2221 }
2223 //*************************************************************************************************
2224 
2225 
2226 
2227 
2228 //=================================================================================================
2229 //
2230 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2231 //
2232 //=================================================================================================
2233 
2234 //*************************************************************************************************
2245 template< typename MT // Type of the adapted sparse matrix
2246  , bool SO > // Storage order of the adapted sparse matrix
2247 template< typename Other > // Data type of the foreign expression
2248 inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2249 {
2250  return matrix_.canAlias( alias );
2251 }
2253 //*************************************************************************************************
2254 
2255 
2256 //*************************************************************************************************
2267 template< typename MT // Type of the adapted sparse matrix
2268  , bool SO > // Storage order of the adapted sparse matrix
2269 template< typename Other > // Data type of the foreign expression
2270 inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2271 {
2272  return matrix_.isAliased( alias );
2273 }
2275 //*************************************************************************************************
2276 
2277 
2278 //*************************************************************************************************
2289 template< typename MT // Type of the adapted sparse matrix
2290  , bool SO > // Storage order of the adapted sparse matrix
2291 inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2292 {
2293  return matrix_.canSMPAssign();
2294 }
2296 //*************************************************************************************************
2297 
2298 } // namespace blaze
2299 
2300 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.In case the given data type T is a transformation expression (i....
Definition: Transformation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
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
Constraint on the data type.
Header file for auxiliary alias declarations.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1968
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i....
Definition: Computation.h:81
Constraint on the data type.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
Header file for all adaptor forward declarations.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the extended initializer_list functionality.
Constraint on the data type.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
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.
Header file for the implementation of a matrix representation of an initializer list.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#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,...
Definition: Static.h:61
Compile time assertion.
#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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
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:1001
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
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
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:615
#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,...
Definition: Symmetric.h:79
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,...
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:282
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
Constraint on the data type.
Constraint on the data type.
Header file for the StrictlyLowerProxy class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.In case the given data type T is a view type (i.e. a subvector,...
Definition: View.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
#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 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
#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,...
Definition: Hermitian.h:79
#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
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Header file for the IsResizable type trait.
Constraint on the data type.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
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
Header file for the clear shim.