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>
59 #include <blaze/math/Exception.h>
62 #include <blaze/math/shims/Clear.h>
69 #include <blaze/util/Assert.h>
74 #include <blaze/util/DisableIf.h>
75 #include <blaze/util/EnableIf.h>
77 #include <blaze/util/Types.h>
78 
79 
80 namespace blaze {
81 
82 //=================================================================================================
83 //
84 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
85 //
86 //=================================================================================================
87 
88 //*************************************************************************************************
96 template< typename MT // Type of the adapted sparse matrix
97  , bool SO > // Storage order of the adapted sparse matrix
98 class LowerMatrix<MT,SO,false>
99  : public SparseMatrix< LowerMatrix<MT,SO,false>, SO >
100 {
101  private:
102  //**Type definitions****************************************************************************
103  using OT = OppositeType_<MT>;
104  using TT = TransposeType_<MT>;
105  using ET = ElementType_<MT>;
106  //**********************************************************************************************
107 
108  public:
109  //**Type definitions****************************************************************************
110  using This = LowerMatrix<MT,SO,false>;
111  using BaseType = SparseMatrix<This,SO>;
112  using ResultType = This;
113  using OppositeType = LowerMatrix<OT,!SO,false>;
114  using TransposeType = UpperMatrix<TT,!SO,false>;
115  using ElementType = ET;
116  using ReturnType = ReturnType_<MT>;
117  using CompositeType = const This&;
118  using Reference = LowerProxy<MT>;
119  using ConstReference = ConstReference_<MT>;
120  using Iterator = Iterator_<MT>;
121  using ConstIterator = ConstIterator_<MT>;
122  //**********************************************************************************************
123 
124  //**Rebind struct definition********************************************************************
127  template< typename NewType > // Data type of the other matrix
128  struct Rebind {
130  using Other = LowerMatrix< typename MT::template Rebind<NewType>::Other >;
131  };
132  //**********************************************************************************************
133 
134  //**Resize struct definition********************************************************************
137  template< size_t NewM // Number of rows of the other matrix
138  , size_t NewN > // Number of columns of the other matrix
139  struct Resize {
141  using Other = LowerMatrix< typename MT::template Resize<NewM,NewN>::Other >;
142  };
143  //**********************************************************************************************
144 
145  //**Compilation flags***************************************************************************
147  enum : bool { smpAssignable = false };
148  //**********************************************************************************************
149 
150  //**Constructors********************************************************************************
153  explicit inline LowerMatrix();
154  explicit inline LowerMatrix( size_t n );
155  explicit inline LowerMatrix( size_t n, size_t nonzeros );
156  explicit inline LowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
157  explicit inline LowerMatrix( initializer_list< initializer_list<ElementType> > list );
158 
159  inline LowerMatrix( const LowerMatrix& m );
160  inline LowerMatrix( LowerMatrix&& m ) noexcept;
161 
162  template< typename MT2, bool SO2 >
163  inline LowerMatrix( const Matrix<MT2,SO2>& m );
165  //**********************************************************************************************
166 
167  //**Destructor**********************************************************************************
168  // No explicitly declared destructor.
169  //**********************************************************************************************
170 
171  //**Data access functions***********************************************************************
174  inline Reference operator()( size_t i, size_t j );
175  inline ConstReference operator()( size_t i, size_t j ) const;
176  inline Reference at( size_t i, size_t j );
177  inline ConstReference at( size_t i, size_t j ) const;
178  inline Iterator begin ( size_t i );
179  inline ConstIterator begin ( size_t i ) const;
180  inline ConstIterator cbegin( size_t i ) const;
181  inline Iterator end ( size_t i );
182  inline ConstIterator end ( size_t i ) const;
183  inline ConstIterator cend ( size_t i ) const;
185  //**********************************************************************************************
186 
187  //**Assignment operators************************************************************************
190  inline LowerMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
191 
192  inline LowerMatrix& operator=( const LowerMatrix& rhs );
193  inline LowerMatrix& operator=( LowerMatrix&& rhs ) noexcept;
194 
195  template< typename MT2, bool SO2 >
196  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
197 
198  template< typename MT2, bool SO2 >
199  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
200 
201  template< typename MT2, bool SO2 >
202  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
203 
204  template< typename MT2, bool SO2 >
205  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
206 
207  template< typename MT2, bool SO2 >
208  inline DisableIf_< IsComputation<MT2>, LowerMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
209 
210  template< typename MT2, bool SO2 >
211  inline EnableIf_< IsComputation<MT2>, LowerMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
212 
213  template< typename MT2, bool SO2 >
214  inline LowerMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
216  //**********************************************************************************************
217 
218  //**Utility functions***************************************************************************
221  inline size_t rows() const noexcept;
222  inline size_t columns() const noexcept;
223  inline size_t capacity() const noexcept;
224  inline size_t capacity( size_t i ) const noexcept;
225  inline size_t nonZeros() const;
226  inline size_t nonZeros( size_t i ) const;
227  inline void reset();
228  inline void reset( size_t i );
229  inline void clear();
230  inline void resize ( size_t n, bool preserve=true );
231  inline void reserve( size_t nonzeros );
232  inline void reserve( size_t i, size_t nonzeros );
233  inline void trim();
234  inline void trim( size_t i );
235  inline void shrinkToFit();
236  inline void swap( LowerMatrix& m ) noexcept;
237 
238  static inline constexpr size_t maxNonZeros() noexcept;
239  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
241  //**********************************************************************************************
242 
243  //**Insertion functions*************************************************************************
246  inline Iterator set ( size_t i, size_t j, const ElementType& value );
247  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
248  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
249  inline void finalize( size_t i );
251  //**********************************************************************************************
252 
253  //**Erase functions*****************************************************************************
256  inline void erase( size_t i, size_t j );
257  inline Iterator erase( size_t i, Iterator pos );
258  inline Iterator erase( size_t i, Iterator first, Iterator last );
259 
260  template< typename Pred >
261  inline void erase( Pred predicate );
262 
263  template< typename Pred >
264  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
266  //**********************************************************************************************
267 
268  //**Lookup functions****************************************************************************
271  inline Iterator find ( size_t i, size_t j );
272  inline ConstIterator find ( size_t i, size_t j ) const;
273  inline Iterator lowerBound( size_t i, size_t j );
274  inline ConstIterator lowerBound( size_t i, size_t j ) const;
275  inline Iterator upperBound( size_t i, size_t j );
276  inline ConstIterator upperBound( size_t i, size_t j ) const;
278  //**********************************************************************************************
279 
280  //**Numeric functions***************************************************************************
283  template< typename Other > inline LowerMatrix& scale( const Other& scalar );
285  //**********************************************************************************************
286 
287  //**Debugging functions*************************************************************************
290  inline bool isIntact() const noexcept;
292  //**********************************************************************************************
293 
294  //**Expression template evaluation functions****************************************************
297  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
298  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
299 
300  inline bool canSMPAssign() const noexcept;
302  //**********************************************************************************************
303 
304  private:
305  //**Utility functions***************************************************************************
308  inline void resetUpper();
310  //**********************************************************************************************
311 
312  //**Member variables****************************************************************************
315  MT matrix_;
316 
317  //**********************************************************************************************
318 
319  //**Friend declarations*************************************************************************
320  template< bool RF, typename MT2, bool SO2, bool DF2 >
321  friend bool isDefault( const LowerMatrix<MT2,SO2,DF2>& m );
322 
323  template< typename MT2, bool SO2, bool DF2 >
324  friend MT2& derestrict( LowerMatrix<MT2,SO2,DF2>& m );
325  //**********************************************************************************************
326 
327  //**Compile time checks*************************************************************************
340  BLAZE_STATIC_ASSERT( ( Size<MT,0UL>::value == Size<MT,1UL>::value ) );
341  //**********************************************************************************************
342 };
344 //*************************************************************************************************
345 
346 
347 
348 
349 //=================================================================================================
350 //
351 // CONSTRUCTORS
352 //
353 //=================================================================================================
354 
355 //*************************************************************************************************
359 template< typename MT // Type of the adapted sparse matrix
360  , bool SO > // Storage order of the adapted sparse matrix
361 inline LowerMatrix<MT,SO,false>::LowerMatrix()
362  : matrix_() // The adapted sparse matrix
363 {
364  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
365 }
367 //*************************************************************************************************
368 
369 
370 //*************************************************************************************************
378 template< typename MT // Type of the adapted sparse matrix
379  , bool SO > // Storage order of the adapted sparse matrix
380 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n )
381  : matrix_( n, n ) // The adapted sparse matrix
382 {
384 
385  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
386 }
388 //*************************************************************************************************
389 
390 
391 //*************************************************************************************************
400 template< typename MT // Type of the adapted sparse matrix
401  , bool SO > // Storage order of the adapted sparse matrix
402 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, size_t nonzeros )
403  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
404 {
406 
407  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
408 }
410 //*************************************************************************************************
411 
412 
413 //*************************************************************************************************
424 template< typename MT // Type of the adapted sparse matrix
425  , bool SO > // Storage order of the adapted sparse matrix
426 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
427  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
428 {
430 
431  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
432 }
434 //*************************************************************************************************
435 
436 
437 //*************************************************************************************************
461 template< typename MT // Type of the adapted sparse matrix
462  , bool SO > // Storage order of the adapted sparse matrix
463 inline LowerMatrix<MT,SO,false>::LowerMatrix( initializer_list< initializer_list<ElementType> > list )
464  : matrix_( list ) // The adapted sparse matrix
465 {
466  if( !isLower( matrix_ ) ) {
467  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
468  }
469 
470  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
471 }
473 //*************************************************************************************************
474 
475 
476 //*************************************************************************************************
482 template< typename MT // Type of the adapted sparse matrix
483  , bool SO > // Storage order of the adapted sparse matrix
484 inline LowerMatrix<MT,SO,false>::LowerMatrix( const LowerMatrix& m )
485  : matrix_( m.matrix_ ) // The adapted sparse matrix
486 {
487  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
488  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
489 }
491 //*************************************************************************************************
492 
493 
494 //*************************************************************************************************
500 template< typename MT // Type of the adapted sparse matrix
501  , bool SO > // Storage order of the adapted sparse matrix
502 inline LowerMatrix<MT,SO,false>::LowerMatrix( LowerMatrix&& m ) noexcept
503  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
504 {
505  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
506  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
507 }
509 //*************************************************************************************************
510 
511 
512 //*************************************************************************************************
522 template< typename MT // Type of the adapted sparse matrix
523  , bool SO > // Storage order of the adapted sparse matrix
524 template< typename MT2 // Type of the foreign matrix
525  , bool SO2 > // Storage order of the foreign matrix
526 inline LowerMatrix<MT,SO,false>::LowerMatrix( const Matrix<MT2,SO2>& m )
527  : matrix_( ~m ) // The adapted sparse matrix
528 {
529  if( !IsLower<MT2>::value && !isLower( matrix_ ) ) {
530  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
531  }
532 
533  if( !IsLower<MT2>::value )
534  resetUpper();
535 
536  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
537  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
538 }
540 //*************************************************************************************************
541 
542 
543 
544 
545 //=================================================================================================
546 //
547 // DATA ACCESS FUNCTIONS
548 //
549 //=================================================================================================
550 
551 //*************************************************************************************************
567 template< typename MT // Type of the adapted sparse matrix
568  , bool SO > // Storage order of the adapted sparse matrix
570  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
571 {
572  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
573  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
574 
575  return Reference( matrix_, i, j );
576 }
578 //*************************************************************************************************
579 
580 
581 //*************************************************************************************************
597 template< typename MT // Type of the adapted sparse matrix
598  , bool SO > // Storage order of the adapted sparse matrix
600  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
601 {
602  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
603  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
604 
605  return matrix_(i,j);
606 }
608 //*************************************************************************************************
609 
610 
611 //*************************************************************************************************
628 template< typename MT // Type of the adapted sparse matrix
629  , bool SO > // Storage order of the adapted sparse matrix
631  LowerMatrix<MT,SO,false>::at( size_t i, size_t j )
632 {
633  if( i >= rows() ) {
634  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
635  }
636  if( j >= columns() ) {
637  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
638  }
639  return (*this)(i,j);
640 }
642 //*************************************************************************************************
643 
644 
645 //*************************************************************************************************
662 template< typename MT // Type of the adapted sparse matrix
663  , bool SO > // Storage order of the adapted sparse matrix
665  LowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
666 {
667  if( i >= rows() ) {
668  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
669  }
670  if( j >= columns() ) {
671  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
672  }
673  return (*this)(i,j);
674 }
676 //*************************************************************************************************
677 
678 
679 //*************************************************************************************************
691 template< typename MT // Type of the adapted sparse matrix
692  , bool SO > // Storage order of the adapted sparse matrix
695 {
696  return matrix_.begin(i);
697 }
699 //*************************************************************************************************
700 
701 
702 //*************************************************************************************************
714 template< typename MT // Type of the adapted sparse matrix
715  , bool SO > // Storage order of the adapted sparse matrix
717  LowerMatrix<MT,SO,false>::begin( size_t i ) const
718 {
719  return matrix_.begin(i);
720 }
722 //*************************************************************************************************
723 
724 
725 //*************************************************************************************************
737 template< typename MT // Type of the adapted sparse matrix
738  , bool SO > // Storage order of the adapted sparse matrix
740  LowerMatrix<MT,SO,false>::cbegin( size_t i ) const
741 {
742  return matrix_.cbegin(i);
743 }
745 //*************************************************************************************************
746 
747 
748 //*************************************************************************************************
760 template< typename MT // Type of the adapted sparse matrix
761  , bool SO > // Storage order of the adapted sparse matrix
764 {
765  return matrix_.end(i);
766 }
768 //*************************************************************************************************
769 
770 
771 //*************************************************************************************************
783 template< typename MT // Type of the adapted sparse matrix
784  , bool SO > // Storage order of the adapted sparse matrix
786  LowerMatrix<MT,SO,false>::end( size_t i ) const
787 {
788  return matrix_.end(i);
789 }
791 //*************************************************************************************************
792 
793 
794 //*************************************************************************************************
806 template< typename MT // Type of the adapted sparse matrix
807  , bool SO > // Storage order of the adapted sparse matrix
809  LowerMatrix<MT,SO,false>::cend( size_t i ) const
810 {
811  return matrix_.cend(i);
812 }
814 //*************************************************************************************************
815 
816 
817 
818 
819 //=================================================================================================
820 //
821 // ASSIGNMENT OPERATORS
822 //
823 //=================================================================================================
824 
825 //*************************************************************************************************
850 template< typename MT // Type of the adapted sparse matrix
851  , bool SO > // Storage order of the adapted sparse matrix
852 inline LowerMatrix<MT,SO,false>&
853  LowerMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
854 {
855  const InitializerMatrix<ElementType> tmp( list, list.size() );
856 
857  if( !isLower( tmp ) ) {
858  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
859  }
860 
861  matrix_ = list;
862 
863  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
864  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
865 
866  return *this;
867 }
869 //*************************************************************************************************
870 
871 
872 //*************************************************************************************************
882 template< typename MT // Type of the adapted sparse matrix
883  , bool SO > // Storage order of the adapted sparse matrix
884 inline LowerMatrix<MT,SO,false>&
885  LowerMatrix<MT,SO,false>::operator=( const LowerMatrix& rhs )
886 {
887  matrix_ = rhs.matrix_;
888 
889  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
890  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
891 
892  return *this;
893 }
895 //*************************************************************************************************
896 
897 
898 //*************************************************************************************************
905 template< typename MT // Type of the adapted sparse matrix
906  , bool SO > // Storage order of the adapted sparse matrix
907 inline LowerMatrix<MT,SO,false>&
908  LowerMatrix<MT,SO,false>::operator=( LowerMatrix&& rhs ) noexcept
909 {
910  matrix_ = std::move( rhs.matrix_ );
911 
912  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
913  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
914 
915  return *this;
916 }
918 //*************************************************************************************************
919 
920 
921 //*************************************************************************************************
934 template< typename MT // Type of the adapted sparse matrix
935  , bool SO > // Storage order of the adapted sparse matrix
936 template< typename MT2 // Type of the right-hand side matrix
937  , bool SO2 > // Storage order of the right-hand side matrix
938 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
939  LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
940 {
941  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
942  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
943  }
944 
945  matrix_ = decllow( ~rhs );
946 
947  if( !IsLower<MT2>::value )
948  resetUpper();
949 
950  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
951  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
952 
953  return *this;
954 }
956 //*************************************************************************************************
957 
958 
959 //*************************************************************************************************
972 template< typename MT // Type of the adapted sparse matrix
973  , bool SO > // Storage order of the adapted sparse matrix
974 template< typename MT2 // Type of the right-hand side matrix
975  , bool SO2 > // Storage order of the right-hand side matrix
976 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
977  LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
978 {
979  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
980  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
981  }
982 
983  if( IsLower<MT2>::value ) {
984  matrix_ = ~rhs;
985  }
986  else {
987  MT tmp( ~rhs );
988 
989  if( !isLower( tmp ) ) {
990  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
991  }
992 
993  matrix_ = std::move( tmp );
994  }
995 
996  if( !IsLower<MT2>::value )
997  resetUpper();
998 
999  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1000  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1001 
1002  return *this;
1003 }
1005 //*************************************************************************************************
1006 
1007 
1008 //*************************************************************************************************
1021 template< typename MT // Type of the adapted sparse matrix
1022  , bool SO > // Storage order of the adapted sparse matrix
1023 template< typename MT2 // Type of the right-hand side matrix
1024  , bool SO2 > // Storage order of the right-hand side matrix
1025 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1026  LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1027 {
1028  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
1029  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1030  }
1031 
1032  matrix_ += decllow( ~rhs );
1033 
1034  if( !IsLower<MT2>::value )
1035  resetUpper();
1036 
1037  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1038  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1039 
1040  return *this;
1041 }
1043 //*************************************************************************************************
1044 
1045 
1046 //*************************************************************************************************
1059 template< typename MT // Type of the adapted sparse matrix
1060  , bool SO > // Storage order of the adapted sparse matrix
1061 template< typename MT2 // Type of the right-hand side matrix
1062  , bool SO2 > // Storage order of the right-hand side matrix
1063 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1064  LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1065 {
1066  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1067  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1068  }
1069 
1070  if( IsLower<MT2>::value ) {
1071  matrix_ += ~rhs;
1072  }
1073  else {
1074  const ResultType_<MT2> tmp( ~rhs );
1075 
1076  if( !isLower( tmp ) ) {
1077  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1078  }
1079 
1080  matrix_ += decllow( tmp );
1081  }
1082 
1083  if( !IsLower<MT2>::value )
1084  resetUpper();
1085 
1086  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1087  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1088 
1089  return *this;
1090 }
1092 //*************************************************************************************************
1093 
1094 
1095 //*************************************************************************************************
1108 template< typename MT // Type of the adapted sparse matrix
1109  , bool SO > // Storage order of the adapted sparse matrix
1110 template< typename MT2 // Type of the right-hand side matrix
1111  , bool SO2 > // Storage order of the right-hand side matrix
1112 inline DisableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1113  LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1114 {
1115  if( !IsLower<MT2>::value && !isLower( ~rhs ) ) {
1116  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1117  }
1118 
1119  matrix_ -= decllow( ~rhs );
1120 
1121  if( !IsLower<MT2>::value )
1122  resetUpper();
1123 
1124  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1125  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1126 
1127  return *this;
1128 }
1130 //*************************************************************************************************
1131 
1132 
1133 //*************************************************************************************************
1146 template< typename MT // Type of the adapted sparse matrix
1147  , bool SO > // Storage order of the adapted sparse matrix
1148 template< typename MT2 // Type of the right-hand side matrix
1149  , bool SO2 > // Storage order of the right-hand side matrix
1150 inline EnableIf_< IsComputation<MT2>, LowerMatrix<MT,SO,false>& >
1151  LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1152 {
1153  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1154  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1155  }
1156 
1157  if( IsLower<MT2>::value ) {
1158  matrix_ -= ~rhs;
1159  }
1160  else {
1161  const ResultType_<MT2> tmp( ~rhs );
1162 
1163  if( !isLower( tmp ) ) {
1164  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1165  }
1166 
1167  matrix_ -= decllow( tmp );
1168  }
1169 
1170  if( !IsLower<MT2>::value )
1171  resetUpper();
1172 
1173  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1174  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1175 
1176  return *this;
1177 }
1179 //*************************************************************************************************
1180 
1181 
1182 //*************************************************************************************************
1193 template< typename MT // Type of the adapted sparse matrix
1194  , bool SO > // Storage order of the adapted sparse matrix
1195 template< typename MT2 // Type of the right-hand side matrix
1196  , bool SO2 > // Storage order of the right-hand side matrix
1197 inline LowerMatrix<MT,SO,false>&
1198  LowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1199 {
1200  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1201  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1202  }
1203 
1204  matrix_ %= ~rhs;
1205 
1206  if( !IsLower<MT2>::value )
1207  resetUpper();
1208 
1209  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1210  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1211 
1212  return *this;
1213 }
1215 //*************************************************************************************************
1216 
1217 
1218 
1219 
1220 //=================================================================================================
1221 //
1222 // UTILITY FUNCTIONS
1223 //
1224 //=================================================================================================
1225 
1226 //*************************************************************************************************
1232 template< typename MT // Type of the adapted sparse matrix
1233  , bool SO > // Storage order of the adapted sparse matrix
1234 inline size_t LowerMatrix<MT,SO,false>::rows() const noexcept
1235 {
1236  return matrix_.rows();
1237 }
1239 //*************************************************************************************************
1240 
1241 
1242 //*************************************************************************************************
1248 template< typename MT // Type of the adapted sparse matrix
1249  , bool SO > // Storage order of the adapted sparse matrix
1250 inline size_t LowerMatrix<MT,SO,false>::columns() const noexcept
1251 {
1252  return matrix_.columns();
1253 }
1255 //*************************************************************************************************
1256 
1257 
1258 //*************************************************************************************************
1264 template< typename MT // Type of the adapted sparse matrix
1265  , bool SO > // Storage order of the adapted sparse matrix
1266 inline size_t LowerMatrix<MT,SO,false>::capacity() const noexcept
1267 {
1268  return matrix_.capacity();
1269 }
1271 //*************************************************************************************************
1272 
1273 
1274 //*************************************************************************************************
1286 template< typename MT // Type of the adapted sparse matrix
1287  , bool SO > // Storage order of the adapted sparse matrix
1288 inline size_t LowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1289 {
1290  return matrix_.capacity(i);
1291 }
1293 //*************************************************************************************************
1294 
1295 
1296 //*************************************************************************************************
1302 template< typename MT // Type of the adapted sparse matrix
1303  , bool SO > // Storage order of the adapted sparse matrix
1304 inline size_t LowerMatrix<MT,SO,false>::nonZeros() const
1305 {
1306  return matrix_.nonZeros();
1307 }
1309 //*************************************************************************************************
1310 
1311 
1312 //*************************************************************************************************
1324 template< typename MT // Type of the adapted sparse matrix
1325  , bool SO > // Storage order of the adapted sparse matrix
1326 inline size_t LowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1327 {
1328  return matrix_.nonZeros(i);
1329 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1340 template< typename MT // Type of the adapted sparse matrix
1341  , bool SO > // Storage order of the adapted sparse matrix
1342 inline void LowerMatrix<MT,SO,false>::reset()
1343 {
1344  matrix_.reset();
1345 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1363 template< typename MT // Type of the adapted sparse matrix
1364  , bool SO > // Storage order of the adapted sparse matrix
1365 inline void LowerMatrix<MT,SO,false>::reset( size_t i )
1366 {
1367  matrix_.reset( i );
1368 }
1370 //*************************************************************************************************
1371 
1372 
1373 //*************************************************************************************************
1381 template< typename MT // Type of the adapted sparse matrix
1382  , bool SO > // Storage order of the adapted sparse matrix
1383 inline void LowerMatrix<MT,SO,false>::clear()
1384 {
1385  using blaze::clear;
1386 
1387  clear( matrix_ );
1388 }
1390 //*************************************************************************************************
1391 
1392 
1393 //*************************************************************************************************
1408 template< typename MT // Type of the adapted sparse matrix
1409  , bool SO > // Storage order of the adapted sparse matrix
1410 void LowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1411 {
1413 
1414  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1415 
1416  matrix_.resize( n, n, preserve );
1417 }
1419 //*************************************************************************************************
1420 
1421 
1422 //*************************************************************************************************
1433 template< typename MT // Type of the adapted sparse matrix
1434  , bool SO > // Storage order of the adapted sparse matrix
1435 inline void LowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1436 {
1437  matrix_.reserve( nonzeros );
1438 }
1440 //*************************************************************************************************
1441 
1442 
1443 //*************************************************************************************************
1457 template< typename MT // Type of the adapted sparse matrix
1458  , bool SO > // Storage order of the adapted sparse matrix
1459 inline void LowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1460 {
1461  matrix_.reserve( i, nonzeros );
1462 }
1464 //*************************************************************************************************
1465 
1466 
1467 //*************************************************************************************************
1478 template< typename MT // Type of the adapted sparse matrix
1479  , bool SO > // Storage order of the adapted sparse matrix
1480 inline void LowerMatrix<MT,SO,false>::trim()
1481 {
1482  matrix_.trim();
1483 }
1485 //*************************************************************************************************
1486 
1487 
1488 //*************************************************************************************************
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>::trim( size_t i )
1503 {
1504  matrix_.trim( i );
1505 }
1507 //*************************************************************************************************
1508 
1509 
1510 //*************************************************************************************************
1520 template< typename MT // Type of the adapted sparse matrix
1521  , bool SO > // Storage order of the adapted sparse matrix
1523 {
1524  matrix_.shrinkToFit();
1525 }
1527 //*************************************************************************************************
1528 
1529 
1530 //*************************************************************************************************
1537 template< typename MT // Type of the adapted sparse matrix
1538  , bool SO > // Storage order of the adapted sparse matrix
1539 inline void LowerMatrix<MT,SO,false>::swap( LowerMatrix& m ) noexcept
1540 {
1541  using std::swap;
1542 
1543  swap( matrix_, m.matrix_ );
1544 }
1546 //*************************************************************************************************
1547 
1548 
1549 //*************************************************************************************************
1560 template< typename MT // Type of the adapted dense matrix
1561  , bool SO > // Storage order of the adapted dense matrix
1562 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1563 {
1565 
1566  return maxNonZeros( Size<MT,0UL>::value );
1567 }
1569 //*************************************************************************************************
1570 
1571 
1572 //*************************************************************************************************
1582 template< typename MT // Type of the adapted dense matrix
1583  , bool SO > // Storage order of the adapted dense matrix
1584 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1585 {
1586  return ( ( n + 1UL ) * n ) / 2UL;
1587 }
1589 //*************************************************************************************************
1590 
1591 
1592 //*************************************************************************************************
1598 template< typename MT // Type of the adapted dense matrix
1599  , bool SO > // Storage order of the adapted dense matrix
1600 inline void LowerMatrix<MT,SO,false>::resetUpper()
1601 {
1602  if( SO ) {
1603  for( size_t j=1UL; j<columns(); ++j )
1604  matrix_.erase( j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1605  }
1606  else {
1607  for( size_t i=0UL; i<rows(); ++i )
1608  matrix_.erase( i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1609  }
1610 }
1612 //*************************************************************************************************
1613 
1614 
1615 
1616 
1617 //=================================================================================================
1618 //
1619 // INSERTION FUNCTIONS
1620 //
1621 //=================================================================================================
1622 
1623 //*************************************************************************************************
1639 template< typename MT // Type of the adapted sparse matrix
1640  , bool SO > // Storage order of the adapted sparse matrix
1641 inline typename LowerMatrix<MT,SO,false>::Iterator
1642  LowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1643 {
1644  if( i < j ) {
1645  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1646  }
1647 
1648  return matrix_.set( i, j, value );
1649 }
1651 //*************************************************************************************************
1652 
1653 
1654 //*************************************************************************************************
1671 template< typename MT // Type of the adapted sparse matrix
1672  , bool SO > // Storage order of the adapted sparse matrix
1673 inline typename LowerMatrix<MT,SO,false>::Iterator
1674  LowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1675 {
1676  if( i < j ) {
1677  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1678  }
1679 
1680  return matrix_.insert( i, j, value );
1681 }
1683 //*************************************************************************************************
1684 
1685 
1686 //*************************************************************************************************
1736 template< typename MT // Type of the adapted sparse matrix
1737  , bool SO > // Storage order of the adapted sparse matrix
1738 inline void LowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1739 {
1740  if( i < j ) {
1741  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1742  }
1743 
1744  matrix_.append( i, j, value, check );
1745 }
1747 //*************************************************************************************************
1748 
1749 
1750 //*************************************************************************************************
1764 template< typename MT // Type of the adapted sparse matrix
1765  , bool SO > // Storage order of the adapted sparse matrix
1766 inline void LowerMatrix<MT,SO,false>::finalize( size_t i )
1767 {
1768  matrix_.finalize( i );
1769 }
1771 //*************************************************************************************************
1772 
1773 
1774 
1775 
1776 //=================================================================================================
1777 //
1778 // ERASE FUNCTIONS
1779 //
1780 //=================================================================================================
1781 
1782 //*************************************************************************************************
1792 template< typename MT // Type of the adapted sparse matrix
1793  , bool SO > // Storage order of the adapted sparse matrix
1794 inline void LowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1795 {
1796  matrix_.erase( i, j );
1797 }
1799 //*************************************************************************************************
1800 
1801 
1802 //*************************************************************************************************
1814 template< typename MT // Type of the adapted sparse matrix
1815  , bool SO > // Storage order of the adapted sparse matrix
1816 inline typename LowerMatrix<MT,SO,false>::Iterator
1817  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1818 {
1819  return matrix_.erase( i, pos );
1820 }
1822 //*************************************************************************************************
1823 
1824 
1825 //*************************************************************************************************
1838 template< typename MT // Type of the adapted sparse matrix
1839  , bool SO > // Storage order of the adapted sparse matrix
1840 inline typename LowerMatrix<MT,SO,false>::Iterator
1841  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1842 {
1843  return matrix_.erase( i, first, last );
1844 }
1846 //*************************************************************************************************
1847 
1848 
1849 //*************************************************************************************************
1871 template< typename MT // Type of the adapted sparse matrix
1872  , bool SO > // Storage order of the adapted sparse matrix
1873 template< typename Pred > // Type of the unary predicate
1874 inline void LowerMatrix<MT,SO,false>::erase( Pred predicate )
1875 {
1876  matrix_.erase( predicate );
1877 
1878  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1879 }
1881 //*************************************************************************************************
1882 
1883 
1884 //*************************************************************************************************
1912 template< typename MT // Type of the adapted sparse matrix
1913  , bool SO > // Storage order of the adapted sparse matrix
1914 template< typename Pred > // Type of the unary predicate
1915 inline void LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1916 {
1917  matrix_.erase( i, first, last, predicate );
1918 
1919  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1920 }
1922 //*************************************************************************************************
1923 
1924 
1925 
1926 
1927 //=================================================================================================
1928 //
1929 // LOOKUP FUNCTIONS
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>::find( size_t i, size_t j )
1953 {
1954  return matrix_.find( 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>::find( size_t i, size_t j ) const
1980 {
1981  return matrix_.find( 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>::lowerBound( size_t i, size_t j )
2007 {
2008  return matrix_.lowerBound( 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>::lowerBound( size_t i, size_t j ) const
2034 {
2035  return matrix_.lowerBound( i, j );
2036 }
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2057 template< typename MT // Type of the adapted sparse matrix
2058  , bool SO > // Storage order of the adapted sparse matrix
2059 inline typename LowerMatrix<MT,SO,false>::Iterator
2060  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2061 {
2062  return matrix_.upperBound( i, j );
2063 }
2065 //*************************************************************************************************
2066 
2067 
2068 //*************************************************************************************************
2084 template< typename MT // Type of the adapted sparse matrix
2085  , bool SO > // Storage order of the adapted sparse matrix
2087  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2088 {
2089  return matrix_.upperBound( i, j );
2090 }
2092 //*************************************************************************************************
2093 
2094 
2095 
2096 
2097 //=================================================================================================
2098 //
2099 // NUMERIC FUNCTIONS
2100 //
2101 //=================================================================================================
2102 
2103 //*************************************************************************************************
2121 template< typename MT // Type of the adapted sparse matrix
2122  , bool SO > // Storage order of the adapted sparse matrix
2123 template< typename Other > // Data type of the scalar value
2124 inline LowerMatrix<MT,SO,false>&
2125  LowerMatrix<MT,SO,false>::scale( const Other& scalar )
2126 {
2127  matrix_.scale( scalar );
2128  return *this;
2129 }
2131 //*************************************************************************************************
2132 
2133 
2134 
2135 
2136 //=================================================================================================
2137 //
2138 // DEBUGGING FUNCTIONS
2139 //
2140 //=================================================================================================
2141 
2142 //*************************************************************************************************
2152 template< typename MT // Type of the adapted sparse matrix
2153  , bool SO > // Storage order of the adapted sparse matrix
2154 inline bool LowerMatrix<MT,SO,false>::isIntact() const noexcept
2155 {
2156  using blaze::isIntact;
2157 
2158  return ( isIntact( matrix_ ) && isLower( matrix_ ) );
2159 }
2161 //*************************************************************************************************
2162 
2163 
2164 
2165 
2166 //=================================================================================================
2167 //
2168 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2169 //
2170 //=================================================================================================
2171 
2172 //*************************************************************************************************
2183 template< typename MT // Type of the adapted sparse matrix
2184  , bool SO > // Storage order of the adapted sparse matrix
2185 template< typename Other > // Data type of the foreign expression
2186 inline bool LowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2187 {
2188  return matrix_.canAlias( alias );
2189 }
2191 //*************************************************************************************************
2192 
2193 
2194 //*************************************************************************************************
2205 template< typename MT // Type of the adapted sparse matrix
2206  , bool SO > // Storage order of the adapted sparse matrix
2207 template< typename Other > // Data type of the foreign expression
2208 inline bool LowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2209 {
2210  return matrix_.isAliased( alias );
2211 }
2213 //*************************************************************************************************
2214 
2215 
2216 //*************************************************************************************************
2227 template< typename MT // Type of the adapted sparse matrix
2228  , bool SO > // Storage order of the adapted sparse matrix
2229 inline bool LowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2230 {
2231  return matrix_.canSMPAssign();
2232 }
2234 //*************************************************************************************************
2235 
2236 } // namespace blaze
2237 
2238 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1214
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:522
Header file for basic type definitions.
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:775
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5829
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3084
Header file for the extended initializer_list functionality.
Constraint on the data type.
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_CONSTRAINT_MUST_BE_STATIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a static data type, i.e. a vector or matrix with dimensions fixed at compile time, a compilation error is created.
Definition: Static.h:61
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5891
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3085
Constraint on the data type.
decltype(auto) decllow(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as lower.
Definition: DMatDeclLowExpr.h:1026
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:506
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:714
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:76
Header file for all adaptor forward declarations.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:272
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the implementation of the base template of the LowerMatrix.
Header file for the IsComputation type trait class.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61