Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
48 #include <blaze/math/Aliases.h>
60 #include <blaze/math/Exception.h>
63 #include <blaze/math/shims/Clear.h>
73 #include <blaze/system/Inline.h>
74 #include <blaze/util/Assert.h>
80 #include <blaze/util/DisableIf.h>
81 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/FalseType.h>
84 #include <blaze/util/TrueType.h>
85 #include <blaze/util/Types.h>
86 #include <blaze/util/Unused.h>
87 
88 
89 namespace blaze {
90 
91 //=================================================================================================
92 //
93 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
94 //
95 //=================================================================================================
96 
97 //*************************************************************************************************
105 template< typename MT // Type of the adapted dense matrix
106  , bool SO > // Storage order of the adapted dense matrix
107 class StrictlyUpperMatrix<MT,SO,true>
108  : public DenseMatrix< StrictlyUpperMatrix<MT,SO,true>, SO >
109 {
110  private:
111  //**Type definitions****************************************************************************
112  using OT = OppositeType_<MT>;
113  using TT = TransposeType_<MT>;
114  using ET = ElementType_<MT>;
115  //**********************************************************************************************
116 
117  public:
118  //**Type definitions****************************************************************************
119  using This = StrictlyUpperMatrix<MT,SO,true>;
120  using BaseType = DenseMatrix<This,SO>;
121  using ResultType = This;
122  using OppositeType = StrictlyUpperMatrix<OT,!SO,true>;
123  using TransposeType = StrictlyLowerMatrix<TT,!SO,true>;
124  using ElementType = ET;
125  using SIMDType = SIMDType_<MT>;
126  using ReturnType = ReturnType_<MT>;
127  using CompositeType = const This&;
128  using Reference = StrictlyUpperProxy<MT>;
129  using ConstReference = ConstReference_<MT>;
130  using Pointer = Pointer_<MT>;
131  using ConstPointer = ConstPointer_<MT>;
132  using ConstIterator = ConstIterator_<MT>;
133  //**********************************************************************************************
134 
135  //**Rebind struct definition********************************************************************
138  template< typename NewType > // Data type of the other matrix
139  struct Rebind {
141  using Other = StrictlyUpperMatrix< typename MT::template Rebind<NewType>::Other >;
142  };
143  //**********************************************************************************************
144 
145  //**Resize struct definition********************************************************************
148  template< size_t NewM // Number of rows of the other matrix
149  , size_t NewN > // Number of columns of the other matrix
150  struct Resize {
152  using Other = StrictlyUpperMatrix< typename MT::template Resize<NewM,NewN>::Other >;
153  };
154  //**********************************************************************************************
155 
156  //**Iterator class definition*******************************************************************
159  class Iterator
160  {
161  public:
162  //**Type definitions*************************************************************************
163  using IteratorCategory = std::random_access_iterator_tag;
164  using ValueType = ElementType_<MT>;
165  using PointerType = StrictlyUpperProxy<MT>;
166  using ReferenceType = StrictlyUpperProxy<MT>;
167  using DifferenceType = ptrdiff_t;
168 
169  // STL iterator requirements
170  using iterator_category = IteratorCategory;
171  using value_type = ValueType;
172  using pointer = PointerType;
173  using reference = ReferenceType;
174  using difference_type = DifferenceType;
175  //*******************************************************************************************
176 
177  //**Constructor******************************************************************************
180  inline Iterator() noexcept
181  : matrix_( nullptr ) // Reference to the adapted dense matrix
182  , row_ ( 0UL ) // The current row index of the iterator
183  , column_( 0UL ) // The current column index of the iterator
184  {}
185  //*******************************************************************************************
186 
187  //**Constructor******************************************************************************
194  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
195  : matrix_( &matrix ) // Reference to the adapted dense matrix
196  , row_ ( row ) // The current row-index of the iterator
197  , column_( column ) // The current column-index of the iterator
198  {}
199  //*******************************************************************************************
200 
201  //**Addition assignment operator*************************************************************
207  inline Iterator& operator+=( size_t inc ) noexcept {
208  ( SO )?( row_ += inc ):( column_ += inc );
209  return *this;
210  }
211  //*******************************************************************************************
212 
213  //**Subtraction assignment operator**********************************************************
219  inline Iterator& operator-=( size_t dec ) noexcept {
220  ( SO )?( row_ -= dec ):( column_ -= dec );
221  return *this;
222  }
223  //*******************************************************************************************
224 
225  //**Prefix increment operator****************************************************************
230  inline Iterator& operator++() noexcept {
231  ( SO )?( ++row_ ):( ++column_ );
232  return *this;
233  }
234  //*******************************************************************************************
235 
236  //**Postfix increment operator***************************************************************
241  inline const Iterator operator++( int ) noexcept {
242  const Iterator tmp( *this );
243  ++(*this);
244  return tmp;
245  }
246  //*******************************************************************************************
247 
248  //**Prefix decrement operator****************************************************************
253  inline Iterator& operator--() noexcept {
254  ( SO )?( --row_ ):( --column_ );
255  return *this;
256  }
257  //*******************************************************************************************
258 
259  //**Postfix decrement operator***************************************************************
264  inline const Iterator operator--( int ) noexcept {
265  const Iterator tmp( *this );
266  --(*this);
267  return tmp;
268  }
269  //*******************************************************************************************
270 
271  //**Element access operator******************************************************************
276  inline ReferenceType operator*() const {
277  return ReferenceType( *matrix_, row_, column_ );
278  }
279  //*******************************************************************************************
280 
281  //**Element access operator******************************************************************
286  inline PointerType operator->() const {
287  return PointerType( *matrix_, row_, column_ );
288  }
289  //*******************************************************************************************
290 
291  //**Load function****************************************************************************
301  inline SIMDType load() const {
302  return (*matrix_).load(row_,column_);
303  }
304  //*******************************************************************************************
305 
306  //**Loada function***************************************************************************
316  inline SIMDType loada() const {
317  return (*matrix_).loada(row_,column_);
318  }
319  //*******************************************************************************************
320 
321  //**Loadu function***************************************************************************
331  inline SIMDType loadu() const {
332  return (*matrix_).loadu(row_,column_);
333  }
334  //*******************************************************************************************
335 
336  //**Conversion operator**********************************************************************
341  inline operator ConstIterator() const {
342  if( SO )
343  return matrix_->begin( column_ ) + row_;
344  else
345  return matrix_->begin( row_ ) + column_;
346  }
347  //*******************************************************************************************
348 
349  //**Equality operator************************************************************************
356  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
357  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
358  }
359  //*******************************************************************************************
360 
361  //**Equality operator************************************************************************
368  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
369  return ( ConstIterator( lhs ) == rhs );
370  }
371  //*******************************************************************************************
372 
373  //**Equality operator************************************************************************
380  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
381  return ( lhs == ConstIterator( rhs ) );
382  }
383  //*******************************************************************************************
384 
385  //**Inequality operator**********************************************************************
392  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
393  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
394  }
395  //*******************************************************************************************
396 
397  //**Inequality operator**********************************************************************
404  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
405  return ( ConstIterator( lhs ) != rhs );
406  }
407  //*******************************************************************************************
408 
409  //**Inequality operator**********************************************************************
416  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
417  return ( lhs != ConstIterator( rhs ) );
418  }
419  //*******************************************************************************************
420 
421  //**Less-than operator***********************************************************************
428  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
429  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
430  }
431  //*******************************************************************************************
432 
433  //**Less-than operator***********************************************************************
440  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
441  return ( ConstIterator( lhs ) < rhs );
442  }
443  //*******************************************************************************************
444 
445  //**Less-than operator***********************************************************************
452  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
453  return ( lhs < ConstIterator( rhs ) );
454  }
455  //*******************************************************************************************
456 
457  //**Greater-than operator********************************************************************
464  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
465  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
466  }
467  //*******************************************************************************************
468 
469  //**Greater-than operator********************************************************************
476  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
477  return ( ConstIterator( lhs ) > rhs );
478  }
479  //*******************************************************************************************
480 
481  //**Greater-than operator********************************************************************
488  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
489  return ( lhs > ConstIterator( rhs ) );
490  }
491  //*******************************************************************************************
492 
493  //**Less-or-equal-than operator**************************************************************
500  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
501  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
502  }
503  //*******************************************************************************************
504 
505  //**Less-or-equal-than operator**************************************************************
512  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
513  return ( ConstIterator( lhs ) <= rhs );
514  }
515  //*******************************************************************************************
516 
517  //**Less-or-equal-than operator**************************************************************
524  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
525  return ( lhs <= ConstIterator( rhs ) );
526  }
527  //*******************************************************************************************
528 
529  //**Greater-or-equal-than operator***********************************************************
536  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
537  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
538  }
539  //*******************************************************************************************
540 
541  //**Greater-or-equal-than operator***********************************************************
548  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
549  return ( ConstIterator( lhs ) >= rhs );
550  }
551  //*******************************************************************************************
552 
553  //**Greater-or-equal-than operator***********************************************************
560  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
561  return ( lhs >= ConstIterator( rhs ) );
562  }
563  //*******************************************************************************************
564 
565  //**Subtraction operator*********************************************************************
571  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
572  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
573  }
574  //*******************************************************************************************
575 
576  //**Addition operator************************************************************************
583  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
584  if( SO )
585  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
586  else
587  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
588  }
589  //*******************************************************************************************
590 
591  //**Addition operator************************************************************************
598  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
599  if( SO )
600  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
601  else
602  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
603  }
604  //*******************************************************************************************
605 
606  //**Subtraction operator*********************************************************************
613  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
614  if( SO )
615  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
616  else
617  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
618  }
619  //*******************************************************************************************
620 
621  private:
622  //**Member variables*************************************************************************
623  MT* matrix_;
624  size_t row_;
625  size_t column_;
626  //*******************************************************************************************
627  };
628  //**********************************************************************************************
629 
630  //**Compilation flags***************************************************************************
632  enum : bool { simdEnabled = MT::simdEnabled };
633 
635  enum : bool { smpAssignable = MT::smpAssignable };
636  //**********************************************************************************************
637 
638  //**Constructors********************************************************************************
641  explicit inline StrictlyUpperMatrix();
642  template< typename A1 > explicit inline StrictlyUpperMatrix( const A1& a1 );
643  explicit inline StrictlyUpperMatrix( size_t n, const ElementType& init );
644 
645  explicit inline StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list );
646 
647  template< typename Other >
648  explicit inline StrictlyUpperMatrix( size_t n, const Other* array );
649 
650  template< typename Other, size_t N >
651  explicit inline StrictlyUpperMatrix( const Other (&array)[N][N] );
652 
653  explicit inline StrictlyUpperMatrix( ElementType* ptr, size_t n );
654  explicit inline StrictlyUpperMatrix( ElementType* ptr, size_t n, size_t nn );
655 
656  inline StrictlyUpperMatrix( const StrictlyUpperMatrix& m );
657  inline StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept;
659  //**********************************************************************************************
660 
661  //**Destructor**********************************************************************************
662  // No explicitly declared destructor.
663  //**********************************************************************************************
664 
665  //**Data access functions***********************************************************************
668  inline Reference operator()( size_t i, size_t j );
669  inline ConstReference operator()( size_t i, size_t j ) const;
670  inline Reference at( size_t i, size_t j );
671  inline ConstReference at( size_t i, size_t j ) const;
672  inline ConstPointer data () const noexcept;
673  inline ConstPointer data ( size_t i ) const noexcept;
674  inline Iterator begin ( size_t i );
675  inline ConstIterator begin ( size_t i ) const;
676  inline ConstIterator cbegin( size_t i ) const;
677  inline Iterator end ( size_t i );
678  inline ConstIterator end ( size_t i ) const;
679  inline ConstIterator cend ( size_t i ) const;
681  //**********************************************************************************************
682 
683  //**Assignment operators************************************************************************
686  inline StrictlyUpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
687 
688  template< typename Other, size_t N >
689  inline StrictlyUpperMatrix& operator=( const Other (&array)[N][N] );
690 
691  inline StrictlyUpperMatrix& operator=( const ElementType& rhs );
692  inline StrictlyUpperMatrix& operator=( const StrictlyUpperMatrix& rhs );
693  inline StrictlyUpperMatrix& operator=( StrictlyUpperMatrix&& rhs ) noexcept;
694 
695  template< typename MT2, bool SO2 >
696  inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
697  operator=( const Matrix<MT2,SO2>& rhs );
698 
699  template< typename MT2, bool SO2 >
700  inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
701  operator=( const Matrix<MT2,SO2>& rhs );
702 
703  template< typename MT2, bool SO2 >
704  inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
705  operator+=( const Matrix<MT2,SO2>& rhs );
706 
707  template< typename MT2, bool SO2 >
708  inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
709  operator+=( const Matrix<MT2,SO2>& rhs );
710 
711  template< typename MT2, bool SO2 >
712  inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
713  operator-=( const Matrix<MT2,SO2>& rhs );
714 
715  template< typename MT2, bool SO2 >
716  inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix& >
717  operator-=( const Matrix<MT2,SO2>& rhs );
718 
719  template< typename MT2, bool SO2 >
720  inline StrictlyUpperMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
721 
722  template< typename MT2, bool SO2 >
723  inline StrictlyUpperMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
724 
725  template< typename Other >
726  inline EnableIf_< IsNumeric<Other>, StrictlyUpperMatrix >& operator*=( Other rhs );
727 
728  template< typename Other >
729  inline EnableIf_< IsNumeric<Other>, StrictlyUpperMatrix >& operator/=( Other rhs );
731  //**********************************************************************************************
732 
733  //**Utility functions***************************************************************************
736  inline size_t rows() const noexcept;
737  inline size_t columns() const noexcept;
738  inline size_t spacing() const noexcept;
739  inline size_t capacity() const noexcept;
740  inline size_t capacity( size_t i ) const noexcept;
741  inline size_t nonZeros() const;
742  inline size_t nonZeros( size_t i ) const;
743  inline void reset();
744  inline void reset( size_t i );
745  inline void clear();
746  void resize ( size_t n, bool preserve=true );
747  inline void extend ( size_t n, bool preserve=true );
748  inline void reserve( size_t elements );
749  inline void shrinkToFit();
750  inline void swap( StrictlyUpperMatrix& m ) noexcept;
751 
752  static inline constexpr size_t maxNonZeros() noexcept;
753  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
755  //**********************************************************************************************
756 
757  //**Numeric functions***************************************************************************
760  template< typename Other > inline StrictlyUpperMatrix& scale( const Other& scalar );
762  //**********************************************************************************************
763 
764  //**Debugging functions*************************************************************************
767  inline bool isIntact() const noexcept;
769  //**********************************************************************************************
770 
771  //**Expression template evaluation functions****************************************************
774  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
775  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
776 
777  inline bool isAligned () const noexcept;
778  inline bool canSMPAssign() const noexcept;
779 
780  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
781  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
782  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
784  //**********************************************************************************************
785 
786  private:
787  //**Construction functions**********************************************************************
790  inline const MT construct( size_t n , TrueType );
791  inline const MT construct( const ElementType& value, FalseType );
792 
793  template< typename MT2, bool SO2, typename T >
794  inline const MT construct( const Matrix<MT2,SO2>& m, T );
796  //**********************************************************************************************
797 
798  //**Member variables****************************************************************************
801  MT matrix_;
802 
803  //**********************************************************************************************
804 
805  //**Friend declarations*************************************************************************
806  template< typename MT2, bool SO2, bool DF2 >
807  friend MT2& derestrict( StrictlyUpperMatrix<MT2,SO2,DF2>& m );
808  //**********************************************************************************************
809 
810  //**Compile time checks*************************************************************************
823  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
824  //**********************************************************************************************
825 };
827 //*************************************************************************************************
828 
829 
830 
831 
832 //=================================================================================================
833 //
834 // CONSTRUCTORS
835 //
836 //=================================================================================================
837 
838 //*************************************************************************************************
842 template< typename MT // Type of the adapted dense matrix
843  , bool SO > // Storage order of the adapted dense matrix
844 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix()
845  : matrix_() // The adapted dense matrix
846 {
847  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
848  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
849 }
851 //*************************************************************************************************
852 
853 
854 //*************************************************************************************************
872 template< typename MT // Type of the adapted dense matrix
873  , bool SO > // Storage order of the adapted dense matrix
874 template< typename A1 > // Type of the constructor argument
875 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( const A1& a1 )
876  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
877 {
878  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
879  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
880 }
882 //*************************************************************************************************
883 
884 
885 //*************************************************************************************************
892 template< typename MT // Type of the adapted dense matrix
893  , bool SO > // Storage order of the adapted dense matrix
894 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( size_t n, const ElementType& init )
895  : matrix_( n, n, ElementType() ) // The adapted dense matrix
896 {
898 
899  if( SO ) {
900  for( size_t j=0UL; j<columns(); ++j ) {
901  for( size_t i=0UL; i<j; ++i )
902  matrix_(i,j) = init;
903  }
904  }
905  else {
906  for( size_t i=0UL; i<rows(); ++i ) {
907  for( size_t j=i+1UL; j<columns(); ++j )
908  matrix_(i,j) = init;
909  }
910  }
911 
912  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
913  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
914 }
916 //*************************************************************************************************
917 
918 
919 //*************************************************************************************************
942 template< typename MT // Type of the adapted dense matrix
943  , bool SO > // Storage order of the adapted dense matrix
944 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list )
945  : matrix_( list ) // The adapted dense matrix
946 {
947  if( !isStrictlyUpper( matrix_ ) ) {
948  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
949  }
950 
951  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
952 }
954 //*************************************************************************************************
955 
956 
957 //*************************************************************************************************
984 template< typename MT // Type of the adapted dense matrix
985  , bool SO > // Storage order of the adapted dense matrix
986 template< typename Other > // Data type of the initialization array
987 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( size_t n, const Other* array )
988  : matrix_( n, n, array ) // The adapted dense matrix
989 {
990  if( !isStrictlyUpper( matrix_ ) ) {
991  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
992  }
993 
994  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
995 }
997 //*************************************************************************************************
998 
999 
1000 //*************************************************************************************************
1023 template< typename MT // Type of the adapted dense matrix
1024  , bool SO > // Storage order of the adapted dense matrix
1025 template< typename Other // Data type of the initialization array
1026  , size_t N > // Number of columns of the initialization array
1027 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( const Other (&array)[N][N] )
1028  : matrix_( array ) // The adapted dense matrix
1029 {
1030  if( !isStrictlyUpper( matrix_ ) ) {
1031  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
1032  }
1033 
1034  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1035 }
1037 //*************************************************************************************************
1038 
1039 
1040 //*************************************************************************************************
1073 template< typename MT // Type of the adapted dense matrix
1074  , bool SO > // Storage order of the adapted dense matrix
1075 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( ElementType* ptr, size_t n )
1076  : matrix_( ptr, n, n ) // The adapted dense matrix
1077 {
1078  if( !isStrictlyUpper( matrix_ ) ) {
1079  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
1080  }
1081 
1082  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1083 }
1085 //*************************************************************************************************
1086 
1087 
1088 //*************************************************************************************************
1122 template< typename MT // Type of the adapted dense matrix
1123  , bool SO > // Storage order of the adapted dense matrix
1124 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( ElementType* ptr, size_t n, size_t nn )
1125  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1126 {
1127  if( !isStrictlyUpper( matrix_ ) ) {
1128  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
1129  }
1130 
1131  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1132 }
1134 //*************************************************************************************************
1135 
1136 
1137 //*************************************************************************************************
1143 template< typename MT // Type of the adapted dense matrix
1144  , bool SO > // Storage order of the adapted dense matrix
1145 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( const StrictlyUpperMatrix& m )
1146  : matrix_( m.matrix_ ) // The adapted dense matrix
1147 {
1148  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1149  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1150 }
1152 //*************************************************************************************************
1153 
1154 
1155 //*************************************************************************************************
1161 template< typename MT // Type of the adapted dense matrix
1162  , bool SO > // Storage order of the adapted dense matrix
1163 inline StrictlyUpperMatrix<MT,SO,true>::StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept
1164  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1165 {
1166  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1167  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1168 }
1170 //*************************************************************************************************
1171 
1172 
1173 
1174 
1175 //=================================================================================================
1176 //
1177 // DATA ACCESS FUNCTIONS
1178 //
1179 //=================================================================================================
1180 
1181 //*************************************************************************************************
1197 template< typename MT // Type of the adapted dense matrix
1198  , bool SO > // Storage order of the adapted dense matrix
1200  StrictlyUpperMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1201 {
1202  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1203  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1204 
1205  return Reference( matrix_, i, j );
1206 }
1208 //*************************************************************************************************
1209 
1210 
1211 //*************************************************************************************************
1227 template< typename MT // Type of the adapted dense matrix
1228  , bool SO > // Storage order of the adapted dense matrix
1230  StrictlyUpperMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1231 {
1232  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1233  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1234 
1235  return matrix_(i,j);
1236 }
1238 //*************************************************************************************************
1239 
1240 
1241 //*************************************************************************************************
1258 template< typename MT // Type of the adapted dense matrix
1259  , bool SO > // Storage order of the adapted dense matrix
1261  StrictlyUpperMatrix<MT,SO,true>::at( size_t i, size_t j )
1262 {
1263  if( i >= rows() ) {
1264  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1265  }
1266  if( j >= columns() ) {
1267  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1268  }
1269  return (*this)(i,j);
1270 }
1272 //*************************************************************************************************
1273 
1274 
1275 //*************************************************************************************************
1292 template< typename MT // Type of the adapted dense matrix
1293  , bool SO > // Storage order of the adapted dense matrix
1295  StrictlyUpperMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1296 {
1297  if( i >= rows() ) {
1298  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1299  }
1300  if( j >= columns() ) {
1301  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1302  }
1303  return (*this)(i,j);
1304 }
1306 //*************************************************************************************************
1307 
1308 
1309 //*************************************************************************************************
1322 template< typename MT // Type of the adapted dense matrix
1323  , bool SO > // Storage order of the adapted dense matrix
1324 inline typename StrictlyUpperMatrix<MT,SO,true>::ConstPointer
1325  StrictlyUpperMatrix<MT,SO,true>::data() const noexcept
1326 {
1327  return matrix_.data();
1328 }
1330 //*************************************************************************************************
1331 
1332 
1333 //*************************************************************************************************
1342 template< typename MT // Type of the adapted dense matrix
1343  , bool SO > // Storage order of the adapted dense matrix
1344 inline typename StrictlyUpperMatrix<MT,SO,true>::ConstPointer
1345  StrictlyUpperMatrix<MT,SO,true>::data( size_t i ) const noexcept
1346 {
1347  return matrix_.data(i);
1348 }
1350 //*************************************************************************************************
1351 
1352 
1353 //*************************************************************************************************
1365 template< typename MT // Type of the adapted dense matrix
1366  , bool SO > // Storage order of the adapted dense matrix
1369 {
1370  if( SO )
1371  return Iterator( matrix_, 0UL, i );
1372  else
1373  return Iterator( matrix_, i, 0UL );
1374 }
1376 //*************************************************************************************************
1377 
1378 
1379 //*************************************************************************************************
1391 template< typename MT // Type of the adapted dense matrix
1392  , bool SO > // Storage order of the adapted dense matrix
1394  StrictlyUpperMatrix<MT,SO,true>::begin( size_t i ) const
1395 {
1396  return matrix_.begin(i);
1397 }
1399 //*************************************************************************************************
1400 
1401 
1402 //*************************************************************************************************
1414 template< typename MT // Type of the adapted dense matrix
1415  , bool SO > // Storage order of the adapted dense matrix
1417  StrictlyUpperMatrix<MT,SO,true>::cbegin( size_t i ) const
1418 {
1419  return matrix_.cbegin(i);
1420 }
1422 //*************************************************************************************************
1423 
1424 
1425 //*************************************************************************************************
1437 template< typename MT // Type of the adapted dense matrix
1438  , bool SO > // Storage order of the adapted dense matrix
1441 {
1442  if( SO )
1443  return Iterator( matrix_, rows(), i );
1444  else
1445  return Iterator( matrix_, i, columns() );
1446 }
1448 //*************************************************************************************************
1449 
1450 
1451 //*************************************************************************************************
1463 template< typename MT // Type of the adapted dense matrix
1464  , bool SO > // Storage order of the adapted dense matrix
1466  StrictlyUpperMatrix<MT,SO,true>::end( size_t i ) const
1467 {
1468  return matrix_.end(i);
1469 }
1471 //*************************************************************************************************
1472 
1473 
1474 //*************************************************************************************************
1486 template< typename MT // Type of the adapted dense matrix
1487  , bool SO > // Storage order of the adapted dense matrix
1489  StrictlyUpperMatrix<MT,SO,true>::cend( size_t i ) const
1490 {
1491  return matrix_.cend(i);
1492 }
1494 //*************************************************************************************************
1495 
1496 
1497 
1498 
1499 //=================================================================================================
1500 //
1501 // ASSIGNMENT OPERATORS
1502 //
1503 //=================================================================================================
1504 
1505 //*************************************************************************************************
1512 template< typename MT // Type of the adapted dense matrix
1513  , bool SO > // Storage order of the adapted dense matrix
1514 inline StrictlyUpperMatrix<MT,SO,true>&
1515  StrictlyUpperMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1516 {
1517  if( SO ) {
1518  for( size_t j=1UL; j<columns(); ++j )
1519  for( size_t i=0UL; i<j; ++i )
1520  matrix_(i,j) = rhs;
1521  }
1522  else {
1523  for( size_t i=0UL; i<rows(); ++i )
1524  for( size_t j=i+1UL; j<columns(); ++j )
1525  matrix_(i,j) = rhs;
1526  }
1527 
1528  return *this;
1529 }
1531 //*************************************************************************************************
1532 
1533 
1534 //*************************************************************************************************
1558 template< typename MT // Type of the adapted dense matrix
1559  , bool SO > // Storage order of the adapted dense matrix
1560 inline StrictlyUpperMatrix<MT,SO,true>&
1561  StrictlyUpperMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1562 {
1563  MT tmp( list );
1564 
1565  if( !isStrictlyUpper( tmp ) ) {
1566  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1567  }
1568 
1569  matrix_ = std::move( tmp );
1570 
1571  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1572  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1573 
1574  return *this;
1575 }
1577 //*************************************************************************************************
1578 
1579 
1580 //*************************************************************************************************
1605 template< typename MT // Type of the adapted dense matrix
1606  , bool SO > // Storage order of the adapted dense matrix
1607 template< typename Other // Data type of the initialization array
1608  , size_t N > // Number of rows and columns of the initialization array
1609 inline StrictlyUpperMatrix<MT,SO,true>&
1610  StrictlyUpperMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1611 {
1612  MT tmp( array );
1613 
1614  if( !isStrictlyUpper( tmp ) ) {
1615  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1616  }
1617 
1618  matrix_ = std::move( tmp );
1619 
1620  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1621  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1622 
1623  return *this;
1624 }
1626 //*************************************************************************************************
1627 
1628 
1629 //*************************************************************************************************
1639 template< typename MT // Type of the adapted dense matrix
1640  , bool SO > // Storage order of the adapted dense matrix
1641 inline StrictlyUpperMatrix<MT,SO,true>&
1642  StrictlyUpperMatrix<MT,SO,true>::operator=( const StrictlyUpperMatrix& rhs )
1643 {
1644  matrix_ = rhs.matrix_;
1645 
1646  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1647  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1648 
1649  return *this;
1650 }
1652 //*************************************************************************************************
1653 
1654 
1655 //*************************************************************************************************
1662 template< typename MT // Type of the adapted dense matrix
1663  , bool SO > // Storage order of the adapted dense matrix
1664 inline StrictlyUpperMatrix<MT,SO,true>&
1665  StrictlyUpperMatrix<MT,SO,true>::operator=( StrictlyUpperMatrix&& rhs ) noexcept
1666 {
1667  matrix_ = std::move( rhs.matrix_ );
1668 
1669  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1670  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1671 
1672  return *this;
1673 }
1675 //*************************************************************************************************
1676 
1677 
1678 //*************************************************************************************************
1691 template< typename MT // Type of the adapted dense matrix
1692  , bool SO > // Storage order of the adapted dense matrix
1693 template< typename MT2 // Type of the right-hand side matrix
1694  , bool SO2 > // Storage order of the right-hand side matrix
1695 inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >
1696  StrictlyUpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1697 {
1698  if( IsUniTriangular<MT2>::value ||
1699  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) ) {
1700  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1701  }
1702 
1703  matrix_ = declupp( ~rhs );
1704 
1705  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1706  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1707 
1708  return *this;
1709 }
1711 //*************************************************************************************************
1712 
1713 
1714 //*************************************************************************************************
1727 template< typename MT // Type of the adapted dense matrix
1728  , bool SO > // Storage order of the adapted dense matrix
1729 template< typename MT2 // Type of the right-hand side matrix
1730  , bool SO2 > // Storage order of the right-hand side matrix
1731 inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >
1732  StrictlyUpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1733 {
1734  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1735  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1736  }
1737 
1738  if( IsStrictlyUpper<MT2>::value ) {
1739  matrix_ = ~rhs;
1740  }
1741  else {
1742  MT tmp( ~rhs );
1743 
1744  if( !isStrictlyUpper( tmp ) ) {
1745  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1746  }
1747 
1748  matrix_ = std::move( tmp );
1749  }
1750 
1751  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1752  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1753 
1754  return *this;
1755 }
1757 //*************************************************************************************************
1758 
1759 
1760 //*************************************************************************************************
1773 template< typename MT // Type of the adapted dense matrix
1774  , bool SO > // Storage order of the adapted dense matrix
1775 template< typename MT2 // Type of the right-hand side matrix
1776  , bool SO2 > // Storage order of the right-hand side matrix
1777 inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >
1778  StrictlyUpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1779 {
1780  if( IsUniTriangular<MT2>::value ||
1781  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) ) {
1782  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1783  }
1784 
1785  matrix_ += declupp( ~rhs );
1786 
1787  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1788  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1789 
1790  return *this;
1791 }
1793 //*************************************************************************************************
1794 
1795 
1796 //*************************************************************************************************
1809 template< typename MT // Type of the adapted dense matrix
1810  , bool SO > // Storage order of the adapted dense matrix
1811 template< typename MT2 // Type of the right-hand side matrix
1812  , bool SO2 > // Storage order of the right-hand side matrix
1813 inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >
1814  StrictlyUpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1815 {
1816  if( IsUniTriangular<MT2>::value || ( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) ) {
1817  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1818  }
1819 
1820  if( IsStrictlyUpper<MT2>::value ) {
1821  matrix_ += ~rhs;
1822  }
1823  else {
1824  const ResultType_<MT2> tmp( ~rhs );
1825 
1826  if( !isStrictlyUpper( tmp ) ) {
1827  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1828  }
1829 
1830  matrix_ += declupp( tmp );
1831  }
1832 
1833  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1834  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1835 
1836  return *this;
1837 }
1839 //*************************************************************************************************
1840 
1841 
1842 //*************************************************************************************************
1855 template< typename MT // Type of the adapted dense matrix
1856  , bool SO > // Storage order of the adapted dense matrix
1857 template< typename MT2 // Type of the right-hand side matrix
1858  , bool SO2 > // Storage order of the right-hand side matrix
1859 inline DisableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >
1860  StrictlyUpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1861 {
1862  if( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( ~rhs ) ) {
1863  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1864  }
1865 
1866  matrix_ -= declupp( ~rhs );
1867 
1868  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1869  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1870 
1871  return *this;
1872 }
1874 //*************************************************************************************************
1875 
1876 
1877 //*************************************************************************************************
1890 template< typename MT // Type of the adapted dense matrix
1891  , bool SO > // Storage order of the adapted dense matrix
1892 template< typename MT2 // Type of the right-hand side matrix
1893  , bool SO2 > // Storage order of the right-hand side matrix
1894 inline EnableIf_< IsComputation<MT2>, StrictlyUpperMatrix<MT,SO,true>& >
1895  StrictlyUpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1896 {
1897  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1898  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1899  }
1900 
1901  if( IsStrictlyUpper<MT2>::value ) {
1902  matrix_ -= ~rhs;
1903  }
1904  else {
1905  const ResultType_<MT2> tmp( ~rhs );
1906 
1907  if( !isStrictlyUpper( tmp ) ) {
1908  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1909  }
1910 
1911  matrix_ -= declupp( tmp );
1912  }
1913 
1914  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1915  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1916 
1917  return *this;
1918 }
1920 //*************************************************************************************************
1921 
1922 
1923 //*************************************************************************************************
1934 template< typename MT // Type of the adapted dense matrix
1935  , bool SO > // Storage order of the adapted dense matrix
1936 template< typename MT2 // Type of the right-hand side matrix
1937  , bool SO2 > // Storage order of the right-hand side matrix
1938 inline StrictlyUpperMatrix<MT,SO,true>&
1939  StrictlyUpperMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
1940 {
1941  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1942  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1943  }
1944 
1945  matrix_ %= ~rhs;
1946 
1947  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1948  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1949 
1950  return *this;
1951 }
1953 //*************************************************************************************************
1954 
1955 
1956 //*************************************************************************************************
1968 template< typename MT // Type of the adapted dense matrix
1969  , bool SO > // Storage order of the adapted dense matrix
1970 template< typename MT2 // Type of the right-hand side matrix
1971  , bool SO2 > // Storage order of the right-hand side matrix
1972 inline StrictlyUpperMatrix<MT,SO,true>&
1973  StrictlyUpperMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1974 {
1975  if( matrix_.rows() != (~rhs).columns() ) {
1976  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1977  }
1978 
1979  MT tmp( matrix_ * ~rhs );
1980 
1981  if( !isStrictlyUpper( tmp ) ) {
1982  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1983  }
1984 
1985  matrix_ = std::move( tmp );
1986 
1987  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1988  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1989 
1990  return *this;
1991 }
1993 //*************************************************************************************************
1994 
1995 
1996 //*************************************************************************************************
2004 template< typename MT // Type of the adapted dense matrix
2005  , bool SO > // Storage order of the adapted dense matrix
2006 template< typename Other > // Data type of the right-hand side scalar
2007 inline EnableIf_< IsNumeric<Other>, StrictlyUpperMatrix<MT,SO,true> >&
2009 {
2010  matrix_ *= rhs;
2011  return *this;
2012 }
2013 //*************************************************************************************************
2014 
2015 
2016 //*************************************************************************************************
2024 template< typename MT // Type of the adapted dense matrix
2025  , bool SO > // Storage order of the adapted dense matrix
2026 template< typename Other > // Data type of the right-hand side scalar
2027 inline EnableIf_< IsNumeric<Other>, StrictlyUpperMatrix<MT,SO,true> >&
2029 {
2030  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2031 
2032  matrix_ /= rhs;
2033  return *this;
2034 }
2036 //*************************************************************************************************
2037 
2038 
2039 
2040 
2041 //=================================================================================================
2042 //
2043 // UTILITY FUNCTIONS
2044 //
2045 //=================================================================================================
2046 
2047 //*************************************************************************************************
2053 template< typename MT // Type of the adapted dense matrix
2054  , bool SO > // Storage order of the adapted dense matrix
2055 inline size_t StrictlyUpperMatrix<MT,SO,true>::rows() const noexcept
2056 {
2057  return matrix_.rows();
2058 }
2060 //*************************************************************************************************
2061 
2062 
2063 //*************************************************************************************************
2069 template< typename MT // Type of the adapted dense matrix
2070  , bool SO > // Storage order of the adapted dense matrix
2071 inline size_t StrictlyUpperMatrix<MT,SO,true>::columns() const noexcept
2072 {
2073  return matrix_.columns();
2074 }
2076 //*************************************************************************************************
2077 
2078 
2079 //*************************************************************************************************
2090 template< typename MT // Type of the adapted dense matrix
2091  , bool SO > // Storage order of the adapted dense matrix
2092 inline size_t StrictlyUpperMatrix<MT,SO,true>::spacing() const noexcept
2093 {
2094  return matrix_.spacing();
2095 }
2097 //*************************************************************************************************
2098 
2099 
2100 //*************************************************************************************************
2106 template< typename MT // Type of the adapted dense matrix
2107  , bool SO > // Storage order of the adapted dense matrix
2108 inline size_t StrictlyUpperMatrix<MT,SO,true>::capacity() const noexcept
2109 {
2110  return matrix_.capacity();
2111 }
2113 //*************************************************************************************************
2114 
2115 
2116 //*************************************************************************************************
2128 template< typename MT // Type of the adapted dense matrix
2129  , bool SO > // Storage order of the adapted dense matrix
2130 inline size_t StrictlyUpperMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2131 {
2132  return matrix_.capacity(i);
2133 }
2135 //*************************************************************************************************
2136 
2137 
2138 //*************************************************************************************************
2144 template< typename MT // Type of the adapted dense matrix
2145  , bool SO > // Storage order of the adapted dense matrix
2146 inline size_t StrictlyUpperMatrix<MT,SO,true>::nonZeros() const
2147 {
2148  return matrix_.nonZeros();
2149 }
2151 //*************************************************************************************************
2152 
2153 
2154 //*************************************************************************************************
2166 template< typename MT // Type of the adapted dense matrix
2167  , bool SO > // Storage order of the adapted dense matrix
2168 inline size_t StrictlyUpperMatrix<MT,SO,true>::nonZeros( size_t i ) const
2169 {
2170  return matrix_.nonZeros(i);
2171 }
2173 //*************************************************************************************************
2174 
2175 
2176 //*************************************************************************************************
2182 template< typename MT // Type of the adapted dense matrix
2183  , bool SO > // Storage order of the adapted dense matrix
2185 {
2186  using blaze::clear;
2187 
2188  if( SO ) {
2189  for( size_t j=1UL; j<columns(); ++j )
2190  for( size_t i=0UL; i<j; ++i )
2191  clear( matrix_(i,j) );
2192  }
2193  else {
2194  for( size_t i=0UL; i<rows(); ++i )
2195  for( size_t j=i+1UL; j<columns(); ++j )
2196  clear( matrix_(i,j) );
2197  }
2198 }
2200 //*************************************************************************************************
2201 
2202 
2203 //*************************************************************************************************
2216 template< typename MT // Type of the adapted dense matrix
2217  , bool SO > // Storage order of the adapted dense matrix
2218 inline void StrictlyUpperMatrix<MT,SO,true>::reset( size_t i )
2219 {
2220  using blaze::clear;
2221 
2222  if( SO ) {
2223  for( size_t j=0UL; j<i; ++j )
2224  clear( matrix_(j,i) );
2225  }
2226  else {
2227  for( size_t j=i+1UL; j<columns(); ++j )
2228  clear( matrix_(i,j) );
2229  }
2230 }
2232 //*************************************************************************************************
2233 
2234 
2235 //*************************************************************************************************
2247 template< typename MT // Type of the adapted dense matrix
2248  , bool SO > // Storage order of the adapted dense matrix
2250 {
2251  using blaze::clear;
2252 
2253  if( IsResizable<MT>::value ) {
2254  clear( matrix_ );
2255  }
2256  else {
2257  reset();
2258  }
2259 }
2261 //*************************************************************************************************
2262 
2263 
2264 //*************************************************************************************************
2300 template< typename MT // Type of the adapted dense matrix
2301  , bool SO > // Storage order of the adapted dense matrix
2302 void StrictlyUpperMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2303 {
2305 
2306  UNUSED_PARAMETER( preserve );
2307 
2308  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
2309 
2310  const size_t oldsize( matrix_.rows() );
2311 
2312  matrix_.resize( n, n, true );
2313 
2314  if( n > oldsize )
2315  {
2316  const size_t increment( n - oldsize );
2317  submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2318  }
2319 }
2321 //*************************************************************************************************
2322 
2323 
2324 //*************************************************************************************************
2337 template< typename MT // Type of the adapted dense matrix
2338  , bool SO > // Storage order of the adapted dense matrix
2339 inline void StrictlyUpperMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2340 {
2342 
2343  UNUSED_PARAMETER( preserve );
2344 
2345  resize( rows() + n, true );
2346 }
2347 //*************************************************************************************************
2348 
2349 
2350 //*************************************************************************************************
2360 template< typename MT // Type of the adapted dense matrix
2361  , bool SO > // Storage order of the adapted dense matrix
2362 inline void StrictlyUpperMatrix<MT,SO,true>::reserve( size_t elements )
2363 {
2364  matrix_.reserve( elements );
2365 }
2367 //*************************************************************************************************
2368 
2369 
2370 //*************************************************************************************************
2380 template< typename MT // Type of the adapted dense matrix
2381  , bool SO > // Storage order of the adapted dense matrix
2383 {
2384  matrix_.shrinkToFit();
2385 }
2387 //*************************************************************************************************
2388 
2389 
2390 //*************************************************************************************************
2397 template< typename MT // Type of the adapted dense matrix
2398  , bool SO > // Storage order of the adapted dense matrix
2399 inline void StrictlyUpperMatrix<MT,SO,true>::swap( StrictlyUpperMatrix& m ) noexcept
2400 {
2401  using std::swap;
2402 
2403  swap( matrix_, m.matrix_ );
2404 }
2406 //*************************************************************************************************
2407 
2408 
2409 //*************************************************************************************************
2421 template< typename MT // Type of the adapted dense matrix
2422  , bool SO > // Storage order of the adapted dense matrix
2423 inline constexpr size_t StrictlyUpperMatrix<MT,SO,true>::maxNonZeros() noexcept
2424 {
2426 
2427  return maxNonZeros( Rows<MT>::value );
2428 }
2430 //*************************************************************************************************
2431 
2432 
2433 //*************************************************************************************************
2443 template< typename MT // Type of the adapted dense matrix
2444  , bool SO > // Storage order of the adapted dense matrix
2445 inline constexpr size_t StrictlyUpperMatrix<MT,SO,true>::maxNonZeros( size_t n ) noexcept
2446 {
2447  return ( ( n - 1UL ) * n ) / 2UL;
2448 }
2450 //*************************************************************************************************
2451 
2452 
2453 
2454 
2455 //=================================================================================================
2456 //
2457 // NUMERIC FUNCTIONS
2458 //
2459 //=================================================================================================
2460 
2461 //*************************************************************************************************
2479 template< typename MT // Type of the adapted dense matrix
2480  , bool SO > // Storage order of the adapted dense matrix
2481 template< typename Other > // Data type of the scalar value
2482 inline StrictlyUpperMatrix<MT,SO,true>&
2483  StrictlyUpperMatrix<MT,SO,true>::scale( const Other& scalar )
2484 {
2485  matrix_.scale( scalar );
2486  return *this;
2487 }
2489 //*************************************************************************************************
2490 
2491 
2492 
2493 
2494 //=================================================================================================
2495 //
2496 // DEBUGGING FUNCTIONS
2497 //
2498 //=================================================================================================
2499 
2500 //*************************************************************************************************
2510 template< typename MT // Type of the adapted dense matrix
2511  , bool SO > // Storage order of the adapted dense matrix
2512 inline bool StrictlyUpperMatrix<MT,SO,true>::isIntact() const noexcept
2513 {
2514  using blaze::isIntact;
2515 
2516  return ( isIntact( matrix_ ) && isStrictlyUpper( matrix_ ) );
2517 }
2519 //*************************************************************************************************
2520 
2521 
2522 
2523 
2524 //=================================================================================================
2525 //
2526 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2527 //
2528 //=================================================================================================
2529 
2530 //*************************************************************************************************
2541 template< typename MT // Type of the adapted dense matrix
2542  , bool SO > // Storage order of the adapted dense matrix
2543 template< typename Other > // Data type of the foreign expression
2544 inline bool StrictlyUpperMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2545 {
2546  return matrix_.canAlias( alias );
2547 }
2549 //*************************************************************************************************
2550 
2551 
2552 //*************************************************************************************************
2563 template< typename MT // Type of the adapted dense matrix
2564  , bool SO > // Storage order of the adapted dense matrix
2565 template< typename Other > // Data type of the foreign expression
2566 inline bool StrictlyUpperMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2567 {
2568  return matrix_.isAliased( alias );
2569 }
2571 //*************************************************************************************************
2572 
2573 
2574 //*************************************************************************************************
2584 template< typename MT // Type of the adapted dense matrix
2585  , bool SO > // Storage order of the adapted dense matrix
2586 inline bool StrictlyUpperMatrix<MT,SO,true>::isAligned() const noexcept
2587 {
2588  return matrix_.isAligned();
2589 }
2591 //*************************************************************************************************
2592 
2593 
2594 //*************************************************************************************************
2605 template< typename MT // Type of the adapted dense matrix
2606  , bool SO > // Storage order of the adapted dense matrix
2607 inline bool StrictlyUpperMatrix<MT,SO,true>::canSMPAssign() const noexcept
2608 {
2609  return matrix_.canSMPAssign();
2610 }
2612 //*************************************************************************************************
2613 
2614 
2615 //*************************************************************************************************
2631 template< typename MT // Type of the adapted dense matrix
2632  , bool SO > // Storage order of the adapted dense matrix
2633 BLAZE_ALWAYS_INLINE typename StrictlyUpperMatrix<MT,SO,true>::SIMDType
2634  StrictlyUpperMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2635 {
2636  return matrix_.load( i, j );
2637 }
2639 //*************************************************************************************************
2640 
2641 
2642 //*************************************************************************************************
2658 template< typename MT // Type of the adapted dense matrix
2659  , bool SO > // Storage order of the adapted dense matrix
2660 BLAZE_ALWAYS_INLINE typename StrictlyUpperMatrix<MT,SO,true>::SIMDType
2661  StrictlyUpperMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2662 {
2663  return matrix_.loada( i, j );
2664 }
2666 //*************************************************************************************************
2667 
2668 
2669 //*************************************************************************************************
2685 template< typename MT // Type of the adapted dense matrix
2686  , bool SO > // Storage order of the adapted dense matrix
2687 BLAZE_ALWAYS_INLINE typename StrictlyUpperMatrix<MT,SO,true>::SIMDType
2688  StrictlyUpperMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2689 {
2690  return matrix_.loadu( i, j );
2691 }
2693 //*************************************************************************************************
2694 
2695 
2696 
2697 
2698 //=================================================================================================
2699 //
2700 // CONSTRUCTION FUNCTIONS
2701 //
2702 //=================================================================================================
2703 
2704 //*************************************************************************************************
2711 template< typename MT // Type of the adapted dense matrix
2712  , bool SO > // Storage order of the adapted dense matrix
2713 inline const MT StrictlyUpperMatrix<MT,SO,true>::construct( size_t n, TrueType )
2714 {
2716 
2717  return MT( n, n, ElementType() );
2718 }
2720 //*************************************************************************************************
2721 
2722 
2723 //*************************************************************************************************
2730 template< typename MT // Type of the adapted dense matrix
2731  , bool SO > // Storage order of the adapted dense matrix
2732 inline const MT StrictlyUpperMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2733 {
2736 
2737  MT tmp;
2738 
2739  if( SO ) {
2740  for( size_t j=0UL; j<columns(); ++j ) {
2741  for( size_t i=0UL; i<j; ++i )
2742  tmp(i,j) = init;
2743  }
2744  }
2745  else {
2746  for( size_t i=0UL; i<rows(); ++i ) {
2747  for( size_t j=i+1UL; j<columns(); ++j )
2748  tmp(i,j) = init;
2749  }
2750  }
2751 
2752  return tmp;
2753 }
2755 //*************************************************************************************************
2756 
2757 
2758 //*************************************************************************************************
2769 template< typename MT // Type of the adapted dense matrix
2770  , bool SO > // Storage order of the adapted dense matrix
2771 template< typename MT2 // Type of the foreign matrix
2772  , bool SO2 // Storage order of the foreign matrix
2773  , typename T > // Type of the third argument
2774 inline const MT StrictlyUpperMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2775 {
2776  const MT tmp( ~m );
2777 
2778  if( IsUniTriangular<MT2>::value ||
2779  ( !IsStrictlyUpper<MT2>::value && !isStrictlyUpper( tmp ) ) ) {
2780  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
2781  }
2782 
2783  return tmp;
2784 }
2786 //*************************************************************************************************
2787 
2788 } // namespace blaze
2789 
2790 #endif
Header file for the StrictlyUpperProxy class.
Constraint on the data type.
Header file for the implementation of the Submatrix view.
#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
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
#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:3079
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
Header file for the FalseType type/value trait base class.
#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_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
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:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:609
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5845
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Submatrix< MT, AF > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:352
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.h:1027
#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:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
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:308
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:242
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:110
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a square matrix type, a compilation error is created.
Definition: Square.h:60
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
Constraint on the data type.
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:3084
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#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:5924
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5907
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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:3081
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
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:340
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
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:548
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:264
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
Header file for the implementation of the base template of the StrictlyUpperMatrix.
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:1500
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_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a &#39;resize&#39; member fu...
Definition: Resizable.h:81
#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:270
Constraint on the data type.
Constraint on the data type.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:405
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
#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:3083
#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:252
#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
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#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:742
Header file for the IsResizable type trait.
System settings for the inline keywords.
#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
Header file for the TrueType type/value trait base class.