Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_SPARSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
44 #include <vector>
48 #include <blaze/math/Aliases.h>
57 #include <blaze/math/Exception.h>
59 #include <blaze/math/Functions.h>
60 #include <blaze/math/shims/Clear.h>
71 #include <blaze/util/Assert.h>
76 #include <blaze/util/DisableIf.h>
77 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/Types.h>
81 
82 
83 namespace blaze {
84 
85 //=================================================================================================
86 //
87 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
88 //
89 //=================================================================================================
90 
91 //*************************************************************************************************
99 template< typename MT // Type of the adapted sparse matrix
100  , bool SO > // Storage order of the adapted sparse matrix
101 class StrictlyLowerMatrix<MT,SO,false>
102  : public SparseMatrix< StrictlyLowerMatrix<MT,SO,false>, SO >
103 {
104  private:
105  //**Type definitions****************************************************************************
106  typedef OppositeType_<MT> OT;
107  typedef TransposeType_<MT> TT;
108  typedef ElementType_<MT> ET;
109  //**********************************************************************************************
110 
111  public:
112  //**Type definitions****************************************************************************
113  typedef StrictlyLowerMatrix<MT,SO,false> This;
114  typedef SparseMatrix<This,SO> BaseType;
115  typedef This ResultType;
116  typedef StrictlyLowerMatrix<OT,!SO,false> OppositeType;
117  typedef StrictlyUpperMatrix<TT,!SO,false> TransposeType;
118  typedef ET ElementType;
119  typedef ReturnType_<MT> ReturnType;
120  typedef const This& CompositeType;
121  typedef StrictlyLowerProxy<MT> Reference;
122  typedef ConstReference_<MT> ConstReference;
123  typedef Iterator_<MT> Iterator;
124  typedef ConstIterator_<MT> ConstIterator;
125  //**********************************************************************************************
126 
127  //**Rebind struct definition********************************************************************
130  template< typename ET > // Data type of the other matrix
131  struct Rebind {
133  typedef StrictlyLowerMatrix< typename MT::template Rebind<ET>::Other > Other;
134  };
135  //**********************************************************************************************
136 
137  //**Compilation flags***************************************************************************
139  enum : bool { smpAssignable = false };
140  //**********************************************************************************************
141 
142  //**Constructors********************************************************************************
145  explicit inline StrictlyLowerMatrix();
146  explicit inline StrictlyLowerMatrix( size_t n );
147  explicit inline StrictlyLowerMatrix( size_t n, size_t nonzeros );
148  explicit inline StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
149 
150  inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
151  inline StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept;
152 
153  template< typename MT2, bool SO2 >
154  inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
156  //**********************************************************************************************
157 
158  //**Destructor**********************************************************************************
159  // No explicitly declared destructor.
160  //**********************************************************************************************
161 
162  //**Data access functions***********************************************************************
165  inline Reference operator()( size_t i, size_t j );
166  inline ConstReference operator()( size_t i, size_t j ) const;
167  inline Reference at( size_t i, size_t j );
168  inline ConstReference at( size_t i, size_t j ) const;
169  inline Iterator begin ( size_t i );
170  inline ConstIterator begin ( size_t i ) const;
171  inline ConstIterator cbegin( size_t i ) const;
172  inline Iterator end ( size_t i );
173  inline ConstIterator end ( size_t i ) const;
174  inline ConstIterator cend ( size_t i ) const;
176  //**********************************************************************************************
177 
178  //**Assignment operators************************************************************************
181  inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
182  inline StrictlyLowerMatrix& operator=( StrictlyLowerMatrix&& rhs ) noexcept;
183 
184  template< typename MT2, bool SO2 >
185  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
186  operator=( const Matrix<MT2,SO2>& rhs );
187 
188  template< typename MT2, bool SO2 >
189  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
190  operator=( const Matrix<MT2,SO2>& rhs );
191 
192  template< typename MT2, bool SO2 >
193  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
194  operator+=( const Matrix<MT2,SO2>& rhs );
195 
196  template< typename MT2, bool SO2 >
197  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
198  operator+=( const Matrix<MT2,SO2>& rhs );
199 
200  template< typename MT2, bool SO2 >
201  inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
202  operator-=( const Matrix<MT2,SO2>& rhs );
203 
204  template< typename MT2, bool SO2 >
205  inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix& >
206  operator-=( const Matrix<MT2,SO2>& rhs );
207 
208  template< typename MT2, bool SO2 >
209  inline StrictlyLowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
210 
211  template< typename Other >
212  inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix >& operator*=( Other rhs );
213 
214  template< typename Other >
215  inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix >& operator/=( Other rhs );
217  //**********************************************************************************************
218 
219  //**Utility functions***************************************************************************
222  inline size_t rows() const noexcept;
223  inline size_t columns() const noexcept;
224  inline size_t capacity() const noexcept;
225  inline size_t capacity( size_t i ) const noexcept;
226  inline size_t nonZeros() const;
227  inline size_t nonZeros( size_t i ) const;
228  inline void reset();
229  inline void reset( size_t i );
230  inline void clear();
231  inline Iterator set( size_t i, size_t j, const ElementType& value );
232  inline Iterator insert( size_t i, size_t j, const ElementType& value );
233  inline void erase( size_t i, size_t j );
234  inline Iterator erase( size_t i, Iterator pos );
235  inline Iterator erase( size_t i, Iterator first, Iterator last );
236  inline void resize ( size_t n, bool preserve=true );
237  inline void reserve( size_t nonzeros );
238  inline void reserve( size_t i, size_t nonzeros );
239  inline void trim();
240  inline void trim( size_t i );
241 
242  template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
243  template< typename Other > inline StrictlyLowerMatrix& scaleDiagonal( Other scale );
244 
245  inline void swap( StrictlyLowerMatrix& m ) noexcept;
246 
247  static inline constexpr size_t maxNonZeros() noexcept;
248  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
250  //**********************************************************************************************
251 
252  //**Lookup functions****************************************************************************
255  inline Iterator find ( size_t i, size_t j );
256  inline ConstIterator find ( size_t i, size_t j ) const;
257  inline Iterator lowerBound( size_t i, size_t j );
258  inline ConstIterator lowerBound( size_t i, size_t j ) const;
259  inline Iterator upperBound( size_t i, size_t j );
260  inline ConstIterator upperBound( size_t i, size_t j ) const;
262  //**********************************************************************************************
263 
264  //**Low-level utility functions*****************************************************************
267  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
268  inline void finalize( size_t i );
270  //**********************************************************************************************
271 
272  //**Debugging functions*************************************************************************
275  inline bool isIntact() const noexcept;
277  //**********************************************************************************************
278 
279  //**Expression template evaluation functions****************************************************
282  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
283  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
284 
285  inline bool canSMPAssign() const noexcept;
287  //**********************************************************************************************
288 
289  private:
290  //**Utility functions***************************************************************************
293  inline void resetUpper();
295  //**********************************************************************************************
296 
297  //**Member variables****************************************************************************
300  MT matrix_;
301 
302  //**********************************************************************************************
303 
304  //**Friend declarations*************************************************************************
305  template< typename MT2, bool SO2, bool DF2 >
306  friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
307  //**********************************************************************************************
308 
309  //**Compile time checks*************************************************************************
322  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
323  //**********************************************************************************************
324 };
326 //*************************************************************************************************
327 
328 
329 
330 
331 //=================================================================================================
332 //
333 // CONSTRUCTORS
334 //
335 //=================================================================================================
336 
337 //*************************************************************************************************
341 template< typename MT // Type of the adapted sparse matrix
342  , bool SO > // Storage order of the adapted sparse matrix
343 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix()
344  : matrix_() // The adapted sparse matrix
345 {
346  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
347 }
349 //*************************************************************************************************
350 
351 
352 //*************************************************************************************************
360 template< typename MT // Type of the adapted sparse matrix
361  , bool SO > // Storage order of the adapted sparse matrix
362 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n )
363  : matrix_( n, n, n ) // The adapted sparse matrix
364 {
366 
367  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
368 }
370 //*************************************************************************************************
371 
372 
373 //*************************************************************************************************
383 template< typename MT // Type of the adapted sparse matrix
384  , bool SO > // Storage order of the adapted sparse matrix
385 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, size_t nonzeros )
386  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
387 {
389 
390  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
391 }
393 //*************************************************************************************************
394 
395 
396 //*************************************************************************************************
410 template< typename MT // Type of the adapted sparse matrix
411  , bool SO > // Storage order of the adapted sparse matrix
412 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
413  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
414 {
416 
417  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
418 }
420 //*************************************************************************************************
421 
422 
423 //*************************************************************************************************
429 template< typename MT // Type of the adapted sparse matrix
430  , bool SO > // Storage order of the adapted sparse matrix
431 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
432  : matrix_( m.matrix_ ) // The adapted sparse matrix
433 {
434  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
435  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
436 }
438 //*************************************************************************************************
439 
440 
441 //*************************************************************************************************
447 template< typename MT // Type of the adapted sparse matrix
448  , bool SO > // Storage order of the adapted sparse matrix
449 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept
450  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
451 {
452  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
453  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
454 }
456 //*************************************************************************************************
457 
458 
459 //*************************************************************************************************
470 template< typename MT // Type of the adapted sparse matrix
471  , bool SO > // Storage order of the adapted sparse matrix
472 template< typename MT2 // Type of the foreign matrix
473  , bool SO2 > // Storage order of the foreign matrix
474 inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
475  : matrix_( ~m ) // The adapted sparse matrix
476 {
477  if( IsUniTriangular<MT2>::value ||
478  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( matrix_ ) ) ) {
479  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
480  }
481 
482  if( !IsStrictlyLower<MT2>::value )
483  resetUpper();
484 
485  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
486  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
487 }
489 //*************************************************************************************************
490 
491 
492 
493 
494 //=================================================================================================
495 //
496 // DATA ACCESS FUNCTIONS
497 //
498 //=================================================================================================
499 
500 //*************************************************************************************************
516 template< typename MT // Type of the adapted sparse matrix
517  , bool SO > // Storage order of the adapted sparse matrix
519  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
520 {
521  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
522  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
523 
524  return Reference( matrix_, i, j );
525 }
527 //*************************************************************************************************
528 
529 
530 //*************************************************************************************************
546 template< typename MT // Type of the adapted sparse matrix
547  , bool SO > // Storage order of the adapted sparse matrix
549  StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
550 {
551  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
552  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
553 
554  return matrix_(i,j);
555 }
557 //*************************************************************************************************
558 
559 
560 //*************************************************************************************************
577 template< typename MT // Type of the adapted sparse matrix
578  , bool SO > // Storage order of the adapted sparse matrix
580  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
581 {
582  if( i >= rows() ) {
583  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
584  }
585  if( j >= columns() ) {
586  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
587  }
588  return (*this)(i,j);
589 }
591 //*************************************************************************************************
592 
593 
594 //*************************************************************************************************
611 template< typename MT // Type of the adapted sparse matrix
612  , bool SO > // Storage order of the adapted sparse matrix
614  StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
615 {
616  if( i >= rows() ) {
617  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
618  }
619  if( j >= columns() ) {
620  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
621  }
622  return (*this)(i,j);
623 }
625 //*************************************************************************************************
626 
627 
628 //*************************************************************************************************
640 template< typename MT // Type of the adapted sparse matrix
641  , bool SO > // Storage order of the adapted sparse matrix
644 {
645  return matrix_.begin(i);
646 }
648 //*************************************************************************************************
649 
650 
651 //*************************************************************************************************
663 template< typename MT // Type of the adapted sparse matrix
664  , bool SO > // Storage order of the adapted sparse matrix
667 {
668  return matrix_.begin(i);
669 }
671 //*************************************************************************************************
672 
673 
674 //*************************************************************************************************
686 template< typename MT // Type of the adapted sparse matrix
687  , bool SO > // Storage order of the adapted sparse matrix
690 {
691  return matrix_.cbegin(i);
692 }
694 //*************************************************************************************************
695 
696 
697 //*************************************************************************************************
709 template< typename MT // Type of the adapted sparse matrix
710  , bool SO > // Storage order of the adapted sparse matrix
713 {
714  return matrix_.end(i);
715 }
717 //*************************************************************************************************
718 
719 
720 //*************************************************************************************************
732 template< typename MT // Type of the adapted sparse matrix
733  , bool SO > // Storage order of the adapted sparse matrix
735  StrictlyLowerMatrix<MT,SO,false>::end( size_t i ) const
736 {
737  return matrix_.end(i);
738 }
740 //*************************************************************************************************
741 
742 
743 //*************************************************************************************************
755 template< typename MT // Type of the adapted sparse matrix
756  , bool SO > // Storage order of the adapted sparse matrix
759 {
760  return matrix_.cend(i);
761 }
763 //*************************************************************************************************
764 
765 
766 
767 
768 //=================================================================================================
769 //
770 // ASSIGNMENT OPERATORS
771 //
772 //=================================================================================================
773 
774 //*************************************************************************************************
784 template< typename MT // Type of the adapted sparse matrix
785  , bool SO > // Storage order of the adapted sparse matrix
786 inline StrictlyLowerMatrix<MT,SO,false>&
787  StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
788 {
789  matrix_ = rhs.matrix_;
790 
791  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
792  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
793 
794  return *this;
795 }
797 //*************************************************************************************************
798 
799 
800 //*************************************************************************************************
807 template< typename MT // Type of the adapted sparse matrix
808  , bool SO > // Storage order of the adapted sparse matrix
809 inline StrictlyLowerMatrix<MT,SO,false>&
810  StrictlyLowerMatrix<MT,SO,false>::operator=( StrictlyLowerMatrix&& rhs ) noexcept
811 {
812  matrix_ = std::move( rhs.matrix_ );
813 
814  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
815  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
816 
817  return *this;
818 }
820 //*************************************************************************************************
821 
822 
823 //*************************************************************************************************
836 template< typename MT // Type of the adapted sparse matrix
837  , bool SO > // Storage order of the adapted sparse matrix
838 template< typename MT2 // Type of the right-hand side matrix
839  , bool SO2 > // Storage order of the right-hand side matrix
840 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
841  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
842 {
843  if( IsUniTriangular<MT2>::value ||
844  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
845  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
846  }
847 
848  matrix_ = ~rhs;
849 
850  if( !IsStrictlyLower<MT2>::value )
851  resetUpper();
852 
853  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
854  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
855 
856  return *this;
857 }
859 //*************************************************************************************************
860 
861 
862 //*************************************************************************************************
875 template< typename MT // Type of the adapted sparse matrix
876  , bool SO > // Storage order of the adapted sparse matrix
877 template< typename MT2 // Type of the right-hand side matrix
878  , bool SO2 > // Storage order of the right-hand side matrix
879 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
880  StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
881 {
882  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
883  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
884  }
885 
886  if( IsStrictlyLower<MT2>::value ) {
887  matrix_ = ~rhs;
888  }
889  else {
890  MT tmp( ~rhs );
891 
892  if( !isStrictlyLower( tmp ) ) {
893  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
894  }
895 
896  matrix_ = std::move( tmp );
897  }
898 
899  if( !IsStrictlyLower<MT2>::value )
900  resetUpper();
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 //*************************************************************************************************
924 template< typename MT // Type of the adapted sparse matrix
925  , bool SO > // Storage order of the adapted sparse matrix
926 template< typename MT2 // Type of the right-hand side matrix
927  , bool SO2 > // Storage order of the right-hand side matrix
928 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
929  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
930 {
931  if( IsUniTriangular<MT2>::value ||
932  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
933  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
934  }
935 
936  matrix_ += ~rhs;
937 
938  if( !IsStrictlyLower<MT2>::value )
939  resetUpper();
940 
941  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
942  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
943 
944  return *this;
945 }
947 //*************************************************************************************************
948 
949 
950 //*************************************************************************************************
963 template< typename MT // Type of the adapted sparse matrix
964  , bool SO > // Storage order of the adapted sparse matrix
965 template< typename MT2 // Type of the right-hand side matrix
966  , bool SO2 > // Storage order of the right-hand side matrix
967 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
968  StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
969 {
970  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
971  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
972  }
973 
974  if( IsStrictlyLower<MT2>::value ) {
975  matrix_ += ~rhs;
976  }
977  else {
978  const ResultType_<MT2> tmp( ~rhs );
979 
980  if( !isStrictlyLower( tmp ) ) {
981  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
982  }
983 
984  matrix_ += tmp;
985  }
986 
987  if( !IsStrictlyLower<MT2>::value )
988  resetUpper();
989 
990  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
991  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
992 
993  return *this;
994 }
996 //*************************************************************************************************
997 
998 
999 //*************************************************************************************************
1012 template< typename MT // Type of the adapted sparse matrix
1013  , bool SO > // Storage order of the adapted sparse matrix
1014 template< typename MT2 // Type of the right-hand side matrix
1015  , bool SO2 > // Storage order of the right-hand side matrix
1016 inline DisableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1017  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1018 {
1019  if( IsUniTriangular<MT2>::value ||
1020  ( !IsStrictlyLower<MT2>::value && !isStrictlyLower( ~rhs ) ) ) {
1021  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1022  }
1023 
1024  matrix_ -= ~rhs;
1025 
1026  if( !IsStrictlyLower<MT2>::value )
1027  resetUpper();
1028 
1029  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1030  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1031 
1032  return *this;
1033 }
1035 //*************************************************************************************************
1036 
1037 
1038 //*************************************************************************************************
1051 template< typename MT // Type of the adapted sparse matrix
1052  , bool SO > // Storage order of the adapted sparse matrix
1053 template< typename MT2 // Type of the right-hand side matrix
1054  , bool SO2 > // Storage order of the right-hand side matrix
1055 inline EnableIf_< IsComputation<MT2>, StrictlyLowerMatrix<MT,SO,false>& >
1056  StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1057 {
1058  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1059  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1060  }
1061 
1062  if( IsStrictlyLower<MT2>::value ) {
1063  matrix_ -= ~rhs;
1064  }
1065  else {
1066  const ResultType_<MT2> tmp( ~rhs );
1067 
1068  if( !isStrictlyLower( tmp ) ) {
1069  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1070  }
1071 
1072  matrix_ -= tmp;
1073  }
1074 
1075  if( !IsStrictlyLower<MT2>::value )
1076  resetUpper();
1077 
1078  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1079  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1080 
1081  return *this;
1082 }
1084 //*************************************************************************************************
1085 
1086 
1087 //*************************************************************************************************
1099 template< typename MT // Type of the adapted sparse matrix
1100  , bool SO > // Storage order of the adapted sparse matrix
1101 template< typename MT2 // Type of the right-hand side matrix
1102  , bool SO2 > // Storage order of the right-hand side matrix
1103 inline StrictlyLowerMatrix<MT,SO,false>&
1104  StrictlyLowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1105 {
1106  if( matrix_.rows() != (~rhs).columns() ) {
1107  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1108  }
1109 
1110  MT tmp( matrix_ * ~rhs );
1111 
1112  if( !isStrictlyLower( tmp ) ) {
1113  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1114  }
1115 
1116  matrix_ = std::move( tmp );
1117 
1118  if( !IsStrictlyLower<MT2>::value )
1119  resetUpper();
1120 
1121  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1122  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1123 
1124  return *this;
1125 }
1127 //*************************************************************************************************
1128 
1129 
1130 //*************************************************************************************************
1138 template< typename MT // Type of the adapted sparse matrix
1139  , bool SO > // Storage order of the adapted sparse matrix
1140 template< typename Other > // Data type of the right-hand side scalar
1141 inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >&
1143 {
1144  matrix_ *= rhs;
1145  return *this;
1146 }
1147 //*************************************************************************************************
1148 
1149 
1150 //*************************************************************************************************
1158 template< typename MT // Type of the adapted sparse matrix
1159  , bool SO > // Storage order of the adapted sparse matrix
1160 template< typename Other > // Data type of the right-hand side scalar
1161 inline EnableIf_< IsNumeric<Other>, StrictlyLowerMatrix<MT,SO,false> >&
1163 {
1164  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1165 
1166  matrix_ /= rhs;
1167  return *this;
1168 }
1170 //*************************************************************************************************
1171 
1172 
1173 
1174 
1175 //=================================================================================================
1176 //
1177 // UTILITY FUNCTIONS
1178 //
1179 //=================================================================================================
1180 
1181 //*************************************************************************************************
1187 template< typename MT // Type of the adapted sparse matrix
1188  , bool SO > // Storage order of the adapted sparse matrix
1189 inline size_t StrictlyLowerMatrix<MT,SO,false>::rows() const noexcept
1190 {
1191  return matrix_.rows();
1192 }
1194 //*************************************************************************************************
1195 
1196 
1197 //*************************************************************************************************
1203 template< typename MT // Type of the adapted sparse matrix
1204  , bool SO > // Storage order of the adapted sparse matrix
1205 inline size_t StrictlyLowerMatrix<MT,SO,false>::columns() const noexcept
1206 {
1207  return matrix_.columns();
1208 }
1210 //*************************************************************************************************
1211 
1212 
1213 //*************************************************************************************************
1219 template< typename MT // Type of the adapted sparse matrix
1220  , bool SO > // Storage order of the adapted sparse matrix
1221 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity() const noexcept
1222 {
1223  return matrix_.capacity();
1224 }
1226 //*************************************************************************************************
1227 
1228 
1229 //*************************************************************************************************
1241 template< typename MT // Type of the adapted sparse matrix
1242  , bool SO > // Storage order of the adapted sparse matrix
1243 inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1244 {
1245  return matrix_.capacity(i);
1246 }
1248 //*************************************************************************************************
1249 
1250 
1251 //*************************************************************************************************
1257 template< typename MT // Type of the adapted sparse matrix
1258  , bool SO > // Storage order of the adapted sparse matrix
1259 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros() const
1260 {
1261  return matrix_.nonZeros();
1262 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1279 template< typename MT // Type of the adapted sparse matrix
1280  , bool SO > // Storage order of the adapted sparse matrix
1281 inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1282 {
1283  return matrix_.nonZeros(i);
1284 }
1286 //*************************************************************************************************
1287 
1288 
1289 //*************************************************************************************************
1295 template< typename MT // Type of the adapted sparse matrix
1296  , bool SO > // Storage order of the adapted sparse matrix
1298 {
1299  if( SO ) {
1300  for( size_t j=0UL; j<columns(); ++j ) {
1301  matrix_.erase( j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1302  }
1303  }
1304  else {
1305  for( size_t i=1UL; i<rows(); ++i ) {
1306  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1307  }
1308  }
1309 }
1311 //*************************************************************************************************
1312 
1313 
1314 //*************************************************************************************************
1327 template< typename MT // Type of the adapted sparse matrix
1328  , bool SO > // Storage order of the adapted sparse matrix
1329 inline void StrictlyLowerMatrix<MT,SO,false>::reset( size_t i )
1330 {
1331  if( SO ) {
1332  matrix_.erase( i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1333  }
1334  else {
1335  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1336  }
1337 }
1339 //*************************************************************************************************
1340 
1341 
1342 //*************************************************************************************************
1350 template< typename MT // Type of the adapted sparse matrix
1351  , bool SO > // Storage order of the adapted sparse matrix
1353 {
1354  using blaze::clear;
1355 
1356  if( IsResizable<MT>::value ) {
1357  clear( matrix_ );
1358  }
1359  else {
1360  reset();
1361  }
1362 }
1364 //*************************************************************************************************
1365 
1366 
1367 //*************************************************************************************************
1383 template< typename MT // Type of the adapted sparse matrix
1384  , bool SO > // Storage order of the adapted sparse matrix
1386  StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1387 {
1388  if( i <= j ) {
1389  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1390  }
1391 
1392  return matrix_.set( i, j, value );
1393 }
1395 //*************************************************************************************************
1396 
1397 
1398 //*************************************************************************************************
1415 template< typename MT // Type of the adapted sparse matrix
1416  , bool SO > // Storage order of the adapted sparse matrix
1418  StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1419 {
1420  if( i <= j ) {
1421  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1422  }
1423 
1424  return matrix_.insert( i, j, value );
1425 }
1427 //*************************************************************************************************
1428 
1429 
1430 //*************************************************************************************************
1440 template< typename MT // Type of the adapted sparse matrix
1441  , bool SO > // Storage order of the adapted sparse matrix
1442 inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1443 {
1444  matrix_.erase( i, j );
1445 }
1447 //*************************************************************************************************
1448 
1449 
1450 //*************************************************************************************************
1462 template< typename MT // Type of the adapted sparse matrix
1463  , bool SO > // Storage order of the adapted sparse matrix
1465  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1466 {
1467  return matrix_.erase( i, pos );
1468 }
1470 //*************************************************************************************************
1471 
1472 
1473 //*************************************************************************************************
1487 template< typename MT // Type of the adapted sparse matrix
1488  , bool SO > // Storage order of the adapted sparse matrix
1490  StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1491 {
1492  return matrix_.erase( i, first, last );
1493 }
1495 //*************************************************************************************************
1496 
1497 
1498 //*************************************************************************************************
1513 template< typename MT // Type of the adapted sparse matrix
1514  , bool SO > // Storage order of the adapted sparse matrix
1515 void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1516 {
1518 
1519  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1520 
1521  matrix_.resize( n, n, preserve );
1522 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1538 template< typename MT // Type of the adapted sparse matrix
1539  , bool SO > // Storage order of the adapted sparse matrix
1540 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1541 {
1542  matrix_.reserve( nonzeros );
1543 }
1545 //*************************************************************************************************
1546 
1547 
1548 //*************************************************************************************************
1563 template< typename MT // Type of the adapted sparse matrix
1564  , bool SO > // Storage order of the adapted sparse matrix
1565 inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1566 {
1567  matrix_.reserve( i, nonzeros );
1568 }
1570 //*************************************************************************************************
1571 
1572 
1573 //*************************************************************************************************
1584 template< typename MT // Type of the adapted sparse matrix
1585  , bool SO > // Storage order of the adapted sparse matrix
1586 inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1587 {
1588  matrix_.trim();
1589 }
1591 //*************************************************************************************************
1592 
1593 
1594 //*************************************************************************************************
1606 template< typename MT // Type of the adapted sparse matrix
1607  , bool SO > // Storage order of the adapted sparse matrix
1608 inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1609 {
1610  matrix_.trim( i );
1611 }
1613 //*************************************************************************************************
1614 
1615 
1616 //*************************************************************************************************
1623 template< typename MT // Type of the adapted sparse matrix
1624  , bool SO > // Storage order of the adapted sparse matrix
1625 template< typename Other > // Data type of the scalar value
1626 inline StrictlyLowerMatrix<MT,SO,false>&
1627  StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
1628 {
1629  matrix_.scale( scalar );
1630  return *this;
1631 }
1633 //*************************************************************************************************
1634 
1635 
1636 //*************************************************************************************************
1643 template< typename MT // Type of the adapted sparse matrix
1644  , bool SO > // Storage order of the adapted sparse matrix
1645 template< typename Other > // Data type of the scalar value
1646 inline StrictlyLowerMatrix<MT,SO,false>&
1647  StrictlyLowerMatrix<MT,SO,false>::scaleDiagonal( Other scalar )
1648 {
1649  matrix_.scaleDiagonal( scalar );
1650  return *this;
1651 }
1653 //*************************************************************************************************
1654 
1655 
1656 //*************************************************************************************************
1663 template< typename MT // Type of the adapted sparse matrix
1664  , bool SO > // Storage order of the adapted sparse matrix
1665 inline void StrictlyLowerMatrix<MT,SO,false>::swap( StrictlyLowerMatrix& m ) noexcept
1666 {
1667  using std::swap;
1668 
1669  swap( matrix_, m.matrix_ );
1670 }
1672 //*************************************************************************************************
1673 
1674 
1675 //*************************************************************************************************
1687 template< typename MT // Type of the adapted dense matrix
1688  , bool SO > // Storage order of the adapted dense matrix
1689 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1690 {
1692 
1693  return maxNonZeros( Rows<MT>::value );
1694 }
1696 //*************************************************************************************************
1697 
1698 
1699 //*************************************************************************************************
1709 template< typename MT // Type of the adapted dense matrix
1710  , bool SO > // Storage order of the adapted dense matrix
1711 inline constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1712 {
1713  return ( ( n - 1UL ) * n ) / 2UL;
1714 }
1716 //*************************************************************************************************
1717 
1718 
1719 //*************************************************************************************************
1725 template< typename MT // Type of the adapted dense matrix
1726  , bool SO > // Storage order of the adapted dense matrix
1727 inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1728 {
1729  if( SO ) {
1730  for( size_t j=1UL; j<columns(); ++j )
1731  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1732  }
1733  else {
1734  for( size_t i=0UL; i<rows(); ++i )
1735  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1736  }
1737 }
1739 //*************************************************************************************************
1740 
1741 
1742 
1743 
1744 //=================================================================================================
1745 //
1746 // LOOKUP FUNCTIONS
1747 //
1748 //=================================================================================================
1749 
1750 //*************************************************************************************************
1766 template< typename MT // Type of the adapted sparse matrix
1767  , bool SO > // Storage order of the adapted sparse matrix
1769  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1770 {
1771  return matrix_.find( i, j );
1772 }
1774 //*************************************************************************************************
1775 
1776 
1777 //*************************************************************************************************
1793 template< typename MT // Type of the adapted sparse matrix
1794  , bool SO > // Storage order of the adapted sparse matrix
1796  StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
1797 {
1798  return matrix_.find( i, j );
1799 }
1801 //*************************************************************************************************
1802 
1803 
1804 //*************************************************************************************************
1820 template< typename MT // Type of the adapted sparse matrix
1821  , bool SO > // Storage order of the adapted sparse matrix
1823  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
1824 {
1825  return matrix_.lowerBound( i, j );
1826 }
1828 //*************************************************************************************************
1829 
1830 
1831 //*************************************************************************************************
1847 template< typename MT // Type of the adapted sparse matrix
1848  , bool SO > // Storage order of the adapted sparse matrix
1850  StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
1851 {
1852  return matrix_.lowerBound( i, j );
1853 }
1855 //*************************************************************************************************
1856 
1857 
1858 //*************************************************************************************************
1874 template< typename MT // Type of the adapted sparse matrix
1875  , bool SO > // Storage order of the adapted sparse matrix
1877  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
1878 {
1879  return matrix_.upperBound( i, j );
1880 }
1882 //*************************************************************************************************
1883 
1884 
1885 //*************************************************************************************************
1901 template< typename MT // Type of the adapted sparse matrix
1902  , bool SO > // Storage order of the adapted sparse matrix
1904  StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
1905 {
1906  return matrix_.upperBound( i, j );
1907 }
1909 //*************************************************************************************************
1910 
1911 
1912 
1913 
1914 //=================================================================================================
1915 //
1916 // LOW-LEVEL UTILITY FUNCTIONS
1917 //
1918 //=================================================================================================
1919 
1920 //*************************************************************************************************
1970 template< typename MT // Type of the adapted sparse matrix
1971  , bool SO > // Storage order of the adapted sparse matrix
1972 inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1973 {
1974  if( i <= j ) {
1975  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1976  }
1977 
1978  matrix_.append( i, j, value, check );
1979 }
1981 //*************************************************************************************************
1982 
1983 
1984 //*************************************************************************************************
1998 template< typename MT // Type of the adapted sparse matrix
1999  , bool SO > // Storage order of the adapted sparse matrix
2000 inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
2001 {
2002  matrix_.finalize( i );
2003 }
2005 //*************************************************************************************************
2006 
2007 
2008 
2009 
2010 //=================================================================================================
2011 //
2012 // DEBUGGING FUNCTIONS
2013 //
2014 //=================================================================================================
2015 
2016 //*************************************************************************************************
2026 template< typename MT // Type of the adapted sparse matrix
2027  , bool SO > // Storage order of the adapted sparse matrix
2028 inline bool StrictlyLowerMatrix<MT,SO,false>::isIntact() const noexcept
2029 {
2030  using blaze::isIntact;
2031 
2032  return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
2033 }
2035 //*************************************************************************************************
2036 
2037 
2038 
2039 
2040 //=================================================================================================
2041 //
2042 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2043 //
2044 //=================================================================================================
2045 
2046 //*************************************************************************************************
2057 template< typename MT // Type of the adapted sparse matrix
2058  , bool SO > // Storage order of the adapted sparse matrix
2059 template< typename Other > // Data type of the foreign expression
2060 inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2061 {
2062  return matrix_.canAlias( alias );
2063 }
2065 //*************************************************************************************************
2066 
2067 
2068 //*************************************************************************************************
2079 template< typename MT // Type of the adapted sparse matrix
2080  , bool SO > // Storage order of the adapted sparse matrix
2081 template< typename Other > // Data type of the foreign expression
2082 inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2083 {
2084  return matrix_.isAliased( alias );
2085 }
2087 //*************************************************************************************************
2088 
2089 
2090 //*************************************************************************************************
2101 template< typename MT // Type of the adapted sparse matrix
2102  , bool SO > // Storage order of the adapted sparse matrix
2103 inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2104 {
2105  return matrix_.canSMPAssign();
2106 }
2108 //*************************************************************************************************
2109 
2110 } // namespace blaze
2111 
2112 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for mathematical functions.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
Header file for the implementation of the base template of the StrictlyLowerMatrix.
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:1192
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1339
Constraint on the data type.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2643
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5077
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
#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:384
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
STL namespace.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2639
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:298
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:232
Constraint on the data type.
Constraint on the data type.
Header file for the SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5148
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5131
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the Columns type trait.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
Header file for the SparseElement base class.
Header file for the IsUniTriangular type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
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:538
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:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsNumeric type trait.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
Header file for all adaptor forward declarations.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
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:258
Constraint on the data type.
Constraint on the data type.
Header file for the StrictlyLowerProxy class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a 'resize' member fu...
Definition: Resizable.h:81
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2637
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:609
Header file for the IsResizable type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61