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>
61 #include <blaze/math/Exception.h>
64 #include <blaze/math/shims/Clear.h>
73 #include <blaze/system/Inline.h>
74 #include <blaze/util/Assert.h>
80 #include <blaze/util/DisableIf.h>
81 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/FalseType.h>
84 #include <blaze/util/TrueType.h>
85 #include <blaze/util/Types.h>
87 #include <blaze/util/Unused.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
106 template< typename MT // Type of the adapted dense matrix
107  , bool SO > // Storage order of the adapted dense matrix
108 class UpperMatrix<MT,SO,true>
109  : public DenseMatrix< UpperMatrix<MT,SO,true>, SO >
110 {
111  private:
112  //**Type definitions****************************************************************************
113  using OT = OppositeType_<MT>;
114  using TT = TransposeType_<MT>;
115  using ET = ElementType_<MT>;
116  //**********************************************************************************************
117 
118  public:
119  //**Type definitions****************************************************************************
120  using This = UpperMatrix<MT,SO,true>;
121  using BaseType = DenseMatrix<This,SO>;
122  using ResultType = This;
123  using OppositeType = UpperMatrix<OT,!SO,true>;
124  using TransposeType = LowerMatrix<TT,!SO,true>;
125  using ElementType = ET;
126  using SIMDType = SIMDType_<MT>;
127  using ReturnType = ReturnType_<MT>;
128  using CompositeType = const This&;
129  using Reference = UpperProxy<MT>;
130  using ConstReference = ConstReference_<MT>;
131  using Pointer = Pointer_<MT>;
132  using ConstPointer = ConstPointer_<MT>;
133  using ConstIterator = ConstIterator_<MT>;
134  //**********************************************************************************************
135 
136  //**Rebind struct definition********************************************************************
139  template< typename NewType > // Data type of the other matrix
140  struct Rebind {
142  using Other = UpperMatrix< typename MT::template Rebind<NewType>::Other >;
143  };
144  //**********************************************************************************************
145 
146  //**Resize struct definition********************************************************************
149  template< size_t NewM // Number of rows of the other matrix
150  , size_t NewN > // Number of columns of the other matrix
151  struct Resize {
153  using Other = UpperMatrix< typename MT::template Resize<NewM,NewN>::Other >;
154  };
155  //**********************************************************************************************
156 
157  //**Iterator class definition*******************************************************************
160  class Iterator
161  {
162  public:
163  //**Type definitions*************************************************************************
164  using IteratorCategory = std::random_access_iterator_tag;
165  using ValueType = ElementType_<MT>;
166  using PointerType = UpperProxy<MT>;
167  using ReferenceType = UpperProxy<MT>;
168  using DifferenceType = ptrdiff_t;
169 
170  // STL iterator requirements
171  using iterator_category = IteratorCategory;
172  using value_type = ValueType;
173  using pointer = PointerType;
174  using reference = ReferenceType;
175  using difference_type = DifferenceType;
176  //*******************************************************************************************
177 
178  //**Constructor******************************************************************************
181  inline Iterator() noexcept
182  : matrix_( nullptr ) // Reference to the adapted dense matrix
183  , row_ ( 0UL ) // The current row index of the iterator
184  , column_( 0UL ) // The current column index of the iterator
185  {}
186  //*******************************************************************************************
187 
188  //**Constructor******************************************************************************
195  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
196  : matrix_( &matrix ) // Reference to the adapted dense matrix
197  , row_ ( row ) // The current row-index of the iterator
198  , column_( column ) // The current column-index of the iterator
199  {}
200  //*******************************************************************************************
201 
202  //**Addition assignment operator*************************************************************
208  inline Iterator& operator+=( size_t inc ) noexcept {
209  ( SO )?( row_ += inc ):( column_ += inc );
210  return *this;
211  }
212  //*******************************************************************************************
213 
214  //**Subtraction assignment operator**********************************************************
220  inline Iterator& operator-=( size_t dec ) noexcept {
221  ( SO )?( row_ -= dec ):( column_ -= dec );
222  return *this;
223  }
224  //*******************************************************************************************
225 
226  //**Prefix increment operator****************************************************************
231  inline Iterator& operator++() noexcept {
232  ( SO )?( ++row_ ):( ++column_ );
233  return *this;
234  }
235  //*******************************************************************************************
236 
237  //**Postfix increment operator***************************************************************
242  inline const Iterator operator++( int ) noexcept {
243  const Iterator tmp( *this );
244  ++(*this);
245  return tmp;
246  }
247  //*******************************************************************************************
248 
249  //**Prefix decrement operator****************************************************************
254  inline Iterator& operator--() noexcept {
255  ( SO )?( --row_ ):( --column_ );
256  return *this;
257  }
258  //*******************************************************************************************
259 
260  //**Postfix decrement operator***************************************************************
265  inline const Iterator operator--( int ) noexcept {
266  const Iterator tmp( *this );
267  --(*this);
268  return tmp;
269  }
270  //*******************************************************************************************
271 
272  //**Element access operator******************************************************************
277  inline ReferenceType operator*() const {
278  return ReferenceType( *matrix_, row_, column_ );
279  }
280  //*******************************************************************************************
281 
282  //**Element access operator******************************************************************
287  inline PointerType operator->() const {
288  return PointerType( *matrix_, row_, column_ );
289  }
290  //*******************************************************************************************
291 
292  //**Load function****************************************************************************
302  inline SIMDType load() const {
303  return (*matrix_).load(row_,column_);
304  }
305  //*******************************************************************************************
306 
307  //**Loada function***************************************************************************
317  inline SIMDType loada() const {
318  return (*matrix_).loada(row_,column_);
319  }
320  //*******************************************************************************************
321 
322  //**Loadu function***************************************************************************
332  inline SIMDType loadu() const {
333  return (*matrix_).loadu(row_,column_);
334  }
335  //*******************************************************************************************
336 
337  //**Conversion operator**********************************************************************
342  inline operator ConstIterator() const {
343  if( SO )
344  return matrix_->begin( column_ ) + row_;
345  else
346  return matrix_->begin( row_ ) + column_;
347  }
348  //*******************************************************************************************
349 
350  //**Equality operator************************************************************************
357  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
358  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
359  }
360  //*******************************************************************************************
361 
362  //**Equality operator************************************************************************
369  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
370  return ( ConstIterator( lhs ) == rhs );
371  }
372  //*******************************************************************************************
373 
374  //**Equality operator************************************************************************
381  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
382  return ( lhs == ConstIterator( rhs ) );
383  }
384  //*******************************************************************************************
385 
386  //**Inequality operator**********************************************************************
393  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
394  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
395  }
396  //*******************************************************************************************
397 
398  //**Inequality operator**********************************************************************
405  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
406  return ( ConstIterator( lhs ) != rhs );
407  }
408  //*******************************************************************************************
409 
410  //**Inequality operator**********************************************************************
417  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
418  return ( lhs != ConstIterator( rhs ) );
419  }
420  //*******************************************************************************************
421 
422  //**Less-than operator***********************************************************************
429  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
430  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
431  }
432  //*******************************************************************************************
433 
434  //**Less-than operator***********************************************************************
441  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
442  return ( ConstIterator( lhs ) < rhs );
443  }
444  //*******************************************************************************************
445 
446  //**Less-than operator***********************************************************************
453  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
454  return ( lhs < ConstIterator( rhs ) );
455  }
456  //*******************************************************************************************
457 
458  //**Greater-than operator********************************************************************
465  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
466  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
467  }
468  //*******************************************************************************************
469 
470  //**Greater-than operator********************************************************************
477  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
478  return ( ConstIterator( lhs ) > rhs );
479  }
480  //*******************************************************************************************
481 
482  //**Greater-than operator********************************************************************
489  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
490  return ( lhs > ConstIterator( rhs ) );
491  }
492  //*******************************************************************************************
493 
494  //**Less-or-equal-than operator**************************************************************
501  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
502  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
503  }
504  //*******************************************************************************************
505 
506  //**Less-or-equal-than operator**************************************************************
513  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
514  return ( ConstIterator( lhs ) <= rhs );
515  }
516  //*******************************************************************************************
517 
518  //**Less-or-equal-than operator**************************************************************
525  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
526  return ( lhs <= ConstIterator( rhs ) );
527  }
528  //*******************************************************************************************
529 
530  //**Greater-or-equal-than operator***********************************************************
537  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
538  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
539  }
540  //*******************************************************************************************
541 
542  //**Greater-or-equal-than operator***********************************************************
549  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
550  return ( ConstIterator( lhs ) >= rhs );
551  }
552  //*******************************************************************************************
553 
554  //**Greater-or-equal-than operator***********************************************************
561  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
562  return ( lhs >= ConstIterator( rhs ) );
563  }
564  //*******************************************************************************************
565 
566  //**Subtraction operator*********************************************************************
572  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
573  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
574  }
575  //*******************************************************************************************
576 
577  //**Addition operator************************************************************************
584  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
585  if( SO )
586  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
587  else
588  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
589  }
590  //*******************************************************************************************
591 
592  //**Addition operator************************************************************************
599  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
600  if( SO )
601  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
602  else
603  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
604  }
605  //*******************************************************************************************
606 
607  //**Subtraction operator*********************************************************************
614  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
615  if( SO )
616  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
617  else
618  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
619  }
620  //*******************************************************************************************
621 
622  private:
623  //**Member variables*************************************************************************
624  MT* matrix_;
625  size_t row_;
626  size_t column_;
627  //*******************************************************************************************
628  };
629  //**********************************************************************************************
630 
631  //**Compilation flags***************************************************************************
633  enum : bool { simdEnabled = MT::simdEnabled };
634 
636  enum : bool { smpAssignable = MT::smpAssignable };
637  //**********************************************************************************************
638 
639  //**Constructors********************************************************************************
642  explicit inline UpperMatrix();
643  template< typename A1 > explicit inline UpperMatrix( const A1& a1 );
644  explicit inline UpperMatrix( size_t n, const ElementType& init );
645 
646  explicit inline UpperMatrix( initializer_list< initializer_list<ElementType> > list );
647 
648  template< typename Other >
649  explicit inline UpperMatrix( size_t n, const Other* array );
650 
651  template< typename Other, size_t N >
652  explicit inline UpperMatrix( const Other (&array)[N][N] );
653 
654  explicit inline UpperMatrix( ElementType* ptr, size_t n );
655  explicit inline UpperMatrix( ElementType* ptr, size_t n, size_t nn );
656 
657  inline UpperMatrix( const UpperMatrix& m );
658  inline UpperMatrix( UpperMatrix&& m ) noexcept;
660  //**********************************************************************************************
661 
662  //**Destructor**********************************************************************************
663  // No explicitly declared destructor.
664  //**********************************************************************************************
665 
666  //**Data access functions***********************************************************************
669  inline Reference operator()( size_t i, size_t j );
670  inline ConstReference operator()( size_t i, size_t j ) const;
671  inline Reference at( size_t i, size_t j );
672  inline ConstReference at( size_t i, size_t j ) const;
673  inline ConstPointer data () const noexcept;
674  inline ConstPointer data ( size_t i ) const noexcept;
675  inline Iterator begin ( size_t i );
676  inline ConstIterator begin ( size_t i ) const;
677  inline ConstIterator cbegin( size_t i ) const;
678  inline Iterator end ( size_t i );
679  inline ConstIterator end ( size_t i ) const;
680  inline ConstIterator cend ( size_t i ) const;
682  //**********************************************************************************************
683 
684  //**Assignment operators************************************************************************
687  inline UpperMatrix& operator=( const ElementType& rhs );
688  inline UpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
689 
690  template< typename Other, size_t N >
691  inline UpperMatrix& operator=( const Other (&array)[N][N] );
692 
693  inline UpperMatrix& operator=( const UpperMatrix& rhs );
694  inline UpperMatrix& operator=( UpperMatrix&& rhs ) noexcept;
695 
696  template< typename MT2, bool SO2 >
697  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
698 
699  template< typename MT2, bool SO2 >
700  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
701 
702  template< typename MT2, bool SO2 >
703  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
704 
705  template< typename MT2, bool SO2 >
706  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
707 
708  template< typename MT2, bool SO2 >
709  inline DisableIf_< IsComputation<MT2>, UpperMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
710 
711  template< typename MT2, bool SO2 >
712  inline EnableIf_< IsComputation<MT2>, UpperMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
713 
714  template< typename MT2, bool SO2 >
715  inline UpperMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
716 
717  template< typename ST >
718  inline EnableIf_< IsNumeric<ST>, UpperMatrix >& operator*=( ST rhs );
719 
720  template< typename ST >
721  inline EnableIf_< IsNumeric<ST>, UpperMatrix >& operator/=( ST rhs );
723  //**********************************************************************************************
724 
725  //**Utility functions***************************************************************************
728  inline size_t rows() const noexcept;
729  inline size_t columns() const noexcept;
730  inline size_t spacing() const noexcept;
731  inline size_t capacity() const noexcept;
732  inline size_t capacity( size_t i ) const noexcept;
733  inline size_t nonZeros() const;
734  inline size_t nonZeros( size_t i ) const;
735  inline void reset();
736  inline void reset( size_t i );
737  inline void clear();
738  void resize ( size_t n, bool preserve=true );
739  inline void extend ( size_t n, bool preserve=true );
740  inline void reserve( size_t elements );
741  inline void shrinkToFit();
742  inline void swap( UpperMatrix& m ) noexcept;
743 
744  static inline constexpr size_t maxNonZeros() noexcept;
745  static inline constexpr size_t maxNonZeros( size_t n ) noexcept;
747  //**********************************************************************************************
748 
749  //**Numeric functions***************************************************************************
752  template< typename Other > inline UpperMatrix& scale( const Other& scalar );
754  //**********************************************************************************************
755 
756  //**Debugging functions*************************************************************************
759  inline bool isIntact() const noexcept;
761  //**********************************************************************************************
762 
763  //**Expression template evaluation functions****************************************************
766  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
767  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
768 
769  inline bool isAligned () const noexcept;
770  inline bool canSMPAssign() const noexcept;
771 
772  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
773  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
774  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
776  //**********************************************************************************************
777 
778  private:
779  //**Construction functions**********************************************************************
782  inline const MT construct( size_t n , TrueType );
783  inline const MT construct( const ElementType& value, FalseType );
784 
785  template< typename MT2, bool SO2, typename T >
786  inline const MT construct( const Matrix<MT2,SO2>& m, T );
788  //**********************************************************************************************
789 
790  //**Member variables****************************************************************************
793  MT matrix_;
794 
795  //**********************************************************************************************
796 
797  //**Friend declarations*************************************************************************
798  template< bool RF, typename MT2, bool SO2, bool DF2 >
799  friend bool isDefault( const UpperMatrix<MT2,SO2,DF2>& m );
800 
801  template< typename MT2, bool SO2, bool DF2 >
802  friend MT2& derestrict( UpperMatrix<MT2,SO2,DF2>& m );
803  //**********************************************************************************************
804 
805  //**Compile time checks*************************************************************************
818  BLAZE_STATIC_ASSERT( ( Size<MT,0UL>::value == Size<MT,1UL>::value ) );
819  //**********************************************************************************************
820 };
822 //*************************************************************************************************
823 
824 
825 
826 
827 //=================================================================================================
828 //
829 // CONSTRUCTORS
830 //
831 //=================================================================================================
832 
833 //*************************************************************************************************
837 template< typename MT // Type of the adapted dense matrix
838  , bool SO > // Storage order of the adapted dense matrix
839 inline UpperMatrix<MT,SO,true>::UpperMatrix()
840  : matrix_() // The adapted dense matrix
841 {
842  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
843  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
844 }
846 //*************************************************************************************************
847 
848 
849 //*************************************************************************************************
867 template< typename MT // Type of the adapted dense matrix
868  , bool SO > // Storage order of the adapted dense matrix
869 template< typename A1 > // Type of the constructor argument
870 inline UpperMatrix<MT,SO,true>::UpperMatrix( const A1& a1 )
871  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
872 {
873  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
874  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
875 }
877 //*************************************************************************************************
878 
879 
880 //*************************************************************************************************
887 template< typename MT // Type of the adapted dense matrix
888  , bool SO > // Storage order of the adapted dense matrix
889 inline UpperMatrix<MT,SO,true>::UpperMatrix( size_t n, const ElementType& init )
890  : matrix_( n, n, ElementType() ) // The adapted dense matrix
891 {
893 
894  if( SO ) {
895  for( size_t j=0UL; j<columns(); ++j )
896  for( size_t i=0UL; i<=j; ++i )
897  matrix_(i,j) = init;
898  }
899  else {
900  for( size_t i=0UL; i<rows(); ++i )
901  for( size_t j=i; j<columns(); ++j )
902  matrix_(i,j) = init;
903  }
904 
905  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
906  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
907 }
909 //*************************************************************************************************
910 
911 
912 //*************************************************************************************************
936 template< typename MT // Type of the adapted dense matrix
937  , bool SO > // Storage order of the adapted dense matrix
938 inline UpperMatrix<MT,SO,true>::UpperMatrix( initializer_list< initializer_list<ElementType> > list )
939  : matrix_( list ) // The adapted dense matrix
940 {
941  if( !isUpper( matrix_ ) ) {
942  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
943  }
944 
945  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
946 }
948 //*************************************************************************************************
949 
950 
951 //*************************************************************************************************
977 template< typename MT // Type of the adapted dense matrix
978  , bool SO > // Storage order of the adapted dense matrix
979 template< typename Other > // Data type of the initialization array
980 inline UpperMatrix<MT,SO,true>::UpperMatrix( size_t n, const Other* array )
981  : matrix_( n, n, array ) // The adapted dense matrix
982 {
983  if( !isUpper( matrix_ ) ) {
984  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
985  }
986 
987  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
988 }
990 //*************************************************************************************************
991 
992 
993 //*************************************************************************************************
1016 template< typename MT // Type of the adapted dense matrix
1017  , bool SO > // Storage order of the adapted dense matrix
1018 template< typename Other // Data type of the initialization array
1019  , size_t N > // Number of rows and columns of the initialization array
1020 inline UpperMatrix<MT,SO,true>::UpperMatrix( const Other (&array)[N][N] )
1021  : matrix_( array ) // The adapted dense matrix
1022 {
1023  if( !isUpper( matrix_ ) ) {
1024  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1025  }
1026 
1027  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1028 }
1030 //*************************************************************************************************
1031 
1032 
1033 //*************************************************************************************************
1065 template< typename MT // Type of the adapted dense matrix
1066  , bool SO > // Storage order of the adapted dense matrix
1067 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n )
1068  : matrix_( ptr, n, n ) // The adapted dense matrix
1069 {
1070  if( !isUpper( matrix_ ) ) {
1071  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1072  }
1073 
1074  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1075 }
1077 //*************************************************************************************************
1078 
1079 
1080 //*************************************************************************************************
1114 template< typename MT // Type of the adapted dense matrix
1115  , bool SO > // Storage order of the adapted dense matrix
1116 inline UpperMatrix<MT,SO,true>::UpperMatrix( ElementType* ptr, size_t n, size_t nn )
1117  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1118 {
1119  if( !isUpper( matrix_ ) ) {
1120  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
1121  }
1122 
1123  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1124 }
1126 //*************************************************************************************************
1127 
1128 
1129 //*************************************************************************************************
1135 template< typename MT // Type of the adapted dense matrix
1136  , bool SO > // Storage order of the adapted dense matrix
1137 inline UpperMatrix<MT,SO,true>::UpperMatrix( const UpperMatrix& m )
1138  : matrix_( m.matrix_ ) // The adapted dense matrix
1139 {
1140  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1141  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1142 }
1144 //*************************************************************************************************
1145 
1146 
1147 //*************************************************************************************************
1153 template< typename MT // Type of the adapted dense matrix
1154  , bool SO > // Storage order of the adapted dense matrix
1155 inline UpperMatrix<MT,SO,true>::UpperMatrix( UpperMatrix&& m ) noexcept
1156  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1157 {
1158  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
1159  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1160 }
1162 //*************************************************************************************************
1163 
1164 
1165 
1166 
1167 //=================================================================================================
1168 //
1169 // DATA ACCESS FUNCTIONS
1170 //
1171 //=================================================================================================
1172 
1173 //*************************************************************************************************
1189 template< typename MT // Type of the adapted dense matrix
1190  , bool SO > // Storage order of the adapted dense matrix
1191 inline typename UpperMatrix<MT,SO,true>::Reference
1192  UpperMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1193 {
1194  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1195  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1196 
1197  return Reference( matrix_, i, j );
1198 }
1200 //*************************************************************************************************
1201 
1202 
1203 //*************************************************************************************************
1219 template< typename MT // Type of the adapted dense matrix
1220  , bool SO > // Storage order of the adapted dense matrix
1222  UpperMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1223 {
1224  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1225  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1226 
1227  return matrix_(i,j);
1228 }
1230 //*************************************************************************************************
1231 
1232 
1233 //*************************************************************************************************
1250 template< typename MT // Type of the adapted dense matrix
1251  , bool SO > // Storage order of the adapted dense matrix
1252 inline typename UpperMatrix<MT,SO,true>::Reference
1253  UpperMatrix<MT,SO,true>::at( size_t i, size_t j )
1254 {
1255  if( i >= rows() ) {
1256  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1257  }
1258  if( j >= columns() ) {
1259  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1260  }
1261  return (*this)(i,j);
1262 }
1264 //*************************************************************************************************
1265 
1266 
1267 //*************************************************************************************************
1284 template< typename MT // Type of the adapted dense matrix
1285  , bool SO > // Storage order of the adapted dense matrix
1287  UpperMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1288 {
1289  if( i >= rows() ) {
1290  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1291  }
1292  if( j >= columns() ) {
1293  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1294  }
1295  return (*this)(i,j);
1296 }
1298 //*************************************************************************************************
1299 
1300 
1301 //*************************************************************************************************
1314 template< typename MT // Type of the adapted dense matrix
1315  , bool SO > // Storage order of the adapted dense matrix
1316 inline typename UpperMatrix<MT,SO,true>::ConstPointer
1317  UpperMatrix<MT,SO,true>::data() const noexcept
1318 {
1319  return matrix_.data();
1320 }
1322 //*************************************************************************************************
1323 
1324 
1325 //*************************************************************************************************
1334 template< typename MT // Type of the adapted dense matrix
1335  , bool SO > // Storage order of the adapted dense matrix
1336 inline typename UpperMatrix<MT,SO,true>::ConstPointer
1337  UpperMatrix<MT,SO,true>::data( size_t i ) const noexcept
1338 {
1339  return matrix_.data(i);
1340 }
1342 //*************************************************************************************************
1343 
1344 
1345 //*************************************************************************************************
1357 template< typename MT // Type of the adapted dense matrix
1358  , bool SO > // Storage order of the adapted dense matrix
1359 inline typename UpperMatrix<MT,SO,true>::Iterator
1360  UpperMatrix<MT,SO,true>::begin( size_t i )
1361 {
1362  if( SO )
1363  return Iterator( matrix_, 0UL, i );
1364  else
1365  return Iterator( matrix_, i, 0UL );
1366 }
1368 //*************************************************************************************************
1369 
1370 
1371 //*************************************************************************************************
1383 template< typename MT // Type of the adapted dense matrix
1384  , bool SO > // Storage order of the adapted dense matrix
1386  UpperMatrix<MT,SO,true>::begin( size_t i ) const
1387 {
1388  return matrix_.begin(i);
1389 }
1391 //*************************************************************************************************
1392 
1393 
1394 //*************************************************************************************************
1406 template< typename MT // Type of the adapted dense matrix
1407  , bool SO > // Storage order of the adapted dense matrix
1409  UpperMatrix<MT,SO,true>::cbegin( size_t i ) const
1410 {
1411  return matrix_.cbegin(i);
1412 }
1414 //*************************************************************************************************
1415 
1416 
1417 //*************************************************************************************************
1429 template< typename MT // Type of the adapted dense matrix
1430  , bool SO > // Storage order of the adapted dense matrix
1431 inline typename UpperMatrix<MT,SO,true>::Iterator
1432  UpperMatrix<MT,SO,true>::end( size_t i )
1433 {
1434  if( SO )
1435  return Iterator( matrix_, rows(), i );
1436  else
1437  return Iterator( matrix_, i, columns() );
1438 }
1440 //*************************************************************************************************
1441 
1442 
1443 //*************************************************************************************************
1455 template< typename MT // Type of the adapted dense matrix
1456  , bool SO > // Storage order of the adapted dense matrix
1458  UpperMatrix<MT,SO,true>::end( size_t i ) const
1459 {
1460  return matrix_.end(i);
1461 }
1463 //*************************************************************************************************
1464 
1465 
1466 //*************************************************************************************************
1478 template< typename MT // Type of the adapted dense matrix
1479  , bool SO > // Storage order of the adapted dense matrix
1481  UpperMatrix<MT,SO,true>::cend( size_t i ) const
1482 {
1483  return matrix_.cend(i);
1484 }
1486 //*************************************************************************************************
1487 
1488 
1489 
1490 
1491 //=================================================================================================
1492 //
1493 // ASSIGNMENT OPERATORS
1494 //
1495 //=================================================================================================
1496 
1497 //*************************************************************************************************
1504 template< typename MT // Type of the adapted dense matrix
1505  , bool SO > // Storage order of the adapted dense matrix
1506 inline UpperMatrix<MT,SO,true>&
1507  UpperMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1508 {
1509  if( SO ) {
1510  for( size_t j=0UL; j<columns(); ++j )
1511  for( size_t i=0UL; i<=j; ++i )
1512  matrix_(i,j) = rhs;
1513  }
1514  else {
1515  for( size_t i=0UL; i<rows(); ++i )
1516  for( size_t j=i; j<columns(); ++j )
1517  matrix_(i,j) = rhs;
1518  }
1519 
1520  return *this;
1521 }
1523 //*************************************************************************************************
1524 
1525 
1526 //*************************************************************************************************
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  const InitializerMatrix<ElementType> tmp( list, list.size() );
1557 
1558  if( !isUpper( tmp ) ) {
1559  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to upper matrix" );
1560  }
1561 
1562  matrix_ = list;
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 //*************************************************************************************************
1954 template< typename MT // Type of the adapted dense matrix
1955  , bool SO > // Storage order of the adapted dense matrix
1956 template< typename ST > // Data type of the right-hand side scalar
1957 inline EnableIf_< IsNumeric<ST>, UpperMatrix<MT,SO,true> >&
1959 {
1960  matrix_ *= rhs;
1961  return *this;
1962 }
1963 //*************************************************************************************************
1964 
1965 
1966 //*************************************************************************************************
1974 template< typename MT // Type of the adapted dense matrix
1975  , bool SO > // Storage order of the adapted dense matrix
1976 template< typename ST > // Data type of the right-hand side scalar
1977 inline EnableIf_< IsNumeric<ST>, UpperMatrix<MT,SO,true> >&
1979 {
1980  BLAZE_USER_ASSERT( !isZero( rhs ), "Division by zero detected" );
1981 
1982  matrix_ /= rhs;
1983  return *this;
1984 }
1986 //*************************************************************************************************
1987 
1988 
1989 
1990 
1991 //=================================================================================================
1992 //
1993 // UTILITY FUNCTIONS
1994 //
1995 //=================================================================================================
1996 
1997 //*************************************************************************************************
2003 template< typename MT // Type of the adapted dense matrix
2004  , bool SO > // Storage order of the adapted dense matrix
2005 inline size_t UpperMatrix<MT,SO,true>::rows() const noexcept
2006 {
2007  return matrix_.rows();
2008 }
2010 //*************************************************************************************************
2011 
2012 
2013 //*************************************************************************************************
2019 template< typename MT // Type of the adapted dense matrix
2020  , bool SO > // Storage order of the adapted dense matrix
2021 inline size_t UpperMatrix<MT,SO,true>::columns() const noexcept
2022 {
2023  return matrix_.columns();
2024 }
2026 //*************************************************************************************************
2027 
2028 
2029 //*************************************************************************************************
2040 template< typename MT // Type of the adapted dense matrix
2041  , bool SO > // Storage order of the adapted dense matrix
2042 inline size_t UpperMatrix<MT,SO,true>::spacing() const noexcept
2043 {
2044  return matrix_.spacing();
2045 }
2047 //*************************************************************************************************
2048 
2049 
2050 //*************************************************************************************************
2056 template< typename MT // Type of the adapted dense matrix
2057  , bool SO > // Storage order of the adapted dense matrix
2058 inline size_t UpperMatrix<MT,SO,true>::capacity() const noexcept
2059 {
2060  return matrix_.capacity();
2061 }
2063 //*************************************************************************************************
2064 
2065 
2066 //*************************************************************************************************
2078 template< typename MT // Type of the adapted dense matrix
2079  , bool SO > // Storage order of the adapted dense matrix
2080 inline size_t UpperMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2081 {
2082  return matrix_.capacity(i);
2083 }
2085 //*************************************************************************************************
2086 
2087 
2088 //*************************************************************************************************
2094 template< typename MT // Type of the adapted dense matrix
2095  , bool SO > // Storage order of the adapted dense matrix
2096 inline size_t UpperMatrix<MT,SO,true>::nonZeros() const
2097 {
2098  return matrix_.nonZeros();
2099 }
2101 //*************************************************************************************************
2102 
2103 
2104 //*************************************************************************************************
2116 template< typename MT // Type of the adapted dense matrix
2117  , bool SO > // Storage order of the adapted dense matrix
2118 inline size_t UpperMatrix<MT,SO,true>::nonZeros( size_t i ) const
2119 {
2120  return matrix_.nonZeros(i);
2121 }
2123 //*************************************************************************************************
2124 
2125 
2126 //*************************************************************************************************
2132 template< typename MT // Type of the adapted dense matrix
2133  , bool SO > // Storage order of the adapted dense matrix
2134 inline void UpperMatrix<MT,SO,true>::reset()
2135 {
2136  using blaze::clear;
2137 
2138  if( SO ) {
2139  for( size_t j=0UL; j<columns(); ++j )
2140  for( size_t i=0UL; i<=j; ++i )
2141  clear( matrix_(i,j) );
2142  }
2143  else {
2144  for( size_t i=0UL; i<rows(); ++i )
2145  for( size_t j=i; j<columns(); ++j )
2146  clear( matrix_(i,j) );
2147  }
2148 }
2150 //*************************************************************************************************
2151 
2152 
2153 //*************************************************************************************************
2166 template< typename MT // Type of the adapted dense matrix
2167  , bool SO > // Storage order of the adapted dense matrix
2168 inline void UpperMatrix<MT,SO,true>::reset( size_t i )
2169 {
2170  using blaze::clear;
2171 
2172  if( SO ) {
2173  for( size_t j=0UL; j<=i; ++j )
2174  clear( matrix_(j,i) );
2175  }
2176  else {
2177  for( size_t j=i; j<columns(); ++j )
2178  clear( matrix_(i,j) );
2179  }
2180 }
2182 //*************************************************************************************************
2183 
2184 
2185 //*************************************************************************************************
2197 template< typename MT // Type of the adapted dense matrix
2198  , bool SO > // Storage order of the adapted dense matrix
2199 inline void UpperMatrix<MT,SO,true>::clear()
2200 {
2201  using blaze::clear;
2202 
2203  if( IsResizable<MT>::value ) {
2204  clear( matrix_ );
2205  }
2206  else {
2207  reset();
2208  }
2209 }
2211 //*************************************************************************************************
2212 
2213 
2214 //*************************************************************************************************
2250 template< typename MT // Type of the adapted dense matrix
2251  , bool SO > // Storage order of the adapted dense matrix
2252 void UpperMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2253 {
2255 
2256  UNUSED_PARAMETER( preserve );
2257 
2258  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square upper matrix detected" );
2259 
2260  const size_t oldsize( matrix_.rows() );
2261 
2262  matrix_.resize( n, n, true );
2263 
2264  if( n > oldsize ) {
2265  const size_t increment( n - oldsize );
2266  submatrix( matrix_, oldsize, 0UL, increment, n-1 ).reset();
2267  }
2268 }
2270 //*************************************************************************************************
2271 
2272 
2273 //*************************************************************************************************
2286 template< typename MT // Type of the adapted dense matrix
2287  , bool SO > // Storage order of the adapted dense matrix
2288 inline void UpperMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2289 {
2291 
2292  UNUSED_PARAMETER( preserve );
2293 
2294  resize( rows() + n, true );
2295 }
2296 //*************************************************************************************************
2297 
2298 
2299 //*************************************************************************************************
2309 template< typename MT // Type of the adapted dense matrix
2310  , bool SO > // Storage order of the adapted dense matrix
2311 inline void UpperMatrix<MT,SO,true>::reserve( size_t elements )
2312 {
2313  matrix_.reserve( elements );
2314 }
2316 //*************************************************************************************************
2317 
2318 
2319 //*************************************************************************************************
2329 template< typename MT // Type of the adapted dense matrix
2330  , bool SO > // Storage order of the adapted dense matrix
2332 {
2333  matrix_.shrinkToFit();
2334 }
2336 //*************************************************************************************************
2337 
2338 
2339 //*************************************************************************************************
2346 template< typename MT // Type of the adapted dense matrix
2347  , bool SO > // Storage order of the adapted dense matrix
2348 inline void UpperMatrix<MT,SO,true>::swap( UpperMatrix& m ) noexcept
2349 {
2350  using std::swap;
2351 
2352  swap( matrix_, m.matrix_ );
2353 }
2355 //*************************************************************************************************
2356 
2357 
2358 //*************************************************************************************************
2370 template< typename MT // Type of the adapted dense matrix
2371  , bool SO > // Storage order of the adapted dense matrix
2372 inline constexpr size_t UpperMatrix<MT,SO,true>::maxNonZeros() noexcept
2373 {
2375 
2376  return maxNonZeros( Size<MT,0UL>::value );
2377 }
2379 //*************************************************************************************************
2380 
2381 
2382 //*************************************************************************************************
2392 template< typename MT // Type of the adapted dense matrix
2393  , bool SO > // Storage order of the adapted dense matrix
2394 inline constexpr size_t UpperMatrix<MT,SO,true>::maxNonZeros( size_t n ) noexcept
2395 {
2396  return ( ( n + 1UL ) * n ) / 2UL;
2397 }
2399 //*************************************************************************************************
2400 
2401 
2402 
2403 
2404 //=================================================================================================
2405 //
2406 // NUMERIC FUNCTIONS
2407 //
2408 //=================================================================================================
2409 
2410 //*************************************************************************************************
2428 template< typename MT // Type of the adapted dense matrix
2429  , bool SO > // Storage order of the adapted dense matrix
2430 template< typename Other > // Data type of the scalar value
2431 inline UpperMatrix<MT,SO,true>& UpperMatrix<MT,SO,true>::scale( const Other& scalar )
2432 {
2433  matrix_.scale( scalar );
2434  return *this;
2435 }
2437 //*************************************************************************************************
2438 
2439 
2440 
2441 
2442 //=================================================================================================
2443 //
2444 // DEBUGGING FUNCTIONS
2445 //
2446 //=================================================================================================
2447 
2448 //*************************************************************************************************
2458 template< typename MT // Type of the adapted dense matrix
2459  , bool SO > // Storage order of the adapted dense matrix
2460 inline bool UpperMatrix<MT,SO,true>::isIntact() const noexcept
2461 {
2462  using blaze::isIntact;
2463 
2464  return ( isIntact( matrix_ ) && isUpper( matrix_ ) );
2465 }
2467 //*************************************************************************************************
2468 
2469 
2470 
2471 
2472 //=================================================================================================
2473 //
2474 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2475 //
2476 //=================================================================================================
2477 
2478 //*************************************************************************************************
2489 template< typename MT // Type of the adapted dense matrix
2490  , bool SO > // Storage order of the adapted dense matrix
2491 template< typename Other > // Data type of the foreign expression
2492 inline bool UpperMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2493 {
2494  return matrix_.canAlias( alias );
2495 }
2497 //*************************************************************************************************
2498 
2499 
2500 //*************************************************************************************************
2511 template< typename MT // Type of the adapted dense matrix
2512  , bool SO > // Storage order of the adapted dense matrix
2513 template< typename Other > // Data type of the foreign expression
2514 inline bool UpperMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2515 {
2516  return matrix_.isAliased( alias );
2517 }
2519 //*************************************************************************************************
2520 
2521 
2522 //*************************************************************************************************
2532 template< typename MT // Type of the adapted dense matrix
2533  , bool SO > // Storage order of the adapted dense matrix
2534 inline bool UpperMatrix<MT,SO,true>::isAligned() const noexcept
2535 {
2536  return matrix_.isAligned();
2537 }
2539 //*************************************************************************************************
2540 
2541 
2542 //*************************************************************************************************
2553 template< typename MT // Type of the adapted dense matrix
2554  , bool SO > // Storage order of the adapted dense matrix
2555 inline bool UpperMatrix<MT,SO,true>::canSMPAssign() const noexcept
2556 {
2557  return matrix_.canSMPAssign();
2558 }
2560 //*************************************************************************************************
2561 
2562 
2563 //*************************************************************************************************
2579 template< typename MT // Type of the adapted dense matrix
2580  , bool SO > // Storage order of the adapted dense matrix
2581 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2582  UpperMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2583 {
2584  return matrix_.load( i, j );
2585 }
2587 //*************************************************************************************************
2588 
2589 
2590 //*************************************************************************************************
2606 template< typename MT // Type of the adapted dense matrix
2607  , bool SO > // Storage order of the adapted dense matrix
2608 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2609  UpperMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2610 {
2611  return matrix_.loada( i, j );
2612 }
2614 //*************************************************************************************************
2615 
2616 
2617 //*************************************************************************************************
2633 template< typename MT // Type of the adapted dense matrix
2634  , bool SO > // Storage order of the adapted dense matrix
2635 BLAZE_ALWAYS_INLINE typename UpperMatrix<MT,SO,true>::SIMDType
2636  UpperMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2637 {
2638  return matrix_.loadu( i, j );
2639 }
2641 //*************************************************************************************************
2642 
2643 
2644 
2645 
2646 //=================================================================================================
2647 //
2648 // CONSTRUCTION FUNCTIONS
2649 //
2650 //=================================================================================================
2651 
2652 //*************************************************************************************************
2659 template< typename MT // Type of the adapted dense matrix
2660  , bool SO > // Storage order of the adapted dense matrix
2661 inline const MT UpperMatrix<MT,SO,true>::construct( size_t n, TrueType )
2662 {
2664 
2665  return MT( n, n, ElementType() );
2666 }
2668 //*************************************************************************************************
2669 
2670 
2671 //*************************************************************************************************
2678 template< typename MT // Type of the adapted dense matrix
2679  , bool SO > // Storage order of the adapted dense matrix
2680 inline const MT UpperMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2681 {
2684 
2685  MT tmp;
2686 
2687  if( SO ) {
2688  for( size_t j=0UL; j<columns(); ++j )
2689  for( size_t i=0UL; i<=j; ++i )
2690  tmp(i,j) = init;
2691  }
2692  else {
2693  for( size_t i=0UL; i<rows(); ++i )
2694  for( size_t j=i; j<columns(); ++j )
2695  tmp(i,j) = init;
2696  }
2697 
2698  return tmp;
2699 }
2701 //*************************************************************************************************
2702 
2703 
2704 //*************************************************************************************************
2715 template< typename MT // Type of the adapted dense matrix
2716  , bool SO > // Storage order of the adapted dense matrix
2717 template< typename MT2 // Type of the foreign matrix
2718  , bool SO2 // Storage order of the foreign matrix
2719  , typename T > // Type of the third argument
2720 inline const MT UpperMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2721 {
2722  const MT tmp( ~m );
2723 
2724  if( !IsUpper<MT2>::value && !isUpper( tmp ) ) {
2725  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of upper matrix" );
2726  }
2727 
2728  return tmp;
2729 }
2731 //*************************************************************************************************
2732 
2733 } // namespace blaze
2734 
2735 #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.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:131
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3077
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1469
#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 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:522
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
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3076
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:364
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3074
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:588
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:701
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:775
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:5829
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3078
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3083
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.h:1026
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:560
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:733
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:3084
Header file for the extended initializer_list functionality.
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:474
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:408
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
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:252
#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 IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:670
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3082
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_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:5908
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5891
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3079
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
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:3085
Header file for the isZero shim.
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:506
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.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:134
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:714
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:430
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.
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
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:608
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.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:131
#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:272
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:490
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3080
BLAZE_ALWAYS_INLINE MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
EnableIf_< IsNumeric< ST >, MT &> operator/=(DenseMatrix< MT, SO > &mat, ST scalar)
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:655
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3081
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:254
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
#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.
EnableIf_< IsNumeric< ST >, MT &> operator*=(DenseMatrix< MT, SO > &mat, ST scalar)
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:593
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:908
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TrueType type/value trait base class.