Sparse.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_SPARSE_H_
36 #define _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_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>
72 #include <blaze/util/Assert.h>
77 #include <blaze/util/DisableIf.h>
78 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/Types.h>
81 
82 
83 namespace blaze {
84 
85 //=================================================================================================
86 //
87 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
88 //
89 //=================================================================================================
90 
91 //*************************************************************************************************
99 template< typename MT // Type of the adapted sparse matrix
100  , bool SO > // Storage order of the adapted sparse matrix
101 class StrictlyUpperMatrix<MT,SO,false>
102  : public SparseMatrix< StrictlyUpperMatrix<MT,SO,false>, SO >
103 {
104  private:
105  //**Type definitions****************************************************************************
106  using OT = OppositeType_<MT>;
107  using TT = TransposeType_<MT>;
108  using ET = ElementType_<MT>;
109  //**********************************************************************************************
110 
111  public:
112  //**Type definitions****************************************************************************
113  using This = StrictlyUpperMatrix<MT,SO,false>;
114  using BaseType = SparseMatrix<This,SO>;
115  using ResultType = This;
116  using OppositeType = StrictlyUpperMatrix<OT,!SO,false>;
117  using TransposeType = StrictlyLowerMatrix<TT,!SO,false>;
118  using ElementType = ET;
119  using ReturnType = ReturnType_<MT>;
120  using CompositeType = const This&;
121  using Reference = StrictlyUpperProxy<MT>;
122  using ConstReference = ConstReference_<MT>;
123  using Iterator = Iterator_<MT>;
124  using ConstIterator = ConstIterator_<MT>;
125  //**********************************************************************************************
126 
127  //**Rebind struct definition********************************************************************
130  template< typename NewType > // Data type of the other matrix
131  struct Rebind {
133  using Other = StrictlyUpperMatrix< typename MT::template Rebind<NewType>::Other >;
134  };
135  //**********************************************************************************************
136 
137  //**Resize struct definition********************************************************************
140  template< size_t NewM // Number of rows of the other matrix
141  , size_t NewN > // Number of columns of the other matrix
142  struct Resize {
144  using Other = StrictlyUpperMatrix< typename MT::template Resize<NewM,NewN>::Other >;
145  };
146  //**********************************************************************************************
147 
148  //**Compilation flags***************************************************************************
150  enum : bool { smpAssignable = false };
151  //**********************************************************************************************
152 
153  //**Constructors********************************************************************************
156  explicit inline StrictlyUpperMatrix();
157  explicit inline StrictlyUpperMatrix( size_t n );
158  explicit inline StrictlyUpperMatrix( size_t n, size_t nonzeros );
159  explicit inline StrictlyUpperMatrix( size_t n, const std::vector<size_t>& nonzeros );
160  explicit inline StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list );
161 
162  inline StrictlyUpperMatrix( const StrictlyUpperMatrix& m );
163  inline StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept;
164 
165  template< typename MT2, bool SO2 >
166  inline StrictlyUpperMatrix( const Matrix<MT2,SO2>& m );
168  //**********************************************************************************************
169 
170  //**Destructor**********************************************************************************
171  // No explicitly declared destructor.
172  //**********************************************************************************************
173 
174  //**Data access functions***********************************************************************
177  inline Reference operator()( size_t i, size_t j );
178  inline ConstReference operator()( size_t i, size_t j ) const;
179  inline Reference at( size_t i, size_t j );
180  inline ConstReference at( size_t i, size_t j ) const;
181  inline Iterator begin ( size_t i );
182  inline ConstIterator begin ( size_t i ) const;
183  inline ConstIterator cbegin( size_t i ) const;
184  inline Iterator end ( size_t i );
185  inline ConstIterator end ( size_t i ) const;
186  inline ConstIterator cend ( size_t i ) const;
188  //**********************************************************************************************
189 
190  //**Assignment operators************************************************************************
193  inline StrictlyUpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
194 
195  inline StrictlyUpperMatrix& operator=( const StrictlyUpperMatrix& rhs );
196  inline StrictlyUpperMatrix& operator=( StrictlyUpperMatrix&& rhs ) noexcept;
197 
198  template< typename MT2, bool SO2 >
199  inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
200  operator=( const Matrix<MT2,SO2>& rhs );
201 
202  template< typename MT2, bool SO2 >
203  inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
204  operator=( const Matrix<MT2,SO2>& rhs );
205 
206  template< typename MT2, bool SO2 >
207  inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
208  operator+=( const Matrix<MT2,SO2>& rhs );
209 
210  template< typename MT2, bool SO2 >
211  inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
212  operator+=( const Matrix<MT2,SO2>& rhs );
213 
214  template< typename MT2, bool SO2 >
215  inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
216  operator-=( const Matrix<MT2,SO2>& rhs );
217 
218  template< typename MT2, bool SO2 >
219  inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
220  operator-=( const Matrix<MT2,SO2>& rhs );
221 
222  template< typename MT2, bool SO2 >
223  inline StrictlyUpperMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
225  //**********************************************************************************************
226 
227  //**Utility functions***************************************************************************
230  inline size_t rows() const noexcept;
231  inline size_t columns() const noexcept;
232  inline size_t capacity() const noexcept;
233  inline size_t capacity( size_t i ) const noexcept;
234  inline size_t nonZeros() const;
235  inline size_t nonZeros( size_t i ) const;
236  inline void reset();
237  inline void reset( size_t i );
238  inline void clear();
239  inline void resize ( size_t n, bool preserve=true );
240  inline void reserve( size_t nonzeros );
241  inline void reserve( size_t i, size_t nonzeros );
242  inline void trim();
243  inline void trim( size_t i );
244  inline void shrinkToFit();
245  inline void swap( StrictlyUpperMatrix& m ) noexcept;
246 
247  static inline constexpr size_t maxNonZeros() noexcept;
248  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
250  //**********************************************************************************************
251 
252  //**Insertion functions*************************************************************************
255  inline Iterator set ( size_t i, size_t j, const ElementType& value );
256  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
257  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
258  inline void finalize( size_t i );
260  //**********************************************************************************************
261 
262  //**Erase functions*****************************************************************************
265  inline void erase( size_t i, size_t j );
266  inline Iterator erase( size_t i, Iterator pos );
267  inline Iterator erase( size_t i, Iterator first, Iterator last );
268 
269  template< typename Pred >
270  inline void erase( Pred predicate );
271 
272  template< typename Pred >
273  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
275  //**********************************************************************************************
276 
277  //**Lookup functions****************************************************************************
280  inline Iterator find ( size_t i, size_t j );
281  inline ConstIterator find ( size_t i, size_t j ) const;
282  inline Iterator lowerBound( size_t i, size_t j );
283  inline ConstIterator lowerBound( size_t i, size_t j ) const;
284  inline Iterator upperBound( size_t i, size_t j );
285  inline ConstIterator upperBound( size_t i, size_t j ) const;
287  //**********************************************************************************************
288 
289  //**Numeric functions***************************************************************************
292  template< typename Other > inline StrictlyUpperMatrix& scale( const Other& scalar );
294  //**********************************************************************************************
295 
296  //**Debugging functions*************************************************************************
299  inline bool isIntact() const noexcept;
301  //**********************************************************************************************
302 
303  //**Expression template evaluation functions****************************************************
306  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
307  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
308 
309  inline bool canSMPAssign() const noexcept;
311  //**********************************************************************************************
312 
313  private:
314  //**Utility functions***************************************************************************
317  inline void resetLower();
319  //**********************************************************************************************
320 
321  //**Member variables****************************************************************************
324  MT matrix_;
325 
326  //**********************************************************************************************
327 
328  //**Friend declarations*************************************************************************
329  template< typename MT2, bool SO2, bool DF2 >
330  friend MT2& derestrict( StrictlyUpperMatrix<MT2,SO2,DF2>& m );
331  //**********************************************************************************************
332 
333  //**Compile time checks*************************************************************************
346  BLAZE_STATIC_ASSERT( ( Size<MT,0UL>::value == Size<MT,1UL>::value ) );
347  //**********************************************************************************************
348 };
350 //*************************************************************************************************
351 
352 
353 
354 
355 //=================================================================================================
356 //
357 // CONSTRUCTORS
358 //
359 //=================================================================================================
360 
361 //*************************************************************************************************
365 template< typename MT // Type of the adapted sparse matrix
366  , bool SO > // Storage order of the adapted sparse matrix
367 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix()
368  : matrix_() // The adapted sparse matrix
369 {
370  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
371 }
373 //*************************************************************************************************
374 
375 
376 //*************************************************************************************************
384 template< typename MT // Type of the adapted sparse matrix
385  , bool SO > // Storage order of the adapted sparse matrix
386 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n )
387  : matrix_( n, n, n ) // The adapted sparse matrix
388 {
390 
391  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
392 }
394 //*************************************************************************************************
395 
396 
397 //*************************************************************************************************
407 template< typename MT // Type of the adapted sparse matrix
408  , bool SO > // Storage order of the adapted sparse matrix
409 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n, size_t nonzeros )
410  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
411 {
413 
414  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
415 }
417 //*************************************************************************************************
418 
419 
420 //*************************************************************************************************
434 template< typename MT // Type of the adapted sparse matrix
435  , bool SO > // Storage order of the adapted sparse matrix
436 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n, const std::vector<size_t>& nonzeros )
437  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
438 {
440 
441  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
442 }
444 //*************************************************************************************************
445 
446 
447 //*************************************************************************************************
471 template< typename MT // Type of the adapted sparse matrix
472  , bool SO > // Storage order of the adapted sparse matrix
473 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list )
474  : matrix_( list ) // The adapted sparse matrix
475 {
476  if( !isStrictlyUpper( matrix_ ) ) {
477  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
478  }
479 
480  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
481 }
483 //*************************************************************************************************
484 
485 
486 //*************************************************************************************************
492 template< typename MT // Type of the adapted sparse matrix
493  , bool SO > // Storage order of the adapted sparse matrix
494 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( const StrictlyUpperMatrix& m )
495  : matrix_( m.matrix_ ) // The adapted sparse matrix
496 {
497  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
498  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
499 }
501 //*************************************************************************************************
502 
503 
504 //*************************************************************************************************
510 template< typename MT // Type of the adapted sparse matrix
511  , bool SO > // Storage order of the adapted sparse matrix
512 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept
513  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
514 {
515  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
516  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
517 }
519 //*************************************************************************************************
520 
521 
522 //*************************************************************************************************
533 template< typename MT // Type of the adapted sparse matrix
534  , bool SO > // Storage order of the adapted sparse matrix
535 template< typename MT2 // Type of the foreign matrix
536  , bool SO2 > // Storage order of the foreign matrix
537 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( const Matrix<MT2,SO2>& m )
538  : matrix_( ~m ) // The adapted sparse matrix
539 {
540  if( IsUniTriangular<MT2>::value ||
541  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( matrix_ ) ) ) {
542  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
543  }
544 
545  if( !IsStrictlyUpper<MT2>::value )
546  resetLower();
547 
548  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
549  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
550 }
552 //*************************************************************************************************
553 
554 
555 
556 
557 //=================================================================================================
558 //
559 // DATA ACCESS FUNCTIONS
560 //
561 //=================================================================================================
562 
563 //*************************************************************************************************
579 template< typename MT // Type of the adapted sparse matrix
580  , bool SO > // Storage order of the adapted sparse matrix
582  StrictlyUpperMatrix<MT,SO,false>::operator()( size_t i, size_t j )
583 {
584  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
585  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
586 
587  return Reference( matrix_, i, j );
588 }
590 //*************************************************************************************************
591 
592 
593 //*************************************************************************************************
609 template< typename MT // Type of the adapted sparse matrix
610  , bool SO > // Storage order of the adapted sparse matrix
612  StrictlyUpperMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
613 {
614  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
615  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
616 
617  return matrix_(i,j);
618 }
620 //*************************************************************************************************
621 
622 
623 //*************************************************************************************************
640 template< typename MT // Type of the adapted sparse matrix
641  , bool SO > // Storage order of the adapted sparse matrix
643  StrictlyUpperMatrix<MT,SO,false>::at( size_t i, size_t j )
644 {
645  if( i >= rows() ) {
646  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
647  }
648  if( j >= columns() ) {
649  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
650  }
651  return (*this)(i,j);
652 }
654 //*************************************************************************************************
655 
656 
657 //*************************************************************************************************
674 template< typename MT // Type of the adapted sparse matrix
675  , bool SO > // Storage order of the adapted sparse matrix
677  StrictlyUpperMatrix<MT,SO,false>::at( size_t i, size_t j ) const
678 {
679  if( i >= rows() ) {
680  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
681  }
682  if( j >= columns() ) {
683  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
684  }
685  return (*this)(i,j);
686 }
688 //*************************************************************************************************
689 
690 
691 //*************************************************************************************************
703 template< typename MT // Type of the adapted sparse matrix
704  , bool SO > // Storage order of the adapted sparse matrix
707 {
708  return matrix_.begin(i);
709 }
711 //*************************************************************************************************
712 
713 
714 //*************************************************************************************************
726 template< typename MT // Type of the adapted sparse matrix
727  , bool SO > // Storage order of the adapted sparse matrix
730 {
731  return matrix_.begin(i);
732 }
734 //*************************************************************************************************
735 
736 
737 //*************************************************************************************************
749 template< typename MT // Type of the adapted sparse matrix
750  , bool SO > // Storage order of the adapted sparse matrix
753 {
754  return matrix_.cbegin(i);
755 }
757 //*************************************************************************************************
758 
759 
760 //*************************************************************************************************
772 template< typename MT // Type of the adapted sparse matrix
773  , bool SO > // Storage order of the adapted sparse matrix
776 {
777  return matrix_.end(i);
778 }
780 //*************************************************************************************************
781 
782 
783 //*************************************************************************************************
795 template< typename MT // Type of the adapted sparse matrix
796  , bool SO > // Storage order of the adapted sparse matrix
798  StrictlyUpperMatrix<MT,SO,false>::end( size_t i ) const
799 {
800  return matrix_.end(i);
801 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
818 template< typename MT // Type of the adapted sparse matrix
819  , bool SO > // Storage order of the adapted sparse matrix
822 {
823  return matrix_.cend(i);
824 }
826 //*************************************************************************************************
827 
828 
829 
830 
831 //=================================================================================================
832 //
833 // ASSIGNMENT OPERATORS
834 //
835 //=================================================================================================
836 
837 //*************************************************************************************************
862 template< typename MT // Type of the adapted sparse matrix
863  , bool SO > // Storage order of the adapted sparse matrix
864 inline StrictlyUpperMatrix<MT,SO,false>&
865  StrictlyUpperMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
866 {
867  const InitializerMatrix<ElementType> tmp( list, list.size() );
868 
869  if( !isStrictlyUpper( tmp ) ) {
870  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
871  }
872 
873  matrix_ = list;
874 
875  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
876  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
877 
878  return *this;
879 }
881 //*************************************************************************************************
882 
883 
884 //*************************************************************************************************
894 template< typename MT // Type of the adapted sparse matrix
895  , bool SO > // Storage order of the adapted sparse matrix
896 inline StrictlyUpperMatrix<MT,SO,false>&
897  StrictlyUpperMatrix<MT,SO,false>::operator=( const StrictlyUpperMatrix& rhs )
898 {
899  matrix_ = rhs.matrix_;
900 
901  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
902  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
903 
904  return *this;
905 }
907 //*************************************************************************************************
908 
909 
910 //*************************************************************************************************
917 template< typename MT // Type of the adapted sparse matrix
918  , bool SO > // Storage order of the adapted sparse matrix
919 inline StrictlyUpperMatrix<MT,SO,false>&
920  StrictlyUpperMatrix<MT,SO,false>::operator=( StrictlyUpperMatrix&& rhs ) noexcept
921 {
922  matrix_ = std::move( rhs.matrix_ );
923 
924  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
925  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
926 
927  return *this;
928 }
930 //*************************************************************************************************
931 
932 
933 //*************************************************************************************************
946 template< typename MT // Type of the adapted sparse matrix
947  , bool SO > // Storage order of the adapted sparse matrix
948 template< typename MT2 // Type of the right-hand side matrix
949  , bool SO2 > // Storage order of the right-hand side matrix
950 inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,false>& >
951  StrictlyUpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
952 {
953  if( IsUniTriangular<MT2>::value ||
954  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) ) {
955  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
956  }
957 
958  matrix_ = declupp( ~rhs );
959 
960  if( !IsStrictlyUpper<MT2>::value )
961  resetLower();
962 
963  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper 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 EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,false>& >
990  StrictlyUpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
991 {
992  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
993  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
994  }
995 
996  if( IsStrictlyUpper<MT2>::value ) {
997  matrix_ = ~rhs;
998  }
999  else {
1000  MT tmp( ~rhs );
1001 
1002  if( !isStrictlyUpper( tmp ) ) {
1003  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1004  }
1005 
1006  matrix_ = std::move( tmp );
1007  }
1008 
1009  if( !IsStrictlyUpper<MT2>::value )
1010  resetLower();
1011 
1012  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper 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 DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,false>& >
1039  StrictlyUpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1040 {
1041  if( IsUniTriangular<MT2>::value ||
1042  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) ) {
1043  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1044  }
1045 
1046  matrix_ += declupp( ~rhs );
1047 
1048  if( !IsStrictlyUpper<MT2>::value )
1049  resetLower();
1050 
1051  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1052  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1053 
1054  return *this;
1055 }
1057 //*************************************************************************************************
1058 
1059 
1060 //*************************************************************************************************
1073 template< typename MT // Type of the adapted sparse matrix
1074  , bool SO > // Storage order of the adapted sparse matrix
1075 template< typename MT2 // Type of the right-hand side matrix
1076  , bool SO2 > // Storage order of the right-hand side matrix
1077 inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,false>& >
1078  StrictlyUpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1079 {
1080  if( IsUniTriangular<MT2>::value || ( IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1081  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1082  }
1083 
1084  if( IsStrictlyUpper<MT2>::value ) {
1085  matrix_ += ~rhs;
1086  }
1087  else {
1088  const ResultType_<MT2> tmp( ~rhs );
1089 
1090  if( !isStrictlyUpper( tmp ) ) {
1091  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1092  }
1093 
1094  matrix_ += declupp( tmp );
1095  }
1096 
1097  if( !IsStrictlyUpper<MT2>::value )
1098  resetLower();
1099 
1100  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1101  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1102 
1103  return *this;
1104 }
1106 //*************************************************************************************************
1107 
1108 
1109 //*************************************************************************************************
1122 template< typename MT // Type of the adapted sparse matrix
1123  , bool SO > // Storage order of the adapted sparse matrix
1124 template< typename MT2 // Type of the right-hand side matrix
1125  , bool SO2 > // Storage order of the right-hand side matrix
1126 inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,false>& >
1127  StrictlyUpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1128 {
1129  if( IsUniTriangular<MT2>::value ||
1130  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) ) {
1131  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1132  }
1133 
1134  matrix_ -= declupp( ~rhs );
1135 
1136  if( !IsStrictlyUpper<MT2>::value )
1137  resetLower();
1138 
1139  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1140  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1141 
1142  return *this;
1143 }
1145 //*************************************************************************************************
1146 
1147 
1148 //*************************************************************************************************
1161 template< typename MT // Type of the adapted sparse matrix
1162  , bool SO > // Storage order of the adapted sparse matrix
1163 template< typename MT2 // Type of the right-hand side matrix
1164  , bool SO2 > // Storage order of the right-hand side matrix
1165 inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,false>& >
1166  StrictlyUpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1167 {
1168  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1169  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1170  }
1171 
1172  if( IsStrictlyUpper<MT2>::value ) {
1173  matrix_ -= ~rhs;
1174  }
1175  else {
1176  const ResultType_<MT2> tmp( ~rhs );
1177 
1178  if( !isStrictlyUpper( tmp ) ) {
1179  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1180  }
1181 
1182  matrix_ -= declupp( tmp );
1183  }
1184 
1185  if( !IsStrictlyUpper<MT2>::value )
1186  resetLower();
1187 
1188  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1189  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1190 
1191  return *this;
1192 }
1194 //*************************************************************************************************
1195 
1196 
1197 //*************************************************************************************************
1208 template< typename MT // Type of the adapted sparse matrix
1209  , bool SO > // Storage order of the adapted sparse matrix
1210 template< typename MT2 // Type of the right-hand side matrix
1211  , bool SO2 > // Storage order of the right-hand side matrix
1212 inline StrictlyUpperMatrix<MT,SO,false>&
1213  StrictlyUpperMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1214 {
1215  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1216  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1217  }
1218 
1219  matrix_ %= ~rhs;
1220 
1221  if( !IsStrictlyUpper<MT2>::value )
1222  resetLower();
1223 
1224  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1225  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1226 
1227  return *this;
1228 }
1230 //*************************************************************************************************
1231 
1232 
1233 
1234 
1235 //=================================================================================================
1236 //
1237 // UTILITY FUNCTIONS
1238 //
1239 //=================================================================================================
1240 
1241 //*************************************************************************************************
1247 template< typename MT // Type of the adapted sparse matrix
1248  , bool SO > // Storage order of the adapted sparse matrix
1249 inline size_t StrictlyUpperMatrix<MT,SO,false>::rows() const noexcept
1250 {
1251  return matrix_.rows();
1252 }
1254 //*************************************************************************************************
1255 
1256 
1257 //*************************************************************************************************
1263 template< typename MT // Type of the adapted sparse matrix
1264  , bool SO > // Storage order of the adapted sparse matrix
1265 inline size_t StrictlyUpperMatrix<MT,SO,false>::columns() const noexcept
1266 {
1267  return matrix_.columns();
1268 }
1270 //*************************************************************************************************
1271 
1272 
1273 //*************************************************************************************************
1279 template< typename MT // Type of the adapted sparse matrix
1280  , bool SO > // Storage order of the adapted sparse matrix
1281 inline size_t StrictlyUpperMatrix<MT,SO,false>::capacity() const noexcept
1282 {
1283  return matrix_.capacity();
1284 }
1286 //*************************************************************************************************
1287 
1288 
1289 //*************************************************************************************************
1301 template< typename MT // Type of the adapted sparse matrix
1302  , bool SO > // Storage order of the adapted sparse matrix
1303 inline size_t StrictlyUpperMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1304 {
1305  return matrix_.capacity(i);
1306 }
1308 //*************************************************************************************************
1309 
1310 
1311 //*************************************************************************************************
1317 template< typename MT // Type of the adapted sparse matrix
1318  , bool SO > // Storage order of the adapted sparse matrix
1319 inline size_t StrictlyUpperMatrix<MT,SO,false>::nonZeros() const
1320 {
1321  return matrix_.nonZeros();
1322 }
1324 //*************************************************************************************************
1325 
1326 
1327 //*************************************************************************************************
1339 template< typename MT // Type of the adapted sparse matrix
1340  , bool SO > // Storage order of the adapted sparse matrix
1341 inline size_t StrictlyUpperMatrix<MT,SO,false>::nonZeros( size_t i ) const
1342 {
1343  return matrix_.nonZeros(i);
1344 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1355 template< typename MT // Type of the adapted sparse matrix
1356  , bool SO > // Storage order of the adapted sparse matrix
1358 {
1359  if( SO ) {
1360  for( size_t j=1UL; j<columns(); ++j ) {
1361  matrix_.erase( j, matrix_.begin(j), matrix_.lowerBound(j,j) );
1362  }
1363  }
1364  else {
1365  for( size_t i=0UL; i<rows(); ++i ) {
1366  matrix_.erase( i, matrix_.lowerBound(i,i+1UL), matrix_.end(i) );
1367  }
1368  }
1369 }
1371 //*************************************************************************************************
1372 
1373 
1374 //*************************************************************************************************
1387 template< typename MT // Type of the adapted sparse matrix
1388  , bool SO > // Storage order of the adapted sparse matrix
1389 inline void StrictlyUpperMatrix<MT,SO,false>::reset( size_t i )
1390 {
1391  if( SO ) {
1392  matrix_.erase( i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1393  }
1394  else {
1395  matrix_.erase( i, matrix_.lowerBound(i,i+1UL), matrix_.end(i) );
1396  }
1397 }
1399 //*************************************************************************************************
1400 
1401 
1402 //*************************************************************************************************
1410 template< typename MT // Type of the adapted sparse matrix
1411  , bool SO > // Storage order of the adapted sparse matrix
1413 {
1414  using blaze::clear;
1415 
1416  if( IsResizable<MT>::value ) {
1417  clear( matrix_ );
1418  }
1419  else {
1420  reset();
1421  }
1422 }
1424 //*************************************************************************************************
1425 
1426 
1427 //*************************************************************************************************
1442 template< typename MT // Type of the adapted sparse matrix
1443  , bool SO > // Storage order of the adapted sparse matrix
1444 void StrictlyUpperMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1445 {
1447 
1448  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1449 
1450  matrix_.resize( n, n, preserve );
1451 }
1453 //*************************************************************************************************
1454 
1455 
1456 //*************************************************************************************************
1467 template< typename MT // Type of the adapted sparse matrix
1468  , bool SO > // Storage order of the adapted sparse matrix
1469 inline void StrictlyUpperMatrix<MT,SO,false>::reserve( size_t nonzeros )
1470 {
1471  matrix_.reserve( nonzeros );
1472 }
1474 //*************************************************************************************************
1475 
1476 
1477 //*************************************************************************************************
1492 template< typename MT // Type of the adapted sparse matrix
1493  , bool SO > // Storage order of the adapted sparse matrix
1494 inline void StrictlyUpperMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1495 {
1496  matrix_.reserve( i, nonzeros );
1497 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1513 template< typename MT // Type of the adapted sparse matrix
1514  , bool SO > // Storage order of the adapted sparse matrix
1515 inline void StrictlyUpperMatrix<MT,SO,false>::trim()
1516 {
1517  matrix_.trim();
1518 }
1520 //*************************************************************************************************
1521 
1522 
1523 //*************************************************************************************************
1535 template< typename MT // Type of the adapted sparse matrix
1536  , bool SO > // Storage order of the adapted sparse matrix
1537 inline void StrictlyUpperMatrix<MT,SO,false>::trim( size_t i )
1538 {
1539  matrix_.trim( i );
1540 }
1542 //*************************************************************************************************
1543 
1544 
1545 //*************************************************************************************************
1555 template< typename MT // Type of the adapted sparse matrix
1556  , bool SO > // Storage order of the adapted sparse matrix
1558 {
1559  matrix_.shrinkToFit();
1560 }
1562 //*************************************************************************************************
1563 
1564 
1565 //*************************************************************************************************
1572 template< typename MT // Type of the adapted sparse matrix
1573  , bool SO > // Storage order of the adapted sparse matrix
1574 inline void StrictlyUpperMatrix<MT,SO,false>::swap( StrictlyUpperMatrix& m ) noexcept
1575 {
1576  using std::swap;
1577 
1578  swap( matrix_, m.matrix_ );
1579 }
1581 //*************************************************************************************************
1582 
1583 
1584 //*************************************************************************************************
1596 template< typename MT // Type of the adapted dense matrix
1597  , bool SO > // Storage order of the adapted dense matrix
1598 inline constexpr size_t StrictlyUpperMatrix<MT,SO,false>::maxNonZeros() noexcept
1599 {
1601 
1602  return maxNonZeros( Size<MT,0UL>::value );
1603 }
1605 //*************************************************************************************************
1606 
1607 
1608 //*************************************************************************************************
1618 template< typename MT // Type of the adapted dense matrix
1619  , bool SO > // Storage order of the adapted dense matrix
1620 inline constexpr size_t StrictlyUpperMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1621 {
1622  return ( ( n - 1UL ) * n ) / 2UL;
1623 }
1625 //*************************************************************************************************
1626 
1627 
1628 //*************************************************************************************************
1634 template< typename MT // Type of the adapted dense matrix
1635  , bool SO > // Storage order of the adapted dense matrix
1636 inline void StrictlyUpperMatrix<MT,SO,false>::resetLower()
1637 {
1638  if( SO ) {
1639  for( size_t j=0UL; j<columns(); ++j )
1640  matrix_.erase( j, matrix_.upperBound( j, j ), matrix_.end( j ) );
1641  }
1642  else {
1643  for( size_t i=1UL; i<rows(); ++i )
1644  matrix_.erase( i, matrix_.begin( i ), matrix_.lowerBound( i, i ) );
1645  }
1646 }
1648 //*************************************************************************************************
1649 
1650 
1651 
1652 
1653 //=================================================================================================
1654 //
1655 // INSERTION FUNCTIONS
1656 //
1657 //=================================================================================================
1658 
1659 //*************************************************************************************************
1675 template< typename MT // Type of the adapted sparse matrix
1676  , bool SO > // Storage order of the adapted sparse matrix
1678  StrictlyUpperMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1679 {
1680  if( i >= j ) {
1681  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1682  }
1683 
1684  return matrix_.set( i, j, value );
1685 }
1687 //*************************************************************************************************
1688 
1689 
1690 //*************************************************************************************************
1707 template< typename MT // Type of the adapted sparse matrix
1708  , bool SO > // Storage order of the adapted sparse matrix
1710  StrictlyUpperMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1711 {
1712  if( i >= j ) {
1713  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1714  }
1715 
1716  return matrix_.insert( i, j, value );
1717 }
1719 //*************************************************************************************************
1720 
1721 
1722 //*************************************************************************************************
1772 template< typename MT // Type of the adapted sparse matrix
1773  , bool SO > // Storage order of the adapted sparse matrix
1774 inline void StrictlyUpperMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1775 {
1776  if( i >= j ) {
1777  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1778  }
1779 
1780  matrix_.append( i, j, value, check );
1781 }
1783 //*************************************************************************************************
1784 
1785 
1786 //*************************************************************************************************
1800 template< typename MT // Type of the adapted sparse matrix
1801  , bool SO > // Storage order of the adapted sparse matrix
1802 inline void StrictlyUpperMatrix<MT,SO,false>::finalize( size_t i )
1803 {
1804  matrix_.finalize( i );
1805 }
1807 //*************************************************************************************************
1808 
1809 
1810 
1811 
1812 //=================================================================================================
1813 //
1814 // ERASE FUNCTIONS
1815 //
1816 //=================================================================================================
1817 
1818 //*************************************************************************************************
1828 template< typename MT // Type of the adapted sparse matrix
1829  , bool SO > // Storage order of the adapted sparse matrix
1830 inline void StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, size_t j )
1831 {
1832  matrix_.erase( i, j );
1833 }
1835 //*************************************************************************************************
1836 
1837 
1838 //*************************************************************************************************
1850 template< typename MT // Type of the adapted sparse matrix
1851  , bool SO > // Storage order of the adapted sparse matrix
1853  StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1854 {
1855  return matrix_.erase( i, pos );
1856 }
1858 //*************************************************************************************************
1859 
1860 
1861 //*************************************************************************************************
1875 template< typename MT // Type of the adapted sparse matrix
1876  , bool SO > // Storage order of the adapted sparse matrix
1878  StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1879 {
1880  return matrix_.erase( i, first, last );
1881 }
1883 //*************************************************************************************************
1884 
1885 
1886 //*************************************************************************************************
1908 template< typename MT // Type of the adapted sparse matrix
1909  , bool SO > // Storage order of the adapted sparse matrix
1910 template< typename Pred > // Type of the unary predicate
1911 inline void StrictlyUpperMatrix<MT,SO,false>::erase( Pred predicate )
1912 {
1913  matrix_.erase( predicate );
1914 
1915  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1916 }
1918 //*************************************************************************************************
1919 
1920 
1921 //*************************************************************************************************
1949 template< typename MT // Type of the adapted sparse matrix
1950  , bool SO > // Storage order of the adapted sparse matrix
1951 template< typename Pred > // Type of the unary predicate
1952 inline void StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1953 {
1954  matrix_.erase( i, first, last, predicate );
1955 
1956  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1957 }
1959 //*************************************************************************************************
1960 
1961 
1962 
1963 
1964 //=================================================================================================
1965 //
1966 // LOOKUP FUNCTIONS
1967 //
1968 //=================================================================================================
1969 
1970 //*************************************************************************************************
1986 template< typename MT // Type of the adapted sparse matrix
1987  , bool SO > // Storage order of the adapted sparse matrix
1989  StrictlyUpperMatrix<MT,SO,false>::find( size_t i, size_t j )
1990 {
1991  return matrix_.find( i, j );
1992 }
1994 //*************************************************************************************************
1995 
1996 
1997 //*************************************************************************************************
2013 template< typename MT // Type of the adapted sparse matrix
2014  , bool SO > // Storage order of the adapted sparse matrix
2016  StrictlyUpperMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2017 {
2018  return matrix_.find( i, j );
2019 }
2021 //*************************************************************************************************
2022 
2023 
2024 //*************************************************************************************************
2040 template< typename MT // Type of the adapted sparse matrix
2041  , bool SO > // Storage order of the adapted sparse matrix
2043  StrictlyUpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2044 {
2045  return matrix_.lowerBound( i, j );
2046 }
2048 //*************************************************************************************************
2049 
2050 
2051 //*************************************************************************************************
2067 template< typename MT // Type of the adapted sparse matrix
2068  , bool SO > // Storage order of the adapted sparse matrix
2070  StrictlyUpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2071 {
2072  return matrix_.lowerBound( i, j );
2073 }
2075 //*************************************************************************************************
2076 
2077 
2078 //*************************************************************************************************
2094 template< typename MT // Type of the adapted sparse matrix
2095  , bool SO > // Storage order of the adapted sparse matrix
2097  StrictlyUpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2098 {
2099  return matrix_.upperBound( i, j );
2100 }
2102 //*************************************************************************************************
2103 
2104 
2105 //*************************************************************************************************
2121 template< typename MT // Type of the adapted sparse matrix
2122  , bool SO > // Storage order of the adapted sparse matrix
2124  StrictlyUpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2125 {
2126  return matrix_.upperBound( i, j );
2127 }
2129 //*************************************************************************************************
2130 
2131 
2132 
2133 
2134 //=================================================================================================
2135 //
2136 // NUMERIC FUNCTIONS
2137 //
2138 //=================================================================================================
2139 
2140 //*************************************************************************************************
2158 template< typename MT // Type of the adapted sparse matrix
2159  , bool SO > // Storage order of the adapted sparse matrix
2160 template< typename Other > // Data type of the scalar value
2161 inline StrictlyUpperMatrix<MT,SO,false>&
2162  StrictlyUpperMatrix<MT,SO,false>::scale( const Other& scalar )
2163 {
2164  matrix_.scale( scalar );
2165  return *this;
2166 }
2168 //*************************************************************************************************
2169 
2170 
2171 
2172 
2173 //=================================================================================================
2174 //
2175 // DEBUGGING FUNCTIONS
2176 //
2177 //=================================================================================================
2178 
2179 //*************************************************************************************************
2189 template< typename MT // Type of the adapted sparse matrix
2190  , bool SO > // Storage order of the adapted sparse matrix
2191 inline bool StrictlyUpperMatrix<MT,SO,false>::isIntact() const noexcept
2192 {
2193  using blaze::isIntact;
2194 
2195  return ( isIntact( matrix_ ) && isStrictlyUpper( matrix_ ) );
2196 }
2198 //*************************************************************************************************
2199 
2200 
2201 
2202 
2203 //=================================================================================================
2204 //
2205 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2206 //
2207 //=================================================================================================
2208 
2209 //*************************************************************************************************
2220 template< typename MT // Type of the adapted sparse matrix
2221  , bool SO > // Storage order of the adapted sparse matrix
2222 template< typename Other > // Data type of the foreign expression
2223 inline bool StrictlyUpperMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2224 {
2225  return matrix_.canAlias( alias );
2226 }
2228 //*************************************************************************************************
2229 
2230 
2231 //*************************************************************************************************
2242 template< typename MT // Type of the adapted sparse matrix
2243  , bool SO > // Storage order of the adapted sparse matrix
2244 template< typename Other > // Data type of the foreign expression
2245 inline bool StrictlyUpperMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2246 {
2247  return matrix_.isAliased( alias );
2248 }
2250 //*************************************************************************************************
2251 
2252 
2253 //*************************************************************************************************
2264 template< typename MT // Type of the adapted sparse matrix
2265  , bool SO > // Storage order of the adapted sparse matrix
2266 inline bool StrictlyUpperMatrix<MT,SO,false>::canSMPAssign() const noexcept
2267 {
2268  return matrix_.canSMPAssign();
2269 }
2271 //*************************************************************************************************
2272 
2273 } // namespace blaze
2274 
2275 #endif
Header file for the StrictlyUpperProxy class.
#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
#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
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.h:1026
#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.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1950
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.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
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.
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
Header file for the IsUniTriangular type trait.
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
Header file for the implementation of the base template of the StrictlyUpperMatrix.
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
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:1641
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 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
#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 IsResizable type trait.
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