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>
58 #include <blaze/math/Exception.h>
61 #include <blaze/math/shims/Clear.h>
70 #include <blaze/system/Inline.h>
71 #include <blaze/util/Assert.h>
77 #include <blaze/util/DisableIf.h>
78 #include <blaze/util/EnableIf.h>
79 #include <blaze/util/FalseType.h>
81 #include <blaze/util/TrueType.h>
82 #include <blaze/util/Types.h>
84 #include <blaze/util/Unused.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
103 template< typename MT // Type of the adapted dense matrix
104  , bool SO > // Storage order of the adapted dense matrix
105 class UpperMatrix<MT,SO,true>
106  : public DenseMatrix< UpperMatrix<MT,SO,true>, SO >
107 {
108  private:
109  //**Type definitions****************************************************************************
110  typedef OppositeType_<MT> OT;
111  typedef TransposeType_<MT> TT;
112  typedef ElementType_<MT> ET;
113  //**********************************************************************************************
114 
115  public:
116  //**Type definitions****************************************************************************
117  typedef UpperMatrix<MT,SO,true> This;
118  typedef DenseMatrix<This,SO> BaseType;
119  typedef This ResultType;
120  typedef UpperMatrix<OT,!SO,true> OppositeType;
121  typedef LowerMatrix<TT,!SO,true> TransposeType;
122  typedef ET ElementType;
123  typedef SIMDType_<MT> SIMDType;
124  typedef ReturnType_<MT> ReturnType;
125  typedef const This& CompositeType;
126  typedef UpperProxy<MT> Reference;
127  typedef ConstReference_<MT> ConstReference;
128  typedef Pointer_<MT> Pointer;
129  typedef ConstPointer_<MT> ConstPointer;
130  typedef ConstIterator_<MT> ConstIterator;
131  //**********************************************************************************************
132 
133  //**Rebind struct definition********************************************************************
136  template< typename ET > // Data type of the other matrix
137  struct Rebind {
139  typedef UpperMatrix< typename MT::template Rebind<ET>::Other > Other;
140  };
141  //**********************************************************************************************
142 
143  //**Iterator class definition*******************************************************************
146  class Iterator
147  {
148  public:
149  //**Type definitions*************************************************************************
150  typedef std::random_access_iterator_tag IteratorCategory;
151  typedef ElementType_<MT> ValueType;
152  typedef UpperProxy<MT> PointerType;
153  typedef UpperProxy<MT> ReferenceType;
154  typedef ptrdiff_t DifferenceType;
155 
156  // STL iterator requirements
157  typedef IteratorCategory iterator_category;
158  typedef ValueType value_type;
159  typedef PointerType pointer;
160  typedef ReferenceType reference;
161  typedef DifferenceType difference_type;
162  //*******************************************************************************************
163 
164  //**Constructor******************************************************************************
167  inline Iterator() noexcept
168  : matrix_( nullptr ) // Reference to the adapted dense matrix
169  , row_ ( 0UL ) // The current row index of the iterator
170  , column_( 0UL ) // The current column index of the iterator
171  {}
172  //*******************************************************************************************
173 
174  //**Constructor******************************************************************************
181  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
182  : matrix_( &matrix ) // Reference to the adapted dense matrix
183  , row_ ( row ) // The current row-index of the iterator
184  , column_( column ) // The current column-index of the iterator
185  {}
186  //*******************************************************************************************
187 
188  //**Addition assignment operator*************************************************************
194  inline Iterator& operator+=( size_t inc ) noexcept {
195  ( SO )?( row_ += inc ):( column_ += inc );
196  return *this;
197  }
198  //*******************************************************************************************
199 
200  //**Subtraction assignment operator**********************************************************
206  inline Iterator& operator-=( size_t dec ) noexcept {
207  ( SO )?( row_ -= dec ):( column_ -= dec );
208  return *this;
209  }
210  //*******************************************************************************************
211 
212  //**Prefix increment operator****************************************************************
217  inline Iterator& operator++() noexcept {
218  ( SO )?( ++row_ ):( ++column_ );
219  return *this;
220  }
221  //*******************************************************************************************
222 
223  //**Postfix increment operator***************************************************************
228  inline const Iterator operator++( int ) noexcept {
229  const Iterator tmp( *this );
230  ++(*this);
231  return tmp;
232  }
233  //*******************************************************************************************
234 
235  //**Prefix decrement operator****************************************************************
240  inline Iterator& operator--() noexcept {
241  ( SO )?( --row_ ):( --column_ );
242  return *this;
243  }
244  //*******************************************************************************************
245 
246  //**Postfix decrement operator***************************************************************
251  inline const Iterator operator--( int ) noexcept {
252  const Iterator tmp( *this );
253  --(*this);
254  return tmp;
255  }
256  //*******************************************************************************************
257 
258  //**Element access operator******************************************************************
263  inline ReferenceType operator*() const {
264  return ReferenceType( *matrix_, row_, column_ );
265  }
266  //*******************************************************************************************
267 
268  //**Element access operator******************************************************************
273  inline PointerType operator->() const {
274  return PointerType( *matrix_, row_, column_ );
275  }
276  //*******************************************************************************************
277 
278  //**Load function****************************************************************************
288  inline SIMDType load() const {
289  return (*matrix_).load(row_,column_);
290  }
291  //*******************************************************************************************
292 
293  //**Loada function***************************************************************************
303  inline SIMDType loada() const {
304  return (*matrix_).loada(row_,column_);
305  }
306  //*******************************************************************************************
307 
308  //**Loadu function***************************************************************************
318  inline SIMDType loadu() const {
319  return (*matrix_).loadu(row_,column_);
320  }
321  //*******************************************************************************************
322 
323  //**Conversion operator**********************************************************************
328  inline operator ConstIterator() const {
329  if( SO )
330  return matrix_->begin( column_ ) + row_;
331  else
332  return matrix_->begin( row_ ) + column_;
333  }
334  //*******************************************************************************************
335 
336  //**Equality operator************************************************************************
343  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
344  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
345  }
346  //*******************************************************************************************
347 
348  //**Equality operator************************************************************************
355  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
356  return ( ConstIterator( lhs ) == rhs );
357  }
358  //*******************************************************************************************
359 
360  //**Equality operator************************************************************************
367  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
368  return ( lhs == ConstIterator( rhs ) );
369  }
370  //*******************************************************************************************
371 
372  //**Inequality operator**********************************************************************
379  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
380  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
381  }
382  //*******************************************************************************************
383 
384  //**Inequality operator**********************************************************************
391  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
392  return ( ConstIterator( lhs ) != rhs );
393  }
394  //*******************************************************************************************
395 
396  //**Inequality operator**********************************************************************
403  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
404  return ( lhs != ConstIterator( rhs ) );
405  }
406  //*******************************************************************************************
407 
408  //**Less-than operator***********************************************************************
415  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
416  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
417  }
418  //*******************************************************************************************
419 
420  //**Less-than operator***********************************************************************
427  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
428  return ( ConstIterator( lhs ) < rhs );
429  }
430  //*******************************************************************************************
431 
432  //**Less-than operator***********************************************************************
439  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
440  return ( lhs < ConstIterator( rhs ) );
441  }
442  //*******************************************************************************************
443 
444  //**Greater-than operator********************************************************************
451  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
452  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
453  }
454  //*******************************************************************************************
455 
456  //**Greater-than operator********************************************************************
463  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
464  return ( ConstIterator( lhs ) > rhs );
465  }
466  //*******************************************************************************************
467 
468  //**Greater-than operator********************************************************************
475  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
476  return ( lhs > ConstIterator( rhs ) );
477  }
478  //*******************************************************************************************
479 
480  //**Less-or-equal-than operator**************************************************************
487  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
488  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
489  }
490  //*******************************************************************************************
491 
492  //**Less-or-equal-than operator**************************************************************
499  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
500  return ( ConstIterator( lhs ) <= rhs );
501  }
502  //*******************************************************************************************
503 
504  //**Less-or-equal-than operator**************************************************************
511  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
512  return ( lhs <= ConstIterator( rhs ) );
513  }
514  //*******************************************************************************************
515 
516  //**Greater-or-equal-than operator***********************************************************
523  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
524  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
525  }
526  //*******************************************************************************************
527 
528  //**Greater-or-equal-than operator***********************************************************
535  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
536  return ( ConstIterator( lhs ) >= rhs );
537  }
538  //*******************************************************************************************
539 
540  //**Greater-or-equal-than operator***********************************************************
547  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
548  return ( lhs >= ConstIterator( rhs ) );
549  }
550  //*******************************************************************************************
551 
552  //**Subtraction operator*********************************************************************
558  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
559  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
560  }
561  //*******************************************************************************************
562 
563  //**Addition operator************************************************************************
570  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
571  if( SO )
572  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
573  else
574  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
575  }
576  //*******************************************************************************************
577 
578  //**Addition operator************************************************************************
585  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
586  if( SO )
587  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
588  else
589  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
590  }
591  //*******************************************************************************************
592 
593  //**Subtraction operator*********************************************************************
600  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
601  if( SO )
602  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
603  else
604  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
605  }
606  //*******************************************************************************************
607 
608  private:
609  //**Member variables*************************************************************************
610  MT* matrix_;
611  size_t row_;
612  size_t column_;
613  //*******************************************************************************************
614  };
615  //**********************************************************************************************
616 
617  //**Compilation flags***************************************************************************
619  enum : bool { simdEnabled = MT::simdEnabled };
620 
622  enum : bool { smpAssignable = MT::smpAssignable };
623  //**********************************************************************************************
624 
625  //**Constructors********************************************************************************
628  explicit inline UpperMatrix();
629  template< typename A1 > explicit inline UpperMatrix( const A1& a1 );
630  explicit inline UpperMatrix( size_t n, const ElementType& init );
631 
632  explicit inline UpperMatrix( initializer_list< initializer_list<ElementType> > list );
633 
634  template< typename Other >
635  explicit inline UpperMatrix( size_t n, const Other* array );
636 
637  template< typename Other, size_t N >
638  explicit inline UpperMatrix( const Other (&array)[N][N] );
639 
640  explicit inline UpperMatrix( ElementType* ptr, size_t n );
641  explicit inline UpperMatrix( ElementType* ptr, size_t n, size_t nn );
642 
643  template< typename Deleter >
644  explicit inline UpperMatrix( ElementType* ptr, size_t n, Deleter d );
645 
646  template< typename Deleter >
647  explicit inline UpperMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
648 
649  inline UpperMatrix( const UpperMatrix& m );
650  inline UpperMatrix( UpperMatrix&& m ) noexcept;
652  //**********************************************************************************************
653 
654  //**Destructor**********************************************************************************
655  // No explicitly declared destructor.
656  //**********************************************************************************************
657 
658  //**Data access functions***********************************************************************
661  inline Reference operator()( size_t i, size_t j );
662  inline ConstReference operator()( size_t i, size_t j ) const;
663  inline Reference at( size_t i, size_t j );
664  inline ConstReference at( size_t i, size_t j ) const;
665  inline ConstPointer data () const noexcept;
666  inline ConstPointer data ( size_t i ) const noexcept;
667  inline Iterator begin ( size_t i );
668  inline ConstIterator begin ( size_t i ) const;
669  inline ConstIterator cbegin( size_t i ) const;
670  inline Iterator end ( size_t i );
671  inline ConstIterator end ( size_t i ) const;
672  inline ConstIterator cend ( size_t i ) const;
674  //**********************************************************************************************
675 
676  //**Assignment operators************************************************************************
679  inline UpperMatrix& operator=( const ElementType& rhs );
680  inline UpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
681 
682  template< typename Other, size_t N >
683  inline UpperMatrix& operator=( const Other (&array)[N][N] );
684 
685  inline UpperMatrix& operator=( const UpperMatrix& rhs );
686  inline UpperMatrix& operator=( UpperMatrix&& rhs ) noexcept;
687 
688  template< typename MT2, bool SO2 >
689  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
690 
691  template< typename MT2, bool SO2 >
692  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
693 
694  template< typename MT2, bool SO2 >
695  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
696 
697  template< typename MT2, bool SO2 >
698  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
699 
700  template< typename MT2, bool SO2 >
701  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
702 
703  template< typename MT2, bool SO2 >
704  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
705 
706  template< typename MT2, bool SO2 >
707  inline UpperMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
708 
709  template< typename Other >
710  inline EnableIf_< IsNumeric<Other>, UpperMatrix >& operator*=( Other rhs );
711 
712  template< typename Other >
713  inline EnableIf_< IsNumeric<Other>, UpperMatrix >& operator/=( Other rhs );
715  //**********************************************************************************************
716 
717  //**Utility functions***************************************************************************
720  inline size_t rows() const noexcept;
721  inline size_t columns() const noexcept;
722  inline size_t spacing() const noexcept;
723  inline size_t capacity() const noexcept;
724  inline size_t capacity( size_t i ) const noexcept;
725  inline size_t nonZeros() const;
726  inline size_t nonZeros( size_t i ) const;
727  inline void reset();
728  inline void reset( size_t i );
729  inline void clear();
730  void resize ( size_t n, bool preserve=true );
731  inline void extend ( size_t n, bool preserve=true );
732  inline void reserve( size_t elements );
733  template< typename Other > inline UpperMatrix& scale( const Other& scalar );
734  inline void swap( UpperMatrix& m ) noexcept;
735 
736  static inline constexpr size_t maxNonZeros() noexcept;
737  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
739  //**********************************************************************************************
740 
741  //**Debugging functions*************************************************************************
744  inline bool isIntact() const noexcept;
746  //**********************************************************************************************
747 
748  //**Expression template evaluation functions****************************************************
751  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
752  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
753 
754  inline bool isAligned () const noexcept;
755  inline bool canSMPAssign() const noexcept;
756 
757  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
758  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
759  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
761  //**********************************************************************************************
762 
763  private:
764  //**Construction functions**********************************************************************
767  inline const MT construct( size_t n , TrueType );
768  inline const MT construct( const ElementType& value, FalseType );
769 
770  template< typename MT2, bool SO2, typename T >
771  inline const MT construct( const Matrix<MT2,SO2>& m, T );
773  //**********************************************************************************************
774 
775  //**Member variables****************************************************************************
778  MT matrix_;
779 
780  //**********************************************************************************************
781 
782  //**Friend declarations*************************************************************************
783  template< typename MT2, bool SO2, bool DF2 >
784  friend bool isDefault( const UpperMatrix<MT2,SO2,DF2>& m );
785 
786  template< typename MT2, bool SO2, bool DF2 >
787  friend MT2& derestrict( UpperMatrix<MT2,SO2,DF2>& m );
788  //**********************************************************************************************
789 
790  //**Compile time checks*************************************************************************
803  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
804  //**********************************************************************************************
805 };
807 //*************************************************************************************************
808 
809 
810 
811 
812 //=================================================================================================
813 //
814 // CONSTRUCTORS
815 //
816 //=================================================================================================
817 
818 //*************************************************************************************************
822 template< typename MT // Type of the adapted dense matrix
823  , bool SO > // Storage order of the adapted dense matrix
824 inline UpperMatrix<MT,SO,true>::UpperMatrix()
825  : matrix_() // The adapted dense matrix
826 {
827  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
828  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
829 }
831 //*************************************************************************************************
832 
833 
834 //*************************************************************************************************
852 template< typename MT // Type of the adapted dense matrix
853  , bool SO > // Storage order of the adapted dense matrix
854 template< typename A1 > // Type of the constructor argument
855 inline UpperMatrix<MT,SO,true>::UpperMatrix( const A1& a1 )
856  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
857 {
858  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
859  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
860 }
862 //*************************************************************************************************
863 
864 
865 //*************************************************************************************************
872 template< typename MT // Type of the adapted dense matrix
873  , bool SO > // Storage order of the adapted dense matrix
874 inline UpperMatrix<MT,SO,true>::UpperMatrix( size_t n, const ElementType& init )
875  : matrix_( n, n, ElementType() ) // The adapted dense matrix
876 {
878 
879  if( SO ) {
880  for( size_t j=0UL; j<columns(); ++j )
881  for( size_t i=0UL; i<=j; ++i )
882  matrix_(i,j) = init;
883  }
884  else {
885  for( size_t i=0UL; i<rows(); ++i )
886  for( size_t j=i; j<columns(); ++j )
887  matrix_(i,j) = init;
888  }
889 
890  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
891  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
892 }
894 //*************************************************************************************************
895 
896 
897 //*************************************************************************************************
920 template< typename MT // Type of the adapted dense matrix
921  , bool SO > // Storage order of the adapted dense matrix
922 inline UpperMatrix<MT,SO,true>::UpperMatrix( initializer_list< initializer_list<ElementType> > list )
923  : matrix_( list ) // The adapted dense matrix
924 {
925  if( !isUpper( matrix_ ) ) {
926  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
927  }
928 
929  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
930 }
932 //*************************************************************************************************
933 
934 
935 //*************************************************************************************************
961 template< typename MT // Type of the adapted dense matrix
962  , bool SO > // Storage order of the adapted dense matrix
963 template< typename Other > // Data type of the initialization array
964 inline UpperMatrix<MT,SO,true>::UpperMatrix( size_t n, const Other* array )
965  : matrix_( n, n, array ) // The adapted dense matrix
966 {
967  if( !isUpper( matrix_ ) ) {
968  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
969  }
970 
971  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
972 }
974 //*************************************************************************************************
975 
976 
977 //*************************************************************************************************
1000 template< typename MT // Type of the adapted dense matrix
1001  , bool SO > // Storage order of the adapted dense matrix
1002 template< typename Other // Data type of the initialization array
1003  , size_t N > // Number of rows and columns of the initialization array
1004 inline UpperMatrix<MT,SO,true>::UpperMatrix( const Other (&array)[N][N] )
1005  : matrix_( array ) // The adapted dense matrix
1006 {
1007  if( !isUpper( matrix_ ) ) {
1008  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1009  }
1010 
1011  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1012 }
1014 //*************************************************************************************************
1015 
1016 
1017 //*************************************************************************************************
1038 template< typename MT // Type of the adapted dense matrix
1039  , bool SO > // Storage order of the adapted dense matrix
1040 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n )
1041  : matrix_( ptr, n, n ) // The adapted dense matrix
1042 {
1043  if( !isUpper( matrix_ ) ) {
1044  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1045  }
1046 
1047  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1048 }
1050 //*************************************************************************************************
1051 
1052 
1053 //*************************************************************************************************
1076 template< typename MT // Type of the adapted dense matrix
1077  , bool SO > // Storage order of the adapted dense matrix
1078 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n, size_t nn )
1079  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1080 {
1081  if( !isUpper( matrix_ ) ) {
1082  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1083  }
1084 
1085  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1086 }
1088 //*************************************************************************************************
1089 
1090 
1091 //*************************************************************************************************
1112 template< typename MT // Type of the adapted dense matrix
1113  , bool SO > // Storage order of the adapted dense matrix
1114 template< typename Deleter > // Type of the custom deleter
1115 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n, Deleter d )
1116  : matrix_( ptr, n, n, d ) // The adapted dense matrix
1117 {
1118  if( !isUpper( matrix_ ) ) {
1119  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1120  }
1121 
1122  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1123 }
1125 //*************************************************************************************************
1126 
1127 
1128 //*************************************************************************************************
1150 template< typename MT // Type of the adapted dense matrix
1151  , bool SO > // Storage order of the adapted dense matrix
1152 template< typename Deleter > // Type of the custom deleter
1153 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
1154  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
1155 {
1156  if( !isUpper( matrix_ ) ) {
1157  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1158  }
1159 
1160  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1161 }
1163 //*************************************************************************************************
1164 
1165 
1166 //*************************************************************************************************
1172 template< typename MT // Type of the adapted dense matrix
1173  , bool SO > // Storage order of the adapted dense matrix
1174 inline UpperMatrix<MT,SO,true>::UpperMatrix( const UpperMatrix& m )
1175  : matrix_( m.matrix_ ) // The adapted dense matrix
1176 {
1177  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1178  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1179 }
1181 //*************************************************************************************************
1182 
1183 
1184 //*************************************************************************************************
1190 template< typename MT // Type of the adapted dense matrix
1191  , bool SO > // Storage order of the adapted dense matrix
1192 inline UpperMatrix<MT,SO,true>::UpperMatrix( UpperMatrix&& m ) noexcept
1193  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1194 {
1195  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1196  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1197 }
1199 //*************************************************************************************************
1200 
1201 
1202 
1203 
1204 //=================================================================================================
1205 //
1206 // DATA ACCESS FUNCTIONS
1207 //
1208 //=================================================================================================
1209 
1210 //*************************************************************************************************
1226 template< typename MT // Type of the adapted dense matrix
1227  , bool SO > // Storage order of the adapted dense matrix
1228 inline typename UpperMatrix<MT,SO,true>::Reference
1229  UpperMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1230 {
1231  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1232  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1233 
1234  return Reference( matrix_, i, j );
1235 }
1237 //*************************************************************************************************
1238 
1239 
1240 //*************************************************************************************************
1256 template< typename MT // Type of the adapted dense matrix
1257  , bool SO > // Storage order of the adapted dense matrix
1259  UpperMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1260 {
1261  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1262  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1263 
1264  return matrix_(i,j);
1265 }
1267 //*************************************************************************************************
1268 
1269 
1270 //*************************************************************************************************
1287 template< typename MT // Type of the adapted dense matrix
1288  , bool SO > // Storage order of the adapted dense matrix
1289 inline typename UpperMatrix<MT,SO,true>::Reference
1290  UpperMatrix<MT,SO,true>::at( size_t i, size_t j )
1291 {
1292  if( i >= rows() ) {
1293  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1294  }
1295  if( j >= columns() ) {
1296  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1297  }
1298  return (*this)(i,j);
1299 }
1301 //*************************************************************************************************
1302 
1303 
1304 //*************************************************************************************************
1321 template< typename MT // Type of the adapted dense matrix
1322  , bool SO > // Storage order of the adapted dense matrix
1324  UpperMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1325 {
1326  if( i >= rows() ) {
1327  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1328  }
1329  if( j >= columns() ) {
1330  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1331  }
1332  return (*this)(i,j);
1333 }
1335 //*************************************************************************************************
1336 
1337 
1338 //*************************************************************************************************
1351 template< typename MT // Type of the adapted dense matrix
1352  , bool SO > // Storage order of the adapted dense matrix
1353 inline typename UpperMatrix<MT,SO,true>::ConstPointer
1354  UpperMatrix<MT,SO,true>::data() const noexcept
1355 {
1356  return matrix_.data();
1357 }
1359 //*************************************************************************************************
1360 
1361 
1362 //*************************************************************************************************
1371 template< typename MT // Type of the adapted dense matrix
1372  , bool SO > // Storage order of the adapted dense matrix
1373 inline typename UpperMatrix<MT,SO,true>::ConstPointer
1374  UpperMatrix<MT,SO,true>::data( size_t i ) const noexcept
1375 {
1376  return matrix_.data(i);
1377 }
1379 //*************************************************************************************************
1380 
1381 
1382 //*************************************************************************************************
1394 template< typename MT // Type of the adapted dense matrix
1395  , bool SO > // Storage order of the adapted dense matrix
1396 inline typename UpperMatrix<MT,SO,true>::Iterator
1397  UpperMatrix<MT,SO,true>::begin( size_t i )
1398 {
1399  if( SO )
1400  return Iterator( matrix_, 0UL, i );
1401  else
1402  return Iterator( matrix_, i, 0UL );
1403 }
1405 //*************************************************************************************************
1406 
1407 
1408 //*************************************************************************************************
1420 template< typename MT // Type of the adapted dense matrix
1421  , bool SO > // Storage order of the adapted dense matrix
1423  UpperMatrix<MT,SO,true>::begin( size_t i ) const
1424 {
1425  return matrix_.begin(i);
1426 }
1428 //*************************************************************************************************
1429 
1430 
1431 //*************************************************************************************************
1443 template< typename MT // Type of the adapted dense matrix
1444  , bool SO > // Storage order of the adapted dense matrix
1446  UpperMatrix<MT,SO,true>::cbegin( size_t i ) const
1447 {
1448  return matrix_.cbegin(i);
1449 }
1451 //*************************************************************************************************
1452 
1453 
1454 //*************************************************************************************************
1466 template< typename MT // Type of the adapted dense matrix
1467  , bool SO > // Storage order of the adapted dense matrix
1468 inline typename UpperMatrix<MT,SO,true>::Iterator
1469  UpperMatrix<MT,SO,true>::end( size_t i )
1470 {
1471  if( SO )
1472  return Iterator( matrix_, rows(), i );
1473  else
1474  return Iterator( matrix_, i, columns() );
1475 }
1477 //*************************************************************************************************
1478 
1479 
1480 //*************************************************************************************************
1492 template< typename MT // Type of the adapted dense matrix
1493  , bool SO > // Storage order of the adapted dense matrix
1495  UpperMatrix<MT,SO,true>::end( size_t i ) const
1496 {
1497  return matrix_.end(i);
1498 }
1500 //*************************************************************************************************
1501 
1502 
1503 //*************************************************************************************************
1515 template< typename MT // Type of the adapted dense matrix
1516  , bool SO > // Storage order of the adapted dense matrix
1518  UpperMatrix<MT,SO,true>::cend( size_t i ) const
1519 {
1520  return matrix_.cend(i);
1521 }
1523 //*************************************************************************************************
1524 
1525 
1526 
1527 
1528 //=================================================================================================
1529 //
1530 // ASSIGNMENT OPERATORS
1531 //
1532 //=================================================================================================
1533 
1534 //*************************************************************************************************
1541 template< typename MT // Type of the adapted dense matrix
1542  , bool SO > // Storage order of the adapted dense matrix
1543 inline UpperMatrix<MT,SO,true>&
1544  UpperMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1545 {
1546  if( SO ) {
1547  for( size_t j=0UL; j<columns(); ++j )
1548  for( size_t i=0UL; i<=j; ++i )
1549  matrix_(i,j) = rhs;
1550  }
1551  else {
1552  for( size_t i=0UL; i<rows(); ++i )
1553  for( size_t j=i; j<columns(); ++j )
1554  matrix_(i,j) = rhs;
1555  }
1556 
1557  return *this;
1558 }
1560 //*************************************************************************************************
1561 
1562 
1563 //*************************************************************************************************
1587 template< typename MT // Type of the adapted dense matrix
1588  , bool SO > // Storage order of the adapted dense matrix
1589 inline UpperMatrix<MT,SO,true>&
1590  UpperMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1591 {
1592  MT tmp( list );
1593 
1594  if( !isUpper( tmp ) ) {
1595  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1596  }
1597 
1598  matrix_ = std::move( tmp );
1599 
1600  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1601  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1602 
1603  return *this;
1604 }
1606 //*************************************************************************************************
1607 
1608 
1609 //*************************************************************************************************
1633 template< typename MT // Type of the adapted dense matrix
1634  , bool SO > // Storage order of the adapted dense matrix
1635 template< typename Other // Data type of the initialization array
1636  , size_t N > // Number of rows and columns of the initialization array
1637 inline UpperMatrix<MT,SO,true>&
1638  UpperMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1639 {
1640  MT tmp( array );
1641 
1642  if( !isUpper( tmp ) ) {
1643  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1644  }
1645 
1646  matrix_ = std::move( tmp );
1647 
1648  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1649  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1650 
1651  return *this;
1652 }
1654 //*************************************************************************************************
1655 
1656 
1657 //*************************************************************************************************
1667 template< typename MT // Type of the adapted dense matrix
1668  , bool SO > // Storage order of the adapted dense matrix
1669 inline UpperMatrix<MT,SO,true>&
1670  UpperMatrix<MT,SO,true>::operator=( const UpperMatrix& rhs )
1671 {
1672  matrix_ = rhs.matrix_;
1673 
1674  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1675  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1676 
1677  return *this;
1678 }
1680 //*************************************************************************************************
1681 
1682 
1683 //*************************************************************************************************
1690 template< typename MT // Type of the adapted dense matrix
1691  , bool SO > // Storage order of the adapted dense matrix
1692 inline UpperMatrix<MT,SO,true>&
1693  UpperMatrix<MT,SO,true>::operator=( UpperMatrix&& rhs ) noexcept
1694 {
1695  matrix_ = std::move( rhs.matrix_ );
1696 
1697  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1698  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1699 
1700  return *this;
1701 }
1703 //*************************************************************************************************
1704 
1705 
1706 //*************************************************************************************************
1719 template< typename MT // Type of the adapted dense matrix
1720  , bool SO > // Storage order of the adapted dense matrix
1721 template< typename MT2 // Type of the right-hand side matrix
1722  , bool SO2 > // Storage order of the right-hand side matrix
1723 inline DisableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1724  UpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1725 {
1726  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
1727  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1728  }
1729 
1730  matrix_ = ~rhs;
1731 
1732  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1733  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1734 
1735  return *this;
1736 }
1738 //*************************************************************************************************
1739 
1740 
1741 //*************************************************************************************************
1754 template< typename MT // Type of the adapted dense matrix
1755  , bool SO > // Storage order of the adapted dense matrix
1756 template< typename MT2 // Type of the right-hand side matrix
1757  , bool SO2 > // Storage order of the right-hand side matrix
1758 inline EnableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1759  UpperMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1760 {
1761  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1762  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1763  }
1764 
1765  if( IsUpper<MT2>::value ) {
1766  matrix_ = ~rhs;
1767  }
1768  else {
1769  MT tmp( ~rhs );
1770 
1771  if( !isUpper( tmp ) ) {
1772  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1773  }
1774 
1775  matrix_ = std::move( tmp );
1776  }
1777 
1778  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1779  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1780 
1781  return *this;
1782 }
1784 //*************************************************************************************************
1785 
1786 
1787 //*************************************************************************************************
1800 template< typename MT // Type of the adapted dense matrix
1801  , bool SO > // Storage order of the adapted dense matrix
1802 template< typename MT2 // Type of the right-hand side matrix
1803  , bool SO2 > // Storage order of the right-hand side matrix
1804 inline DisableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1805  UpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1806 {
1807  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
1808  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1809  }
1810 
1811  matrix_ += ~rhs;
1812 
1813  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1814  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1815 
1816  return *this;
1817 }
1819 //*************************************************************************************************
1820 
1821 
1822 //*************************************************************************************************
1835 template< typename MT // Type of the adapted dense matrix
1836  , bool SO > // Storage order of the adapted dense matrix
1837 template< typename MT2 // Type of the right-hand side matrix
1838  , bool SO2 > // Storage order of the right-hand side matrix
1839 inline EnableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1840  UpperMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1841 {
1842  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1843  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1844  }
1845 
1846  if( IsUpper<MT2>::value ) {
1847  matrix_ += ~rhs;
1848  }
1849  else {
1850  const ResultType_<MT2> tmp( ~rhs );
1851 
1852  if( !isUpper( tmp ) ) {
1853  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1854  }
1855 
1856  matrix_ += tmp;
1857  }
1858 
1859  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1860  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1861 
1862  return *this;
1863 }
1865 //*************************************************************************************************
1866 
1867 
1868 //*************************************************************************************************
1881 template< typename MT // Type of the adapted dense matrix
1882  , bool SO > // Storage order of the adapted dense matrix
1883 template< typename MT2 // Type of the right-hand side matrix
1884  , bool SO2 > // Storage order of the right-hand side matrix
1885 inline DisableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1886  UpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1887 {
1888  if( !IsUpper<MT2>::value && !isUpper( ~rhs ) ) {
1889  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1890  }
1891 
1892  matrix_ -= ~rhs;
1893 
1894  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1895  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1896 
1897  return *this;
1898 }
1900 //*************************************************************************************************
1901 
1902 
1903 //*************************************************************************************************
1916 template< typename MT // Type of the adapted dense matrix
1917  , bool SO > // Storage order of the adapted dense matrix
1918 template< typename MT2 // Type of the right-hand side matrix
1919  , bool SO2 > // Storage order of the right-hand side matrix
1920 inline EnableIf_< IsComputation<MT2>, UpperMatrix<MT,SO,true>& >
1921  UpperMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1922 {
1923  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1924  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1925  }
1926 
1927  if( IsUpper<MT2>::value ) {
1928  matrix_ -= ~rhs;
1929  }
1930  else {
1931  const ResultType_<MT2> tmp( ~rhs );
1932 
1933  if( !isUpper( tmp ) ) {
1934  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1935  }
1936 
1937  matrix_ -= tmp;
1938  }
1939 
1940  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1941  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1942 
1943  return *this;
1944 }
1946 //*************************************************************************************************
1947 
1948 
1949 //*************************************************************************************************
1961 template< typename MT // Type of the adapted dense matrix
1962  , bool SO > // Storage order of the adapted dense matrix
1963 template< typename MT2 // Type of the right-hand side matrix
1964  , bool SO2 > // Storage order of the right-hand side matrix
1965 inline UpperMatrix<MT,SO,true>&
1966  UpperMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1967 {
1968  if( matrix_.rows() != (~rhs).columns() ) {
1969  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1970  }
1971 
1972  MT tmp( matrix_ * ~rhs );
1973 
1974  if( !isUpper( tmp ) ) {
1975  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1976  }
1977 
1978  matrix_ = std::move( tmp );
1979 
1980  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1981  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1982 
1983  return *this;
1984 }
1986 //*************************************************************************************************
1987 
1988 
1989 //*************************************************************************************************
1997 template< typename MT // Type of the adapted dense matrix
1998  , bool SO > // Storage order of the adapted dense matrix
1999 template< typename Other > // Data type of the right-hand side scalar
2000 inline EnableIf_< IsNumeric<Other>, UpperMatrix<MT,SO,true> >&
2002 {
2003  matrix_ *= rhs;
2004  return *this;
2005 }
2006 //*************************************************************************************************
2007 
2008 
2009 //*************************************************************************************************
2017 template< typename MT // Type of the adapted dense matrix
2018  , bool SO > // Storage order of the adapted dense matrix
2019 template< typename Other > // Data type of the right-hand side scalar
2020 inline EnableIf_< IsNumeric<Other>, UpperMatrix<MT,SO,true> >&
2022 {
2023  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2024 
2025  matrix_ /= rhs;
2026  return *this;
2027 }
2029 //*************************************************************************************************
2030 
2031 
2032 
2033 
2034 //=================================================================================================
2035 //
2036 // UTILITY FUNCTIONS
2037 //
2038 //=================================================================================================
2039 
2040 //*************************************************************************************************
2046 template< typename MT // Type of the adapted dense matrix
2047  , bool SO > // Storage order of the adapted dense matrix
2048 inline size_t UpperMatrix<MT,SO,true>::rows() const noexcept
2049 {
2050  return matrix_.rows();
2051 }
2053 //*************************************************************************************************
2054 
2055 
2056 //*************************************************************************************************
2062 template< typename MT // Type of the adapted dense matrix
2063  , bool SO > // Storage order of the adapted dense matrix
2064 inline size_t UpperMatrix<MT,SO,true>::columns() const noexcept
2065 {
2066  return matrix_.columns();
2067 }
2069 //*************************************************************************************************
2070 
2071 
2072 //*************************************************************************************************
2083 template< typename MT // Type of the adapted dense matrix
2084  , bool SO > // Storage order of the adapted dense matrix
2085 inline size_t UpperMatrix<MT,SO,true>::spacing() const noexcept
2086 {
2087  return matrix_.spacing();
2088 }
2090 //*************************************************************************************************
2091 
2092 
2093 //*************************************************************************************************
2099 template< typename MT // Type of the adapted dense matrix
2100  , bool SO > // Storage order of the adapted dense matrix
2101 inline size_t UpperMatrix<MT,SO,true>::capacity() const noexcept
2102 {
2103  return matrix_.capacity();
2104 }
2106 //*************************************************************************************************
2107 
2108 
2109 //*************************************************************************************************
2121 template< typename MT // Type of the adapted dense matrix
2122  , bool SO > // Storage order of the adapted dense matrix
2123 inline size_t UpperMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2124 {
2125  return matrix_.capacity(i);
2126 }
2128 //*************************************************************************************************
2129 
2130 
2131 //*************************************************************************************************
2137 template< typename MT // Type of the adapted dense matrix
2138  , bool SO > // Storage order of the adapted dense matrix
2139 inline size_t UpperMatrix<MT,SO,true>::nonZeros() const
2140 {
2141  return matrix_.nonZeros();
2142 }
2144 //*************************************************************************************************
2145 
2146 
2147 //*************************************************************************************************
2159 template< typename MT // Type of the adapted dense matrix
2160  , bool SO > // Storage order of the adapted dense matrix
2161 inline size_t UpperMatrix<MT,SO,true>::nonZeros( size_t i ) const
2162 {
2163  return matrix_.nonZeros(i);
2164 }
2166 //*************************************************************************************************
2167 
2168 
2169 //*************************************************************************************************
2175 template< typename MT // Type of the adapted dense matrix
2176  , bool SO > // Storage order of the adapted dense matrix
2177 inline void UpperMatrix<MT,SO,true>::reset()
2178 {
2179  using blaze::clear;
2180 
2181  if( SO ) {
2182  for( size_t j=0UL; j<columns(); ++j )
2183  for( size_t i=0UL; i<=j; ++i )
2184  clear( matrix_(i,j) );
2185  }
2186  else {
2187  for( size_t i=0UL; i<rows(); ++i )
2188  for( size_t j=i; j<columns(); ++j )
2189  clear( matrix_(i,j) );
2190  }
2191 }
2193 //*************************************************************************************************
2194 
2195 
2196 //*************************************************************************************************
2209 template< typename MT // Type of the adapted dense matrix
2210  , bool SO > // Storage order of the adapted dense matrix
2211 inline void UpperMatrix<MT,SO,true>::reset( size_t i )
2212 {
2213  using blaze::clear;
2214 
2215  if( SO ) {
2216  for( size_t j=0UL; j<=i; ++j )
2217  clear( matrix_(j,i) );
2218  }
2219  else {
2220  for( size_t j=i; j<columns(); ++j )
2221  clear( matrix_(i,j) );
2222  }
2223 }
2225 //*************************************************************************************************
2226 
2227 
2228 //*************************************************************************************************
2240 template< typename MT // Type of the adapted dense matrix
2241  , bool SO > // Storage order of the adapted dense matrix
2242 inline void UpperMatrix<MT,SO,true>::clear()
2243 {
2244  using blaze::clear;
2245 
2246  if( IsResizable<MT>::value ) {
2247  clear( matrix_ );
2248  }
2249  else {
2250  reset();
2251  }
2252 }
2254 //*************************************************************************************************
2255 
2256 
2257 //*************************************************************************************************
2293 template< typename MT // Type of the adapted dense matrix
2294  , bool SO > // Storage order of the adapted dense matrix
2295 void UpperMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2296 {
2298 
2299  UNUSED_PARAMETER( preserve );
2300 
2301  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
2302 
2303  const size_t oldsize( matrix_.rows() );
2304 
2305  matrix_.resize( n, n, true );
2306 
2307  if( n > oldsize ) {
2308  const size_t increment( n - oldsize );
2309  submatrix( matrix_, oldsize, 0UL, increment, n-1 ).reset();
2310  }
2311 }
2313 //*************************************************************************************************
2314 
2315 
2316 //*************************************************************************************************
2329 template< typename MT // Type of the adapted dense matrix
2330  , bool SO > // Storage order of the adapted dense matrix
2331 inline void UpperMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2332 {
2334 
2335  UNUSED_PARAMETER( preserve );
2336 
2337  resize( rows() + n, true );
2338 }
2339 //*************************************************************************************************
2340 
2341 
2342 //*************************************************************************************************
2352 template< typename MT // Type of the adapted dense matrix
2353  , bool SO > // Storage order of the adapted dense matrix
2354 inline void UpperMatrix<MT,SO,true>::reserve( size_t elements )
2355 {
2356  matrix_.reserve( elements );
2357 }
2359 //*************************************************************************************************
2360 
2361 
2362 //*************************************************************************************************
2369 template< typename MT // Type of the adapted dense matrix
2370  , bool SO > // Storage order of the adapted dense matrix
2371 template< typename Other > // Data type of the scalar value
2372 inline UpperMatrix<MT,SO,true>& UpperMatrix<MT,SO,true>::scale( const Other& scalar )
2373 {
2374  matrix_.scale( scalar );
2375  return *this;
2376 }
2378 //*************************************************************************************************
2379 
2380 
2381 //*************************************************************************************************
2388 template< typename MT // Type of the adapted dense matrix
2389  , bool SO > // Storage order of the adapted dense matrix
2390 inline void UpperMatrix<MT,SO,true>::swap( UpperMatrix& m ) noexcept
2391 {
2392  using std::swap;
2393 
2394  swap( matrix_, m.matrix_ );
2395 }
2397 //*************************************************************************************************
2398 
2399 
2400 //*************************************************************************************************
2412 template< typename MT // Type of the adapted dense matrix
2413  , bool SO > // Storage order of the adapted dense matrix
2414 inline constexpr size_t UpperMatrix<MT,SO,true>::maxNonZeros() noexcept
2415 {
2417 
2418  return maxNonZeros( Rows<MT>::value );
2419 }
2421 //*************************************************************************************************
2422 
2423 
2424 //*************************************************************************************************
2434 template< typename MT // Type of the adapted dense matrix
2435  , bool SO > // Storage order of the adapted dense matrix
2436 inline constexpr size_t UpperMatrix<MT,SO,true>::maxNonZeros( size_t n ) noexcept
2437 {
2438  return ( ( n + 1UL ) * n ) / 2UL;
2439 }
2441 //*************************************************************************************************
2442 
2443 
2444 
2445 
2446 //=================================================================================================
2447 //
2448 // DEBUGGING FUNCTIONS
2449 //
2450 //=================================================================================================
2451 
2452 //*************************************************************************************************
2462 template< typename MT // Type of the adapted dense matrix
2463  , bool SO > // Storage order of the adapted dense matrix
2464 inline bool UpperMatrix<MT,SO,true>::isIntact() const noexcept
2465 {
2466  using blaze::isIntact;
2467 
2468  return ( isIntact( matrix_ ) && isUpper( matrix_ ) );
2469 }
2471 //*************************************************************************************************
2472 
2473 
2474 
2475 
2476 //=================================================================================================
2477 //
2478 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2479 //
2480 //=================================================================================================
2481 
2482 //*************************************************************************************************
2493 template< typename MT // Type of the adapted dense matrix
2494  , bool SO > // Storage order of the adapted dense matrix
2495 template< typename Other > // Data type of the foreign expression
2496 inline bool UpperMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2497 {
2498  return matrix_.canAlias( alias );
2499 }
2501 //*************************************************************************************************
2502 
2503 
2504 //*************************************************************************************************
2515 template< typename MT // Type of the adapted dense matrix
2516  , bool SO > // Storage order of the adapted dense matrix
2517 template< typename Other > // Data type of the foreign expression
2518 inline bool UpperMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2519 {
2520  return matrix_.isAliased( alias );
2521 }
2523 //*************************************************************************************************
2524 
2525 
2526 //*************************************************************************************************
2536 template< typename MT // Type of the adapted dense matrix
2537  , bool SO > // Storage order of the adapted dense matrix
2538 inline bool UpperMatrix<MT,SO,true>::isAligned() const noexcept
2539 {
2540  return matrix_.isAligned();
2541 }
2543 //*************************************************************************************************
2544 
2545 
2546 //*************************************************************************************************
2557 template< typename MT // Type of the adapted dense matrix
2558  , bool SO > // Storage order of the adapted dense matrix
2559 inline bool UpperMatrix<MT,SO,true>::canSMPAssign() const noexcept
2560 {
2561  return matrix_.canSMPAssign();
2562 }
2564 //*************************************************************************************************
2565 
2566 
2567 //*************************************************************************************************
2583 template< typename MT // Type of the adapted dense matrix
2584  , bool SO > // Storage order of the adapted dense matrix
2585 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2586  UpperMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2587 {
2588  return matrix_.load( i, j );
2589 }
2591 //*************************************************************************************************
2592 
2593 
2594 //*************************************************************************************************
2610 template< typename MT // Type of the adapted dense matrix
2611  , bool SO > // Storage order of the adapted dense matrix
2612 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2613  UpperMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2614 {
2615  return matrix_.loada( i, j );
2616 }
2618 //*************************************************************************************************
2619 
2620 
2621 //*************************************************************************************************
2637 template< typename MT // Type of the adapted dense matrix
2638  , bool SO > // Storage order of the adapted dense matrix
2639 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2640  UpperMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2641 {
2642  return matrix_.loadu( i, j );
2643 }
2645 //*************************************************************************************************
2646 
2647 
2648 
2649 
2650 //=================================================================================================
2651 //
2652 // CONSTRUCTION FUNCTIONS
2653 //
2654 //=================================================================================================
2655 
2656 //*************************************************************************************************
2663 template< typename MT // Type of the adapted dense matrix
2664  , bool SO > // Storage order of the adapted dense matrix
2665 inline const MT UpperMatrix<MT,SO,true>::construct( size_t n, TrueType )
2666 {
2668 
2669  return MT( n, n, ElementType() );
2670 }
2672 //*************************************************************************************************
2673 
2674 
2675 //*************************************************************************************************
2682 template< typename MT // Type of the adapted dense matrix
2683  , bool SO > // Storage order of the adapted dense matrix
2684 inline const MT UpperMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2685 {
2688 
2689  MT tmp;
2690 
2691  if( SO ) {
2692  for( size_t j=0UL; j<columns(); ++j )
2693  for( size_t i=0UL; i<=j; ++i )
2694  tmp(i,j) = init;
2695  }
2696  else {
2697  for( size_t i=0UL; i<rows(); ++i )
2698  for( size_t j=i; j<columns(); ++j )
2699  tmp(i,j) = init;
2700  }
2701 
2702  return tmp;
2703 }
2705 //*************************************************************************************************
2706 
2707 
2708 //*************************************************************************************************
2719 template< typename MT // Type of the adapted dense matrix
2720  , bool SO > // Storage order of the adapted dense matrix
2721 template< typename MT2 // Type of the foreign matrix
2722  , bool SO2 // Storage order of the foreign matrix
2723  , typename T > // Type of the third argument
2724 inline const MT UpperMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2725 {
2726  const MT tmp( ~m );
2727 
2728  if( !IsUpper<MT2>::value && !isUpper( tmp ) ) {
2729  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
2730  }
2731 
2732  return tmp;
2733 }
2735 //*************************************************************************************************
2736 
2737 } // namespace blaze
2738 
2739 #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
#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.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7800
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
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:404
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
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:1339
Constraint on the data type.
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:188
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
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
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2643
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5077
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2636
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:442
#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:384
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE(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
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
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:1321
Constraint on the data type.
STL namespace.
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
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2639
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:126
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:298
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:232
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Constraint on the data type.
Constraint on the data type.
constexpr bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Constraint on the data type.
Constraint on the data type.
Header file for the DisableIf class template.
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
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5148
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5131
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
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:330
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
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2640
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1267
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:538
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:254
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2641
Header file for the UpperProxy class.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2645
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:553
Header file for the IsNumeric type trait.
Header file for all adaptor forward declarations.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:126
#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
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2642
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:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
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:258
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a 'resize' member fu...
Definition: Resizable.h:81
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2637
bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:328
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
#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 operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2638
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
#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:1303
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.
SubmatrixExprTrait_< MT, unaligned > 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:167
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:609
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.