Blaze  3.6
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>
61 #include <blaze/math/Exception.h>
64 #include <blaze/math/shims/Clear.h>
71 #include <blaze/util/Assert.h>
76 #include <blaze/util/DisableIf.h>
77 #include <blaze/util/EnableIf.h>
79 #include <blaze/util/Types.h>
80 
81 
82 namespace blaze {
83 
84 //=================================================================================================
85 //
86 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
98 template< typename MT // Type of the adapted sparse matrix
99  , bool SO > // Storage order of the adapted sparse matrix
100 class LowerMatrix<MT,SO,false>
101  : public SparseMatrix< LowerMatrix<MT,SO,false>, SO >
102 {
103  private:
104  //**Type definitions****************************************************************************
105  using OT = OppositeType_t<MT>;
106  using TT = TransposeType_t<MT>;
107  using ET = ElementType_t<MT>;
108  //**********************************************************************************************
109 
110  public:
111  //**Type definitions****************************************************************************
112  using This = LowerMatrix<MT,SO,false>;
113  using BaseType = SparseMatrix<This,SO>;
114  using ResultType = This;
115  using OppositeType = LowerMatrix<OT,!SO,false>;
116  using TransposeType = UpperMatrix<TT,!SO,false>;
117  using ElementType = ET;
118  using ReturnType = ReturnType_t<MT>;
119  using CompositeType = const This&;
120  using Reference = LowerProxy<MT>;
121  using ConstReference = ConstReference_t<MT>;
122  using Iterator = Iterator_t<MT>;
123  using ConstIterator = ConstIterator_t<MT>;
124  //**********************************************************************************************
125 
126  //**Rebind struct definition********************************************************************
129  template< typename NewType > // Data type of the other matrix
130  struct Rebind {
132  using Other = LowerMatrix< typename MT::template Rebind<NewType>::Other >;
133  };
134  //**********************************************************************************************
135 
136  //**Resize struct definition********************************************************************
139  template< size_t NewM // Number of rows of the other matrix
140  , size_t NewN > // Number of columns of the other matrix
141  struct Resize {
143  using Other = LowerMatrix< typename MT::template Resize<NewM,NewN>::Other >;
144  };
145  //**********************************************************************************************
146 
147  //**Compilation flags***************************************************************************
149  static constexpr bool smpAssignable = false;
150  //**********************************************************************************************
151 
152  //**Constructors********************************************************************************
155  explicit inline LowerMatrix();
156  explicit inline LowerMatrix( size_t n );
157  explicit inline LowerMatrix( size_t n, size_t nonzeros );
158  explicit inline LowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
159  inline LowerMatrix( initializer_list< initializer_list<ElementType> > list );
160 
161  inline LowerMatrix( const LowerMatrix& m );
162  inline LowerMatrix( LowerMatrix&& m ) noexcept;
163 
164  template< typename MT2, bool SO2 >
165  inline LowerMatrix( const Matrix<MT2,SO2>& m );
167  //**********************************************************************************************
168 
169  //**Destructor**********************************************************************************
172  ~LowerMatrix() = default;
174  //**********************************************************************************************
175 
176  //**Data access functions***********************************************************************
179  inline Reference operator()( size_t i, size_t j );
180  inline ConstReference operator()( size_t i, size_t j ) const;
181  inline Reference at( size_t i, size_t j );
182  inline ConstReference at( size_t i, size_t j ) const;
183  inline Iterator begin ( size_t i );
184  inline ConstIterator begin ( size_t i ) const;
185  inline ConstIterator cbegin( size_t i ) const;
186  inline Iterator end ( size_t i );
187  inline ConstIterator end ( size_t i ) const;
188  inline ConstIterator cend ( size_t i ) const;
190  //**********************************************************************************************
191 
192  //**Assignment operators************************************************************************
195  inline LowerMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
196 
197  inline LowerMatrix& operator=( const LowerMatrix& rhs );
198  inline LowerMatrix& operator=( LowerMatrix&& rhs ) noexcept;
199 
200  template< typename MT2, bool SO2 >
201  inline auto operator=( const Matrix<MT2,SO2>& rhs )
202  -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
203 
204  template< typename MT2, bool SO2 >
205  inline auto operator=( const Matrix<MT2,SO2>& rhs )
206  -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
207 
208  template< typename MT2, bool SO2 >
209  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
210  -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
211 
212  template< typename MT2, bool SO2 >
213  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
214  -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
215 
216  template< typename MT2, bool SO2 >
217  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
218  -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
219 
220  template< typename MT2, bool SO2 >
221  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
222  -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
223 
224  template< typename MT2, bool SO2 >
225  inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> LowerMatrix&;
227  //**********************************************************************************************
228 
229  //**Utility functions***************************************************************************
232  inline size_t rows() const noexcept;
233  inline size_t columns() const noexcept;
234  inline size_t capacity() const noexcept;
235  inline size_t capacity( size_t i ) const noexcept;
236  inline size_t nonZeros() const;
237  inline size_t nonZeros( size_t i ) const;
238  inline void reset();
239  inline void reset( size_t i );
240  inline void clear();
241  inline void resize ( size_t n, bool preserve=true );
242  inline void reserve( size_t nonzeros );
243  inline void reserve( size_t i, size_t nonzeros );
244  inline void trim();
245  inline void trim( size_t i );
246  inline void shrinkToFit();
247  inline void swap( LowerMatrix& m ) noexcept;
248 
249  static inline constexpr size_t maxNonZeros() noexcept;
250  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
252  //**********************************************************************************************
253 
254  //**Insertion functions*************************************************************************
257  inline Iterator set ( size_t i, size_t j, const ElementType& value );
258  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
259  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
260  inline void finalize( size_t i );
262  //**********************************************************************************************
263 
264  //**Erase functions*****************************************************************************
267  inline void erase( size_t i, size_t j );
268  inline Iterator erase( size_t i, Iterator pos );
269  inline Iterator erase( size_t i, Iterator first, Iterator last );
270 
271  template< typename Pred >
272  inline void erase( Pred predicate );
273 
274  template< typename Pred >
275  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
277  //**********************************************************************************************
278 
279  //**Lookup functions****************************************************************************
282  inline Iterator find ( size_t i, size_t j );
283  inline ConstIterator find ( size_t i, size_t j ) const;
284  inline Iterator lowerBound( size_t i, size_t j );
285  inline ConstIterator lowerBound( size_t i, size_t j ) const;
286  inline Iterator upperBound( size_t i, size_t j );
287  inline ConstIterator upperBound( size_t i, size_t j ) const;
289  //**********************************************************************************************
290 
291  //**Numeric functions***************************************************************************
294  template< typename Other > inline LowerMatrix& scale( const Other& scalar );
296  //**********************************************************************************************
297 
298  //**Debugging functions*************************************************************************
301  inline bool isIntact() const noexcept;
303  //**********************************************************************************************
304 
305  //**Expression template evaluation functions****************************************************
308  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
309  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
310 
311  inline bool canSMPAssign() const noexcept;
313  //**********************************************************************************************
314 
315  private:
316  //**Utility functions***************************************************************************
319  inline void resetUpper();
321  //**********************************************************************************************
322 
323  //**Member variables****************************************************************************
326  MT matrix_;
327 
328  //**********************************************************************************************
329 
330  //**Friend declarations*************************************************************************
331  template< bool RF, typename MT2, bool SO2, bool DF2 >
332  friend bool isDefault( const LowerMatrix<MT2,SO2,DF2>& m );
333 
334  template< typename MT2, bool SO2, bool DF2 >
335  friend MT2& derestrict( LowerMatrix<MT2,SO2,DF2>& m );
336  //**********************************************************************************************
337 
338  //**Compile time checks*************************************************************************
353  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
354  //**********************************************************************************************
355 };
357 //*************************************************************************************************
358 
359 
360 
361 
362 //=================================================================================================
363 //
364 // CONSTRUCTORS
365 //
366 //=================================================================================================
367 
368 //*************************************************************************************************
372 template< typename MT // Type of the adapted sparse matrix
373  , bool SO > // Storage order of the adapted sparse matrix
374 inline LowerMatrix<MT,SO,false>::LowerMatrix()
375  : matrix_() // The adapted sparse matrix
376 {
377  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
378 }
380 //*************************************************************************************************
381 
382 
383 //*************************************************************************************************
391 template< typename MT // Type of the adapted sparse matrix
392  , bool SO > // Storage order of the adapted sparse matrix
393 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n )
394  : matrix_( n, n ) // The adapted sparse matrix
395 {
397 
398  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
399 }
401 //*************************************************************************************************
402 
403 
404 //*************************************************************************************************
413 template< typename MT // Type of the adapted sparse matrix
414  , bool SO > // Storage order of the adapted sparse matrix
415 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, size_t nonzeros )
416  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
417 {
419 
420  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
421 }
423 //*************************************************************************************************
424 
425 
426 //*************************************************************************************************
437 template< typename MT // Type of the adapted sparse matrix
438  , bool SO > // Storage order of the adapted sparse matrix
439 inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
440  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
441 {
443 
444  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
445 }
447 //*************************************************************************************************
448 
449 
450 //*************************************************************************************************
474 template< typename MT // Type of the adapted sparse matrix
475  , bool SO > // Storage order of the adapted sparse matrix
476 inline LowerMatrix<MT,SO,false>::LowerMatrix( initializer_list< initializer_list<ElementType> > list )
477  : matrix_( list ) // The adapted sparse matrix
478 {
479  if( !isLower( matrix_ ) ) {
480  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
481  }
482 
483  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
484 }
486 //*************************************************************************************************
487 
488 
489 //*************************************************************************************************
495 template< typename MT // Type of the adapted sparse matrix
496  , bool SO > // Storage order of the adapted sparse matrix
497 inline LowerMatrix<MT,SO,false>::LowerMatrix( const LowerMatrix& m )
498  : matrix_( m.matrix_ ) // The adapted sparse matrix
499 {
500  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
501  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
502 }
504 //*************************************************************************************************
505 
506 
507 //*************************************************************************************************
513 template< typename MT // Type of the adapted sparse matrix
514  , bool SO > // Storage order of the adapted sparse matrix
515 inline LowerMatrix<MT,SO,false>::LowerMatrix( LowerMatrix&& m ) noexcept
516  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
517 {
518  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
519  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
520 }
522 //*************************************************************************************************
523 
524 
525 //*************************************************************************************************
535 template< typename MT // Type of the adapted sparse matrix
536  , bool SO > // Storage order of the adapted sparse matrix
537 template< typename MT2 // Type of the foreign matrix
538  , bool SO2 > // Storage order of the foreign matrix
539 inline LowerMatrix<MT,SO,false>::LowerMatrix( const Matrix<MT2,SO2>& m )
540  : matrix_( ~m ) // The adapted sparse matrix
541 {
542  if( !IsLower_v<MT2> && !isLower( matrix_ ) ) {
543  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
544  }
545 
546  if( !IsLower_v<MT2> )
547  resetUpper();
548 
549  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
550  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
551 }
553 //*************************************************************************************************
554 
555 
556 
557 
558 //=================================================================================================
559 //
560 // DATA ACCESS FUNCTIONS
561 //
562 //=================================================================================================
563 
564 //*************************************************************************************************
580 template< typename MT // Type of the adapted sparse matrix
581  , bool SO > // Storage order of the adapted sparse matrix
582 inline typename LowerMatrix<MT,SO,false>::Reference
583  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
584 {
585  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
586  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
587 
588  return Reference( matrix_, i, j );
589 }
591 //*************************************************************************************************
592 
593 
594 //*************************************************************************************************
610 template< typename MT // Type of the adapted sparse matrix
611  , bool SO > // Storage order of the adapted sparse matrix
612 inline typename LowerMatrix<MT,SO,false>::ConstReference
613  LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
614 {
615  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
616  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
617 
618  return matrix_(i,j);
619 }
621 //*************************************************************************************************
622 
623 
624 //*************************************************************************************************
641 template< typename MT // Type of the adapted sparse matrix
642  , bool SO > // Storage order of the adapted sparse matrix
643 inline typename LowerMatrix<MT,SO,false>::Reference
644  LowerMatrix<MT,SO,false>::at( size_t i, size_t j )
645 {
646  if( i >= rows() ) {
647  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
648  }
649  if( j >= columns() ) {
650  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
651  }
652  return (*this)(i,j);
653 }
655 //*************************************************************************************************
656 
657 
658 //*************************************************************************************************
675 template< typename MT // Type of the adapted sparse matrix
676  , bool SO > // Storage order of the adapted sparse matrix
677 inline typename LowerMatrix<MT,SO,false>::ConstReference
678  LowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
679 {
680  if( i >= rows() ) {
681  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
682  }
683  if( j >= columns() ) {
684  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
685  }
686  return (*this)(i,j);
687 }
689 //*************************************************************************************************
690 
691 
692 //*************************************************************************************************
704 template< typename MT // Type of the adapted sparse matrix
705  , bool SO > // Storage order of the adapted sparse matrix
706 inline typename LowerMatrix<MT,SO,false>::Iterator
708 {
709  return matrix_.begin(i);
710 }
712 //*************************************************************************************************
713 
714 
715 //*************************************************************************************************
727 template< typename MT // Type of the adapted sparse matrix
728  , bool SO > // Storage order of the adapted sparse matrix
729 inline typename LowerMatrix<MT,SO,false>::ConstIterator
730  LowerMatrix<MT,SO,false>::begin( size_t i ) const
731 {
732  return matrix_.begin(i);
733 }
735 //*************************************************************************************************
736 
737 
738 //*************************************************************************************************
750 template< typename MT // Type of the adapted sparse matrix
751  , bool SO > // Storage order of the adapted sparse matrix
752 inline typename LowerMatrix<MT,SO,false>::ConstIterator
753  LowerMatrix<MT,SO,false>::cbegin( size_t i ) const
754 {
755  return matrix_.cbegin(i);
756 }
758 //*************************************************************************************************
759 
760 
761 //*************************************************************************************************
773 template< typename MT // Type of the adapted sparse matrix
774  , bool SO > // Storage order of the adapted sparse matrix
775 inline typename LowerMatrix<MT,SO,false>::Iterator
777 {
778  return matrix_.end(i);
779 }
781 //*************************************************************************************************
782 
783 
784 //*************************************************************************************************
796 template< typename MT // Type of the adapted sparse matrix
797  , bool SO > // Storage order of the adapted sparse matrix
798 inline typename LowerMatrix<MT,SO,false>::ConstIterator
799  LowerMatrix<MT,SO,false>::end( size_t i ) const
800 {
801  return matrix_.end(i);
802 }
804 //*************************************************************************************************
805 
806 
807 //*************************************************************************************************
819 template< typename MT // Type of the adapted sparse matrix
820  , bool SO > // Storage order of the adapted sparse matrix
821 inline typename LowerMatrix<MT,SO,false>::ConstIterator
822  LowerMatrix<MT,SO,false>::cend( size_t i ) const
823 {
824  return matrix_.cend(i);
825 }
827 //*************************************************************************************************
828 
829 
830 
831 
832 //=================================================================================================
833 //
834 // ASSIGNMENT OPERATORS
835 //
836 //=================================================================================================
837 
838 //*************************************************************************************************
863 template< typename MT // Type of the adapted sparse matrix
864  , bool SO > // Storage order of the adapted sparse matrix
865 inline LowerMatrix<MT,SO,false>&
866  LowerMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
867 {
868  const InitializerMatrix<ElementType> tmp( list, list.size() );
869 
870  if( !isLower( tmp ) ) {
871  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
872  }
873 
874  matrix_ = list;
875 
876  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
877  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
878 
879  return *this;
880 }
882 //*************************************************************************************************
883 
884 
885 //*************************************************************************************************
895 template< typename MT // Type of the adapted sparse matrix
896  , bool SO > // Storage order of the adapted sparse matrix
897 inline LowerMatrix<MT,SO,false>&
898  LowerMatrix<MT,SO,false>::operator=( const LowerMatrix& rhs )
899 {
900  matrix_ = rhs.matrix_;
901 
902  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
903  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
904 
905  return *this;
906 }
908 //*************************************************************************************************
909 
910 
911 //*************************************************************************************************
918 template< typename MT // Type of the adapted sparse matrix
919  , bool SO > // Storage order of the adapted sparse matrix
920 inline LowerMatrix<MT,SO,false>&
921  LowerMatrix<MT,SO,false>::operator=( LowerMatrix&& rhs ) noexcept
922 {
923  matrix_ = std::move( rhs.matrix_ );
924 
925  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
926  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
927 
928  return *this;
929 }
931 //*************************************************************************************************
932 
933 
934 //*************************************************************************************************
947 template< typename MT // Type of the adapted sparse matrix
948  , bool SO > // Storage order of the adapted sparse matrix
949 template< typename MT2 // Type of the right-hand side matrix
950  , bool SO2 > // Storage order of the right-hand side matrix
951 inline auto LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
952  -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >
953 {
954  if( !IsLower_v<MT2> && !isLower( ~rhs ) ) {
955  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
956  }
957 
958  matrix_ = decllow( ~rhs );
959 
960  if( !IsLower_v<MT2> )
961  resetUpper();
962 
963  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
964  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
965 
966  return *this;
967 }
969 //*************************************************************************************************
970 
971 
972 //*************************************************************************************************
985 template< typename MT // Type of the adapted sparse matrix
986  , bool SO > // Storage order of the adapted sparse matrix
987 template< typename MT2 // Type of the right-hand side matrix
988  , bool SO2 > // Storage order of the right-hand side matrix
989 inline auto LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
990  -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >
991 {
992  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
993  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
994  }
995 
996  if( IsLower_v<MT2> ) {
997  matrix_ = ~rhs;
998  }
999  else {
1000  MT tmp( ~rhs );
1001 
1002  if( !isLower( tmp ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1004  }
1005 
1006  matrix_ = std::move( tmp );
1007  }
1008 
1009  if( !IsLower_v<MT2> )
1010  resetUpper();
1011 
1012  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1013  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1014 
1015  return *this;
1016 }
1018 //*************************************************************************************************
1019 
1020 
1021 //*************************************************************************************************
1034 template< typename MT // Type of the adapted sparse matrix
1035  , bool SO > // Storage order of the adapted sparse matrix
1036 template< typename MT2 // Type of the right-hand side matrix
1037  , bool SO2 > // Storage order of the right-hand side matrix
1038 inline auto LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1039  -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1040 {
1041  if( !IsLower_v<MT2> && !isLower( ~rhs ) ) {
1042  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1043  }
1044 
1045  matrix_ += decllow( ~rhs );
1046 
1047  if( !IsLower_v<MT2> )
1048  resetUpper();
1049 
1050  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1051  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1052 
1053  return *this;
1054 }
1056 //*************************************************************************************************
1057 
1058 
1059 //*************************************************************************************************
1072 template< typename MT // Type of the adapted sparse matrix
1073  , bool SO > // Storage order of the adapted sparse matrix
1074 template< typename MT2 // Type of the right-hand side matrix
1075  , bool SO2 > // Storage order of the right-hand side matrix
1076 inline auto LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1077  -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1078 {
1079  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1080  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1081  }
1082 
1083  if( IsLower_v<MT2> ) {
1084  matrix_ += ~rhs;
1085  }
1086  else {
1087  const ResultType_t<MT2> tmp( ~rhs );
1088 
1089  if( !isLower( tmp ) ) {
1090  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1091  }
1092 
1093  matrix_ += decllow( tmp );
1094  }
1095 
1096  if( !IsLower_v<MT2> )
1097  resetUpper();
1098 
1099  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1100  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1101 
1102  return *this;
1103 }
1105 //*************************************************************************************************
1106 
1107 
1108 //*************************************************************************************************
1121 template< typename MT // Type of the adapted sparse matrix
1122  , bool SO > // Storage order of the adapted sparse matrix
1123 template< typename MT2 // Type of the right-hand side matrix
1124  , bool SO2 > // Storage order of the right-hand side matrix
1125 inline auto LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1126  -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1127 {
1128  if( !IsLower_v<MT2> && !isLower( ~rhs ) ) {
1129  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1130  }
1131 
1132  matrix_ -= decllow( ~rhs );
1133 
1134  if( !IsLower_v<MT2> )
1135  resetUpper();
1136 
1137  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1138  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1139 
1140  return *this;
1141 }
1143 //*************************************************************************************************
1144 
1145 
1146 //*************************************************************************************************
1159 template< typename MT // Type of the adapted sparse matrix
1160  , bool SO > // Storage order of the adapted sparse matrix
1161 template< typename MT2 // Type of the right-hand side matrix
1162  , bool SO2 > // Storage order of the right-hand side matrix
1163 inline auto LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1164  -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1165 {
1166  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1167  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1168  }
1169 
1170  if( IsLower_v<MT2> ) {
1171  matrix_ -= ~rhs;
1172  }
1173  else {
1174  const ResultType_t<MT2> tmp( ~rhs );
1175 
1176  if( !isLower( tmp ) ) {
1177  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1178  }
1179 
1180  matrix_ -= decllow( tmp );
1181  }
1182 
1183  if( !IsLower_v<MT2> )
1184  resetUpper();
1185 
1186  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1187  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1188 
1189  return *this;
1190 }
1192 //*************************************************************************************************
1193 
1194 
1195 //*************************************************************************************************
1206 template< typename MT // Type of the adapted sparse matrix
1207  , bool SO > // Storage order of the adapted sparse matrix
1208 template< typename MT2 // Type of the right-hand side matrix
1209  , bool SO2 > // Storage order of the right-hand side matrix
1210 inline auto LowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1211  -> LowerMatrix&
1212 {
1213  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1214  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1215  }
1216 
1217  matrix_ %= ~rhs;
1218 
1219  if( !IsLower_v<MT2> )
1220  resetUpper();
1221 
1222  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1223  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1224 
1225  return *this;
1226 }
1228 //*************************************************************************************************
1229 
1230 
1231 
1232 
1233 //=================================================================================================
1234 //
1235 // UTILITY FUNCTIONS
1236 //
1237 //=================================================================================================
1238 
1239 //*************************************************************************************************
1245 template< typename MT // Type of the adapted sparse matrix
1246  , bool SO > // Storage order of the adapted sparse matrix
1247 inline size_t LowerMatrix<MT,SO,false>::rows() const noexcept
1248 {
1249  return matrix_.rows();
1250 }
1252 //*************************************************************************************************
1253 
1254 
1255 //*************************************************************************************************
1261 template< typename MT // Type of the adapted sparse matrix
1262  , bool SO > // Storage order of the adapted sparse matrix
1263 inline size_t LowerMatrix<MT,SO,false>::columns() const noexcept
1264 {
1265  return matrix_.columns();
1266 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1277 template< typename MT // Type of the adapted sparse matrix
1278  , bool SO > // Storage order of the adapted sparse matrix
1279 inline size_t LowerMatrix<MT,SO,false>::capacity() const noexcept
1280 {
1281  return matrix_.capacity();
1282 }
1284 //*************************************************************************************************
1285 
1286 
1287 //*************************************************************************************************
1299 template< typename MT // Type of the adapted sparse matrix
1300  , bool SO > // Storage order of the adapted sparse matrix
1301 inline size_t LowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1302 {
1303  return matrix_.capacity(i);
1304 }
1306 //*************************************************************************************************
1307 
1308 
1309 //*************************************************************************************************
1315 template< typename MT // Type of the adapted sparse matrix
1316  , bool SO > // Storage order of the adapted sparse matrix
1317 inline size_t LowerMatrix<MT,SO,false>::nonZeros() const
1318 {
1319  return matrix_.nonZeros();
1320 }
1322 //*************************************************************************************************
1323 
1324 
1325 //*************************************************************************************************
1337 template< typename MT // Type of the adapted sparse matrix
1338  , bool SO > // Storage order of the adapted sparse matrix
1339 inline size_t LowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1340 {
1341  return matrix_.nonZeros(i);
1342 }
1344 //*************************************************************************************************
1345 
1346 
1347 //*************************************************************************************************
1353 template< typename MT // Type of the adapted sparse matrix
1354  , bool SO > // Storage order of the adapted sparse matrix
1355 inline void LowerMatrix<MT,SO,false>::reset()
1356 {
1357  matrix_.reset();
1358 }
1360 //*************************************************************************************************
1361 
1362 
1363 //*************************************************************************************************
1376 template< typename MT // Type of the adapted sparse matrix
1377  , bool SO > // Storage order of the adapted sparse matrix
1378 inline void LowerMatrix<MT,SO,false>::reset( size_t i )
1379 {
1380  matrix_.reset( i );
1381 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1394 template< typename MT // Type of the adapted sparse matrix
1395  , bool SO > // Storage order of the adapted sparse matrix
1396 inline void LowerMatrix<MT,SO,false>::clear()
1397 {
1398  using blaze::clear;
1399 
1400  clear( matrix_ );
1401 }
1403 //*************************************************************************************************
1404 
1405 
1406 //*************************************************************************************************
1421 template< typename MT // Type of the adapted sparse matrix
1422  , bool SO > // Storage order of the adapted sparse matrix
1423 void LowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1424 {
1426 
1427  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1428 
1429  matrix_.resize( n, n, preserve );
1430 }
1432 //*************************************************************************************************
1433 
1434 
1435 //*************************************************************************************************
1446 template< typename MT // Type of the adapted sparse matrix
1447  , bool SO > // Storage order of the adapted sparse matrix
1448 inline void LowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1449 {
1450  matrix_.reserve( nonzeros );
1451 }
1453 //*************************************************************************************************
1454 
1455 
1456 //*************************************************************************************************
1470 template< typename MT // Type of the adapted sparse matrix
1471  , bool SO > // Storage order of the adapted sparse matrix
1472 inline void LowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1473 {
1474  matrix_.reserve( i, nonzeros );
1475 }
1477 //*************************************************************************************************
1478 
1479 
1480 //*************************************************************************************************
1491 template< typename MT // Type of the adapted sparse matrix
1492  , bool SO > // Storage order of the adapted sparse matrix
1493 inline void LowerMatrix<MT,SO,false>::trim()
1494 {
1495  matrix_.trim();
1496 }
1498 //*************************************************************************************************
1499 
1500 
1501 //*************************************************************************************************
1513 template< typename MT // Type of the adapted sparse matrix
1514  , bool SO > // Storage order of the adapted sparse matrix
1515 inline void LowerMatrix<MT,SO,false>::trim( size_t i )
1516 {
1517  matrix_.trim( i );
1518 }
1520 //*************************************************************************************************
1521 
1522 
1523 //*************************************************************************************************
1533 template< typename MT // Type of the adapted sparse matrix
1534  , bool SO > // Storage order of the adapted sparse matrix
1536 {
1537  matrix_.shrinkToFit();
1538 }
1540 //*************************************************************************************************
1541 
1542 
1543 //*************************************************************************************************
1550 template< typename MT // Type of the adapted sparse matrix
1551  , bool SO > // Storage order of the adapted sparse matrix
1552 inline void LowerMatrix<MT,SO,false>::swap( LowerMatrix& m ) noexcept
1553 {
1554  using std::swap;
1555 
1556  swap( matrix_, m.matrix_ );
1557 }
1559 //*************************************************************************************************
1560 
1561 
1562 //*************************************************************************************************
1573 template< typename MT // Type of the adapted dense matrix
1574  , bool SO > // Storage order of the adapted dense matrix
1575 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1576 {
1578 
1579  return maxNonZeros( Size_v<MT,0UL> );
1580 }
1582 //*************************************************************************************************
1583 
1584 
1585 //*************************************************************************************************
1595 template< typename MT // Type of the adapted dense matrix
1596  , bool SO > // Storage order of the adapted dense matrix
1597 inline constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1598 {
1599  return ( ( n + 1UL ) * n ) / 2UL;
1600 }
1602 //*************************************************************************************************
1603 
1604 
1605 //*************************************************************************************************
1611 template< typename MT // Type of the adapted dense matrix
1612  , bool SO > // Storage order of the adapted dense matrix
1613 inline void LowerMatrix<MT,SO,false>::resetUpper()
1614 {
1615  using blaze::erase;
1616 
1617  if( SO ) {
1618  for( size_t j=1UL; j<columns(); ++j )
1619  erase( matrix_, j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1620  }
1621  else {
1622  for( size_t i=0UL; i<rows(); ++i )
1623  erase( matrix_, i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1624  }
1625 }
1627 //*************************************************************************************************
1628 
1629 
1630 
1631 
1632 //=================================================================================================
1633 //
1634 // INSERTION FUNCTIONS
1635 //
1636 //=================================================================================================
1637 
1638 //*************************************************************************************************
1654 template< typename MT // Type of the adapted sparse matrix
1655  , bool SO > // Storage order of the adapted sparse matrix
1656 inline typename LowerMatrix<MT,SO,false>::Iterator
1657  LowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1658 {
1659  if( i < j ) {
1660  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1661  }
1662 
1663  return matrix_.set( i, j, value );
1664 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1686 template< typename MT // Type of the adapted sparse matrix
1687  , bool SO > // Storage order of the adapted sparse matrix
1688 inline typename LowerMatrix<MT,SO,false>::Iterator
1689  LowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1690 {
1691  if( i < j ) {
1692  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1693  }
1694 
1695  return matrix_.insert( i, j, value );
1696 }
1698 //*************************************************************************************************
1699 
1700 
1701 //*************************************************************************************************
1751 template< typename MT // Type of the adapted sparse matrix
1752  , bool SO > // Storage order of the adapted sparse matrix
1753 inline void LowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1754 {
1755  if( i < j ) {
1756  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1757  }
1758 
1759  matrix_.append( i, j, value, check );
1760 }
1762 //*************************************************************************************************
1763 
1764 
1765 //*************************************************************************************************
1779 template< typename MT // Type of the adapted sparse matrix
1780  , bool SO > // Storage order of the adapted sparse matrix
1781 inline void LowerMatrix<MT,SO,false>::finalize( size_t i )
1782 {
1783  matrix_.finalize( i );
1784 }
1786 //*************************************************************************************************
1787 
1788 
1789 
1790 
1791 //=================================================================================================
1792 //
1793 // ERASE FUNCTIONS
1794 //
1795 //=================================================================================================
1796 
1797 //*************************************************************************************************
1807 template< typename MT // Type of the adapted sparse matrix
1808  , bool SO > // Storage order of the adapted sparse matrix
1809 inline void LowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1810 {
1811  using blaze::erase;
1812 
1813  erase( matrix_, i, j );
1814 }
1816 //*************************************************************************************************
1817 
1818 
1819 //*************************************************************************************************
1831 template< typename MT // Type of the adapted sparse matrix
1832  , bool SO > // Storage order of the adapted sparse matrix
1833 inline typename LowerMatrix<MT,SO,false>::Iterator
1834  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1835 {
1836  using blaze::erase;
1837 
1838  return erase( matrix_, i, pos );
1839 }
1841 //*************************************************************************************************
1842 
1843 
1844 //*************************************************************************************************
1857 template< typename MT // Type of the adapted sparse matrix
1858  , bool SO > // Storage order of the adapted sparse matrix
1859 inline typename LowerMatrix<MT,SO,false>::Iterator
1860  LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1861 {
1862  using blaze::erase;
1863 
1864  return erase( matrix_, i, first, last );
1865 }
1867 //*************************************************************************************************
1868 
1869 
1870 //*************************************************************************************************
1892 template< typename MT // Type of the adapted sparse matrix
1893  , bool SO > // Storage order of the adapted sparse matrix
1894 template< typename Pred > // Type of the unary predicate
1895 inline void LowerMatrix<MT,SO,false>::erase( Pred predicate )
1896 {
1897  using blaze::erase;
1898 
1899  erase( matrix_, predicate );
1900 
1901  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1902 }
1904 //*************************************************************************************************
1905 
1906 
1907 //*************************************************************************************************
1935 template< typename MT // Type of the adapted sparse matrix
1936  , bool SO > // Storage order of the adapted sparse matrix
1937 template< typename Pred > // Type of the unary predicate
1938 inline void LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1939 {
1940  using blaze::erase;
1941 
1942  erase( matrix_, i, first, last, predicate );
1943 
1944  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1945 }
1947 //*************************************************************************************************
1948 
1949 
1950 
1951 
1952 //=================================================================================================
1953 //
1954 // LOOKUP FUNCTIONS
1955 //
1956 //=================================================================================================
1957 
1958 //*************************************************************************************************
1974 template< typename MT // Type of the adapted sparse matrix
1975  , bool SO > // Storage order of the adapted sparse matrix
1976 inline typename LowerMatrix<MT,SO,false>::Iterator
1977  LowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1978 {
1979  return matrix_.find( i, j );
1980 }
1982 //*************************************************************************************************
1983 
1984 
1985 //*************************************************************************************************
2001 template< typename MT // Type of the adapted sparse matrix
2002  , bool SO > // Storage order of the adapted sparse matrix
2003 inline typename LowerMatrix<MT,SO,false>::ConstIterator
2004  LowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2005 {
2006  return matrix_.find( i, j );
2007 }
2009 //*************************************************************************************************
2010 
2011 
2012 //*************************************************************************************************
2028 template< typename MT // Type of the adapted sparse matrix
2029  , bool SO > // Storage order of the adapted sparse matrix
2030 inline typename LowerMatrix<MT,SO,false>::Iterator
2031  LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2032 {
2033  return matrix_.lowerBound( i, j );
2034 }
2036 //*************************************************************************************************
2037 
2038 
2039 //*************************************************************************************************
2055 template< typename MT // Type of the adapted sparse matrix
2056  , bool SO > // Storage order of the adapted sparse matrix
2057 inline typename LowerMatrix<MT,SO,false>::ConstIterator
2058  LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2059 {
2060  return matrix_.lowerBound( i, j );
2061 }
2063 //*************************************************************************************************
2064 
2065 
2066 //*************************************************************************************************
2082 template< typename MT // Type of the adapted sparse matrix
2083  , bool SO > // Storage order of the adapted sparse matrix
2084 inline typename LowerMatrix<MT,SO,false>::Iterator
2085  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2086 {
2087  return matrix_.upperBound( i, j );
2088 }
2090 //*************************************************************************************************
2091 
2092 
2093 //*************************************************************************************************
2109 template< typename MT // Type of the adapted sparse matrix
2110  , bool SO > // Storage order of the adapted sparse matrix
2111 inline typename LowerMatrix<MT,SO,false>::ConstIterator
2112  LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2113 {
2114  return matrix_.upperBound( i, j );
2115 }
2117 //*************************************************************************************************
2118 
2119 
2120 
2121 
2122 //=================================================================================================
2123 //
2124 // NUMERIC FUNCTIONS
2125 //
2126 //=================================================================================================
2127 
2128 //*************************************************************************************************
2146 template< typename MT // Type of the adapted sparse matrix
2147  , bool SO > // Storage order of the adapted sparse matrix
2148 template< typename Other > // Data type of the scalar value
2149 inline LowerMatrix<MT,SO,false>&
2150  LowerMatrix<MT,SO,false>::scale( const Other& scalar )
2151 {
2152  matrix_.scale( scalar );
2153  return *this;
2154 }
2156 //*************************************************************************************************
2157 
2158 
2159 
2160 
2161 //=================================================================================================
2162 //
2163 // DEBUGGING FUNCTIONS
2164 //
2165 //=================================================================================================
2166 
2167 //*************************************************************************************************
2177 template< typename MT // Type of the adapted sparse matrix
2178  , bool SO > // Storage order of the adapted sparse matrix
2179 inline bool LowerMatrix<MT,SO,false>::isIntact() const noexcept
2180 {
2181  using blaze::isIntact;
2182 
2183  return ( isIntact( matrix_ ) && isLower( matrix_ ) );
2184 }
2186 //*************************************************************************************************
2187 
2188 
2189 
2190 
2191 //=================================================================================================
2192 //
2193 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2194 //
2195 //=================================================================================================
2196 
2197 //*************************************************************************************************
2208 template< typename MT // Type of the adapted sparse matrix
2209  , bool SO > // Storage order of the adapted sparse matrix
2210 template< typename Other > // Data type of the foreign expression
2211 inline bool LowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2212 {
2213  return matrix_.canAlias( alias );
2214 }
2216 //*************************************************************************************************
2217 
2218 
2219 //*************************************************************************************************
2230 template< typename MT // Type of the adapted sparse matrix
2231  , bool SO > // Storage order of the adapted sparse matrix
2232 template< typename Other > // Data type of the foreign expression
2233 inline bool LowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2234 {
2235  return matrix_.isAliased( alias );
2236 }
2238 //*************************************************************************************************
2239 
2240 
2241 //*************************************************************************************************
2252 template< typename MT // Type of the adapted sparse matrix
2253  , bool SO > // Storage order of the adapted sparse matrix
2254 inline bool LowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2255 {
2256  return matrix_.canSMPAssign();
2257 }
2259 //*************************************************************************************************
2260 
2261 } // namespace blaze
2262 
2263 #endif
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.In case the given data type T is a transformation expression (i....
Definition: Transformation.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
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
Constraint on the data type.
Header file for auxiliary alias declarations.
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1793
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i....
Definition: Computation.h:81
Constraint on the data type.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
Header file for all adaptor forward declarations.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the extended initializer_list functionality.
Constraint on the data type.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
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.
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,...
Definition: Static.h:61
Compile time assertion.
#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
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
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:1001
Header file for the IsLower type trait.
Header file for the LowerProxy class.
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
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
#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,...
Definition: Symmetric.h:79
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,...
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:282
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.In case the given data type T is a view type (i.e. a subvector,...
Definition: View.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
#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 '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.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#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,...
Definition: Hermitian.h:79
#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
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Constraint on the data type.
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,...
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
Header file for the clear shim.