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>
59 #include <blaze/math/Exception.h>
62 #include <blaze/math/shims/Clear.h>
73 #include <blaze/util/Assert.h>
78 #include <blaze/util/DisableIf.h>
79 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/Types.h>
82 
83 
84 namespace blaze {
85 
86 //=================================================================================================
87 //
88 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
89 //
90 //=================================================================================================
91 
92 //*************************************************************************************************
100 template< typename MT // Type of the adapted sparse matrix
101  , bool SO > // Storage order of the adapted sparse matrix
102 class 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  explicit inline StrictlyLowerMatrix( initializer_list< initializer_list<ElementType> > list );
162 
163  inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
164  inline StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept;
165 
166  template< typename MT2, bool SO2 >
167  inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
169  //**********************************************************************************************
170 
171  //**Destructor**********************************************************************************
172  // No explicitly declared destructor.
173  //**********************************************************************************************
174 
175  //**Data access functions***********************************************************************
178  inline Reference operator()( size_t i, size_t j );
179  inline ConstReference operator()( size_t i, size_t j ) const;
180  inline Reference at( size_t i, size_t j );
181  inline ConstReference at( size_t i, size_t j ) const;
182  inline Iterator begin ( size_t i );
183  inline ConstIterator begin ( size_t i ) const;
184  inline ConstIterator cbegin( size_t i ) const;
185  inline Iterator end ( size_t i );
186  inline ConstIterator end ( size_t i ) const;
187  inline ConstIterator cend ( size_t i ) const;
189  //**********************************************************************************************
190 
191  //**Assignment operators************************************************************************
194  inline StrictlyLowerMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
195 
196  inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
197  inline StrictlyLowerMatrix& operator=( StrictlyLowerMatrix&& rhs ) noexcept;
198 
199  template< typename MT2, bool SO2 >
200  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
201  operator=( const Matrix<MT2,SO2>& rhs );
202 
203  template< typename MT2, bool SO2 >
204  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
205  operator=( const Matrix<MT2,SO2>& rhs );
206 
207  template< typename MT2, bool SO2 >
208  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
209  operator+=( const Matrix<MT2,SO2>& rhs );
210 
211  template< typename MT2, bool SO2 >
212  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
213  operator+=( const Matrix<MT2,SO2>& rhs );
214 
215  template< typename MT2, bool SO2 >
216  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
217  operator-=( const Matrix<MT2,SO2>& rhs );
218 
219  template< typename MT2, bool SO2 >
220  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
221  operator-=( const Matrix<MT2,SO2>& rhs );
222 
223  template< typename MT2, bool SO2 >
224  inline StrictlyLowerMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
226  //**********************************************************************************************
227 
228  //**Utility functions***************************************************************************
231  inline size_t rows() const noexcept;
232  inline size_t columns() const noexcept;
233  inline size_t capacity() const noexcept;
234  inline size_t capacity( size_t i ) const noexcept;
235  inline size_t nonZeros() const;
236  inline size_t nonZeros( size_t i ) const;
237  inline void reset();
238  inline void reset( size_t i );
239  inline void clear();
240  inline void resize ( size_t n, bool preserve=true );
241  inline void reserve( size_t nonzeros );
242  inline void reserve( size_t i, size_t nonzeros );
243  inline void trim();
244  inline void trim( size_t i );
245  inline void shrinkToFit();
246  inline void swap( StrictlyLowerMatrix& m ) noexcept;
247 
248  static inline constexpr size_t maxNonZeros() noexcept;
249  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
251  //**********************************************************************************************
252 
253  //**Insertion functions*************************************************************************
256  inline Iterator set ( size_t i, size_t j, const ElementType& value );
257  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
258  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
259  inline void finalize( size_t i );
261  //**********************************************************************************************
262 
263  //**Erase functions*****************************************************************************
266  inline void erase( size_t i, size_t j );
267  inline Iterator erase( size_t i, Iterator pos );
268  inline Iterator erase( size_t i, Iterator first, Iterator last );
269 
270  template< typename Pred >
271  inline void erase( Pred predicate );
272 
273  template< typename Pred >
274  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
276  //**********************************************************************************************
277 
278  //**Lookup functions****************************************************************************
281  inline Iterator find ( size_t i, size_t j );
282  inline ConstIterator find ( size_t i, size_t j ) const;
283  inline Iterator lowerBound( size_t i, size_t j );
284  inline ConstIterator lowerBound( size_t i, size_t j ) const;
285  inline Iterator upperBound( size_t i, size_t j );
286  inline ConstIterator upperBound( size_t i, size_t j ) const;
288  //**********************************************************************************************
289 
290  //**Numeric functions***************************************************************************
293  template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
295  //**********************************************************************************************
296 
297  //**Debugging functions*************************************************************************
300  inline bool isIntact() const noexcept;
302  //**********************************************************************************************
303 
304  //**Expression template evaluation functions****************************************************
307  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
308  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
309 
310  inline bool canSMPAssign() const noexcept;
312  //**********************************************************************************************
313 
314  private:
315  //**Utility functions***************************************************************************
318  inline void resetUpper();
320  //**********************************************************************************************
321 
322  //**Member variables****************************************************************************
325  MT matrix_;
326 
327  //**********************************************************************************************
328 
329  //**Friend declarations*************************************************************************
330  template< typename MT2, bool SO2, bool DF2 >
331  friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
332  //**********************************************************************************************
333 
334  //**Compile time checks*************************************************************************
347  BLAZE_STATIC_ASSERT( ( Size<MT,0UL>::value == Size<MT,1UL>::value ) );
348  //**********************************************************************************************
349 };
351 //*************************************************************************************************
352 
353 
354 
355 
356 //=================================================================================================
357 //
358 // CONSTRUCTORS
359 //
360 //=================================================================================================
361 
362 //*************************************************************************************************
366 template< typename MT // Type of the adapted sparse matrix
367  , bool SO > // Storage order of the adapted sparse matrix
368 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix()
369  : matrix_() // The adapted sparse matrix
370 {
371  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
372 }
374 //*************************************************************************************************
375 
376 
377 //*************************************************************************************************
385 template< typename MT // Type of the adapted sparse matrix
386  , bool SO > // Storage order of the adapted sparse matrix
387 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n )
388  : matrix_( n, n, n ) // The adapted sparse matrix
389 {
391 
392  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
393 }
395 //*************************************************************************************************
396 
397 
398 //*************************************************************************************************
408 template< typename MT // Type of the adapted sparse matrix
409  , bool SO > // Storage order of the adapted sparse matrix
410 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, size_t nonzeros )
411  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
412 {
414 
415  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
416 }
418 //*************************************************************************************************
419 
420 
421 //*************************************************************************************************
435 template< typename MT // Type of the adapted sparse matrix
436  , bool SO > // Storage order of the adapted sparse matrix
437 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
438  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
439 {
441 
442  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
443 }
445 //*************************************************************************************************
446 
447 
448 //*************************************************************************************************
472 template< typename MT // Type of the adapted sparse matrix
473  , bool SO > // Storage order of the adapted sparse matrix
474 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( initializer_list< initializer_list<ElementType> > list )
475  : matrix_( list ) // The adapted sparse matrix
476 {
477  if( !isStrictlyLower( matrix_ ) ) {
478  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
479  }
480 
481  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
482 }
484 //*************************************************************************************************
485 
486 
487 //*************************************************************************************************
493 template< typename MT // Type of the adapted sparse matrix
494  , bool SO > // Storage order of the adapted sparse matrix
495 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
496  : matrix_( m.matrix_ ) // The adapted sparse matrix
497 {
498  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
499  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
500 }
502 //*************************************************************************************************
503 
504 
505 //*************************************************************************************************
511 template< typename MT // Type of the adapted sparse matrix
512  , bool SO > // Storage order of the adapted sparse matrix
513 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept
514  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
515 {
516  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
517  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
518 }
520 //*************************************************************************************************
521 
522 
523 //*************************************************************************************************
534 template< typename MT // Type of the adapted sparse matrix
535  , bool SO > // Storage order of the adapted sparse matrix
536 template< typename MT2 // Type of the foreign matrix
537  , bool SO2 > // Storage order of the foreign matrix
538 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
539  : matrix_( ~m ) // The adapted sparse matrix
540 {
541  if( IsUniTriangular<MT2>::value ||
542  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( matrix_ ) ) ) {
543  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
544  }
545 
546  if( !IsStrictlyLower<MT2>::value )
547  resetUpper();
548 
549  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
550  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
551 }
553 //*************************************************************************************************
554 
555 
556 
557 
558 //=================================================================================================
559 //
560 // DATA ACCESS FUNCTIONS
561 //
562 //=================================================================================================
563 
564 //*************************************************************************************************
580 template< typename MT // Type of the adapted sparse matrix
581  , bool SO > // Storage order of the adapted sparse matrix
583  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
584 {
585  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
586  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
587 
588  return Reference( matrix_, i, j );
589 }
591 //*************************************************************************************************
592 
593 
594 //*************************************************************************************************
610 template< typename MT // Type of the adapted sparse matrix
611  , bool SO > // Storage order of the adapted sparse matrix
613  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
614 {
615  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
616  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
617 
618  return matrix_(i,j);
619 }
621 //*************************************************************************************************
622 
623 
624 //*************************************************************************************************
641 template< typename MT // Type of the adapted sparse matrix
642  , bool SO > // Storage order of the adapted sparse matrix
644  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
645 {
646  if( i >= rows() ) {
647  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
648  }
649  if( j >= columns() ) {
650  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
651  }
652  return (*this)(i,j);
653 }
655 //*************************************************************************************************
656 
657 
658 //*************************************************************************************************
675 template< typename MT // Type of the adapted sparse matrix
676  , bool SO > // Storage order of the adapted sparse matrix
678  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
679 {
680  if( i >= rows() ) {
681  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
682  }
683  if( j >= columns() ) {
684  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
685  }
686  return (*this)(i,j);
687 }
689 //*************************************************************************************************
690 
691 
692 //*************************************************************************************************
704 template< typename MT // Type of the adapted sparse matrix
705  , bool SO > // Storage order of the adapted sparse matrix
708 {
709  return matrix_.begin(i);
710 }
712 //*************************************************************************************************
713 
714 
715 //*************************************************************************************************
727 template< typename MT // Type of the adapted sparse matrix
728  , bool SO > // Storage order of the adapted sparse matrix
731 {
732  return matrix_.begin(i);
733 }
735 //*************************************************************************************************
736 
737 
738 //*************************************************************************************************
750 template< typename MT // Type of the adapted sparse matrix
751  , bool SO > // Storage order of the adapted sparse matrix
754 {
755  return matrix_.cbegin(i);
756 }
758 //*************************************************************************************************
759 
760 
761 //*************************************************************************************************
773 template< typename MT // Type of the adapted sparse matrix
774  , bool SO > // Storage order of the adapted sparse matrix
777 {
778  return matrix_.end(i);
779 }
781 //*************************************************************************************************
782 
783 
784 //*************************************************************************************************
796 template< typename MT // Type of the adapted sparse matrix
797  , bool SO > // Storage order of the adapted sparse matrix
799  StrictlyLowerMatrix<MT,SO,false>::end( size_t i ) const
800 {
801  return matrix_.end(i);
802 }
804 //*************************************************************************************************
805 
806 
807 //*************************************************************************************************
819 template< typename MT // Type of the adapted sparse matrix
820  , bool SO > // Storage order of the adapted sparse matrix
823 {
824  return matrix_.cend(i);
825 }
827 //*************************************************************************************************
828 
829 
830 
831 
832 //=================================================================================================
833 //
834 // ASSIGNMENT OPERATORS
835 //
836 //=================================================================================================
837 
838 //*************************************************************************************************
863 template< typename MT // Type of the adapted sparse matrix
864  , bool SO > // Storage order of the adapted sparse matrix
865 inline StrictlyLowerMatrix<MT,SO,false>&
866  StrictlyLowerMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
867 {
868  const InitializerMatrix<ElementType> tmp( list, list.size() );
869 
870  if( !isStrictlyLower( tmp ) ) {
871  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
872  }
873 
874  matrix_ = list;
875 
876  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
877  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
878 
879  return *this;
880 }
882 //*************************************************************************************************
883 
884 
885 //*************************************************************************************************
895 template< typename MT // Type of the adapted sparse matrix
896  , bool SO > // Storage order of the adapted sparse matrix
897 inline StrictlyLowerMatrix<MT,SO,false>&
898  StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
899 {
900  matrix_ = rhs.matrix_;
901 
902  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
903  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
904 
905  return *this;
906 }
908 //*************************************************************************************************
909 
910 
911 //*************************************************************************************************
918 template< typename MT // Type of the adapted sparse matrix
919  , bool SO > // Storage order of the adapted sparse matrix
920 inline StrictlyLowerMatrix<MT,SO,false>&
921  StrictlyLowerMatrix<MT,SO,false>::operator=( StrictlyLowerMatrix&& rhs ) noexcept
922 {
923  matrix_ = std::move( rhs.matrix_ );
924 
925  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
926  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
927 
928  return *this;
929 }
931 //*************************************************************************************************
932 
933 
934 //*************************************************************************************************
947 template< typename MT // Type of the adapted sparse matrix
948  , bool SO > // Storage order of the adapted sparse matrix
949 template< typename MT2 // Type of the right-hand side matrix
950  , bool SO2 > // Storage order of the right-hand side matrix
951 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
952  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
953 {
954  if( IsUniTriangular<MT2>::value ||
955  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
956  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
957  }
958 
959  matrix_ = decllow( ~rhs );
960 
961  if( !IsStrictlyLower<MT2>::value )
962  resetUpper();
963 
964  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
965  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
966 
967  return *this;
968 }
970 //*************************************************************************************************
971 
972 
973 //*************************************************************************************************
986 template< typename MT // Type of the adapted sparse matrix
987  , bool SO > // Storage order of the adapted sparse matrix
988 template< typename MT2 // Type of the right-hand side matrix
989  , bool SO2 > // Storage order of the right-hand side matrix
990 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
991  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
992 {
993  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
994  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
995  }
996 
997  if( IsStrictlyLower<MT2>::value ) {
998  matrix_ = ~rhs;
999  }
1000  else {
1001  MT tmp( ~rhs );
1002 
1003  if( !isStrictlyLower( tmp ) ) {
1004  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1005  }
1006 
1007  matrix_ = std::move( tmp );
1008  }
1009 
1010  if( !IsStrictlyLower<MT2>::value )
1011  resetUpper();
1012 
1013  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1014  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1015 
1016  return *this;
1017 }
1019 //*************************************************************************************************
1020 
1021 
1022 //*************************************************************************************************
1035 template< typename MT // Type of the adapted sparse matrix
1036  , bool SO > // Storage order of the adapted sparse matrix
1037 template< typename MT2 // Type of the right-hand side matrix
1038  , bool SO2 > // Storage order of the right-hand side matrix
1039 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1040  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1041 {
1042  if( IsUniTriangular<MT2>::value ||
1043  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
1044  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1045  }
1046 
1047  matrix_ += decllow( ~rhs );
1048 
1049  if( !IsStrictlyLower<MT2>::value )
1050  resetUpper();
1051 
1052  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1053  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1054 
1055  return *this;
1056 }
1058 //*************************************************************************************************
1059 
1060 
1061 //*************************************************************************************************
1074 template< typename MT // Type of the adapted sparse matrix
1075  , bool SO > // Storage order of the adapted sparse matrix
1076 template< typename MT2 // Type of the right-hand side matrix
1077  , bool SO2 > // Storage order of the right-hand side matrix
1078 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1079  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1080 {
1081  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1082  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1083  }
1084 
1085  if( IsStrictlyLower<MT2>::value ) {
1086  matrix_ += ~rhs;
1087  }
1088  else {
1089  const ResultType_<MT2> tmp( ~rhs );
1090 
1091  if( !isStrictlyLower( tmp ) ) {
1092  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1093  }
1094 
1095  matrix_ += decllow( tmp );
1096  }
1097 
1098  if( !IsStrictlyLower<MT2>::value )
1099  resetUpper();
1100 
1101  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1102  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1103 
1104  return *this;
1105 }
1107 //*************************************************************************************************
1108 
1109 
1110 //*************************************************************************************************
1123 template< typename MT // Type of the adapted sparse matrix
1124  , bool SO > // Storage order of the adapted sparse matrix
1125 template< typename MT2 // Type of the right-hand side matrix
1126  , bool SO2 > // Storage order of the right-hand side matrix
1127 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1128  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1129 {
1130  if( IsUniTriangular<MT2>::value ||
1131  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
1132  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1133  }
1134 
1135  matrix_ -= decllow( ~rhs );
1136 
1137  if( !IsStrictlyLower<MT2>::value )
1138  resetUpper();
1139 
1140  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1141  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1142 
1143  return *this;
1144 }
1146 //*************************************************************************************************
1147 
1148 
1149 //*************************************************************************************************
1162 template< typename MT // Type of the adapted sparse matrix
1163  , bool SO > // Storage order of the adapted sparse matrix
1164 template< typename MT2 // Type of the right-hand side matrix
1165  , bool SO2 > // Storage order of the right-hand side matrix
1166 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1167  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1168 {
1169  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1170  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1171  }
1172 
1173  if( IsStrictlyLower<MT2>::value ) {
1174  matrix_ -= ~rhs;
1175  }
1176  else {
1177  const ResultType_<MT2> tmp( ~rhs );
1178 
1179  if( !isStrictlyLower( tmp ) ) {
1180  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1181  }
1182 
1183  matrix_ -= decllow( tmp );
1184  }
1185 
1186  if( !IsStrictlyLower<MT2>::value )
1187  resetUpper();
1188 
1189  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1190  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1191 
1192  return *this;
1193 }
1195 //*************************************************************************************************
1196 
1197 
1198 //*************************************************************************************************
1210 template< typename MT // Type of the adapted sparse matrix
1211  , bool SO > // Storage order of the adapted sparse matrix
1212 template< typename MT2 // Type of the right-hand side matrix
1213  , bool SO2 > // Storage order of the right-hand side matrix
1214 inline StrictlyLowerMatrix<MT,SO,false>&
1215  StrictlyLowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1216 {
1217  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1218  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1219  }
1220 
1221  matrix_ %= ~rhs;
1222 
1223  if( !IsStrictlyLower<MT2>::value )
1224  resetUpper();
1225 
1226  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1227  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1228 
1229  return *this;
1230 }
1232 //*************************************************************************************************
1233 
1234 
1235 
1236 
1237 //=================================================================================================
1238 //
1239 // UTILITY FUNCTIONS
1240 //
1241 //=================================================================================================
1242 
1243 //*************************************************************************************************
1249 template< typename MT // Type of the adapted sparse matrix
1250  , bool SO > // Storage order of the adapted sparse matrix
1251 inline size_t StrictlyLowerMatrix<MT,SO,false>::rows() const noexcept
1252 {
1253  return matrix_.rows();
1254 }
1256 //*************************************************************************************************
1257 
1258 
1259 //*************************************************************************************************
1265 template< typename MT // Type of the adapted sparse matrix
1266  , bool SO > // Storage order of the adapted sparse matrix
1267 inline size_t StrictlyLowerMatrix<MT,SO,false>::columns() const noexcept
1268 {
1269  return matrix_.columns();
1270 }
1272 //*************************************************************************************************
1273 
1274 
1275 //*************************************************************************************************
1281 template< typename MT // Type of the adapted sparse matrix
1282  , bool SO > // Storage order of the adapted sparse matrix
1283 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity() const noexcept
1284 {
1285  return matrix_.capacity();
1286 }
1288 //*************************************************************************************************
1289 
1290 
1291 //*************************************************************************************************
1303 template< typename MT // Type of the adapted sparse matrix
1304  , bool SO > // Storage order of the adapted sparse matrix
1305 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1306 {
1307  return matrix_.capacity(i);
1308 }
1310 //*************************************************************************************************
1311 
1312 
1313 //*************************************************************************************************
1319 template< typename MT // Type of the adapted sparse matrix
1320  , bool SO > // Storage order of the adapted sparse matrix
1321 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros() const
1322 {
1323  return matrix_.nonZeros();
1324 }
1326 //*************************************************************************************************
1327 
1328 
1329 //*************************************************************************************************
1341 template< typename MT // Type of the adapted sparse matrix
1342  , bool SO > // Storage order of the adapted sparse matrix
1343 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1344 {
1345  return matrix_.nonZeros(i);
1346 }
1348 //*************************************************************************************************
1349 
1350 
1351 //*************************************************************************************************
1357 template< typename MT // Type of the adapted sparse matrix
1358  , bool SO > // Storage order of the adapted sparse matrix
1360 {
1361  if( SO ) {
1362  for( size_t j=0UL; j<columns(); ++j ) {
1363  matrix_.erase( j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1364  }
1365  }
1366  else {
1367  for( size_t i=1UL; i<rows(); ++i ) {
1368  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1369  }
1370  }
1371 }
1373 //*************************************************************************************************
1374 
1375 
1376 //*************************************************************************************************
1389 template< typename MT // Type of the adapted sparse matrix
1390  , bool SO > // Storage order of the adapted sparse matrix
1391 inline void StrictlyLowerMatrix<MT,SO,false>::reset( size_t i )
1392 {
1393  if( SO ) {
1394  matrix_.erase( i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1395  }
1396  else {
1397  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1398  }
1399 }
1401 //*************************************************************************************************
1402 
1403 
1404 //*************************************************************************************************
1412 template< typename MT // Type of the adapted sparse matrix
1413  , bool SO > // Storage order of the adapted sparse matrix
1415 {
1416  using blaze::clear;
1417 
1418  if( IsResizable<MT>::value ) {
1419  clear( matrix_ );
1420  }
1421  else {
1422  reset();
1423  }
1424 }
1426 //*************************************************************************************************
1427 
1428 
1429 //*************************************************************************************************
1444 template< typename MT // Type of the adapted sparse matrix
1445  , bool SO > // Storage order of the adapted sparse matrix
1446 void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1447 {
1449 
1450  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1451 
1452  matrix_.resize( n, n, preserve );
1453 }
1455 //*************************************************************************************************
1456 
1457 
1458 //*************************************************************************************************
1469 template< typename MT // Type of the adapted sparse matrix
1470  , bool SO > // Storage order of the adapted sparse matrix
1471 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1472 {
1473  matrix_.reserve( nonzeros );
1474 }
1476 //*************************************************************************************************
1477 
1478 
1479 //*************************************************************************************************
1494 template< typename MT // Type of the adapted sparse matrix
1495  , bool SO > // Storage order of the adapted sparse matrix
1496 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1497 {
1498  matrix_.reserve( i, nonzeros );
1499 }
1501 //*************************************************************************************************
1502 
1503 
1504 //*************************************************************************************************
1515 template< typename MT // Type of the adapted sparse matrix
1516  , bool SO > // Storage order of the adapted sparse matrix
1517 inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1518 {
1519  matrix_.trim();
1520 }
1522 //*************************************************************************************************
1523 
1524 
1525 //*************************************************************************************************
1537 template< typename MT // Type of the adapted sparse matrix
1538  , bool SO > // Storage order of the adapted sparse matrix
1539 inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1540 {
1541  matrix_.trim( i );
1542 }
1544 //*************************************************************************************************
1545 
1546 
1547 //*************************************************************************************************
1557 template< typename MT // Type of the adapted sparse matrix
1558  , bool SO > // Storage order of the adapted sparse matrix
1560 {
1561  matrix_.shrinkToFit();
1562 }
1564 //*************************************************************************************************
1565 
1566 
1567 //*************************************************************************************************
1574 template< typename MT // Type of the adapted sparse matrix
1575  , bool SO > // Storage order of the adapted sparse matrix
1576 inline void StrictlyLowerMatrix<MT,SO,false>::swap( StrictlyLowerMatrix& m ) noexcept
1577 {
1578  using std::swap;
1579 
1580  swap( matrix_, m.matrix_ );
1581 }
1583 //*************************************************************************************************
1584 
1585 
1586 //*************************************************************************************************
1598 template< typename MT // Type of the adapted dense matrix
1599  , bool SO > // Storage order of the adapted dense matrix
1600 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1601 {
1603 
1604  return maxNonZeros( Size<MT,0UL>::value );
1605 }
1607 //*************************************************************************************************
1608 
1609 
1610 //*************************************************************************************************
1620 template< typename MT // Type of the adapted dense matrix
1621  , bool SO > // Storage order of the adapted dense matrix
1622 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1623 {
1624  return ( ( n - 1UL ) * n ) / 2UL;
1625 }
1627 //*************************************************************************************************
1628 
1629 
1630 //*************************************************************************************************
1636 template< typename MT // Type of the adapted dense matrix
1637  , bool SO > // Storage order of the adapted dense matrix
1638 inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1639 {
1640  if( SO ) {
1641  for( size_t j=1UL; j<columns(); ++j )
1642  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1643  }
1644  else {
1645  for( size_t i=0UL; i<rows(); ++i )
1646  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1647  }
1648 }
1650 //*************************************************************************************************
1651 
1652 
1653 
1654 
1655 //=================================================================================================
1656 //
1657 // INSERTION FUNCTIONS
1658 //
1659 //=================================================================================================
1660 
1661 //*************************************************************************************************
1677 template< typename MT // Type of the adapted sparse matrix
1678  , bool SO > // Storage order of the adapted sparse matrix
1680  StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1681 {
1682  if( i <= j ) {
1683  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1684  }
1685 
1686  return matrix_.set( i, j, value );
1687 }
1689 //*************************************************************************************************
1690 
1691 
1692 //*************************************************************************************************
1709 template< typename MT // Type of the adapted sparse matrix
1710  , bool SO > // Storage order of the adapted sparse matrix
1712  StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1713 {
1714  if( i <= j ) {
1715  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1716  }
1717 
1718  return matrix_.insert( i, j, value );
1719 }
1721 //*************************************************************************************************
1722 
1723 
1724 //*************************************************************************************************
1774 template< typename MT // Type of the adapted sparse matrix
1775  , bool SO > // Storage order of the adapted sparse matrix
1776 inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1777 {
1778  if( i <= j ) {
1779  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1780  }
1781 
1782  matrix_.append( i, j, value, check );
1783 }
1785 //*************************************************************************************************
1786 
1787 
1788 //*************************************************************************************************
1802 template< typename MT // Type of the adapted sparse matrix
1803  , bool SO > // Storage order of the adapted sparse matrix
1804 inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
1805 {
1806  matrix_.finalize( i );
1807 }
1809 //*************************************************************************************************
1810 
1811 
1812 
1813 
1814 //=================================================================================================
1815 //
1816 // ERASE FUNCTIONS
1817 //
1818 //=================================================================================================
1819 
1820 //*************************************************************************************************
1830 template< typename MT // Type of the adapted sparse matrix
1831  , bool SO > // Storage order of the adapted sparse matrix
1832 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1833 {
1834  matrix_.erase( i, j );
1835 }
1837 //*************************************************************************************************
1838 
1839 
1840 //*************************************************************************************************
1852 template< typename MT // Type of the adapted sparse matrix
1853  , bool SO > // Storage order of the adapted sparse matrix
1855  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1856 {
1857  return matrix_.erase( i, pos );
1858 }
1860 //*************************************************************************************************
1861 
1862 
1863 //*************************************************************************************************
1877 template< typename MT // Type of the adapted sparse matrix
1878  , bool SO > // Storage order of the adapted sparse matrix
1880  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1881 {
1882  return matrix_.erase( i, first, last );
1883 }
1885 //*************************************************************************************************
1886 
1887 
1888 //*************************************************************************************************
1910 template< typename MT // Type of the adapted sparse matrix
1911  , bool SO > // Storage order of the adapted sparse matrix
1912 template< typename Pred > // Type of the unary predicate
1913 inline void StrictlyLowerMatrix<MT,SO,false>::erase( Pred predicate )
1914 {
1915  matrix_.erase( predicate );
1916 
1917  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1918 }
1920 //*************************************************************************************************
1921 
1922 
1923 //*************************************************************************************************
1951 template< typename MT // Type of the adapted sparse matrix
1952  , bool SO > // Storage order of the adapted sparse matrix
1953 template< typename Pred > // Type of the unary predicate
1954 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1955 {
1956  matrix_.erase( i, first, last, predicate );
1957 
1958  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1959 }
1961 //*************************************************************************************************
1962 
1963 
1964 
1965 
1966 //=================================================================================================
1967 //
1968 // LOOKUP FUNCTIONS
1969 //
1970 //=================================================================================================
1971 
1972 //*************************************************************************************************
1988 template< typename MT // Type of the adapted sparse matrix
1989  , bool SO > // Storage order of the adapted sparse matrix
1991  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1992 {
1993  return matrix_.find( i, j );
1994 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2015 template< typename MT // Type of the adapted sparse matrix
2016  , bool SO > // Storage order of the adapted sparse matrix
2018  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2019 {
2020  return matrix_.find( i, j );
2021 }
2023 //*************************************************************************************************
2024 
2025 
2026 //*************************************************************************************************
2042 template< typename MT // Type of the adapted sparse matrix
2043  , bool SO > // Storage order of the adapted sparse matrix
2045  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2046 {
2047  return matrix_.lowerBound( i, j );
2048 }
2050 //*************************************************************************************************
2051 
2052 
2053 //*************************************************************************************************
2069 template< typename MT // Type of the adapted sparse matrix
2070  , bool SO > // Storage order of the adapted sparse matrix
2072  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2073 {
2074  return matrix_.lowerBound( i, j );
2075 }
2077 //*************************************************************************************************
2078 
2079 
2080 //*************************************************************************************************
2096 template< typename MT // Type of the adapted sparse matrix
2097  , bool SO > // Storage order of the adapted sparse matrix
2099  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2100 {
2101  return matrix_.upperBound( i, j );
2102 }
2104 //*************************************************************************************************
2105 
2106 
2107 //*************************************************************************************************
2123 template< typename MT // Type of the adapted sparse matrix
2124  , bool SO > // Storage order of the adapted sparse matrix
2126  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2127 {
2128  return matrix_.upperBound( i, j );
2129 }
2131 //*************************************************************************************************
2132 
2133 
2134 
2135 
2136 //=================================================================================================
2137 //
2138 // NUMERIC FUNCTIONS
2139 //
2140 //=================================================================================================
2141 
2142 //*************************************************************************************************
2160 template< typename MT // Type of the adapted sparse matrix
2161  , bool SO > // Storage order of the adapted sparse matrix
2162 template< typename Other > // Data type of the scalar value
2163 inline StrictlyLowerMatrix<MT,SO,false>&
2164  StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
2165 {
2166  matrix_.scale( scalar );
2167  return *this;
2168 }
2170 //*************************************************************************************************
2171 
2172 
2173 
2174 
2175 //=================================================================================================
2176 //
2177 // DEBUGGING FUNCTIONS
2178 //
2179 //=================================================================================================
2180 
2181 //*************************************************************************************************
2191 template< typename MT // Type of the adapted sparse matrix
2192  , bool SO > // Storage order of the adapted sparse matrix
2193 inline bool StrictlyLowerMatrix<MT,SO,false>::isIntact() const noexcept
2194 {
2195  using blaze::isIntact;
2196 
2197  return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
2198 }
2200 //*************************************************************************************************
2201 
2202 
2203 
2204 
2205 //=================================================================================================
2206 //
2207 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2208 //
2209 //=================================================================================================
2210 
2211 //*************************************************************************************************
2222 template< typename MT // Type of the adapted sparse matrix
2223  , bool SO > // Storage order of the adapted sparse matrix
2224 template< typename Other > // Data type of the foreign expression
2225 inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2226 {
2227  return matrix_.canAlias( alias );
2228 }
2230 //*************************************************************************************************
2231 
2232 
2233 //*************************************************************************************************
2244 template< typename MT // Type of the adapted sparse matrix
2245  , bool SO > // Storage order of the adapted sparse matrix
2246 template< typename Other > // Data type of the foreign expression
2247 inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2248 {
2249  return matrix_.isAliased( alias );
2250 }
2252 //*************************************************************************************************
2253 
2254 
2255 //*************************************************************************************************
2266 template< typename MT // Type of the adapted sparse matrix
2267  , bool SO > // Storage order of the adapted sparse matrix
2268 inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2269 {
2270  return matrix_.canSMPAssign();
2271 }
2273 //*************************************************************************************************
2274 
2275 } // namespace blaze
2276 
2277 #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:3077
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1386
#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
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
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
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
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:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:775
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5829
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
#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:560
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Header file for the extended initializer_list functionality.
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:1950
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:474
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:408
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.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
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, 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:5908
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5891
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#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:3079
#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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
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:1026
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:506
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:714
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:430
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:608
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:272
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:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#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:3081
#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:254
#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:908
Header file for the IsResizable type trait.
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, 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