Blaze  3.6
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>
61 #include <blaze/math/Exception.h>
64 #include <blaze/math/shims/Clear.h>
74 #include <blaze/util/Assert.h>
79 #include <blaze/util/DisableIf.h>
80 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/Types.h>
83 
84 
85 namespace blaze {
86 
87 //=================================================================================================
88 //
89 // CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
90 //
91 //=================================================================================================
92 
93 //*************************************************************************************************
101 template< typename MT // Type of the adapted sparse matrix
102  , bool SO > // Storage order of the adapted sparse matrix
103 class StrictlyUpperMatrix<MT,SO,false>
104  : public SparseMatrix< StrictlyUpperMatrix<MT,SO,false>, SO >
105 {
106  private:
107  //**Type definitions****************************************************************************
108  using OT = OppositeType_t<MT>;
109  using TT = TransposeType_t<MT>;
110  using ET = ElementType_t<MT>;
111  //**********************************************************************************************
112 
113  public:
114  //**Type definitions****************************************************************************
115  using This = StrictlyUpperMatrix<MT,SO,false>;
116  using BaseType = SparseMatrix<This,SO>;
117  using ResultType = This;
118  using OppositeType = StrictlyUpperMatrix<OT,!SO,false>;
119  using TransposeType = StrictlyLowerMatrix<TT,!SO,false>;
120  using ElementType = ET;
121  using ReturnType = ReturnType_t<MT>;
122  using CompositeType = const This&;
123  using Reference = StrictlyUpperProxy<MT>;
124  using ConstReference = ConstReference_t<MT>;
125  using Iterator = Iterator_t<MT>;
126  using ConstIterator = ConstIterator_t<MT>;
127  //**********************************************************************************************
128 
129  //**Rebind struct definition********************************************************************
132  template< typename NewType > // Data type of the other matrix
133  struct Rebind {
135  using Other = StrictlyUpperMatrix< typename MT::template Rebind<NewType>::Other >;
136  };
137  //**********************************************************************************************
138 
139  //**Resize struct definition********************************************************************
142  template< size_t NewM // Number of rows of the other matrix
143  , size_t NewN > // Number of columns of the other matrix
144  struct Resize {
146  using Other = StrictlyUpperMatrix< typename MT::template Resize<NewM,NewN>::Other >;
147  };
148  //**********************************************************************************************
149 
150  //**Compilation flags***************************************************************************
152  static constexpr bool smpAssignable = false;
153  //**********************************************************************************************
154 
155  //**Constructors********************************************************************************
158  explicit inline StrictlyUpperMatrix();
159  explicit inline StrictlyUpperMatrix( size_t n );
160  explicit inline StrictlyUpperMatrix( size_t n, size_t nonzeros );
161  explicit inline StrictlyUpperMatrix( size_t n, const std::vector<size_t>& nonzeros );
162  inline StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list );
163 
164  inline StrictlyUpperMatrix( const StrictlyUpperMatrix& m );
165  inline StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept;
166 
167  template< typename MT2, bool SO2 >
168  inline StrictlyUpperMatrix( const Matrix<MT2,SO2>& m );
170  //**********************************************************************************************
171 
172  //**Destructor**********************************************************************************
175  ~StrictlyUpperMatrix() = default;
177  //**********************************************************************************************
178 
179  //**Data access functions***********************************************************************
182  inline Reference operator()( size_t i, size_t j );
183  inline ConstReference operator()( size_t i, size_t j ) const;
184  inline Reference at( size_t i, size_t j );
185  inline ConstReference at( size_t i, size_t j ) const;
186  inline Iterator begin ( size_t i );
187  inline ConstIterator begin ( size_t i ) const;
188  inline ConstIterator cbegin( size_t i ) const;
189  inline Iterator end ( size_t i );
190  inline ConstIterator end ( size_t i ) const;
191  inline ConstIterator cend ( size_t i ) const;
193  //**********************************************************************************************
194 
195  //**Assignment operators************************************************************************
198  inline StrictlyUpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
199 
200  inline StrictlyUpperMatrix& operator=( const StrictlyUpperMatrix& rhs );
201  inline StrictlyUpperMatrix& operator=( StrictlyUpperMatrix&& rhs ) noexcept;
202 
203  template< typename MT2, bool SO2 >
204  inline auto operator=( const Matrix<MT2,SO2>& rhs )
205  -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
206 
207  template< typename MT2, bool SO2 >
208  inline auto operator=( const Matrix<MT2,SO2>& rhs )
209  -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
210 
211  template< typename MT2, bool SO2 >
212  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
213  -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
214 
215  template< typename MT2, bool SO2 >
216  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
217  -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
218 
219  template< typename MT2, bool SO2 >
220  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
221  -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
222 
223  template< typename MT2, bool SO2 >
224  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
225  -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
226 
227  template< typename MT2, bool SO2 >
228  inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> StrictlyUpperMatrix&;
230  //**********************************************************************************************
231 
232  //**Utility functions***************************************************************************
235  inline size_t rows() const noexcept;
236  inline size_t columns() const noexcept;
237  inline size_t capacity() const noexcept;
238  inline size_t capacity( size_t i ) const noexcept;
239  inline size_t nonZeros() const;
240  inline size_t nonZeros( size_t i ) const;
241  inline void reset();
242  inline void reset( size_t i );
243  inline void clear();
244  inline void resize ( size_t n, bool preserve=true );
245  inline void reserve( size_t nonzeros );
246  inline void reserve( size_t i, size_t nonzeros );
247  inline void trim();
248  inline void trim( size_t i );
249  inline void shrinkToFit();
250  inline void swap( StrictlyUpperMatrix& m ) noexcept;
251 
252  static inline constexpr size_t maxNonZeros() noexcept;
253  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
255  //**********************************************************************************************
256 
257  //**Insertion functions*************************************************************************
260  inline Iterator set ( size_t i, size_t j, const ElementType& value );
261  inline Iterator insert ( size_t i, size_t j, const ElementType& value );
262  inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
263  inline void finalize( size_t i );
265  //**********************************************************************************************
266 
267  //**Erase functions*****************************************************************************
270  inline void erase( size_t i, size_t j );
271  inline Iterator erase( size_t i, Iterator pos );
272  inline Iterator erase( size_t i, Iterator first, Iterator last );
273 
274  template< typename Pred >
275  inline void erase( Pred predicate );
276 
277  template< typename Pred >
278  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
280  //**********************************************************************************************
281 
282  //**Lookup functions****************************************************************************
285  inline Iterator find ( size_t i, size_t j );
286  inline ConstIterator find ( size_t i, size_t j ) const;
287  inline Iterator lowerBound( size_t i, size_t j );
288  inline ConstIterator lowerBound( size_t i, size_t j ) const;
289  inline Iterator upperBound( size_t i, size_t j );
290  inline ConstIterator upperBound( size_t i, size_t j ) const;
292  //**********************************************************************************************
293 
294  //**Numeric functions***************************************************************************
297  template< typename Other > inline StrictlyUpperMatrix& scale( const Other& scalar );
299  //**********************************************************************************************
300 
301  //**Debugging functions*************************************************************************
304  inline bool isIntact() const noexcept;
306  //**********************************************************************************************
307 
308  //**Expression template evaluation functions****************************************************
311  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
312  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
313 
314  inline bool canSMPAssign() const noexcept;
316  //**********************************************************************************************
317 
318  private:
319  //**Utility functions***************************************************************************
322  inline void resetLower();
324  //**********************************************************************************************
325 
326  //**Member variables****************************************************************************
329  MT matrix_;
330 
331  //**********************************************************************************************
332 
333  //**Friend declarations*************************************************************************
334  template< typename MT2, bool SO2, bool DF2 >
335  friend MT2& derestrict( StrictlyUpperMatrix<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 StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix()
375  : matrix_() // The adapted sparse matrix
376 {
377  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper 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 StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n )
394  : matrix_( n, n ) // The adapted sparse matrix
395 {
397 
398  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
399 }
401 //*************************************************************************************************
402 
403 
404 //*************************************************************************************************
414 template< typename MT // Type of the adapted sparse matrix
415  , bool SO > // Storage order of the adapted sparse matrix
416 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n, size_t nonzeros )
417  : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
418 {
420 
421  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
422 }
424 //*************************************************************************************************
425 
426 
427 //*************************************************************************************************
441 template< typename MT // Type of the adapted sparse matrix
442  , bool SO > // Storage order of the adapted sparse matrix
443 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n, const std::vector<size_t>& nonzeros )
444  : matrix_( n, n, nonzeros ) // The adapted sparse matrix
445 {
447 
448  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
449 }
451 //*************************************************************************************************
452 
453 
454 //*************************************************************************************************
478 template< typename MT // Type of the adapted sparse matrix
479  , bool SO > // Storage order of the adapted sparse matrix
480 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list )
481  : matrix_( list ) // The adapted sparse matrix
482 {
483  if( !isStrictlyUpper( matrix_ ) ) {
484  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
485  }
486 
487  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
488 }
490 //*************************************************************************************************
491 
492 
493 //*************************************************************************************************
499 template< typename MT // Type of the adapted sparse matrix
500  , bool SO > // Storage order of the adapted sparse matrix
501 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( const StrictlyUpperMatrix& m )
502  : matrix_( m.matrix_ ) // The adapted sparse matrix
503 {
504  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
505  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
506 }
508 //*************************************************************************************************
509 
510 
511 //*************************************************************************************************
517 template< typename MT // Type of the adapted sparse matrix
518  , bool SO > // Storage order of the adapted sparse matrix
519 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept
520  : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
521 {
522  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
523  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
524 }
526 //*************************************************************************************************
527 
528 
529 //*************************************************************************************************
540 template< typename MT // Type of the adapted sparse matrix
541  , bool SO > // Storage order of the adapted sparse matrix
542 template< typename MT2 // Type of the foreign matrix
543  , bool SO2 > // Storage order of the foreign matrix
544 inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( const Matrix<MT2,SO2>& m )
545  : matrix_( ~m ) // The adapted sparse matrix
546 {
547  if( IsUniTriangular_v<MT2> ||
548  ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( matrix_ ) ) ) {
549  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
550  }
551 
552  if( !IsStrictlyUpper_v<MT2> )
553  resetLower();
554 
555  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
556  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
557 }
559 //*************************************************************************************************
560 
561 
562 
563 
564 //=================================================================================================
565 //
566 // DATA ACCESS FUNCTIONS
567 //
568 //=================================================================================================
569 
570 //*************************************************************************************************
586 template< typename MT // Type of the adapted sparse matrix
587  , bool SO > // Storage order of the adapted sparse matrix
588 inline typename StrictlyUpperMatrix<MT,SO,false>::Reference
589  StrictlyUpperMatrix<MT,SO,false>::operator()( size_t i, size_t j )
590 {
591  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
592  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
593 
594  return Reference( matrix_, i, j );
595 }
597 //*************************************************************************************************
598 
599 
600 //*************************************************************************************************
616 template< typename MT // Type of the adapted sparse matrix
617  , bool SO > // Storage order of the adapted sparse matrix
618 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstReference
619  StrictlyUpperMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
620 {
621  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
622  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
623 
624  return matrix_(i,j);
625 }
627 //*************************************************************************************************
628 
629 
630 //*************************************************************************************************
647 template< typename MT // Type of the adapted sparse matrix
648  , bool SO > // Storage order of the adapted sparse matrix
649 inline typename StrictlyUpperMatrix<MT,SO,false>::Reference
650  StrictlyUpperMatrix<MT,SO,false>::at( size_t i, size_t j )
651 {
652  if( i >= rows() ) {
653  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
654  }
655  if( j >= columns() ) {
656  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
657  }
658  return (*this)(i,j);
659 }
661 //*************************************************************************************************
662 
663 
664 //*************************************************************************************************
681 template< typename MT // Type of the adapted sparse matrix
682  , bool SO > // Storage order of the adapted sparse matrix
683 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstReference
684  StrictlyUpperMatrix<MT,SO,false>::at( size_t i, size_t j ) const
685 {
686  if( i >= rows() ) {
687  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
688  }
689  if( j >= columns() ) {
690  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
691  }
692  return (*this)(i,j);
693 }
695 //*************************************************************************************************
696 
697 
698 //*************************************************************************************************
710 template< typename MT // Type of the adapted sparse matrix
711  , bool SO > // Storage order of the adapted sparse matrix
712 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
714 {
715  return matrix_.begin(i);
716 }
718 //*************************************************************************************************
719 
720 
721 //*************************************************************************************************
733 template< typename MT // Type of the adapted sparse matrix
734  , bool SO > // Storage order of the adapted sparse matrix
735 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
737 {
738  return matrix_.begin(i);
739 }
741 //*************************************************************************************************
742 
743 
744 //*************************************************************************************************
756 template< typename MT // Type of the adapted sparse matrix
757  , bool SO > // Storage order of the adapted sparse matrix
758 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
760 {
761  return matrix_.cbegin(i);
762 }
764 //*************************************************************************************************
765 
766 
767 //*************************************************************************************************
779 template< typename MT // Type of the adapted sparse matrix
780  , bool SO > // Storage order of the adapted sparse matrix
781 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
783 {
784  return matrix_.end(i);
785 }
787 //*************************************************************************************************
788 
789 
790 //*************************************************************************************************
802 template< typename MT // Type of the adapted sparse matrix
803  , bool SO > // Storage order of the adapted sparse matrix
804 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
805  StrictlyUpperMatrix<MT,SO,false>::end( size_t i ) const
806 {
807  return matrix_.end(i);
808 }
810 //*************************************************************************************************
811 
812 
813 //*************************************************************************************************
825 template< typename MT // Type of the adapted sparse matrix
826  , bool SO > // Storage order of the adapted sparse matrix
827 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
829 {
830  return matrix_.cend(i);
831 }
833 //*************************************************************************************************
834 
835 
836 
837 
838 //=================================================================================================
839 //
840 // ASSIGNMENT OPERATORS
841 //
842 //=================================================================================================
843 
844 //*************************************************************************************************
869 template< typename MT // Type of the adapted sparse matrix
870  , bool SO > // Storage order of the adapted sparse matrix
871 inline StrictlyUpperMatrix<MT,SO,false>&
872  StrictlyUpperMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
873 {
874  const InitializerMatrix<ElementType> tmp( list, list.size() );
875 
876  if( !isStrictlyUpper( tmp ) ) {
877  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
878  }
879 
880  matrix_ = list;
881 
882  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
883  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
884 
885  return *this;
886 }
888 //*************************************************************************************************
889 
890 
891 //*************************************************************************************************
901 template< typename MT // Type of the adapted sparse matrix
902  , bool SO > // Storage order of the adapted sparse matrix
903 inline StrictlyUpperMatrix<MT,SO,false>&
904  StrictlyUpperMatrix<MT,SO,false>::operator=( const StrictlyUpperMatrix& rhs )
905 {
906  matrix_ = rhs.matrix_;
907 
908  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
909  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
910 
911  return *this;
912 }
914 //*************************************************************************************************
915 
916 
917 //*************************************************************************************************
924 template< typename MT // Type of the adapted sparse matrix
925  , bool SO > // Storage order of the adapted sparse matrix
926 inline StrictlyUpperMatrix<MT,SO,false>&
927  StrictlyUpperMatrix<MT,SO,false>::operator=( StrictlyUpperMatrix&& rhs ) noexcept
928 {
929  matrix_ = std::move( rhs.matrix_ );
930 
931  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
932  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
933 
934  return *this;
935 }
937 //*************************************************************************************************
938 
939 
940 //*************************************************************************************************
953 template< typename MT // Type of the adapted sparse matrix
954  , bool SO > // Storage order of the adapted sparse matrix
955 template< typename MT2 // Type of the right-hand side matrix
956  , bool SO2 > // Storage order of the right-hand side matrix
957 inline auto StrictlyUpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
958  -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
959 {
960  if( IsUniTriangular_v<MT2> ||
961  ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( ~rhs ) ) ) {
962  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
963  }
964 
965  matrix_ = declupp( ~rhs );
966 
967  if( !IsStrictlyUpper_v<MT2> )
968  resetLower();
969 
970  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
971  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
972 
973  return *this;
974 }
976 //*************************************************************************************************
977 
978 
979 //*************************************************************************************************
992 template< typename MT // Type of the adapted sparse matrix
993  , bool SO > // Storage order of the adapted sparse matrix
994 template< typename MT2 // Type of the right-hand side matrix
995  , bool SO2 > // Storage order of the right-hand side matrix
996 inline auto StrictlyUpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
997  -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
998 {
999  if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) ) {
1000  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1001  }
1002 
1003  if( IsStrictlyUpper_v<MT2> ) {
1004  matrix_ = ~rhs;
1005  }
1006  else {
1007  MT tmp( ~rhs );
1008 
1009  if( !isStrictlyUpper( tmp ) ) {
1010  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1011  }
1012 
1013  matrix_ = std::move( tmp );
1014  }
1015 
1016  if( !IsStrictlyUpper_v<MT2> )
1017  resetLower();
1018 
1019  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1020  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1021 
1022  return *this;
1023 }
1025 //*************************************************************************************************
1026 
1027 
1028 //*************************************************************************************************
1041 template< typename MT // Type of the adapted sparse matrix
1042  , bool SO > // Storage order of the adapted sparse matrix
1043 template< typename MT2 // Type of the right-hand side matrix
1044  , bool SO2 > // Storage order of the right-hand side matrix
1045 inline auto StrictlyUpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1046  -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1047 {
1048  if( IsUniTriangular_v<MT2> ||
1049  ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( ~rhs ) ) ) {
1050  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1051  }
1052 
1053  matrix_ += declupp( ~rhs );
1054 
1055  if( !IsStrictlyUpper_v<MT2> )
1056  resetLower();
1057 
1058  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1059  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1060 
1061  return *this;
1062 }
1064 //*************************************************************************************************
1065 
1066 
1067 //*************************************************************************************************
1080 template< typename MT // Type of the adapted sparse matrix
1081  , bool SO > // Storage order of the adapted sparse matrix
1082 template< typename MT2 // Type of the right-hand side matrix
1083  , bool SO2 > // Storage order of the right-hand side matrix
1084 inline auto StrictlyUpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1085  -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1086 {
1087  if( IsUniTriangular_v<MT2> || ( IsSquare_v<MT2> && !isSquare( ~rhs ) ) ) {
1088  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1089  }
1090 
1091  if( IsStrictlyUpper_v<MT2> ) {
1092  matrix_ += ~rhs;
1093  }
1094  else {
1095  const ResultType_t<MT2> tmp( ~rhs );
1096 
1097  if( !isStrictlyUpper( tmp ) ) {
1098  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1099  }
1100 
1101  matrix_ += declupp( tmp );
1102  }
1103 
1104  if( !IsStrictlyUpper_v<MT2> )
1105  resetLower();
1106 
1107  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1108  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1109 
1110  return *this;
1111 }
1113 //*************************************************************************************************
1114 
1115 
1116 //*************************************************************************************************
1129 template< typename MT // Type of the adapted sparse matrix
1130  , bool SO > // Storage order of the adapted sparse matrix
1131 template< typename MT2 // Type of the right-hand side matrix
1132  , bool SO2 > // Storage order of the right-hand side matrix
1133 inline auto StrictlyUpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1134  -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1135 {
1136  if( IsUniTriangular_v<MT2> ||
1137  ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( ~rhs ) ) ) {
1138  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1139  }
1140 
1141  matrix_ -= declupp( ~rhs );
1142 
1143  if( !IsStrictlyUpper_v<MT2> )
1144  resetLower();
1145 
1146  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1147  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1148 
1149  return *this;
1150 }
1152 //*************************************************************************************************
1153 
1154 
1155 //*************************************************************************************************
1168 template< typename MT // Type of the adapted sparse matrix
1169  , bool SO > // Storage order of the adapted sparse matrix
1170 template< typename MT2 // Type of the right-hand side matrix
1171  , bool SO2 > // Storage order of the right-hand side matrix
1172 inline auto StrictlyUpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1173  -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1174 {
1175  if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) ) {
1176  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1177  }
1178 
1179  if( IsStrictlyUpper_v<MT2> ) {
1180  matrix_ -= ~rhs;
1181  }
1182  else {
1183  const ResultType_t<MT2> tmp( ~rhs );
1184 
1185  if( !isStrictlyUpper( tmp ) ) {
1186  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1187  }
1188 
1189  matrix_ -= declupp( tmp );
1190  }
1191 
1192  if( !IsStrictlyUpper_v<MT2> )
1193  resetLower();
1194 
1195  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1196  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1197 
1198  return *this;
1199 }
1201 //*************************************************************************************************
1202 
1203 
1204 //*************************************************************************************************
1215 template< typename MT // Type of the adapted sparse matrix
1216  , bool SO > // Storage order of the adapted sparse matrix
1217 template< typename MT2 // Type of the right-hand side matrix
1218  , bool SO2 > // Storage order of the right-hand side matrix
1219 inline auto StrictlyUpperMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1220  -> StrictlyUpperMatrix&
1221 {
1222  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1223  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1224  }
1225 
1226  matrix_ %= ~rhs;
1227 
1228  if( !IsStrictlyUpper_v<MT2> )
1229  resetLower();
1230 
1231  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1232  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1233 
1234  return *this;
1235 }
1237 //*************************************************************************************************
1238 
1239 
1240 
1241 
1242 //=================================================================================================
1243 //
1244 // UTILITY FUNCTIONS
1245 //
1246 //=================================================================================================
1247 
1248 //*************************************************************************************************
1254 template< typename MT // Type of the adapted sparse matrix
1255  , bool SO > // Storage order of the adapted sparse matrix
1256 inline size_t StrictlyUpperMatrix<MT,SO,false>::rows() const noexcept
1257 {
1258  return matrix_.rows();
1259 }
1261 //*************************************************************************************************
1262 
1263 
1264 //*************************************************************************************************
1270 template< typename MT // Type of the adapted sparse matrix
1271  , bool SO > // Storage order of the adapted sparse matrix
1272 inline size_t StrictlyUpperMatrix<MT,SO,false>::columns() const noexcept
1273 {
1274  return matrix_.columns();
1275 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1286 template< typename MT // Type of the adapted sparse matrix
1287  , bool SO > // Storage order of the adapted sparse matrix
1288 inline size_t StrictlyUpperMatrix<MT,SO,false>::capacity() const noexcept
1289 {
1290  return matrix_.capacity();
1291 }
1293 //*************************************************************************************************
1294 
1295 
1296 //*************************************************************************************************
1308 template< typename MT // Type of the adapted sparse matrix
1309  , bool SO > // Storage order of the adapted sparse matrix
1310 inline size_t StrictlyUpperMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1311 {
1312  return matrix_.capacity(i);
1313 }
1315 //*************************************************************************************************
1316 
1317 
1318 //*************************************************************************************************
1324 template< typename MT // Type of the adapted sparse matrix
1325  , bool SO > // Storage order of the adapted sparse matrix
1326 inline size_t StrictlyUpperMatrix<MT,SO,false>::nonZeros() const
1327 {
1328  return matrix_.nonZeros();
1329 }
1331 //*************************************************************************************************
1332 
1333 
1334 //*************************************************************************************************
1346 template< typename MT // Type of the adapted sparse matrix
1347  , bool SO > // Storage order of the adapted sparse matrix
1348 inline size_t StrictlyUpperMatrix<MT,SO,false>::nonZeros( size_t i ) const
1349 {
1350  return matrix_.nonZeros(i);
1351 }
1353 //*************************************************************************************************
1354 
1355 
1356 //*************************************************************************************************
1362 template< typename MT // Type of the adapted sparse matrix
1363  , bool SO > // Storage order of the adapted sparse matrix
1365 {
1366  using blaze::erase;
1367 
1368  if( SO ) {
1369  for( size_t j=1UL; j<columns(); ++j ) {
1370  erase( matrix_, j, matrix_.begin(j), matrix_.lowerBound(j,j) );
1371  }
1372  }
1373  else {
1374  for( size_t i=0UL; i<rows(); ++i ) {
1375  erase( matrix_, i, matrix_.lowerBound(i,i+1UL), matrix_.end(i) );
1376  }
1377  }
1378 }
1380 //*************************************************************************************************
1381 
1382 
1383 //*************************************************************************************************
1396 template< typename MT // Type of the adapted sparse matrix
1397  , bool SO > // Storage order of the adapted sparse matrix
1398 inline void StrictlyUpperMatrix<MT,SO,false>::reset( size_t i )
1399 {
1400  using blaze::erase;
1401 
1402  if( SO ) {
1403  erase( matrix_, i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1404  }
1405  else {
1406  erase( matrix_, i, matrix_.lowerBound(i,i+1UL), matrix_.end(i) );
1407  }
1408 }
1410 //*************************************************************************************************
1411 
1412 
1413 //*************************************************************************************************
1421 template< typename MT // Type of the adapted sparse matrix
1422  , bool SO > // Storage order of the adapted sparse matrix
1424 {
1425  using blaze::clear;
1426 
1427  if( IsResizable_v<MT> ) {
1428  clear( matrix_ );
1429  }
1430  else {
1431  reset();
1432  }
1433 }
1435 //*************************************************************************************************
1436 
1437 
1438 //*************************************************************************************************
1453 template< typename MT // Type of the adapted sparse matrix
1454  , bool SO > // Storage order of the adapted sparse matrix
1455 void StrictlyUpperMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1456 {
1458 
1459  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1460 
1461  matrix_.resize( n, n, preserve );
1462 }
1464 //*************************************************************************************************
1465 
1466 
1467 //*************************************************************************************************
1478 template< typename MT // Type of the adapted sparse matrix
1479  , bool SO > // Storage order of the adapted sparse matrix
1480 inline void StrictlyUpperMatrix<MT,SO,false>::reserve( size_t nonzeros )
1481 {
1482  matrix_.reserve( nonzeros );
1483 }
1485 //*************************************************************************************************
1486 
1487 
1488 //*************************************************************************************************
1503 template< typename MT // Type of the adapted sparse matrix
1504  , bool SO > // Storage order of the adapted sparse matrix
1505 inline void StrictlyUpperMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1506 {
1507  matrix_.reserve( i, nonzeros );
1508 }
1510 //*************************************************************************************************
1511 
1512 
1513 //*************************************************************************************************
1524 template< typename MT // Type of the adapted sparse matrix
1525  , bool SO > // Storage order of the adapted sparse matrix
1526 inline void StrictlyUpperMatrix<MT,SO,false>::trim()
1527 {
1528  matrix_.trim();
1529 }
1531 //*************************************************************************************************
1532 
1533 
1534 //*************************************************************************************************
1546 template< typename MT // Type of the adapted sparse matrix
1547  , bool SO > // Storage order of the adapted sparse matrix
1548 inline void StrictlyUpperMatrix<MT,SO,false>::trim( size_t i )
1549 {
1550  matrix_.trim( i );
1551 }
1553 //*************************************************************************************************
1554 
1555 
1556 //*************************************************************************************************
1566 template< typename MT // Type of the adapted sparse matrix
1567  , bool SO > // Storage order of the adapted sparse matrix
1569 {
1570  matrix_.shrinkToFit();
1571 }
1573 //*************************************************************************************************
1574 
1575 
1576 //*************************************************************************************************
1583 template< typename MT // Type of the adapted sparse matrix
1584  , bool SO > // Storage order of the adapted sparse matrix
1585 inline void StrictlyUpperMatrix<MT,SO,false>::swap( StrictlyUpperMatrix& m ) noexcept
1586 {
1587  using std::swap;
1588 
1589  swap( matrix_, m.matrix_ );
1590 }
1592 //*************************************************************************************************
1593 
1594 
1595 //*************************************************************************************************
1607 template< typename MT // Type of the adapted dense matrix
1608  , bool SO > // Storage order of the adapted dense matrix
1609 inline constexpr size_t StrictlyUpperMatrix<MT,SO,false>::maxNonZeros() noexcept
1610 {
1612 
1613  return maxNonZeros( Size_v<MT,0UL> );
1614 }
1616 //*************************************************************************************************
1617 
1618 
1619 //*************************************************************************************************
1629 template< typename MT // Type of the adapted dense matrix
1630  , bool SO > // Storage order of the adapted dense matrix
1631 inline constexpr size_t StrictlyUpperMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1632 {
1633  return ( ( n - 1UL ) * n ) / 2UL;
1634 }
1636 //*************************************************************************************************
1637 
1638 
1639 //*************************************************************************************************
1645 template< typename MT // Type of the adapted dense matrix
1646  , bool SO > // Storage order of the adapted dense matrix
1647 inline void StrictlyUpperMatrix<MT,SO,false>::resetLower()
1648 {
1649  using blaze::erase;
1650 
1651  if( SO ) {
1652  for( size_t j=0UL; j<columns(); ++j )
1653  erase( matrix_, j, matrix_.upperBound( j, j ), matrix_.end( j ) );
1654  }
1655  else {
1656  for( size_t i=1UL; i<rows(); ++i )
1657  erase( matrix_, i, matrix_.begin( i ), matrix_.lowerBound( i, i ) );
1658  }
1659 }
1661 //*************************************************************************************************
1662 
1663 
1664 
1665 
1666 //=================================================================================================
1667 //
1668 // INSERTION FUNCTIONS
1669 //
1670 //=================================================================================================
1671 
1672 //*************************************************************************************************
1688 template< typename MT // Type of the adapted sparse matrix
1689  , bool SO > // Storage order of the adapted sparse matrix
1690 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1691  StrictlyUpperMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1692 {
1693  if( i >= j ) {
1694  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1695  }
1696 
1697  return matrix_.set( i, j, value );
1698 }
1700 //*************************************************************************************************
1701 
1702 
1703 //*************************************************************************************************
1720 template< typename MT // Type of the adapted sparse matrix
1721  , bool SO > // Storage order of the adapted sparse matrix
1722 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1723  StrictlyUpperMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1724 {
1725  if( i >= j ) {
1726  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1727  }
1728 
1729  return matrix_.insert( i, j, value );
1730 }
1732 //*************************************************************************************************
1733 
1734 
1735 //*************************************************************************************************
1785 template< typename MT // Type of the adapted sparse matrix
1786  , bool SO > // Storage order of the adapted sparse matrix
1787 inline void StrictlyUpperMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1788 {
1789  if( i >= j ) {
1790  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1791  }
1792 
1793  matrix_.append( i, j, value, check );
1794 }
1796 //*************************************************************************************************
1797 
1798 
1799 //*************************************************************************************************
1813 template< typename MT // Type of the adapted sparse matrix
1814  , bool SO > // Storage order of the adapted sparse matrix
1815 inline void StrictlyUpperMatrix<MT,SO,false>::finalize( size_t i )
1816 {
1817  matrix_.finalize( i );
1818 }
1820 //*************************************************************************************************
1821 
1822 
1823 
1824 
1825 //=================================================================================================
1826 //
1827 // ERASE FUNCTIONS
1828 //
1829 //=================================================================================================
1830 
1831 //*************************************************************************************************
1841 template< typename MT // Type of the adapted sparse matrix
1842  , bool SO > // Storage order of the adapted sparse matrix
1843 inline void StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, size_t j )
1844 {
1845  using blaze::erase;
1846 
1847  erase( matrix_, i, j );
1848 }
1850 //*************************************************************************************************
1851 
1852 
1853 //*************************************************************************************************
1865 template< typename MT // Type of the adapted sparse matrix
1866  , bool SO > // Storage order of the adapted sparse matrix
1867 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1868  StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1869 {
1870  using blaze::erase;
1871 
1872  return erase( matrix_, i, pos );
1873 }
1875 //*************************************************************************************************
1876 
1877 
1878 //*************************************************************************************************
1892 template< typename MT // Type of the adapted sparse matrix
1893  , bool SO > // Storage order of the adapted sparse matrix
1894 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1895  StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1896 {
1897  using blaze::erase;
1898 
1899  return erase( matrix_, i, first, last );
1900 }
1902 //*************************************************************************************************
1903 
1904 
1905 //*************************************************************************************************
1927 template< typename MT // Type of the adapted sparse matrix
1928  , bool SO > // Storage order of the adapted sparse matrix
1929 template< typename Pred > // Type of the unary predicate
1930 inline void StrictlyUpperMatrix<MT,SO,false>::erase( Pred predicate )
1931 {
1932  using blaze::erase;
1933 
1934  erase( matrix_, predicate );
1935 
1936  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1937 }
1939 //*************************************************************************************************
1940 
1941 
1942 //*************************************************************************************************
1970 template< typename MT // Type of the adapted sparse matrix
1971  , bool SO > // Storage order of the adapted sparse matrix
1972 template< typename Pred > // Type of the unary predicate
1973 inline void StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1974 {
1975  using blaze::erase;
1976 
1977  erase( matrix_, i, first, last, predicate );
1978 
1979  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1980 }
1982 //*************************************************************************************************
1983 
1984 
1985 
1986 
1987 //=================================================================================================
1988 //
1989 // LOOKUP FUNCTIONS
1990 //
1991 //=================================================================================================
1992 
1993 //*************************************************************************************************
2009 template< typename MT // Type of the adapted sparse matrix
2010  , bool SO > // Storage order of the adapted sparse matrix
2011 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
2012  StrictlyUpperMatrix<MT,SO,false>::find( size_t i, size_t j )
2013 {
2014  return matrix_.find( i, j );
2015 }
2017 //*************************************************************************************************
2018 
2019 
2020 //*************************************************************************************************
2036 template< typename MT // Type of the adapted sparse matrix
2037  , bool SO > // Storage order of the adapted sparse matrix
2038 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
2039  StrictlyUpperMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2040 {
2041  return matrix_.find( i, j );
2042 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2063 template< typename MT // Type of the adapted sparse matrix
2064  , bool SO > // Storage order of the adapted sparse matrix
2065 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
2066  StrictlyUpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2067 {
2068  return matrix_.lowerBound( i, j );
2069 }
2071 //*************************************************************************************************
2072 
2073 
2074 //*************************************************************************************************
2090 template< typename MT // Type of the adapted sparse matrix
2091  , bool SO > // Storage order of the adapted sparse matrix
2092 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
2093  StrictlyUpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2094 {
2095  return matrix_.lowerBound( i, j );
2096 }
2098 //*************************************************************************************************
2099 
2100 
2101 //*************************************************************************************************
2117 template< typename MT // Type of the adapted sparse matrix
2118  , bool SO > // Storage order of the adapted sparse matrix
2119 inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
2120  StrictlyUpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2121 {
2122  return matrix_.upperBound( i, j );
2123 }
2125 //*************************************************************************************************
2126 
2127 
2128 //*************************************************************************************************
2144 template< typename MT // Type of the adapted sparse matrix
2145  , bool SO > // Storage order of the adapted sparse matrix
2146 inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
2147  StrictlyUpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2148 {
2149  return matrix_.upperBound( i, j );
2150 }
2152 //*************************************************************************************************
2153 
2154 
2155 
2156 
2157 //=================================================================================================
2158 //
2159 // NUMERIC FUNCTIONS
2160 //
2161 //=================================================================================================
2162 
2163 //*************************************************************************************************
2181 template< typename MT // Type of the adapted sparse matrix
2182  , bool SO > // Storage order of the adapted sparse matrix
2183 template< typename Other > // Data type of the scalar value
2184 inline StrictlyUpperMatrix<MT,SO,false>&
2185  StrictlyUpperMatrix<MT,SO,false>::scale( const Other& scalar )
2186 {
2187  matrix_.scale( scalar );
2188  return *this;
2189 }
2191 //*************************************************************************************************
2192 
2193 
2194 
2195 
2196 //=================================================================================================
2197 //
2198 // DEBUGGING FUNCTIONS
2199 //
2200 //=================================================================================================
2201 
2202 //*************************************************************************************************
2212 template< typename MT // Type of the adapted sparse matrix
2213  , bool SO > // Storage order of the adapted sparse matrix
2214 inline bool StrictlyUpperMatrix<MT,SO,false>::isIntact() const noexcept
2215 {
2216  using blaze::isIntact;
2217 
2218  return ( isIntact( matrix_ ) && isStrictlyUpper( matrix_ ) );
2219 }
2221 //*************************************************************************************************
2222 
2223 
2224 
2225 
2226 //=================================================================================================
2227 //
2228 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2229 //
2230 //=================================================================================================
2231 
2232 //*************************************************************************************************
2243 template< typename MT // Type of the adapted sparse matrix
2244  , bool SO > // Storage order of the adapted sparse matrix
2245 template< typename Other > // Data type of the foreign expression
2246 inline bool StrictlyUpperMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2247 {
2248  return matrix_.canAlias( alias );
2249 }
2251 //*************************************************************************************************
2252 
2253 
2254 //*************************************************************************************************
2265 template< typename MT // Type of the adapted sparse matrix
2266  , bool SO > // Storage order of the adapted sparse matrix
2267 template< typename Other > // Data type of the foreign expression
2268 inline bool StrictlyUpperMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2269 {
2270  return matrix_.isAliased( alias );
2271 }
2273 //*************************************************************************************************
2274 
2275 
2276 //*************************************************************************************************
2287 template< typename MT // Type of the adapted sparse matrix
2288  , bool SO > // Storage order of the adapted sparse matrix
2289 inline bool StrictlyUpperMatrix<MT,SO,false>::canSMPAssign() const noexcept
2290 {
2291  return matrix_.canSMPAssign();
2292 }
2294 //*************************************************************************************************
2295 
2296 } // namespace blaze
2297 
2298 #endif
Header file for the StrictlyUpperProxy class.
#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
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.
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.h:1001
#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.
Headerfile for the generic max algorithm.
Header file for the DisableIf class template.
Header file for the IsStrictlyUpper type trait.
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.
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
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1198
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
Header file for the implementation of the base template of the StrictlyUpperMatrix.
#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
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:2235
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 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
#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
Header file for the IsResizable type trait.
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.