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 NewType > // Data type of the other matrix
127  struct Rebind {
129  typedef LowerMatrix< typename MT::template Rebind<NewType>::Other > Other;
130  };
131  //**********************************************************************************************
132 
133  //**Resize struct definition********************************************************************
136  template< size_t NewM // Number of rows of the other matrix
137  , size_t NewN > // Number of columns of the other matrix
138  struct Resize {
140  typedef LowerMatrix< typename MT::template Resize<NewM,NewN>::Other > Other;
141  };
142  //**********************************************************************************************
143 
144  //**Compilation flags***************************************************************************
146  enum : bool { smpAssignable = false };
147  //**********************************************************************************************
148 
149  //**Constructors********************************************************************************
152  explicit inline LowerMatrix();
153  explicit inline LowerMatrix( size_t n );
154  explicit inline LowerMatrix( size_t n, size_t nonzeros );
155  explicit inline LowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
156 
157  inline LowerMatrix( const LowerMatrix& m );
158  inline LowerMatrix( LowerMatrix&& m ) noexcept;
159 
160  template< typename MT2, bool SO2 >
161  inline LowerMatrix( const Matrix<MT2,SO2>& m );
163  //**********************************************************************************************
164 
165  //**Destructor**********************************************************************************
166  // No explicitly declared destructor.
167  //**********************************************************************************************
168 
169  //**Data access functions***********************************************************************
172  inline Reference operator()( size_t i, size_t j );
173  inline ConstReference operator()( size_t i, size_t j ) const;
174  inline Reference at( size_t i, size_t j );
175  inline ConstReference at( size_t i, size_t j ) const;
176  inline Iterator begin ( size_t i );
177  inline ConstIterator begin ( size_t i ) const;
178  inline ConstIterator cbegin( size_t i ) const;
179  inline Iterator end ( size_t i );
180  inline ConstIterator end ( size_t i ) const;
181  inline ConstIterator cend ( size_t i ) const;
183  //**********************************************************************************************
184 
185  //**Assignment operators************************************************************************
188  inline LowerMatrix& operator=( const LowerMatrix& rhs );
189  inline LowerMatrix& operator=( LowerMatrix&& rhs ) noexcept;
190 
191  template< typename MT2, bool SO2 >
192  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
193 
194  template< typename MT2, bool SO2 >
195  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
196 
197  template< typename MT2, bool SO2 >
198  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
199 
200  template< typename MT2, bool SO2 >
201  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
202 
203  template< typename MT2, bool SO2 >
204  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
205 
206  template< typename MT2, bool SO2 >
207  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
208 
209  template< typename MT2, bool SO2 >
210  inline LowerMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
211 
212  template< typename Other >
213  inline EnableIf_< IsNumeric<Other>, LowerMatrix >& operator*=( Other rhs );
214 
215  template< typename Other >
216  inline EnableIf_< IsNumeric<Other>, LowerMatrix >& operator/=( Other rhs );
218  //**********************************************************************************************
219 
220  //**Utility functions***************************************************************************
223  inline size_t rows() const noexcept;
224  inline size_t columns() const noexcept;
225  inline size_t capacity() const noexcept;
226  inline size_t capacity( size_t i ) const noexcept;
227  inline size_t nonZeros() const;
228  inline size_t nonZeros( size_t i ) const;
229  inline void reset();
230  inline void reset( size_t i );
231  inline void clear();
232  inline void resize ( size_t n, bool preserve=true );
233  inline void reserve( size_t nonzeros );
234  inline void reserve( size_t i, size_t nonzeros );
235  inline void trim();
236  inline void trim( size_t i );
237  inline void swap( LowerMatrix& m ) noexcept;
238 
239  static inline constexpr size_t maxNonZeros() noexcept;
240  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
242  //**********************************************************************************************
243 
244  //**Insertion functions*************************************************************************
247  inline Iterator set ( size_t i, size_t j, const ElementType& value );
248  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
249  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
250  inline void finalize( size_t i );
252  //**********************************************************************************************
253 
254  //**Erase functions*****************************************************************************
257  inline void erase( size_t i, size_t j );
258  inline Iterator erase( size_t i, Iterator pos );
259  inline Iterator erase( size_t i, Iterator first, Iterator last );
260 
261  template< typename Pred >
262  inline void erase( Pred predicate );
263 
264  template< typename Pred >
265  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
267  //**********************************************************************************************
268 
269  //**Lookup functions****************************************************************************
272  inline Iterator find ( size_t i, size_t j );
273  inline ConstIterator find ( size_t i, size_t j ) const;
274  inline Iterator lowerBound( size_t i, size_t j );
275  inline ConstIterator lowerBound( size_t i, size_t j ) const;
276  inline Iterator upperBound( size_t i, size_t j );
277  inline ConstIterator upperBound( size_t i, size_t j ) const;
279  //**********************************************************************************************
280 
281  //**Numeric functions***************************************************************************
284  template< typename Other > inline LowerMatrix& scale( const Other& scalar );
285  template< typename Other > inline LowerMatrix& scaleDiagonal( const Other& scale );
287  //**********************************************************************************************
288 
289  //**Debugging functions*************************************************************************
292  inline bool isIntact() const noexcept;
294  //**********************************************************************************************
295 
296  //**Expression template evaluation functions****************************************************
299  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
300  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
301 
302  inline bool canSMPAssign() const noexcept;
304  //**********************************************************************************************
305 
306  private:
307  //**Utility functions***************************************************************************
310  inline void resetUpper();
312  //**********************************************************************************************
313 
314  //**Member variables****************************************************************************
317  MT matrix_;
318 
319  //**********************************************************************************************
320 
321  //**Friend declarations*************************************************************************
322  template< bool RF, typename MT2, bool SO2, bool DF2 >
323  friend bool isDefault( const LowerMatrix<MT2,SO2,DF2>& m );
324 
325  template< typename MT2, bool SO2, bool DF2 >
326  friend MT2& derestrict( LowerMatrix<MT2,SO2,DF2>& m );
327  //**********************************************************************************************
328 
329  //**Compile time checks*************************************************************************
342  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
343  //**********************************************************************************************
344 };
346 //*************************************************************************************************
347 
348 
349 
350 
351 //=================================================================================================
352 //
353 // CONSTRUCTORS
354 //
355 //=================================================================================================
356 
357 //*************************************************************************************************
361 template< typename MT // Type of the adapted sparse matrix
362  , bool SO > // Storage order of the adapted sparse matrix
363 inline LowerMatrix<MT,SO,false>::LowerMatrix()
364  : matrix_() // The adapted sparse matrix
365 {
366  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
367 }
369 //*************************************************************************************************
370 
371 
372 //*************************************************************************************************
380 template< typename MT // Type of the adapted sparse matrix
381  , bool SO > // Storage order of the adapted sparse matrix
382 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n )
383  : matrix_( n, n ) // The adapted sparse matrix
384 {
386 
387  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
388 }
390 //*************************************************************************************************
391 
392 
393 //*************************************************************************************************
402 template< typename MT // Type of the adapted sparse matrix
403  , bool SO > // Storage order of the adapted sparse matrix
404 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, size_t nonzeros )
405  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
406 {
408 
409  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
410 }
412 //*************************************************************************************************
413 
414 
415 //*************************************************************************************************
426 template< typename MT // Type of the adapted sparse matrix
427  , bool SO > // Storage order of the adapted sparse matrix
428 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
429  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
430 {
432 
433  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
434 }
436 //*************************************************************************************************
437 
438 
439 //*************************************************************************************************
445 template< typename MT // Type of the adapted sparse matrix
446  , bool SO > // Storage order of the adapted sparse matrix
447 inline LowerMatrix<MT,SO,false>::LowerMatrix( const LowerMatrix& m )
448  : matrix_( m.matrix_ ) // The adapted sparse matrix
449 {
450  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
451  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
452 }
454 //*************************************************************************************************
455 
456 
457 //*************************************************************************************************
463 template< typename MT // Type of the adapted sparse matrix
464  , bool SO > // Storage order of the adapted sparse matrix
465 inline LowerMatrix<MT,SO,false>::LowerMatrix( LowerMatrix&& m ) noexcept
466  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
467 {
468  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
469  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
470 }
472 //*************************************************************************************************
473 
474 
475 //*************************************************************************************************
485 template< typename MT // Type of the adapted sparse matrix
486  , bool SO > // Storage order of the adapted sparse matrix
487 template< typename MT2 // Type of the foreign matrix
488  , bool SO2 > // Storage order of the foreign matrix
489 inline LowerMatrix<MT,SO,false>::LowerMatrix( const Matrix<MT2,SO2>& m )
490  : matrix_( ~m ) // The adapted sparse matrix
491 {
492  if( !IsLower<MT2>::value && !isLower( matrix_ ) ) {
493  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
494  }
495 
496  if( !IsLower<MT2>::value )
497  resetUpper();
498 
499  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
500  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
501 }
503 //*************************************************************************************************
504 
505 
506 
507 
508 //=================================================================================================
509 //
510 // DATA ACCESS FUNCTIONS
511 //
512 //=================================================================================================
513 
514 //*************************************************************************************************
530 template< typename MT // Type of the adapted sparse matrix
531  , bool SO > // Storage order of the adapted sparse matrix
533  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
534 {
535  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
536  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
537 
538  return Reference( matrix_, i, j );
539 }
541 //*************************************************************************************************
542 
543 
544 //*************************************************************************************************
560 template< typename MT // Type of the adapted sparse matrix
561  , bool SO > // Storage order of the adapted sparse matrix
563  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
564 {
565  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
566  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
567 
568  return matrix_(i,j);
569 }
571 //*************************************************************************************************
572 
573 
574 //*************************************************************************************************
591 template< typename MT // Type of the adapted sparse matrix
592  , bool SO > // Storage order of the adapted sparse matrix
594  LowerMatrix<MT,SO,false>::at( size_t i, size_t j )
595 {
596  if( i >= rows() ) {
597  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
598  }
599  if( j >= columns() ) {
600  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
601  }
602  return (*this)(i,j);
603 }
605 //*************************************************************************************************
606 
607 
608 //*************************************************************************************************
625 template< typename MT // Type of the adapted sparse matrix
626  , bool SO > // Storage order of the adapted sparse matrix
628  LowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
629 {
630  if( i >= rows() ) {
631  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
632  }
633  if( j >= columns() ) {
634  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
635  }
636  return (*this)(i,j);
637 }
639 //*************************************************************************************************
640 
641 
642 //*************************************************************************************************
654 template< typename MT // Type of the adapted sparse matrix
655  , bool SO > // Storage order of the adapted sparse matrix
658 {
659  return matrix_.begin(i);
660 }
662 //*************************************************************************************************
663 
664 
665 //*************************************************************************************************
677 template< typename MT // Type of the adapted sparse matrix
678  , bool SO > // Storage order of the adapted sparse matrix
680  LowerMatrix<MT,SO,false>::begin( size_t i ) const
681 {
682  return matrix_.begin(i);
683 }
685 //*************************************************************************************************
686 
687 
688 //*************************************************************************************************
700 template< typename MT // Type of the adapted sparse matrix
701  , bool SO > // Storage order of the adapted sparse matrix
703  LowerMatrix<MT,SO,false>::cbegin( size_t i ) const
704 {
705  return matrix_.cbegin(i);
706 }
708 //*************************************************************************************************
709 
710 
711 //*************************************************************************************************
723 template< typename MT // Type of the adapted sparse matrix
724  , bool SO > // Storage order of the adapted sparse matrix
727 {
728  return matrix_.end(i);
729 }
731 //*************************************************************************************************
732 
733 
734 //*************************************************************************************************
746 template< typename MT // Type of the adapted sparse matrix
747  , bool SO > // Storage order of the adapted sparse matrix
749  LowerMatrix<MT,SO,false>::end( size_t i ) const
750 {
751  return matrix_.end(i);
752 }
754 //*************************************************************************************************
755 
756 
757 //*************************************************************************************************
769 template< typename MT // Type of the adapted sparse matrix
770  , bool SO > // Storage order of the adapted sparse matrix
772  LowerMatrix<MT,SO,false>::cend( size_t i ) const
773 {
774  return matrix_.cend(i);
775 }
777 //*************************************************************************************************
778 
779 
780 
781 
782 //=================================================================================================
783 //
784 // ASSIGNMENT OPERATORS
785 //
786 //=================================================================================================
787 
788 //*************************************************************************************************
798 template< typename MT // Type of the adapted sparse matrix
799  , bool SO > // Storage order of the adapted sparse matrix
800 inline LowerMatrix<MT,SO,false>&
801  LowerMatrix<MT,SO,false>::operator=( const LowerMatrix& rhs )
802 {
803  matrix_ = rhs.matrix_;
804 
805  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
806  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
807 
808  return *this;
809 }
811 //*************************************************************************************************
812 
813 
814 //*************************************************************************************************
821 template< typename MT // Type of the adapted sparse matrix
822  , bool SO > // Storage order of the adapted sparse matrix
823 inline LowerMatrix<MT,SO,false>&
824  LowerMatrix<MT,SO,false>::operator=( LowerMatrix&& rhs ) noexcept
825 {
826  matrix_ = std::move( rhs.matrix_ );
827 
828  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
829  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
830 
831  return *this;
832 }
834 //*************************************************************************************************
835 
836 
837 //*************************************************************************************************
850 template< typename MT // Type of the adapted sparse matrix
851  , bool SO > // Storage order of the adapted sparse matrix
852 template< typename MT2 // Type of the right-hand side matrix
853  , bool SO2 > // Storage order of the right-hand side matrix
854 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
855  LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
856 {
857  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
858  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
859  }
860 
861  matrix_ = ~rhs;
862 
863  if( !IsLower<MT2>::value )
864  resetUpper();
865 
866  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
867  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
868 
869  return *this;
870 }
872 //*************************************************************************************************
873 
874 
875 //*************************************************************************************************
888 template< typename MT // Type of the adapted sparse matrix
889  , bool SO > // Storage order of the adapted sparse matrix
890 template< typename MT2 // Type of the right-hand side matrix
891  , bool SO2 > // Storage order of the right-hand side matrix
892 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
893  LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
894 {
895  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
896  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
897  }
898 
899  if( IsLower<MT2>::value ) {
900  matrix_ = ~rhs;
901  }
902  else {
903  MT tmp( ~rhs );
904 
905  if( !isLower( tmp ) ) {
906  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
907  }
908 
909  matrix_ = std::move( tmp );
910  }
911 
912  if( !IsLower<MT2>::value )
913  resetUpper();
914 
915  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
916  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
917 
918  return *this;
919 }
921 //*************************************************************************************************
922 
923 
924 //*************************************************************************************************
937 template< typename MT // Type of the adapted sparse matrix
938  , bool SO > // Storage order of the adapted sparse matrix
939 template< typename MT2 // Type of the right-hand side matrix
940  , bool SO2 > // Storage order of the right-hand side matrix
941 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
942  LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
943 {
944  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
945  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
946  }
947 
948  matrix_ += ~rhs;
949 
950  if( !IsLower<MT2>::value )
951  resetUpper();
952 
953  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
954  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
955 
956  return *this;
957 }
959 //*************************************************************************************************
960 
961 
962 //*************************************************************************************************
975 template< typename MT // Type of the adapted sparse matrix
976  , bool SO > // Storage order of the adapted sparse matrix
977 template< typename MT2 // Type of the right-hand side matrix
978  , bool SO2 > // Storage order of the right-hand side matrix
979 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
980  LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
981 {
982  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
983  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
984  }
985 
986  if( IsLower<MT2>::value ) {
987  matrix_ += ~rhs;
988  }
989  else {
990  const ResultType_<MT2> tmp( ~rhs );
991 
992  if( !isLower( tmp ) ) {
993  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
994  }
995 
996  matrix_ += tmp;
997  }
998 
999  if( !IsLower<MT2>::value )
1000  resetUpper();
1001 
1002  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1003  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1004 
1005  return *this;
1006 }
1008 //*************************************************************************************************
1009 
1010 
1011 //*************************************************************************************************
1024 template< typename MT // Type of the adapted sparse matrix
1025  , bool SO > // Storage order of the adapted sparse matrix
1026 template< typename MT2 // Type of the right-hand side matrix
1027  , bool SO2 > // Storage order of the right-hand side matrix
1028 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1029  LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1030 {
1031  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
1032  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1033  }
1034 
1035  matrix_ -= ~rhs;
1036 
1037  if( !IsLower<MT2>::value )
1038  resetUpper();
1039 
1040  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1041  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1042 
1043  return *this;
1044 }
1046 //*************************************************************************************************
1047 
1048 
1049 //*************************************************************************************************
1062 template< typename MT // Type of the adapted sparse matrix
1063  , bool SO > // Storage order of the adapted sparse matrix
1064 template< typename MT2 // Type of the right-hand side matrix
1065  , bool SO2 > // Storage order of the right-hand side matrix
1066 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1067  LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1068 {
1069  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1070  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1071  }
1072 
1073  if( IsLower<MT2>::value ) {
1074  matrix_ -= ~rhs;
1075  }
1076  else {
1077  const ResultType_<MT2> tmp( ~rhs );
1078 
1079  if( !isLower( tmp ) ) {
1080  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1081  }
1082 
1083  matrix_ -= tmp;
1084  }
1085 
1086  if( !IsLower<MT2>::value )
1087  resetUpper();
1088 
1089  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1090  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1091 
1092  return *this;
1093 }
1095 //*************************************************************************************************
1096 
1097 
1098 //*************************************************************************************************
1110 template< typename MT // Type of the adapted sparse matrix
1111  , bool SO > // Storage order of the adapted sparse matrix
1112 template< typename MT2 // Type of the right-hand side matrix
1113  , bool SO2 > // Storage order of the right-hand side matrix
1114 inline LowerMatrix<MT,SO,false>&
1115  LowerMatrix<MT,SO,false>::operator*=( const Matrix<MT2,SO2>& rhs )
1116 {
1117  if( matrix_.rows() != (~rhs).columns() ) {
1118  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1119  }
1120 
1121  MT tmp( matrix_ * ~rhs );
1122 
1123  if( !isLower( tmp ) ) {
1124  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1125  }
1126 
1127  matrix_ = std::move( tmp );
1128 
1129  if( !IsLower<MT2>::value )
1130  resetUpper();
1131 
1132  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1133  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1134 
1135  return *this;
1136 }
1138 //*************************************************************************************************
1139 
1140 
1141 //*************************************************************************************************
1149 template< typename MT // Type of the adapted sparse matrix
1150  , bool SO > // Storage order of the adapted sparse matrix
1151 template< typename Other > // Data type of the right-hand side scalar
1152 inline EnableIf_< IsNumeric<Other>, LowerMatrix<MT,SO,false> >&
1154 {
1155  matrix_ *= rhs;
1156  return *this;
1157 }
1158 //*************************************************************************************************
1159 
1160 
1161 //*************************************************************************************************
1169 template< typename MT // Type of the adapted sparse matrix
1170  , bool SO > // Storage order of the adapted sparse matrix
1171 template< typename Other > // Data type of the right-hand side scalar
1172 inline EnableIf_< IsNumeric<Other>, LowerMatrix<MT,SO,false> >&
1174 {
1175  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1176 
1177  matrix_ /= rhs;
1178  return *this;
1179 }
1181 //*************************************************************************************************
1182 
1183 
1184 
1185 
1186 //=================================================================================================
1187 //
1188 // UTILITY FUNCTIONS
1189 //
1190 //=================================================================================================
1191 
1192 //*************************************************************************************************
1198 template< typename MT // Type of the adapted sparse matrix
1199  , bool SO > // Storage order of the adapted sparse matrix
1200 inline size_t LowerMatrix<MT,SO,false>::rows() const noexcept
1201 {
1202  return matrix_.rows();
1203 }
1205 //*************************************************************************************************
1206 
1207 
1208 //*************************************************************************************************
1214 template< typename MT // Type of the adapted sparse matrix
1215  , bool SO > // Storage order of the adapted sparse matrix
1216 inline size_t LowerMatrix<MT,SO,false>::columns() const noexcept
1217 {
1218  return matrix_.columns();
1219 }
1221 //*************************************************************************************************
1222 
1223 
1224 //*************************************************************************************************
1230 template< typename MT // Type of the adapted sparse matrix
1231  , bool SO > // Storage order of the adapted sparse matrix
1232 inline size_t LowerMatrix<MT,SO,false>::capacity() const noexcept
1233 {
1234  return matrix_.capacity();
1235 }
1237 //*************************************************************************************************
1238 
1239 
1240 //*************************************************************************************************
1252 template< typename MT // Type of the adapted sparse matrix
1253  , bool SO > // Storage order of the adapted sparse matrix
1254 inline size_t LowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1255 {
1256  return matrix_.capacity(i);
1257 }
1259 //*************************************************************************************************
1260 
1261 
1262 //*************************************************************************************************
1268 template< typename MT // Type of the adapted sparse matrix
1269  , bool SO > // Storage order of the adapted sparse matrix
1270 inline size_t LowerMatrix<MT,SO,false>::nonZeros() const
1271 {
1272  return matrix_.nonZeros();
1273 }
1275 //*************************************************************************************************
1276 
1277 
1278 //*************************************************************************************************
1290 template< typename MT // Type of the adapted sparse matrix
1291  , bool SO > // Storage order of the adapted sparse matrix
1292 inline size_t LowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1293 {
1294  return matrix_.nonZeros(i);
1295 }
1297 //*************************************************************************************************
1298 
1299 
1300 //*************************************************************************************************
1306 template< typename MT // Type of the adapted sparse matrix
1307  , bool SO > // Storage order of the adapted sparse matrix
1308 inline void LowerMatrix<MT,SO,false>::reset()
1309 {
1310  matrix_.reset();
1311 }
1313 //*************************************************************************************************
1314 
1315 
1316 //*************************************************************************************************
1329 template< typename MT // Type of the adapted sparse matrix
1330  , bool SO > // Storage order of the adapted sparse matrix
1331 inline void LowerMatrix<MT,SO,false>::reset( size_t i )
1332 {
1333  matrix_.reset( i );
1334 }
1336 //*************************************************************************************************
1337 
1338 
1339 //*************************************************************************************************
1347 template< typename MT // Type of the adapted sparse matrix
1348  , bool SO > // Storage order of the adapted sparse matrix
1349 inline void LowerMatrix<MT,SO,false>::clear()
1350 {
1351  using blaze::clear;
1352 
1353  clear( matrix_ );
1354 }
1356 //*************************************************************************************************
1357 
1358 
1359 //*************************************************************************************************
1374 template< typename MT // Type of the adapted sparse matrix
1375  , bool SO > // Storage order of the adapted sparse matrix
1376 void LowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1377 {
1379 
1380  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1381 
1382  matrix_.resize( n, n, preserve );
1383 }
1385 //*************************************************************************************************
1386 
1387 
1388 //*************************************************************************************************
1399 template< typename MT // Type of the adapted sparse matrix
1400  , bool SO > // Storage order of the adapted sparse matrix
1401 inline void LowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1402 {
1403  matrix_.reserve( nonzeros );
1404 }
1406 //*************************************************************************************************
1407 
1408 
1409 //*************************************************************************************************
1423 template< typename MT // Type of the adapted sparse matrix
1424  , bool SO > // Storage order of the adapted sparse matrix
1425 inline void LowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1426 {
1427  matrix_.reserve( i, nonzeros );
1428 }
1430 //*************************************************************************************************
1431 
1432 
1433 //*************************************************************************************************
1444 template< typename MT // Type of the adapted sparse matrix
1445  , bool SO > // Storage order of the adapted sparse matrix
1446 inline void LowerMatrix<MT,SO,false>::trim()
1447 {
1448  matrix_.trim();
1449 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1466 template< typename MT // Type of the adapted sparse matrix
1467  , bool SO > // Storage order of the adapted sparse matrix
1468 inline void LowerMatrix<MT,SO,false>::trim( size_t i )
1469 {
1470  matrix_.trim( i );
1471 }
1473 //*************************************************************************************************
1474 
1475 
1476 //*************************************************************************************************
1483 template< typename MT // Type of the adapted sparse matrix
1484  , bool SO > // Storage order of the adapted sparse matrix
1485 inline void LowerMatrix<MT,SO,false>::swap( LowerMatrix& m ) noexcept
1486 {
1487  using std::swap;
1488 
1489  swap( matrix_, m.matrix_ );
1490 }
1492 //*************************************************************************************************
1493 
1494 
1495 //*************************************************************************************************
1506 template< typename MT // Type of the adapted dense matrix
1507  , bool SO > // Storage order of the adapted dense matrix
1508 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1509 {
1511 
1512  return maxNonZeros( Rows<MT>::value );
1513 }
1515 //*************************************************************************************************
1516 
1517 
1518 //*************************************************************************************************
1528 template< typename MT // Type of the adapted dense matrix
1529  , bool SO > // Storage order of the adapted dense matrix
1530 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1531 {
1532  return ( ( n + 1UL ) * n ) / 2UL;
1533 }
1535 //*************************************************************************************************
1536 
1537 
1538 //*************************************************************************************************
1544 template< typename MT // Type of the adapted dense matrix
1545  , bool SO > // Storage order of the adapted dense matrix
1546 inline void LowerMatrix<MT,SO,false>::resetUpper()
1547 {
1548  if( SO ) {
1549  for( size_t j=1UL; j<columns(); ++j )
1550  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1551  }
1552  else {
1553  for( size_t i=0UL; i<rows(); ++i )
1554  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1555  }
1556 }
1558 //*************************************************************************************************
1559 
1560 
1561 
1562 
1563 //=================================================================================================
1564 //
1565 // INSERTION FUNCTIONS
1566 //
1567 //=================================================================================================
1568 
1569 //*************************************************************************************************
1585 template< typename MT // Type of the adapted sparse matrix
1586  , bool SO > // Storage order of the adapted sparse matrix
1587 inline typename LowerMatrix<MT,SO,false>::Iterator
1588  LowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1589 {
1590  if( i < j ) {
1591  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1592  }
1593 
1594  return matrix_.set( i, j, value );
1595 }
1597 //*************************************************************************************************
1598 
1599 
1600 //*************************************************************************************************
1617 template< typename MT // Type of the adapted sparse matrix
1618  , bool SO > // Storage order of the adapted sparse matrix
1619 inline typename LowerMatrix<MT,SO,false>::Iterator
1620  LowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1621 {
1622  if( i < j ) {
1623  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1624  }
1625 
1626  return matrix_.insert( i, j, value );
1627 }
1629 //*************************************************************************************************
1630 
1631 
1632 //*************************************************************************************************
1682 template< typename MT // Type of the adapted sparse matrix
1683  , bool SO > // Storage order of the adapted sparse matrix
1684 inline void LowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1685 {
1686  if( i < j ) {
1687  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1688  }
1689 
1690  matrix_.append( i, j, value, check );
1691 }
1693 //*************************************************************************************************
1694 
1695 
1696 //*************************************************************************************************
1710 template< typename MT // Type of the adapted sparse matrix
1711  , bool SO > // Storage order of the adapted sparse matrix
1712 inline void LowerMatrix<MT,SO,false>::finalize( size_t i )
1713 {
1714  matrix_.finalize( i );
1715 }
1717 //*************************************************************************************************
1718 
1719 
1720 
1721 
1722 //=================================================================================================
1723 //
1724 // ERASE FUNCTIONS
1725 //
1726 //=================================================================================================
1727 
1728 //*************************************************************************************************
1738 template< typename MT // Type of the adapted sparse matrix
1739  , bool SO > // Storage order of the adapted sparse matrix
1740 inline void LowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1741 {
1742  matrix_.erase( i, j );
1743 }
1745 //*************************************************************************************************
1746 
1747 
1748 //*************************************************************************************************
1760 template< typename MT // Type of the adapted sparse matrix
1761  , bool SO > // Storage order of the adapted sparse matrix
1762 inline typename LowerMatrix<MT,SO,false>::Iterator
1763  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1764 {
1765  return matrix_.erase( i, pos );
1766 }
1768 //*************************************************************************************************
1769 
1770 
1771 //*************************************************************************************************
1784 template< typename MT // Type of the adapted sparse matrix
1785  , bool SO > // Storage order of the adapted sparse matrix
1786 inline typename LowerMatrix<MT,SO,false>::Iterator
1787  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1788 {
1789  return matrix_.erase( i, first, last );
1790 }
1792 //*************************************************************************************************
1793 
1794 
1795 //*************************************************************************************************
1817 template< typename MT // Type of the adapted sparse matrix
1818  , bool SO > // Storage order of the adapted sparse matrix
1819 template< typename Pred > // Type of the unary predicate
1820 inline void LowerMatrix<MT,SO,false>::erase( Pred predicate )
1821 {
1822  matrix_.erase( predicate );
1823 
1824  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1825 }
1827 //*************************************************************************************************
1828 
1829 
1830 //*************************************************************************************************
1858 template< typename MT // Type of the adapted sparse matrix
1859  , bool SO > // Storage order of the adapted sparse matrix
1860 template< typename Pred > // Type of the unary predicate
1861 inline void LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1862 {
1863  matrix_.erase( i, first, last, predicate );
1864 
1865  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1866 }
1868 //*************************************************************************************************
1869 
1870 
1871 
1872 
1873 //=================================================================================================
1874 //
1875 // LOOKUP FUNCTIONS
1876 //
1877 //=================================================================================================
1878 
1879 //*************************************************************************************************
1895 template< typename MT // Type of the adapted sparse matrix
1896  , bool SO > // Storage order of the adapted sparse matrix
1897 inline typename LowerMatrix<MT,SO,false>::Iterator
1898  LowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1899 {
1900  return matrix_.find( i, j );
1901 }
1903 //*************************************************************************************************
1904 
1905 
1906 //*************************************************************************************************
1922 template< typename MT // Type of the adapted sparse matrix
1923  , bool SO > // Storage order of the adapted sparse matrix
1925  LowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
1926 {
1927  return matrix_.find( i, j );
1928 }
1930 //*************************************************************************************************
1931 
1932 
1933 //*************************************************************************************************
1949 template< typename MT // Type of the adapted sparse matrix
1950  , bool SO > // Storage order of the adapted sparse matrix
1951 inline typename LowerMatrix<MT,SO,false>::Iterator
1952  LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
1953 {
1954  return matrix_.lowerBound( i, j );
1955 }
1957 //*************************************************************************************************
1958 
1959 
1960 //*************************************************************************************************
1976 template< typename MT // Type of the adapted sparse matrix
1977  , bool SO > // Storage order of the adapted sparse matrix
1979  LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
1980 {
1981  return matrix_.lowerBound( i, j );
1982 }
1984 //*************************************************************************************************
1985 
1986 
1987 //*************************************************************************************************
2003 template< typename MT // Type of the adapted sparse matrix
2004  , bool SO > // Storage order of the adapted sparse matrix
2005 inline typename LowerMatrix<MT,SO,false>::Iterator
2006  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2007 {
2008  return matrix_.upperBound( i, j );
2009 }
2011 //*************************************************************************************************
2012 
2013 
2014 //*************************************************************************************************
2030 template< typename MT // Type of the adapted sparse matrix
2031  , bool SO > // Storage order of the adapted sparse matrix
2033  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2034 {
2035  return matrix_.upperBound( i, j );
2036 }
2038 //*************************************************************************************************
2039 
2040 
2041 
2042 
2043 //=================================================================================================
2044 //
2045 // NUMERIC FUNCTIONS
2046 //
2047 //=================================================================================================
2048 
2049 //*************************************************************************************************
2056 template< typename MT // Type of the adapted sparse matrix
2057  , bool SO > // Storage order of the adapted sparse matrix
2058 template< typename Other > // Data type of the scalar value
2059 inline LowerMatrix<MT,SO,false>&
2060  LowerMatrix<MT,SO,false>::scale( const Other& scalar )
2061 {
2062  matrix_.scale( scalar );
2063  return *this;
2064 }
2066 //*************************************************************************************************
2067 
2068 
2069 //*************************************************************************************************
2076 template< typename MT // Type of the adapted sparse matrix
2077  , bool SO > // Storage order of the adapted sparse matrix
2078 template< typename Other > // Data type of the scalar value
2079 inline LowerMatrix<MT,SO,false>&
2080  LowerMatrix<MT,SO,false>::scaleDiagonal( const Other& scalar )
2081 {
2082  matrix_.scaleDiagonal( scalar );
2083  return *this;
2084 }
2086 //*************************************************************************************************
2087 
2088 
2089 
2090 
2091 //=================================================================================================
2092 //
2093 // DEBUGGING FUNCTIONS
2094 //
2095 //=================================================================================================
2096 
2097 //*************************************************************************************************
2107 template< typename MT // Type of the adapted sparse matrix
2108  , bool SO > // Storage order of the adapted sparse matrix
2109 inline bool LowerMatrix<MT,SO,false>::isIntact() const noexcept
2110 {
2111  using blaze::isIntact;
2112 
2113  return ( isIntact( matrix_ ) && isLower( matrix_ ) );
2114 }
2116 //*************************************************************************************************
2117 
2118 
2119 
2120 
2121 //=================================================================================================
2122 //
2123 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2124 //
2125 //=================================================================================================
2126 
2127 //*************************************************************************************************
2138 template< typename MT // Type of the adapted sparse matrix
2139  , bool SO > // Storage order of the adapted sparse matrix
2140 template< typename Other > // Data type of the foreign expression
2141 inline bool LowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2142 {
2143  return matrix_.canAlias( alias );
2144 }
2146 //*************************************************************************************************
2147 
2148 
2149 //*************************************************************************************************
2160 template< typename MT // Type of the adapted sparse matrix
2161  , bool SO > // Storage order of the adapted sparse matrix
2162 template< typename Other > // Data type of the foreign expression
2163 inline bool LowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2164 {
2165  return matrix_.isAliased( alias );
2166 }
2168 //*************************************************************************************************
2169 
2170 
2171 //*************************************************************************************************
2182 template< typename MT // Type of the adapted sparse matrix
2183  , bool SO > // Storage order of the adapted sparse matrix
2184 inline bool LowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2185 {
2186  return matrix_.canSMPAssign();
2187 }
2189 //*************************************************************************************************
2190 
2191 } // namespace blaze
2192 
2193 #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.
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1066
#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:352
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:194
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:2935
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5556
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#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:390
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.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2931
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:304
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:238
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:5635
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5618
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#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:336
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
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:544
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:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
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:2934
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:2938
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:267
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 &#39;resize&#39; member fu...
Definition: Resizable.h:81
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
#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 &#39;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:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
#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:677
#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