Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UPPERMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_UPPERMATRIX_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>
72 #include <blaze/system/Inline.h>
73 #include <blaze/util/Assert.h>
79 #include <blaze/util/DisableIf.h>
80 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/FalseType.h>
83 #include <blaze/util/TrueType.h>
84 #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 UpperMatrix<MT,SO,true>
108  : public DenseMatrix< UpperMatrix<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 = UpperMatrix<MT,SO,true>;
120  using BaseType = DenseMatrix<This,SO>;
121  using ResultType = This;
122  using OppositeType = UpperMatrix<OT,!SO,true>;
123  using TransposeType = LowerMatrix<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 = UpperProxy<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 = UpperMatrix< 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 = UpperMatrix< 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 = UpperProxy<MT>;
166  using ReferenceType = UpperProxy<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 UpperMatrix();
642  template< typename A1 > explicit inline UpperMatrix( const A1& a1 );
643  explicit inline UpperMatrix( size_t n, const ElementType& init );
644 
645  explicit inline UpperMatrix( initializer_list< initializer_list<ElementType> > list );
646 
647  template< typename Other >
648  explicit inline UpperMatrix( size_t n, const Other* array );
649 
650  template< typename Other, size_t N >
651  explicit inline UpperMatrix( const Other (&array)[N][N] );
652 
653  explicit inline UpperMatrix( ElementType* ptr, size_t n );
654  explicit inline UpperMatrix( ElementType* ptr, size_t n, size_t nn );
655 
656  inline UpperMatrix( const UpperMatrix& m );
657  inline UpperMatrix( UpperMatrix&& 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 UpperMatrix& operator=( const ElementType& rhs );
687  inline UpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
688 
689  template< typename Other, size_t N >
690  inline UpperMatrix& operator=( const Other (&array)[N][N] );
691 
692  inline UpperMatrix& operator=( const UpperMatrix& rhs );
693  inline UpperMatrix& operator=( UpperMatrix&& rhs ) noexcept;
694 
695  template< typename MT2, bool SO2 >
696  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
697 
698  template< typename MT2, bool SO2 >
699  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
700 
701  template< typename MT2, bool SO2 >
702  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
703 
704  template< typename MT2, bool SO2 >
705  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
706 
707  template< typename MT2, bool SO2 >
708  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
709 
710  template< typename MT2, bool SO2 >
711  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
712 
713  template< typename MT2, bool SO2 >
714  inline UpperMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
715 
716  template< typename MT2, bool SO2 >
717  inline UpperMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
718 
719  template< typename Other >
720  inline EnableIf_< IsNumeric<Other>, UpperMatrix >& operator*=( Other rhs );
721 
722  template< typename Other >
723  inline EnableIf_< IsNumeric<Other>, UpperMatrix >& operator/=( Other rhs );
725  //**********************************************************************************************
726 
727  //**Utility functions***************************************************************************
730  inline size_t rows() const noexcept;
731  inline size_t columns() const noexcept;
732  inline size_t spacing() const noexcept;
733  inline size_t capacity() const noexcept;
734  inline size_t capacity( size_t i ) const noexcept;
735  inline size_t nonZeros() const;
736  inline size_t nonZeros( size_t i ) const;
737  inline void reset();
738  inline void reset( size_t i );
739  inline void clear();
740  void resize ( size_t n, bool preserve=true );
741  inline void extend ( size_t n, bool preserve=true );
742  inline void reserve( size_t elements );
743  inline void shrinkToFit();
744  inline void swap( UpperMatrix& m ) noexcept;
745 
746  static inline constexpr size_t maxNonZeros() noexcept;
747  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
749  //**********************************************************************************************
750 
751  //**Numeric functions***************************************************************************
754  template< typename Other > inline UpperMatrix& scale( const Other& scalar );
756  //**********************************************************************************************
757 
758  //**Debugging functions*************************************************************************
761  inline bool isIntact() const noexcept;
763  //**********************************************************************************************
764 
765  //**Expression template evaluation functions****************************************************
768  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
769  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
770 
771  inline bool isAligned () const noexcept;
772  inline bool canSMPAssign() const noexcept;
773 
774  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
775  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
776  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
778  //**********************************************************************************************
779 
780  private:
781  //**Construction functions**********************************************************************
784  inline const MT construct( size_t n , TrueType );
785  inline const MT construct( const ElementType& value, FalseType );
786 
787  template< typename MT2, bool SO2, typename T >
788  inline const MT construct( const Matrix<MT2,SO2>& m, T );
790  //**********************************************************************************************
791 
792  //**Member variables****************************************************************************
795  MT matrix_;
796 
797  //**********************************************************************************************
798 
799  //**Friend declarations*************************************************************************
800  template< bool RF, typename MT2, bool SO2, bool DF2 >
801  friend bool isDefault( const UpperMatrix<MT2,SO2,DF2>& m );
802 
803  template< typename MT2, bool SO2, bool DF2 >
804  friend MT2& derestrict( UpperMatrix<MT2,SO2,DF2>& m );
805  //**********************************************************************************************
806 
807  //**Compile time checks*************************************************************************
820  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
821  //**********************************************************************************************
822 };
824 //*************************************************************************************************
825 
826 
827 
828 
829 //=================================================================================================
830 //
831 // CONSTRUCTORS
832 //
833 //=================================================================================================
834 
835 //*************************************************************************************************
839 template< typename MT // Type of the adapted dense matrix
840  , bool SO > // Storage order of the adapted dense matrix
841 inline UpperMatrix<MT,SO,true>::UpperMatrix()
842  : matrix_() // The adapted dense matrix
843 {
844  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
845  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
846 }
848 //*************************************************************************************************
849 
850 
851 //*************************************************************************************************
869 template< typename MT // Type of the adapted dense matrix
870  , bool SO > // Storage order of the adapted dense matrix
871 template< typename A1 > // Type of the constructor argument
872 inline UpperMatrix<MT,SO,true>::UpperMatrix( const A1& a1 )
873  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
874 {
875  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
876  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
877 }
879 //*************************************************************************************************
880 
881 
882 //*************************************************************************************************
889 template< typename MT // Type of the adapted dense matrix
890  , bool SO > // Storage order of the adapted dense matrix
891 inline UpperMatrix<MT,SO,true>::UpperMatrix( size_t n, const ElementType& init )
892  : matrix_( n, n, ElementType() ) // The adapted dense matrix
893 {
895 
896  if( SO ) {
897  for( size_t j=0UL; j<columns(); ++j )
898  for( size_t i=0UL; i<=j; ++i )
899  matrix_(i,j) = init;
900  }
901  else {
902  for( size_t i=0UL; i<rows(); ++i )
903  for( size_t j=i; j<columns(); ++j )
904  matrix_(i,j) = init;
905  }
906 
907  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
908  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
909 }
911 //*************************************************************************************************
912 
913 
914 //*************************************************************************************************
937 template< typename MT // Type of the adapted dense matrix
938  , bool SO > // Storage order of the adapted dense matrix
939 inline UpperMatrix<MT,SO,true>::UpperMatrix( initializer_list< initializer_list<ElementType> > list )
940  : matrix_( list ) // The adapted dense matrix
941 {
942  if( !isUpper( matrix_ ) ) {
943  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
944  }
945 
946  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
947 }
949 //*************************************************************************************************
950 
951 
952 //*************************************************************************************************
978 template< typename MT // Type of the adapted dense matrix
979  , bool SO > // Storage order of the adapted dense matrix
980 template< typename Other > // Data type of the initialization array
981 inline UpperMatrix<MT,SO,true>::UpperMatrix( size_t n, const Other* array )
982  : matrix_( n, n, array ) // The adapted dense matrix
983 {
984  if( !isUpper( matrix_ ) ) {
985  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
986  }
987 
988  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
989 }
991 //*************************************************************************************************
992 
993 
994 //*************************************************************************************************
1017 template< typename MT // Type of the adapted dense matrix
1018  , bool SO > // Storage order of the adapted dense matrix
1019 template< typename Other // Data type of the initialization array
1020  , size_t N > // Number of rows and columns of the initialization array
1021 inline UpperMatrix<MT,SO,true>::UpperMatrix( const Other (&array)[N][N] )
1022  : matrix_( array ) // The adapted dense matrix
1023 {
1024  if( !isUpper( matrix_ ) ) {
1025  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1026  }
1027 
1028  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1029 }
1031 //*************************************************************************************************
1032 
1033 
1034 //*************************************************************************************************
1066 template< typename MT // Type of the adapted dense matrix
1067  , bool SO > // Storage order of the adapted dense matrix
1068 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n )
1069  : matrix_( ptr, n, n ) // The adapted dense matrix
1070 {
1071  if( !isUpper( matrix_ ) ) {
1072  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1073  }
1074 
1075  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1076 }
1078 //*************************************************************************************************
1079 
1080 
1081 //*************************************************************************************************
1115 template< typename MT // Type of the adapted dense matrix
1116  , bool SO > // Storage order of the adapted dense matrix
1117 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n, size_t nn )
1118  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1119 {
1120  if( !isUpper( matrix_ ) ) {
1121  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1122  }
1123 
1124  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1125 }
1127 //*************************************************************************************************
1128 
1129 
1130 //*************************************************************************************************
1136 template< typename MT // Type of the adapted dense matrix
1137  , bool SO > // Storage order of the adapted dense matrix
1138 inline UpperMatrix<MT,SO,true>::UpperMatrix( const UpperMatrix& m )
1139  : matrix_( m.matrix_ ) // The adapted dense matrix
1140 {
1141  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1142  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1143 }
1145 //*************************************************************************************************
1146 
1147 
1148 //*************************************************************************************************
1154 template< typename MT // Type of the adapted dense matrix
1155  , bool SO > // Storage order of the adapted dense matrix
1156 inline UpperMatrix<MT,SO,true>::UpperMatrix( UpperMatrix&& m ) noexcept
1157  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1158 {
1159  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1160  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1161 }
1163 //*************************************************************************************************
1164 
1165 
1166 
1167 
1168 //=================================================================================================
1169 //
1170 // DATA ACCESS FUNCTIONS
1171 //
1172 //=================================================================================================
1173 
1174 //*************************************************************************************************
1190 template< typename MT // Type of the adapted dense matrix
1191  , bool SO > // Storage order of the adapted dense matrix
1192 inline typename UpperMatrix<MT,SO,true>::Reference
1193  UpperMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1194 {
1195  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1196  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1197 
1198  return Reference( matrix_, i, j );
1199 }
1201 //*************************************************************************************************
1202 
1203 
1204 //*************************************************************************************************
1220 template< typename MT // Type of the adapted dense matrix
1221  , bool SO > // Storage order of the adapted dense matrix
1223  UpperMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1224 {
1225  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1226  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1227 
1228  return matrix_(i,j);
1229 }
1231 //*************************************************************************************************
1232 
1233 
1234 //*************************************************************************************************
1251 template< typename MT // Type of the adapted dense matrix
1252  , bool SO > // Storage order of the adapted dense matrix
1253 inline typename UpperMatrix<MT,SO,true>::Reference
1254  UpperMatrix<MT,SO,true>::at( size_t i, size_t j )
1255 {
1256  if( i >= rows() ) {
1257  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1258  }
1259  if( j >= columns() ) {
1260  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1261  }
1262  return (*this)(i,j);
1263 }
1265 //*************************************************************************************************
1266 
1267 
1268 //*************************************************************************************************
1285 template< typename MT // Type of the adapted dense matrix
1286  , bool SO > // Storage order of the adapted dense matrix
1288  UpperMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1289 {
1290  if( i >= rows() ) {
1291  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1292  }
1293  if( j >= columns() ) {
1294  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1295  }
1296  return (*this)(i,j);
1297 }
1299 //*************************************************************************************************
1300 
1301 
1302 //*************************************************************************************************
1315 template< typename MT // Type of the adapted dense matrix
1316  , bool SO > // Storage order of the adapted dense matrix
1317 inline typename UpperMatrix<MT,SO,true>::ConstPointer
1318  UpperMatrix<MT,SO,true>::data() const noexcept
1319 {
1320  return matrix_.data();
1321 }
1323 //*************************************************************************************************
1324 
1325 
1326 //*************************************************************************************************
1335 template< typename MT // Type of the adapted dense matrix
1336  , bool SO > // Storage order of the adapted dense matrix
1337 inline typename UpperMatrix<MT,SO,true>::ConstPointer
1338  UpperMatrix<MT,SO,true>::data( size_t i ) const noexcept
1339 {
1340  return matrix_.data(i);
1341 }
1343 //*************************************************************************************************
1344 
1345 
1346 //*************************************************************************************************
1358 template< typename MT // Type of the adapted dense matrix
1359  , bool SO > // Storage order of the adapted dense matrix
1360 inline typename UpperMatrix<MT,SO,true>::Iterator
1361  UpperMatrix<MT,SO,true>::begin( size_t i )
1362 {
1363  if( SO )
1364  return Iterator( matrix_, 0UL, i );
1365  else
1366  return Iterator( matrix_, i, 0UL );
1367 }
1369 //*************************************************************************************************
1370 
1371 
1372 //*************************************************************************************************
1384 template< typename MT // Type of the adapted dense matrix
1385  , bool SO > // Storage order of the adapted dense matrix
1387  UpperMatrix<MT,SO,true>::begin( size_t i ) const
1388 {
1389  return matrix_.begin(i);
1390 }
1392 //*************************************************************************************************
1393 
1394 
1395 //*************************************************************************************************
1407 template< typename MT // Type of the adapted dense matrix
1408  , bool SO > // Storage order of the adapted dense matrix
1410  UpperMatrix<MT,SO,true>::cbegin( size_t i ) const
1411 {
1412  return matrix_.cbegin(i);
1413 }
1415 //*************************************************************************************************
1416 
1417 
1418 //*************************************************************************************************
1430 template< typename MT // Type of the adapted dense matrix
1431  , bool SO > // Storage order of the adapted dense matrix
1432 inline typename UpperMatrix<MT,SO,true>::Iterator
1433  UpperMatrix<MT,SO,true>::end( size_t i )
1434 {
1435  if( SO )
1436  return Iterator( matrix_, rows(), i );
1437  else
1438  return Iterator( matrix_, i, columns() );
1439 }
1441 //*************************************************************************************************
1442 
1443 
1444 //*************************************************************************************************
1456 template< typename MT // Type of the adapted dense matrix
1457  , bool SO > // Storage order of the adapted dense matrix
1459  UpperMatrix<MT,SO,true>::end( size_t i ) const
1460 {
1461  return matrix_.end(i);
1462 }
1464 //*************************************************************************************************
1465 
1466 
1467 //*************************************************************************************************
1479 template< typename MT // Type of the adapted dense matrix
1480  , bool SO > // Storage order of the adapted dense matrix
1482  UpperMatrix<MT,SO,true>::cend( size_t i ) const
1483 {
1484  return matrix_.cend(i);
1485 }
1487 //*************************************************************************************************
1488 
1489 
1490 
1491 
1492 //=================================================================================================
1493 //
1494 // ASSIGNMENT OPERATORS
1495 //
1496 //=================================================================================================
1497 
1498 //*************************************************************************************************
1505 template< typename MT // Type of the adapted dense matrix
1506  , bool SO > // Storage order of the adapted dense matrix
1507 inline UpperMatrix<MT,SO,true>&
1508  UpperMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1509 {
1510  if( SO ) {
1511  for( size_t j=0UL; j<columns(); ++j )
1512  for( size_t i=0UL; i<=j; ++i )
1513  matrix_(i,j) = rhs;
1514  }
1515  else {
1516  for( size_t i=0UL; i<rows(); ++i )
1517  for( size_t j=i; j<columns(); ++j )
1518  matrix_(i,j) = rhs;
1519  }
1520 
1521  return *this;
1522 }
1524 //*************************************************************************************************
1525 
1526 
1527 //*************************************************************************************************
1551 template< typename MT // Type of the adapted dense matrix
1552  , bool SO > // Storage order of the adapted dense matrix
1553 inline UpperMatrix<MT,SO,true>&
1554  UpperMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1555 {
1556  MT tmp( list );
1557 
1558  if( !isUpper( tmp ) ) {
1559  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1560  }
1561 
1562  matrix_ = std::move( tmp );
1563 
1564  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1565  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1566 
1567  return *this;
1568 }
1570 //*************************************************************************************************
1571 
1572 
1573 //*************************************************************************************************
1597 template< typename MT // Type of the adapted dense matrix
1598  , bool SO > // Storage order of the adapted dense matrix
1599 template< typename Other // Data type of the initialization array
1600  , size_t N > // Number of rows and columns of the initialization array
1601 inline UpperMatrix<MT,SO,true>&
1602  UpperMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1603 {
1604  MT tmp( array );
1605 
1606  if( !isUpper( tmp ) ) {
1607  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1608  }
1609 
1610  matrix_ = std::move( tmp );
1611 
1612  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1613  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1614 
1615  return *this;
1616 }
1618 //*************************************************************************************************
1619 
1620 
1621 //*************************************************************************************************
1631 template< typename MT // Type of the adapted dense matrix
1632  , bool SO > // Storage order of the adapted dense matrix
1633 inline UpperMatrix<MT,SO,true>&
1634  UpperMatrix<MT,SO,true>::operator=( const UpperMatrix& rhs )
1635 {
1636  matrix_ = rhs.matrix_;
1637 
1638  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1639  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1640 
1641  return *this;
1642 }
1644 //*************************************************************************************************
1645 
1646 
1647 //*************************************************************************************************
1654 template< typename MT // Type of the adapted dense matrix
1655  , bool SO > // Storage order of the adapted dense matrix
1656 inline UpperMatrix<MT,SO,true>&
1657  UpperMatrix<MT,SO,true>::operator=( UpperMatrix&& rhs ) noexcept
1658 {
1659  matrix_ = std::move( rhs.matrix_ );
1660 
1661  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1662  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1663 
1664  return *this;
1665 }
1667 //*************************************************************************************************
1668 
1669 
1670 //*************************************************************************************************
1683 template< typename MT // Type of the adapted dense matrix
1684  , bool SO > // Storage order of the adapted dense matrix
1685 template< typename MT2 // Type of the right-hand side matrix
1686  , bool SO2 > // Storage order of the right-hand side matrix
1687 inline DisableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1688  UpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1689 {
1690  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
1691  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1692  }
1693 
1694  matrix_ = declupp( ~rhs );
1695 
1696  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1697  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1698 
1699  return *this;
1700 }
1702 //*************************************************************************************************
1703 
1704 
1705 //*************************************************************************************************
1718 template< typename MT // Type of the adapted dense matrix
1719  , bool SO > // Storage order of the adapted dense matrix
1720 template< typename MT2 // Type of the right-hand side matrix
1721  , bool SO2 > // Storage order of the right-hand side matrix
1722 inline EnableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1723  UpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1724 {
1725  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1726  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1727  }
1728 
1729  if( IsUpper<MT2>::value ) {
1730  matrix_ = ~rhs;
1731  }
1732  else {
1733  MT tmp( ~rhs );
1734 
1735  if( !isUpper( tmp ) ) {
1736  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1737  }
1738 
1739  matrix_ = std::move( tmp );
1740  }
1741 
1742  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1743  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1744 
1745  return *this;
1746 }
1748 //*************************************************************************************************
1749 
1750 
1751 //*************************************************************************************************
1764 template< typename MT // Type of the adapted dense matrix
1765  , bool SO > // Storage order of the adapted dense matrix
1766 template< typename MT2 // Type of the right-hand side matrix
1767  , bool SO2 > // Storage order of the right-hand side matrix
1768 inline DisableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1769  UpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1770 {
1771  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
1772  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1773  }
1774 
1775  matrix_ += declupp( ~rhs );
1776 
1777  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1778  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1779 
1780  return *this;
1781 }
1783 //*************************************************************************************************
1784 
1785 
1786 //*************************************************************************************************
1799 template< typename MT // Type of the adapted dense matrix
1800  , bool SO > // Storage order of the adapted dense matrix
1801 template< typename MT2 // Type of the right-hand side matrix
1802  , bool SO2 > // Storage order of the right-hand side matrix
1803 inline EnableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1804  UpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1805 {
1806  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1807  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1808  }
1809 
1810  if( IsUpper<MT2>::value ) {
1811  matrix_ += ~rhs;
1812  }
1813  else {
1814  const ResultType_<MT2> tmp( ~rhs );
1815 
1816  if( !isUpper( tmp ) ) {
1817  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1818  }
1819 
1820  matrix_ += declupp( tmp );
1821  }
1822 
1823  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1824  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1825 
1826  return *this;
1827 }
1829 //*************************************************************************************************
1830 
1831 
1832 //*************************************************************************************************
1845 template< typename MT // Type of the adapted dense matrix
1846  , bool SO > // Storage order of the adapted dense matrix
1847 template< typename MT2 // Type of the right-hand side matrix
1848  , bool SO2 > // Storage order of the right-hand side matrix
1849 inline DisableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1850  UpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1851 {
1852  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
1853  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1854  }
1855 
1856  matrix_ -= declupp( ~rhs );
1857 
1858  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1859  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1860 
1861  return *this;
1862 }
1864 //*************************************************************************************************
1865 
1866 
1867 //*************************************************************************************************
1880 template< typename MT // Type of the adapted dense matrix
1881  , bool SO > // Storage order of the adapted dense matrix
1882 template< typename MT2 // Type of the right-hand side matrix
1883  , bool SO2 > // Storage order of the right-hand side matrix
1884 inline EnableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1885  UpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1886 {
1887  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1888  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1889  }
1890 
1891  if( IsUpper<MT2>::value ) {
1892  matrix_ -= ~rhs;
1893  }
1894  else {
1895  const ResultType_<MT2> tmp( ~rhs );
1896 
1897  if( !isUpper( tmp ) ) {
1898  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1899  }
1900 
1901  matrix_ -= declupp( tmp );
1902  }
1903 
1904  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1905  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1906 
1907  return *this;
1908 }
1910 //*************************************************************************************************
1911 
1912 
1913 //*************************************************************************************************
1924 template< typename MT // Type of the adapted dense matrix
1925  , bool SO > // Storage order of the adapted dense matrix
1926 template< typename MT2 // Type of the right-hand side matrix
1927  , bool SO2 > // Storage order of the right-hand side matrix
1928 inline UpperMatrix<MT,SO,true>&
1929  UpperMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
1930 {
1931  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1932  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1933  }
1934 
1935  matrix_ %= ~rhs;
1936 
1937  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1938  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1939 
1940  return *this;
1941 }
1943 //*************************************************************************************************
1944 
1945 
1946 //*************************************************************************************************
1958 template< typename MT // Type of the adapted dense matrix
1959  , bool SO > // Storage order of the adapted dense matrix
1960 template< typename MT2 // Type of the right-hand side matrix
1961  , bool SO2 > // Storage order of the right-hand side matrix
1962 inline UpperMatrix<MT,SO,true>&
1963  UpperMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1964 {
1965  if( matrix_.rows() != (~rhs).columns() ) {
1966  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1967  }
1968 
1969  MT tmp( matrix_ * ~rhs );
1970 
1971  if( !isUpper( tmp ) ) {
1972  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1973  }
1974 
1975  matrix_ = std::move( tmp );
1976 
1977  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1978  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1979 
1980  return *this;
1981 }
1983 //*************************************************************************************************
1984 
1985 
1986 //*************************************************************************************************
1994 template< typename MT // Type of the adapted dense matrix
1995  , bool SO > // Storage order of the adapted dense matrix
1996 template< typename Other > // Data type of the right-hand side scalar
1997 inline EnableIf_< IsNumeric<Other>, UpperMatrix<MT,SO,true> >&
1999 {
2000  matrix_ *= rhs;
2001  return *this;
2002 }
2003 //*************************************************************************************************
2004 
2005 
2006 //*************************************************************************************************
2014 template< typename MT // Type of the adapted dense matrix
2015  , bool SO > // Storage order of the adapted dense matrix
2016 template< typename Other > // Data type of the right-hand side scalar
2017 inline EnableIf_< IsNumeric<Other>, UpperMatrix<MT,SO,true> >&
2019 {
2020  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2021 
2022  matrix_ /= rhs;
2023  return *this;
2024 }
2026 //*************************************************************************************************
2027 
2028 
2029 
2030 
2031 //=================================================================================================
2032 //
2033 // UTILITY FUNCTIONS
2034 //
2035 //=================================================================================================
2036 
2037 //*************************************************************************************************
2043 template< typename MT // Type of the adapted dense matrix
2044  , bool SO > // Storage order of the adapted dense matrix
2045 inline size_t UpperMatrix<MT,SO,true>::rows() const noexcept
2046 {
2047  return matrix_.rows();
2048 }
2050 //*************************************************************************************************
2051 
2052 
2053 //*************************************************************************************************
2059 template< typename MT // Type of the adapted dense matrix
2060  , bool SO > // Storage order of the adapted dense matrix
2061 inline size_t UpperMatrix<MT,SO,true>::columns() const noexcept
2062 {
2063  return matrix_.columns();
2064 }
2066 //*************************************************************************************************
2067 
2068 
2069 //*************************************************************************************************
2080 template< typename MT // Type of the adapted dense matrix
2081  , bool SO > // Storage order of the adapted dense matrix
2082 inline size_t UpperMatrix<MT,SO,true>::spacing() const noexcept
2083 {
2084  return matrix_.spacing();
2085 }
2087 //*************************************************************************************************
2088 
2089 
2090 //*************************************************************************************************
2096 template< typename MT // Type of the adapted dense matrix
2097  , bool SO > // Storage order of the adapted dense matrix
2098 inline size_t UpperMatrix<MT,SO,true>::capacity() const noexcept
2099 {
2100  return matrix_.capacity();
2101 }
2103 //*************************************************************************************************
2104 
2105 
2106 //*************************************************************************************************
2118 template< typename MT // Type of the adapted dense matrix
2119  , bool SO > // Storage order of the adapted dense matrix
2120 inline size_t UpperMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2121 {
2122  return matrix_.capacity(i);
2123 }
2125 //*************************************************************************************************
2126 
2127 
2128 //*************************************************************************************************
2134 template< typename MT // Type of the adapted dense matrix
2135  , bool SO > // Storage order of the adapted dense matrix
2136 inline size_t UpperMatrix<MT,SO,true>::nonZeros() const
2137 {
2138  return matrix_.nonZeros();
2139 }
2141 //*************************************************************************************************
2142 
2143 
2144 //*************************************************************************************************
2156 template< typename MT // Type of the adapted dense matrix
2157  , bool SO > // Storage order of the adapted dense matrix
2158 inline size_t UpperMatrix<MT,SO,true>::nonZeros( size_t i ) const
2159 {
2160  return matrix_.nonZeros(i);
2161 }
2163 //*************************************************************************************************
2164 
2165 
2166 //*************************************************************************************************
2172 template< typename MT // Type of the adapted dense matrix
2173  , bool SO > // Storage order of the adapted dense matrix
2174 inline void UpperMatrix<MT,SO,true>::reset()
2175 {
2176  using blaze::clear;
2177 
2178  if( SO ) {
2179  for( size_t j=0UL; j<columns(); ++j )
2180  for( size_t i=0UL; i<=j; ++i )
2181  clear( matrix_(i,j) );
2182  }
2183  else {
2184  for( size_t i=0UL; i<rows(); ++i )
2185  for( size_t j=i; j<columns(); ++j )
2186  clear( matrix_(i,j) );
2187  }
2188 }
2190 //*************************************************************************************************
2191 
2192 
2193 //*************************************************************************************************
2206 template< typename MT // Type of the adapted dense matrix
2207  , bool SO > // Storage order of the adapted dense matrix
2208 inline void UpperMatrix<MT,SO,true>::reset( size_t i )
2209 {
2210  using blaze::clear;
2211 
2212  if( SO ) {
2213  for( size_t j=0UL; j<=i; ++j )
2214  clear( matrix_(j,i) );
2215  }
2216  else {
2217  for( size_t j=i; j<columns(); ++j )
2218  clear( matrix_(i,j) );
2219  }
2220 }
2222 //*************************************************************************************************
2223 
2224 
2225 //*************************************************************************************************
2237 template< typename MT // Type of the adapted dense matrix
2238  , bool SO > // Storage order of the adapted dense matrix
2239 inline void UpperMatrix<MT,SO,true>::clear()
2240 {
2241  using blaze::clear;
2242 
2243  if( IsResizable<MT>::value ) {
2244  clear( matrix_ );
2245  }
2246  else {
2247  reset();
2248  }
2249 }
2251 //*************************************************************************************************
2252 
2253 
2254 //*************************************************************************************************
2290 template< typename MT // Type of the adapted dense matrix
2291  , bool SO > // Storage order of the adapted dense matrix
2292 void UpperMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2293 {
2295 
2296  UNUSED_PARAMETER( preserve );
2297 
2298  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
2299 
2300  const size_t oldsize( matrix_.rows() );
2301 
2302  matrix_.resize( n, n, true );
2303 
2304  if( n > oldsize ) {
2305  const size_t increment( n - oldsize );
2306  submatrix( matrix_, oldsize, 0UL, increment, n-1 ).reset();
2307  }
2308 }
2310 //*************************************************************************************************
2311 
2312 
2313 //*************************************************************************************************
2326 template< typename MT // Type of the adapted dense matrix
2327  , bool SO > // Storage order of the adapted dense matrix
2328 inline void UpperMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2329 {
2331 
2332  UNUSED_PARAMETER( preserve );
2333 
2334  resize( rows() + n, true );
2335 }
2336 //*************************************************************************************************
2337 
2338 
2339 //*************************************************************************************************
2349 template< typename MT // Type of the adapted dense matrix
2350  , bool SO > // Storage order of the adapted dense matrix
2351 inline void UpperMatrix<MT,SO,true>::reserve( size_t elements )
2352 {
2353  matrix_.reserve( elements );
2354 }
2356 //*************************************************************************************************
2357 
2358 
2359 //*************************************************************************************************
2369 template< typename MT // Type of the adapted dense matrix
2370  , bool SO > // Storage order of the adapted dense matrix
2372 {
2373  matrix_.shrinkToFit();
2374 }
2376 //*************************************************************************************************
2377 
2378 
2379 //*************************************************************************************************
2386 template< typename MT // Type of the adapted dense matrix
2387  , bool SO > // Storage order of the adapted dense matrix
2388 inline void UpperMatrix<MT,SO,true>::swap( UpperMatrix& m ) noexcept
2389 {
2390  using std::swap;
2391 
2392  swap( matrix_, m.matrix_ );
2393 }
2395 //*************************************************************************************************
2396 
2397 
2398 //*************************************************************************************************
2410 template< typename MT // Type of the adapted dense matrix
2411  , bool SO > // Storage order of the adapted dense matrix
2412 inline constexpr size_t UpperMatrix<MT,SO,true>::maxNonZeros() noexcept
2413 {
2415 
2416  return maxNonZeros( Rows<MT>::value );
2417 }
2419 //*************************************************************************************************
2420 
2421 
2422 //*************************************************************************************************
2432 template< typename MT // Type of the adapted dense matrix
2433  , bool SO > // Storage order of the adapted dense matrix
2434 inline constexpr size_t UpperMatrix<MT,SO,true>::maxNonZeros( size_t n ) noexcept
2435 {
2436  return ( ( n + 1UL ) * n ) / 2UL;
2437 }
2439 //*************************************************************************************************
2440 
2441 
2442 
2443 
2444 //=================================================================================================
2445 //
2446 // NUMERIC FUNCTIONS
2447 //
2448 //=================================================================================================
2449 
2450 //*************************************************************************************************
2468 template< typename MT // Type of the adapted dense matrix
2469  , bool SO > // Storage order of the adapted dense matrix
2470 template< typename Other > // Data type of the scalar value
2471 inline UpperMatrix<MT,SO,true>& UpperMatrix<MT,SO,true>::scale( const Other& scalar )
2472 {
2473  matrix_.scale( scalar );
2474  return *this;
2475 }
2477 //*************************************************************************************************
2478 
2479 
2480 
2481 
2482 //=================================================================================================
2483 //
2484 // DEBUGGING FUNCTIONS
2485 //
2486 //=================================================================================================
2487 
2488 //*************************************************************************************************
2498 template< typename MT // Type of the adapted dense matrix
2499  , bool SO > // Storage order of the adapted dense matrix
2500 inline bool UpperMatrix<MT,SO,true>::isIntact() const noexcept
2501 {
2502  using blaze::isIntact;
2503 
2504  return ( isIntact( matrix_ ) && isUpper( matrix_ ) );
2505 }
2507 //*************************************************************************************************
2508 
2509 
2510 
2511 
2512 //=================================================================================================
2513 //
2514 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2515 //
2516 //=================================================================================================
2517 
2518 //*************************************************************************************************
2529 template< typename MT // Type of the adapted dense matrix
2530  , bool SO > // Storage order of the adapted dense matrix
2531 template< typename Other > // Data type of the foreign expression
2532 inline bool UpperMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2533 {
2534  return matrix_.canAlias( alias );
2535 }
2537 //*************************************************************************************************
2538 
2539 
2540 //*************************************************************************************************
2551 template< typename MT // Type of the adapted dense matrix
2552  , bool SO > // Storage order of the adapted dense matrix
2553 template< typename Other > // Data type of the foreign expression
2554 inline bool UpperMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2555 {
2556  return matrix_.isAliased( alias );
2557 }
2559 //*************************************************************************************************
2560 
2561 
2562 //*************************************************************************************************
2572 template< typename MT // Type of the adapted dense matrix
2573  , bool SO > // Storage order of the adapted dense matrix
2574 inline bool UpperMatrix<MT,SO,true>::isAligned() const noexcept
2575 {
2576  return matrix_.isAligned();
2577 }
2579 //*************************************************************************************************
2580 
2581 
2582 //*************************************************************************************************
2593 template< typename MT // Type of the adapted dense matrix
2594  , bool SO > // Storage order of the adapted dense matrix
2595 inline bool UpperMatrix<MT,SO,true>::canSMPAssign() const noexcept
2596 {
2597  return matrix_.canSMPAssign();
2598 }
2600 //*************************************************************************************************
2601 
2602 
2603 //*************************************************************************************************
2619 template< typename MT // Type of the adapted dense matrix
2620  , bool SO > // Storage order of the adapted dense matrix
2621 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2622  UpperMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2623 {
2624  return matrix_.load( i, j );
2625 }
2627 //*************************************************************************************************
2628 
2629 
2630 //*************************************************************************************************
2646 template< typename MT // Type of the adapted dense matrix
2647  , bool SO > // Storage order of the adapted dense matrix
2648 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2649  UpperMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2650 {
2651  return matrix_.loada( i, j );
2652 }
2654 //*************************************************************************************************
2655 
2656 
2657 //*************************************************************************************************
2673 template< typename MT // Type of the adapted dense matrix
2674  , bool SO > // Storage order of the adapted dense matrix
2675 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2676  UpperMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2677 {
2678  return matrix_.loadu( i, j );
2679 }
2681 //*************************************************************************************************
2682 
2683 
2684 
2685 
2686 //=================================================================================================
2687 //
2688 // CONSTRUCTION FUNCTIONS
2689 //
2690 //=================================================================================================
2691 
2692 //*************************************************************************************************
2699 template< typename MT // Type of the adapted dense matrix
2700  , bool SO > // Storage order of the adapted dense matrix
2701 inline const MT UpperMatrix<MT,SO,true>::construct( size_t n, TrueType )
2702 {
2704 
2705  return MT( n, n, ElementType() );
2706 }
2708 //*************************************************************************************************
2709 
2710 
2711 //*************************************************************************************************
2718 template< typename MT // Type of the adapted dense matrix
2719  , bool SO > // Storage order of the adapted dense matrix
2720 inline const MT UpperMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2721 {
2724 
2725  MT tmp;
2726 
2727  if( SO ) {
2728  for( size_t j=0UL; j<columns(); ++j )
2729  for( size_t i=0UL; i<=j; ++i )
2730  tmp(i,j) = init;
2731  }
2732  else {
2733  for( size_t i=0UL; i<rows(); ++i )
2734  for( size_t j=i; j<columns(); ++j )
2735  tmp(i,j) = init;
2736  }
2737 
2738  return tmp;
2739 }
2741 //*************************************************************************************************
2742 
2743 
2744 //*************************************************************************************************
2755 template< typename MT // Type of the adapted dense matrix
2756  , bool SO > // Storage order of the adapted dense matrix
2757 template< typename MT2 // Type of the foreign matrix
2758  , bool SO2 // Storage order of the foreign matrix
2759  , typename T > // Type of the third argument
2760 inline const MT UpperMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2761 {
2762  const MT tmp( ~m );
2763 
2764  if( !IsUpper<MT2>::value && !isUpper( tmp ) ) {
2765  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
2766  }
2767 
2768  return tmp;
2769 }
2771 //*************************************************************************************************
2772 
2773 } // namespace blaze
2774 
2775 #endif
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
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1328
#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.
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
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 UpperProxy class.
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 IsNumeric type trait.
Header file for all adaptor forward declarations.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_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
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
#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
Header file for the IsUpper type trait.
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
Header file for the implementation of the base template of the UpperMatrix.
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.