Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_LOWERMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_LOWERMATRIX_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/shims/Clear.h>
67 #include <blaze/util/Assert.h>
72 #include <blaze/util/DisableIf.h>
73 #include <blaze/util/EnableIf.h>
76 #include <blaze/util/Types.h>
77 
78 
79 namespace blaze {
80 
81 //=================================================================================================
82 //
83 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
84 //
85 //=================================================================================================
86 
87 //*************************************************************************************************
95 template< typename MT // Type of the adapted sparse matrix
96  , bool SO > // Storage order of the adapted sparse matrix
97 class LowerMatrix<MT,SO,false>
98  : public SparseMatrix< LowerMatrix<MT,SO,false>, SO >
99 {
100  private:
101  //**Type definitions****************************************************************************
102  typedef OppositeType_<MT> OT;
103  typedef TransposeType_<MT> TT;
104  typedef ElementType_<MT> ET;
105  //**********************************************************************************************
106 
107  public:
108  //**Type definitions****************************************************************************
109  typedef LowerMatrix<MT,SO,false> This;
110  typedef SparseMatrix<This,SO> BaseType;
111  typedef This ResultType;
112  typedef LowerMatrix<OT,!SO,false> OppositeType;
113  typedef UpperMatrix<TT,!SO,false> TransposeType;
114  typedef ET ElementType;
115  typedef ReturnType_<MT> ReturnType;
116  typedef const This& CompositeType;
117  typedef LowerProxy<MT> Reference;
118  typedef ConstReference_<MT> ConstReference;
119  typedef Iterator_<MT> Iterator;
120  typedef ConstIterator_<MT> ConstIterator;
121  //**********************************************************************************************
122 
123  //**Rebind struct definition********************************************************************
126  template< typename ET > // Data type of the other matrix
127  struct Rebind {
129  typedef LowerMatrix< typename MT::template Rebind<ET>::Other > Other;
130  };
131  //**********************************************************************************************
132 
133  //**Compilation flags***************************************************************************
135  enum : bool { smpAssignable = false };
136  //**********************************************************************************************
137 
138  //**Constructors********************************************************************************
141  explicit inline LowerMatrix();
142  explicit inline LowerMatrix( size_t n );
143  explicit inline LowerMatrix( size_t n, size_t nonzeros );
144  explicit inline LowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
145 
146  inline LowerMatrix( const LowerMatrix& m );
147  inline LowerMatrix( LowerMatrix&& m ) noexcept;
148 
149  template< typename MT2, bool SO2 >
150  inline LowerMatrix( const Matrix<MT2,SO2>& m );
152  //**********************************************************************************************
153 
154  //**Destructor**********************************************************************************
155  // No explicitly declared destructor.
156  //**********************************************************************************************
157 
158  //**Data access functions***********************************************************************
161  inline Reference operator()( size_t i, size_t j );
162  inline ConstReference operator()( size_t i, size_t j ) const;
163  inline Reference at( size_t i, size_t j );
164  inline ConstReference at( size_t i, size_t j ) const;
165  inline Iterator begin ( size_t i );
166  inline ConstIterator begin ( size_t i ) const;
167  inline ConstIterator cbegin( size_t i ) const;
168  inline Iterator end ( size_t i );
169  inline ConstIterator end ( size_t i ) const;
170  inline ConstIterator cend ( size_t i ) const;
172  //**********************************************************************************************
173 
174  //**Assignment operators************************************************************************
177  inline LowerMatrix& operator=( const LowerMatrix& rhs );
178  inline LowerMatrix& operator=( LowerMatrix&& rhs ) noexcept;
179 
180  template< typename MT2, bool SO2 >
181  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
182 
183  template< typename MT2, bool SO2 >
184  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
185 
186  template< typename MT2, bool SO2 >
187  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
188 
189  template< typename MT2, bool SO2 >
190  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
191 
192  template< typename MT2, bool SO2 >
193  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
194 
195  template< typename MT2, bool SO2 >
196  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
197 
198  template< typename MT2, bool SO2 >
199  inline LowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
200 
201  template< typename Other >
202  inline EnableIf_< IsNumeric<Other>, LowerMatrix >& operator*=( Other rhs );
203 
204  template< typename Other >
205  inline EnableIf_< IsNumeric<Other>, LowerMatrix >& operator/=( Other rhs );
207  //**********************************************************************************************
208 
209  //**Utility functions***************************************************************************
212  inline size_t rows() const noexcept;
213  inline size_t columns() const noexcept;
214  inline size_t capacity() const noexcept;
215  inline size_t capacity( size_t i ) const noexcept;
216  inline size_t nonZeros() const;
217  inline size_t nonZeros( size_t i ) const;
218  inline void reset();
219  inline void reset( size_t i );
220  inline void clear();
221  inline Iterator set( size_t i, size_t j, const ElementType& value );
222  inline Iterator insert( size_t i, size_t j, const ElementType& value );
223  inline void erase( size_t i, size_t j );
224  inline Iterator erase( size_t i, Iterator pos );
225  inline Iterator erase( size_t i, Iterator first, Iterator last );
226  inline void resize ( size_t n, bool preserve=true );
227  inline void reserve( size_t nonzeros );
228  inline void reserve( size_t i, size_t nonzeros );
229  inline void trim();
230  inline void trim( size_t i );
231  template< typename Other > inline LowerMatrix& scale( const Other& scalar );
232  template< typename Other > inline LowerMatrix& scaleDiagonal( Other scale );
233  inline void swap( LowerMatrix& m ) noexcept;
234 
235  static inline constexpr size_t maxNonZeros() noexcept;
236  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
238  //**********************************************************************************************
239 
240  //**Lookup functions****************************************************************************
243  inline Iterator find ( size_t i, size_t j );
244  inline ConstIterator find ( size_t i, size_t j ) const;
245  inline Iterator lowerBound( size_t i, size_t j );
246  inline ConstIterator lowerBound( size_t i, size_t j ) const;
247  inline Iterator upperBound( size_t i, size_t j );
248  inline ConstIterator upperBound( size_t i, size_t j ) const;
250  //**********************************************************************************************
251 
252  //**Low-level utility functions*****************************************************************
255  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
256  inline void finalize( size_t i );
258  //**********************************************************************************************
259 
260  //**Debugging functions*************************************************************************
263  inline bool isIntact() const noexcept;
265  //**********************************************************************************************
266 
267  //**Expression template evaluation functions****************************************************
270  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
271  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
272 
273  inline bool canSMPAssign() const noexcept;
275  //**********************************************************************************************
276 
277  private:
278  //**Utility functions***************************************************************************
281  inline void resetUpper();
283  //**********************************************************************************************
284 
285  //**Member variables****************************************************************************
288  MT matrix_;
289 
290  //**********************************************************************************************
291 
292  //**Friend declarations*************************************************************************
293  template< typename MT2, bool SO2, bool DF2 >
294  friend bool isDefault( const LowerMatrix<MT2,SO2,DF2>& m );
295 
296  template< typename MT2, bool SO2, bool DF2 >
297  friend MT2& derestrict( LowerMatrix<MT2,SO2,DF2>& m );
298  //**********************************************************************************************
299 
300  //**Compile time checks*************************************************************************
313  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
314  //**********************************************************************************************
315 };
317 //*************************************************************************************************
318 
319 
320 
321 
322 //=================================================================================================
323 //
324 // CONSTRUCTORS
325 //
326 //=================================================================================================
327 
328 //*************************************************************************************************
332 template< typename MT // Type of the adapted sparse matrix
333  , bool SO > // Storage order of the adapted sparse matrix
334 inline LowerMatrix<MT,SO,false>::LowerMatrix()
335  : matrix_() // The adapted sparse matrix
336 {
337  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
338 }
340 //*************************************************************************************************
341 
342 
343 //*************************************************************************************************
351 template< typename MT // Type of the adapted sparse matrix
352  , bool SO > // Storage order of the adapted sparse matrix
353 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n )
354  : matrix_( n, n ) // The adapted sparse matrix
355 {
357 
358  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
359 }
361 //*************************************************************************************************
362 
363 
364 //*************************************************************************************************
373 template< typename MT // Type of the adapted sparse matrix
374  , bool SO > // Storage order of the adapted sparse matrix
375 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, size_t nonzeros )
376  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
377 {
379 
380  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
381 }
383 //*************************************************************************************************
384 
385 
386 //*************************************************************************************************
397 template< typename MT // Type of the adapted sparse matrix
398  , bool SO > // Storage order of the adapted sparse matrix
399 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
400  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
401 {
403 
404  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
405 }
407 //*************************************************************************************************
408 
409 
410 //*************************************************************************************************
416 template< typename MT // Type of the adapted sparse matrix
417  , bool SO > // Storage order of the adapted sparse matrix
418 inline LowerMatrix<MT,SO,false>::LowerMatrix( const LowerMatrix& m )
419  : matrix_( m.matrix_ ) // The adapted sparse matrix
420 {
421  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
422  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
423 }
425 //*************************************************************************************************
426 
427 
428 //*************************************************************************************************
434 template< typename MT // Type of the adapted sparse matrix
435  , bool SO > // Storage order of the adapted sparse matrix
436 inline LowerMatrix<MT,SO,false>::LowerMatrix( LowerMatrix&& m ) noexcept
437  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
438 {
439  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
440  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
441 }
443 //*************************************************************************************************
444 
445 
446 //*************************************************************************************************
456 template< typename MT // Type of the adapted sparse matrix
457  , bool SO > // Storage order of the adapted sparse matrix
458 template< typename MT2 // Type of the foreign matrix
459  , bool SO2 > // Storage order of the foreign matrix
460 inline LowerMatrix<MT,SO,false>::LowerMatrix( const Matrix<MT2,SO2>& m )
461  : matrix_( ~m ) // The adapted sparse matrix
462 {
463  if( !IsLower<MT2>::value && !isLower( matrix_ ) ) {
464  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
465  }
466 
467  if( !IsLower<MT2>::value )
468  resetUpper();
469 
470  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
471  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
472 }
474 //*************************************************************************************************
475 
476 
477 
478 
479 //=================================================================================================
480 //
481 // DATA ACCESS FUNCTIONS
482 //
483 //=================================================================================================
484 
485 //*************************************************************************************************
501 template< typename MT // Type of the adapted sparse matrix
502  , bool SO > // Storage order of the adapted sparse matrix
504  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
505 {
506  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
507  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
508 
509  return Reference( matrix_, i, j );
510 }
512 //*************************************************************************************************
513 
514 
515 //*************************************************************************************************
531 template< typename MT // Type of the adapted sparse matrix
532  , bool SO > // Storage order of the adapted sparse matrix
534  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
535 {
536  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
537  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
538 
539  return matrix_(i,j);
540 }
542 //*************************************************************************************************
543 
544 
545 //*************************************************************************************************
562 template< typename MT // Type of the adapted sparse matrix
563  , bool SO > // Storage order of the adapted sparse matrix
565  LowerMatrix<MT,SO,false>::at( size_t i, size_t j )
566 {
567  if( i >= rows() ) {
568  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
569  }
570  if( j >= columns() ) {
571  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
572  }
573  return (*this)(i,j);
574 }
576 //*************************************************************************************************
577 
578 
579 //*************************************************************************************************
596 template< typename MT // Type of the adapted sparse matrix
597  , bool SO > // Storage order of the adapted sparse matrix
599  LowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
600 {
601  if( i >= rows() ) {
602  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
603  }
604  if( j >= columns() ) {
605  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
606  }
607  return (*this)(i,j);
608 }
610 //*************************************************************************************************
611 
612 
613 //*************************************************************************************************
625 template< typename MT // Type of the adapted sparse matrix
626  , bool SO > // Storage order of the adapted sparse matrix
629 {
630  return matrix_.begin(i);
631 }
633 //*************************************************************************************************
634 
635 
636 //*************************************************************************************************
648 template< typename MT // Type of the adapted sparse matrix
649  , bool SO > // Storage order of the adapted sparse matrix
651  LowerMatrix<MT,SO,false>::begin( size_t i ) const
652 {
653  return matrix_.begin(i);
654 }
656 //*************************************************************************************************
657 
658 
659 //*************************************************************************************************
671 template< typename MT // Type of the adapted sparse matrix
672  , bool SO > // Storage order of the adapted sparse matrix
674  LowerMatrix<MT,SO,false>::cbegin( size_t i ) const
675 {
676  return matrix_.cbegin(i);
677 }
679 //*************************************************************************************************
680 
681 
682 //*************************************************************************************************
694 template< typename MT // Type of the adapted sparse matrix
695  , bool SO > // Storage order of the adapted sparse matrix
698 {
699  return matrix_.end(i);
700 }
702 //*************************************************************************************************
703 
704 
705 //*************************************************************************************************
717 template< typename MT // Type of the adapted sparse matrix
718  , bool SO > // Storage order of the adapted sparse matrix
720  LowerMatrix<MT,SO,false>::end( size_t i ) const
721 {
722  return matrix_.end(i);
723 }
725 //*************************************************************************************************
726 
727 
728 //*************************************************************************************************
740 template< typename MT // Type of the adapted sparse matrix
741  , bool SO > // Storage order of the adapted sparse matrix
743  LowerMatrix<MT,SO,false>::cend( size_t i ) const
744 {
745  return matrix_.cend(i);
746 }
748 //*************************************************************************************************
749 
750 
751 
752 
753 //=================================================================================================
754 //
755 // ASSIGNMENT OPERATORS
756 //
757 //=================================================================================================
758 
759 //*************************************************************************************************
769 template< typename MT // Type of the adapted sparse matrix
770  , bool SO > // Storage order of the adapted sparse matrix
771 inline LowerMatrix<MT,SO,false>&
772  LowerMatrix<MT,SO,false>::operator=( const LowerMatrix& rhs )
773 {
774  matrix_ = rhs.matrix_;
775 
776  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
777  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
778 
779  return *this;
780 }
782 //*************************************************************************************************
783 
784 
785 //*************************************************************************************************
792 template< typename MT // Type of the adapted sparse matrix
793  , bool SO > // Storage order of the adapted sparse matrix
794 inline LowerMatrix<MT,SO,false>&
795  LowerMatrix<MT,SO,false>::operator=( LowerMatrix&& rhs ) noexcept
796 {
797  matrix_ = std::move( rhs.matrix_ );
798 
799  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
800  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
801 
802  return *this;
803 }
805 //*************************************************************************************************
806 
807 
808 //*************************************************************************************************
821 template< typename MT // Type of the adapted sparse matrix
822  , bool SO > // Storage order of the adapted sparse matrix
823 template< typename MT2 // Type of the right-hand side matrix
824  , bool SO2 > // Storage order of the right-hand side matrix
825 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
826  LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
827 {
828  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
829  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
830  }
831 
832  matrix_ = ~rhs;
833 
834  if( !IsLower<MT2>::value )
835  resetUpper();
836 
837  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
838  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
839 
840  return *this;
841 }
843 //*************************************************************************************************
844 
845 
846 //*************************************************************************************************
859 template< typename MT // Type of the adapted sparse matrix
860  , bool SO > // Storage order of the adapted sparse matrix
861 template< typename MT2 // Type of the right-hand side matrix
862  , bool SO2 > // Storage order of the right-hand side matrix
863 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
864  LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
865 {
866  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
867  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
868  }
869 
870  if( IsLower<MT2>::value ) {
871  matrix_ = ~rhs;
872  }
873  else {
874  MT tmp( ~rhs );
875 
876  if( !isLower( tmp ) ) {
877  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
878  }
879 
880  matrix_ = std::move( tmp );
881  }
882 
883  if( !IsLower<MT2>::value )
884  resetUpper();
885 
886  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
887  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
888 
889  return *this;
890 }
892 //*************************************************************************************************
893 
894 
895 //*************************************************************************************************
908 template< typename MT // Type of the adapted sparse matrix
909  , bool SO > // Storage order of the adapted sparse matrix
910 template< typename MT2 // Type of the right-hand side matrix
911  , bool SO2 > // Storage order of the right-hand side matrix
912 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
913  LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
914 {
915  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
916  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
917  }
918 
919  matrix_ += ~rhs;
920 
921  if( !IsLower<MT2>::value )
922  resetUpper();
923 
924  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
925  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
926 
927  return *this;
928 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
946 template< typename MT // Type of the adapted sparse matrix
947  , bool SO > // Storage order of the adapted sparse matrix
948 template< typename MT2 // Type of the right-hand side matrix
949  , bool SO2 > // Storage order of the right-hand side matrix
950 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
951  LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
952 {
953  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
954  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
955  }
956 
957  if( IsLower<MT2>::value ) {
958  matrix_ += ~rhs;
959  }
960  else {
961  const ResultType_<MT2> tmp( ~rhs );
962 
963  if( !isLower( tmp ) ) {
964  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
965  }
966 
967  matrix_ += tmp;
968  }
969 
970  if( !IsLower<MT2>::value )
971  resetUpper();
972 
973  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
974  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
975 
976  return *this;
977 }
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
995 template< typename MT // Type of the adapted sparse matrix
996  , bool SO > // Storage order of the adapted sparse matrix
997 template< typename MT2 // Type of the right-hand side matrix
998  , bool SO2 > // Storage order of the right-hand side matrix
999 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1000  LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1001 {
1002  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1004  }
1005 
1006  matrix_ -= ~rhs;
1007 
1008  if( !IsLower<MT2>::value )
1009  resetUpper();
1010 
1011  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1012  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1013 
1014  return *this;
1015 }
1017 //*************************************************************************************************
1018 
1019 
1020 //*************************************************************************************************
1033 template< typename MT // Type of the adapted sparse matrix
1034  , bool SO > // Storage order of the adapted sparse matrix
1035 template< typename MT2 // Type of the right-hand side matrix
1036  , bool SO2 > // Storage order of the right-hand side matrix
1037 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1038  LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1039 {
1040  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1041  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1042  }
1043 
1044  if( IsLower<MT2>::value ) {
1045  matrix_ -= ~rhs;
1046  }
1047  else {
1048  const ResultType_<MT2> tmp( ~rhs );
1049 
1050  if( !isLower( tmp ) ) {
1051  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1052  }
1053 
1054  matrix_ -= tmp;
1055  }
1056 
1057  if( !IsLower<MT2>::value )
1058  resetUpper();
1059 
1060  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1061  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1062 
1063  return *this;
1064 }
1066 //*************************************************************************************************
1067 
1068 
1069 //*************************************************************************************************
1081 template< typename MT // Type of the adapted sparse matrix
1082  , bool SO > // Storage order of the adapted sparse matrix
1083 template< typename MT2 // Type of the right-hand side matrix
1084  , bool SO2 > // Storage order of the right-hand side matrix
1085 inline LowerMatrix<MT,SO,false>&
1086  LowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1087 {
1088  if( matrix_.rows() != (~rhs).columns() ) {
1089  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1090  }
1091 
1092  MT tmp( matrix_ * ~rhs );
1093 
1094  if( !isLower( tmp ) ) {
1095  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1096  }
1097 
1098  matrix_ = std::move( tmp );
1099 
1100  if( !IsLower<MT2>::value )
1101  resetUpper();
1102 
1103  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1104  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1105 
1106  return *this;
1107 }
1109 //*************************************************************************************************
1110 
1111 
1112 //*************************************************************************************************
1120 template< typename MT // Type of the adapted sparse matrix
1121  , bool SO > // Storage order of the adapted sparse matrix
1122 template< typename Other > // Data type of the right-hand side scalar
1123 inline EnableIf_< IsNumeric<Other>, LowerMatrix<MT,SO,false> >&
1125 {
1126  matrix_ *= rhs;
1127  return *this;
1128 }
1129 //*************************************************************************************************
1130 
1131 
1132 //*************************************************************************************************
1140 template< typename MT // Type of the adapted sparse matrix
1141  , bool SO > // Storage order of the adapted sparse matrix
1142 template< typename Other > // Data type of the right-hand side scalar
1143 inline EnableIf_< IsNumeric<Other>, LowerMatrix<MT,SO,false> >&
1145 {
1146  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1147 
1148  matrix_ /= rhs;
1149  return *this;
1150 }
1152 //*************************************************************************************************
1153 
1154 
1155 
1156 
1157 //=================================================================================================
1158 //
1159 // UTILITY FUNCTIONS
1160 //
1161 //=================================================================================================
1162 
1163 //*************************************************************************************************
1169 template< typename MT // Type of the adapted sparse matrix
1170  , bool SO > // Storage order of the adapted sparse matrix
1171 inline size_t LowerMatrix<MT,SO,false>::rows() const noexcept
1172 {
1173  return matrix_.rows();
1174 }
1176 //*************************************************************************************************
1177 
1178 
1179 //*************************************************************************************************
1185 template< typename MT // Type of the adapted sparse matrix
1186  , bool SO > // Storage order of the adapted sparse matrix
1187 inline size_t LowerMatrix<MT,SO,false>::columns() const noexcept
1188 {
1189  return matrix_.columns();
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 //*************************************************************************************************
1201 template< typename MT // Type of the adapted sparse matrix
1202  , bool SO > // Storage order of the adapted sparse matrix
1203 inline size_t LowerMatrix<MT,SO,false>::capacity() const noexcept
1204 {
1205  return matrix_.capacity();
1206 }
1208 //*************************************************************************************************
1209 
1210 
1211 //*************************************************************************************************
1223 template< typename MT // Type of the adapted sparse matrix
1224  , bool SO > // Storage order of the adapted sparse matrix
1225 inline size_t LowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1226 {
1227  return matrix_.capacity(i);
1228 }
1230 //*************************************************************************************************
1231 
1232 
1233 //*************************************************************************************************
1239 template< typename MT // Type of the adapted sparse matrix
1240  , bool SO > // Storage order of the adapted sparse matrix
1241 inline size_t LowerMatrix<MT,SO,false>::nonZeros() const
1242 {
1243  return matrix_.nonZeros();
1244 }
1246 //*************************************************************************************************
1247 
1248 
1249 //*************************************************************************************************
1261 template< typename MT // Type of the adapted sparse matrix
1262  , bool SO > // Storage order of the adapted sparse matrix
1263 inline size_t LowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1264 {
1265  return matrix_.nonZeros(i);
1266 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1277 template< typename MT // Type of the adapted sparse matrix
1278  , bool SO > // Storage order of the adapted sparse matrix
1279 inline void LowerMatrix<MT,SO,false>::reset()
1280 {
1281  matrix_.reset();
1282 }
1284 //*************************************************************************************************
1285 
1286 
1287 //*************************************************************************************************
1300 template< typename MT // Type of the adapted sparse matrix
1301  , bool SO > // Storage order of the adapted sparse matrix
1302 inline void LowerMatrix<MT,SO,false>::reset( size_t i )
1303 {
1304  matrix_.reset( i );
1305 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1318 template< typename MT // Type of the adapted sparse matrix
1319  , bool SO > // Storage order of the adapted sparse matrix
1320 inline void LowerMatrix<MT,SO,false>::clear()
1321 {
1322  using blaze::clear;
1323 
1324  clear( matrix_ );
1325 }
1327 //*************************************************************************************************
1328 
1329 
1330 //*************************************************************************************************
1346 template< typename MT // Type of the adapted sparse matrix
1347  , bool SO > // Storage order of the adapted sparse matrix
1348 inline typename LowerMatrix<MT,SO,false>::Iterator
1349  LowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1350 {
1351  if( i < j ) {
1352  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1353  }
1354 
1355  return matrix_.set( i, j, value );
1356 }
1358 //*************************************************************************************************
1359 
1360 
1361 //*************************************************************************************************
1378 template< typename MT // Type of the adapted sparse matrix
1379  , bool SO > // Storage order of the adapted sparse matrix
1380 inline typename LowerMatrix<MT,SO,false>::Iterator
1381  LowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1382 {
1383  if( i < j ) {
1384  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1385  }
1386 
1387  return matrix_.insert( i, j, value );
1388 }
1390 //*************************************************************************************************
1391 
1392 
1393 //*************************************************************************************************
1403 template< typename MT // Type of the adapted sparse matrix
1404  , bool SO > // Storage order of the adapted sparse matrix
1405 inline void LowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1406 {
1407  matrix_.erase( i, j );
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1425 template< typename MT // Type of the adapted sparse matrix
1426  , bool SO > // Storage order of the adapted sparse matrix
1427 inline typename LowerMatrix<MT,SO,false>::Iterator
1428  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1429 {
1430  return matrix_.erase( i, pos );
1431 }
1433 //*************************************************************************************************
1434 
1435 
1436 //*************************************************************************************************
1449 template< typename MT // Type of the adapted sparse matrix
1450  , bool SO > // Storage order of the adapted sparse matrix
1451 inline typename LowerMatrix<MT,SO,false>::Iterator
1452  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1453 {
1454  return matrix_.erase( i, first, last );
1455 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1475 template< typename MT // Type of the adapted sparse matrix
1476  , bool SO > // Storage order of the adapted sparse matrix
1477 void LowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1478 {
1480 
1481  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1482 
1483  matrix_.resize( n, n, preserve );
1484 }
1486 //*************************************************************************************************
1487 
1488 
1489 //*************************************************************************************************
1500 template< typename MT // Type of the adapted sparse matrix
1501  , bool SO > // Storage order of the adapted sparse matrix
1502 inline void LowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1503 {
1504  matrix_.reserve( nonzeros );
1505 }
1507 //*************************************************************************************************
1508 
1509 
1510 //*************************************************************************************************
1524 template< typename MT // Type of the adapted sparse matrix
1525  , bool SO > // Storage order of the adapted sparse matrix
1526 inline void LowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1527 {
1528  matrix_.reserve( i, nonzeros );
1529 }
1531 //*************************************************************************************************
1532 
1533 
1534 //*************************************************************************************************
1545 template< typename MT // Type of the adapted sparse matrix
1546  , bool SO > // Storage order of the adapted sparse matrix
1547 inline void LowerMatrix<MT,SO,false>::trim()
1548 {
1549  matrix_.trim();
1550 }
1552 //*************************************************************************************************
1553 
1554 
1555 //*************************************************************************************************
1567 template< typename MT // Type of the adapted sparse matrix
1568  , bool SO > // Storage order of the adapted sparse matrix
1569 inline void LowerMatrix<MT,SO,false>::trim( size_t i )
1570 {
1571  matrix_.trim( i );
1572 }
1574 //*************************************************************************************************
1575 
1576 
1577 //*************************************************************************************************
1584 template< typename MT // Type of the adapted sparse matrix
1585  , bool SO > // Storage order of the adapted sparse matrix
1586 template< typename Other > // Data type of the scalar value
1587 inline LowerMatrix<MT,SO,false>&
1588  LowerMatrix<MT,SO,false>::scale( const Other& scalar )
1589 {
1590  matrix_.scale( scalar );
1591  return *this;
1592 }
1594 //*************************************************************************************************
1595 
1596 
1597 //*************************************************************************************************
1604 template< typename MT // Type of the adapted sparse matrix
1605  , bool SO > // Storage order of the adapted sparse matrix
1606 template< typename Other > // Data type of the scalar value
1607 inline LowerMatrix<MT,SO,false>&
1608  LowerMatrix<MT,SO,false>::scaleDiagonal( Other scalar )
1609 {
1610  matrix_.scaleDiagonal( scalar );
1611  return *this;
1612 }
1614 //*************************************************************************************************
1615 
1616 
1617 //*************************************************************************************************
1624 template< typename MT // Type of the adapted sparse matrix
1625  , bool SO > // Storage order of the adapted sparse matrix
1626 inline void LowerMatrix<MT,SO,false>::swap( LowerMatrix& m ) noexcept
1627 {
1628  using std::swap;
1629 
1630  swap( matrix_, m.matrix_ );
1631 }
1633 //*************************************************************************************************
1634 
1635 
1636 //*************************************************************************************************
1647 template< typename MT // Type of the adapted dense matrix
1648  , bool SO > // Storage order of the adapted dense matrix
1649 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1650 {
1652 
1653  return maxNonZeros( Rows<MT>::value );
1654 }
1656 //*************************************************************************************************
1657 
1658 
1659 //*************************************************************************************************
1669 template< typename MT // Type of the adapted dense matrix
1670  , bool SO > // Storage order of the adapted dense matrix
1671 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1672 {
1673  return ( ( n + 1UL ) * n ) / 2UL;
1674 }
1676 //*************************************************************************************************
1677 
1678 
1679 //*************************************************************************************************
1685 template< typename MT // Type of the adapted dense matrix
1686  , bool SO > // Storage order of the adapted dense matrix
1687 inline void LowerMatrix<MT,SO,false>::resetUpper()
1688 {
1689  if( SO ) {
1690  for( size_t j=1UL; j<columns(); ++j )
1691  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1692  }
1693  else {
1694  for( size_t i=0UL; i<rows(); ++i )
1695  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1696  }
1697 }
1699 //*************************************************************************************************
1700 
1701 
1702 
1703 
1704 //=================================================================================================
1705 //
1706 // LOOKUP FUNCTIONS
1707 //
1708 //=================================================================================================
1709 
1710 //*************************************************************************************************
1726 template< typename MT // Type of the adapted sparse matrix
1727  , bool SO > // Storage order of the adapted sparse matrix
1728 inline typename LowerMatrix<MT,SO,false>::Iterator
1729  LowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1730 {
1731  return matrix_.find( i, j );
1732 }
1734 //*************************************************************************************************
1735 
1736 
1737 //*************************************************************************************************
1753 template< typename MT // Type of the adapted sparse matrix
1754  , bool SO > // Storage order of the adapted sparse matrix
1756  LowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
1757 {
1758  return matrix_.find( i, j );
1759 }
1761 //*************************************************************************************************
1762 
1763 
1764 //*************************************************************************************************
1780 template< typename MT // Type of the adapted sparse matrix
1781  , bool SO > // Storage order of the adapted sparse matrix
1782 inline typename LowerMatrix<MT,SO,false>::Iterator
1783  LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
1784 {
1785  return matrix_.lowerBound( i, j );
1786 }
1788 //*************************************************************************************************
1789 
1790 
1791 //*************************************************************************************************
1807 template< typename MT // Type of the adapted sparse matrix
1808  , bool SO > // Storage order of the adapted sparse matrix
1810  LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
1811 {
1812  return matrix_.lowerBound( i, j );
1813 }
1815 //*************************************************************************************************
1816 
1817 
1818 //*************************************************************************************************
1834 template< typename MT // Type of the adapted sparse matrix
1835  , bool SO > // Storage order of the adapted sparse matrix
1836 inline typename LowerMatrix<MT,SO,false>::Iterator
1837  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
1838 {
1839  return matrix_.upperBound( i, j );
1840 }
1842 //*************************************************************************************************
1843 
1844 
1845 //*************************************************************************************************
1861 template< typename MT // Type of the adapted sparse matrix
1862  , bool SO > // Storage order of the adapted sparse matrix
1864  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
1865 {
1866  return matrix_.upperBound( i, j );
1867 }
1869 //*************************************************************************************************
1870 
1871 
1872 
1873 
1874 //=================================================================================================
1875 //
1876 // LOW-LEVEL UTILITY FUNCTIONS
1877 //
1878 //=================================================================================================
1879 
1880 //*************************************************************************************************
1930 template< typename MT // Type of the adapted sparse matrix
1931  , bool SO > // Storage order of the adapted sparse matrix
1932 inline void LowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1933 {
1934  if( i < j ) {
1935  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1936  }
1937 
1938  matrix_.append( i, j, value, check );
1939 }
1941 //*************************************************************************************************
1942 
1943 
1944 //*************************************************************************************************
1958 template< typename MT // Type of the adapted sparse matrix
1959  , bool SO > // Storage order of the adapted sparse matrix
1960 inline void LowerMatrix<MT,SO,false>::finalize( size_t i )
1961 {
1962  matrix_.finalize( i );
1963 }
1965 //*************************************************************************************************
1966 
1967 
1968 
1969 
1970 //=================================================================================================
1971 //
1972 // DEBUGGING FUNCTIONS
1973 //
1974 //=================================================================================================
1975 
1976 //*************************************************************************************************
1986 template< typename MT // Type of the adapted sparse matrix
1987  , bool SO > // Storage order of the adapted sparse matrix
1988 inline bool LowerMatrix<MT,SO,false>::isIntact() const noexcept
1989 {
1990  using blaze::isIntact;
1991 
1992  return ( isIntact( matrix_ ) && isLower( matrix_ ) );
1993 }
1995 //*************************************************************************************************
1996 
1997 
1998 
1999 
2000 //=================================================================================================
2001 //
2002 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2003 //
2004 //=================================================================================================
2005 
2006 //*************************************************************************************************
2017 template< typename MT // Type of the adapted sparse matrix
2018  , bool SO > // Storage order of the adapted sparse matrix
2019 template< typename Other > // Data type of the foreign expression
2020 inline bool LowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2021 {
2022  return matrix_.canAlias( alias );
2023 }
2025 //*************************************************************************************************
2026 
2027 
2028 //*************************************************************************************************
2039 template< typename MT // Type of the adapted sparse matrix
2040  , bool SO > // Storage order of the adapted sparse matrix
2041 template< typename Other > // Data type of the foreign expression
2042 inline bool LowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2043 {
2044  return matrix_.isAliased( alias );
2045 }
2047 //*************************************************************************************************
2048 
2049 
2050 //*************************************************************************************************
2061 template< typename MT // Type of the adapted sparse matrix
2062  , bool SO > // Storage order of the adapted sparse matrix
2063 inline bool LowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2064 {
2065  return matrix_.canSMPAssign();
2066 }
2068 //*************************************************************************************************
2069 
2070 } // namespace blaze
2071 
2072 #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.
#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.
#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.
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
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1036
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
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
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.
Header file for the IsLower type trait.
Header file for the LowerProxy class.
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
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.
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.
#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 implementation of the base template of the LowerMatrix.
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
#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