Dense.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_DENSE_H_
36 #define _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_DENSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
44 #include <utility>
47 #include <blaze/math/Aliases.h>
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 DiagonalMatrix<MT,SO,true>
106  : public DenseMatrix< DiagonalMatrix<MT,SO,true>, SO >
107 {
108  private:
109  //**Type definitions****************************************************************************
110  using OT = OppositeType_<MT>;
111  using TT = TransposeType_<MT>;
112  using ET = ElementType_<MT>;
113  //**********************************************************************************************
114 
115  public:
116  //**Type definitions****************************************************************************
117  using This = DiagonalMatrix<MT,SO,true>;
118  using BaseType = DenseMatrix<This,SO>;
119  using ResultType = This;
120  using OppositeType = DiagonalMatrix<OT,!SO,true>;
121  using TransposeType = DiagonalMatrix<TT,!SO,true>;
122  using ElementType = ET;
123  using SIMDType = SIMDType_<MT>;
124  using ReturnType = ReturnType_<MT>;
125  using CompositeType = const This&;
126  using Reference = DiagonalProxy<MT>;
127  using ConstReference = ConstReference_<MT>;
128  using Pointer = Pointer_<MT>;
129  using ConstPointer = ConstPointer_<MT>;
130  using ConstIterator = ConstIterator_<MT>;
131  //**********************************************************************************************
132 
133  //**Rebind struct definition********************************************************************
136  template< typename NewType > // Data type of the other matrix
137  struct Rebind {
139  using Other = DiagonalMatrix< typename MT::template Rebind<NewType>::Other >;
140  };
141  //**********************************************************************************************
142 
143  //**Resize struct definition********************************************************************
146  template< size_t NewM // Number of rows of the other matrix
147  , size_t NewN > // Number of columns of the other matrix
148  struct Resize {
150  using Other = DiagonalMatrix< typename MT::template Resize<NewM,NewN>::Other >;
151  };
152  //**********************************************************************************************
153 
154  //**Iterator class definition*******************************************************************
157  class Iterator
158  {
159  public:
160  //**Type definitions*************************************************************************
161  using IteratorCategory = std::random_access_iterator_tag;
162  using ValueType = ElementType_<MT>;
163  using PointerType = DiagonalProxy<MT>;
164  using ReferenceType = DiagonalProxy<MT>;
165  using DifferenceType = ptrdiff_t;
166 
167  // STL iterator requirements
168  using iterator_category = IteratorCategory;
169  using value_type = ValueType;
170  using pointer = PointerType;
171  using reference = ReferenceType;
172  using difference_type = DifferenceType;
173  //*******************************************************************************************
174 
175  //**Constructor******************************************************************************
178  inline Iterator() noexcept
179  : matrix_( nullptr ) // Reference to the adapted dense matrix
180  , row_ ( 0UL ) // The current row index of the iterator
181  , column_( 0UL ) // The current column index of the iterator
182  {}
183  //*******************************************************************************************
184 
185  //**Constructor******************************************************************************
192  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
193  : matrix_( &matrix ) // Reference to the adapted dense matrix
194  , row_ ( row ) // The current row-index of the iterator
195  , column_( column ) // The current column-index of the iterator
196  {}
197  //*******************************************************************************************
198 
199  //**Addition assignment operator*************************************************************
205  inline Iterator& operator+=( size_t inc ) noexcept {
206  ( SO )?( row_ += inc ):( column_ += inc );
207  return *this;
208  }
209  //*******************************************************************************************
210 
211  //**Subtraction assignment operator**********************************************************
217  inline Iterator& operator-=( size_t dec ) noexcept {
218  ( SO )?( row_ -= dec ):( column_ -= dec );
219  return *this;
220  }
221  //*******************************************************************************************
222 
223  //**Prefix increment operator****************************************************************
228  inline Iterator& operator++() noexcept {
229  ( SO )?( ++row_ ):( ++column_ );
230  return *this;
231  }
232  //*******************************************************************************************
233 
234  //**Postfix increment operator***************************************************************
239  inline const Iterator operator++( int ) noexcept {
240  const Iterator tmp( *this );
241  ++(*this);
242  return tmp;
243  }
244  //*******************************************************************************************
245 
246  //**Prefix decrement operator****************************************************************
251  inline Iterator& operator--() noexcept {
252  ( SO )?( --row_ ):( --column_ );
253  return *this;
254  }
255  //*******************************************************************************************
256 
257  //**Postfix decrement operator***************************************************************
262  inline const Iterator operator--( int ) noexcept {
263  const Iterator tmp( *this );
264  --(*this);
265  return tmp;
266  }
267  //*******************************************************************************************
268 
269  //**Element access operator******************************************************************
274  inline ReferenceType operator*() const {
275  return ReferenceType( *matrix_, row_, column_ );
276  }
277  //*******************************************************************************************
278 
279  //**Element access operator******************************************************************
284  inline PointerType operator->() const {
285  return PointerType( *matrix_, row_, column_ );
286  }
287  //*******************************************************************************************
288 
289  //**Load function****************************************************************************
299  inline SIMDType load() const {
300  return (*matrix_).load(row_,column_);
301  }
302  //*******************************************************************************************
303 
304  //**Loada function***************************************************************************
314  inline SIMDType loada() const {
315  return (*matrix_).loada(row_,column_);
316  }
317  //*******************************************************************************************
318 
319  //**Loadu function***************************************************************************
329  inline SIMDType loadu() const {
330  return (*matrix_).loadu(row_,column_);
331  }
332  //*******************************************************************************************
333 
334  //**Conversion operator**********************************************************************
339  inline operator ConstIterator() const {
340  if( SO )
341  return matrix_->begin( column_ ) + row_;
342  else
343  return matrix_->begin( row_ ) + column_;
344  }
345  //*******************************************************************************************
346 
347  //**Equality operator************************************************************************
354  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
355  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
356  }
357  //*******************************************************************************************
358 
359  //**Equality operator************************************************************************
366  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
367  return ( ConstIterator( lhs ) == rhs );
368  }
369  //*******************************************************************************************
370 
371  //**Equality operator************************************************************************
378  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
379  return ( lhs == ConstIterator( rhs ) );
380  }
381  //*******************************************************************************************
382 
383  //**Inequality operator**********************************************************************
390  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
391  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
392  }
393  //*******************************************************************************************
394 
395  //**Inequality operator**********************************************************************
402  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
403  return ( ConstIterator( lhs ) != rhs );
404  }
405  //*******************************************************************************************
406 
407  //**Inequality operator**********************************************************************
414  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
415  return ( lhs != ConstIterator( rhs ) );
416  }
417  //*******************************************************************************************
418 
419  //**Less-than operator***********************************************************************
426  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
427  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
428  }
429  //*******************************************************************************************
430 
431  //**Less-than operator***********************************************************************
438  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
439  return ( ConstIterator( lhs ) < rhs );
440  }
441  //*******************************************************************************************
442 
443  //**Less-than operator***********************************************************************
450  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
451  return ( lhs < ConstIterator( rhs ) );
452  }
453  //*******************************************************************************************
454 
455  //**Greater-than operator********************************************************************
462  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
463  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
464  }
465  //*******************************************************************************************
466 
467  //**Greater-than operator********************************************************************
474  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
475  return ( ConstIterator( lhs ) > rhs );
476  }
477  //*******************************************************************************************
478 
479  //**Greater-than operator********************************************************************
486  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
487  return ( lhs > ConstIterator( rhs ) );
488  }
489  //*******************************************************************************************
490 
491  //**Less-or-equal-than operator**************************************************************
498  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
499  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
500  }
501  //*******************************************************************************************
502 
503  //**Less-or-equal-than operator**************************************************************
510  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
511  return ( ConstIterator( lhs ) <= rhs );
512  }
513  //*******************************************************************************************
514 
515  //**Less-or-equal-than operator**************************************************************
522  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
523  return ( lhs <= ConstIterator( rhs ) );
524  }
525  //*******************************************************************************************
526 
527  //**Greater-or-equal-than operator***********************************************************
534  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
535  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
536  }
537  //*******************************************************************************************
538 
539  //**Greater-or-equal-than operator***********************************************************
546  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
547  return ( ConstIterator( lhs ) >= rhs );
548  }
549  //*******************************************************************************************
550 
551  //**Greater-or-equal-than operator***********************************************************
558  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
559  return ( lhs >= ConstIterator( rhs ) );
560  }
561  //*******************************************************************************************
562 
563  //**Subtraction operator*********************************************************************
569  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
570  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
571  }
572  //*******************************************************************************************
573 
574  //**Addition operator************************************************************************
581  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
582  if( SO )
583  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
584  else
585  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
586  }
587  //*******************************************************************************************
588 
589  //**Addition operator************************************************************************
596  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
597  if( SO )
598  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
599  else
600  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
601  }
602  //*******************************************************************************************
603 
604  //**Subtraction operator*********************************************************************
611  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
612  if( SO )
613  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
614  else
615  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
616  }
617  //*******************************************************************************************
618 
619  private:
620  //**Member variables*************************************************************************
621  MT* matrix_;
622  size_t row_;
623  size_t column_;
624  //*******************************************************************************************
625  };
626  //**********************************************************************************************
627 
628  //**Compilation flags***************************************************************************
630  enum : bool { simdEnabled = MT::simdEnabled };
631 
633  enum : bool { smpAssignable = MT::smpAssignable };
634  //**********************************************************************************************
635 
636  //**Constructors********************************************************************************
639  explicit inline DiagonalMatrix();
640  template< typename A1 > explicit inline DiagonalMatrix( const A1& a1 );
641  explicit inline DiagonalMatrix( size_t n, const ElementType& init );
642 
643  explicit inline DiagonalMatrix( initializer_list< initializer_list<ElementType> > list );
644 
645  template< typename Other >
646  explicit inline DiagonalMatrix( size_t n, const Other* array );
647 
648  template< typename Other, size_t N >
649  explicit inline DiagonalMatrix( const Other (&array)[N][N] );
650 
651  explicit inline DiagonalMatrix( ElementType* ptr, size_t n );
652  explicit inline DiagonalMatrix( ElementType* ptr, size_t n, size_t nn );
653 
654  inline DiagonalMatrix( const DiagonalMatrix& m );
655  inline DiagonalMatrix( DiagonalMatrix&& m ) noexcept;
657  //**********************************************************************************************
658 
659  //**Destructor**********************************************************************************
660  // No explicitly declared destructor.
661  //**********************************************************************************************
662 
663  //**Data access functions***********************************************************************
666  inline Reference operator()( size_t i, size_t j );
667  inline ConstReference operator()( size_t i, size_t j ) const;
668  inline Reference at( size_t i, size_t j );
669  inline ConstReference at( size_t i, size_t j ) const;
670  inline ConstPointer data () const noexcept;
671  inline ConstPointer data ( size_t i ) const noexcept;
672  inline Iterator begin ( size_t i );
673  inline ConstIterator begin ( size_t i ) const;
674  inline ConstIterator cbegin( size_t i ) const;
675  inline Iterator end ( size_t i );
676  inline ConstIterator end ( size_t i ) const;
677  inline ConstIterator cend ( size_t i ) const;
679  //**********************************************************************************************
680 
681  //**Assignment operators************************************************************************
684  inline DiagonalMatrix& operator=( const ElementType& rhs );
685  inline DiagonalMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
686 
687  template< typename Other, size_t N >
688  inline DiagonalMatrix& operator=( const Other (&array)[N][N] );
689 
690  inline DiagonalMatrix& operator=( const DiagonalMatrix& rhs );
691  inline DiagonalMatrix& operator=( DiagonalMatrix&& rhs ) noexcept;
692 
693  template< typename MT2, bool SO2 >
694  inline DisableIf_< IsComputation<MT2>, DiagonalMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
695 
696  template< typename MT2, bool SO2 >
697  inline EnableIf_< IsComputation<MT2>, DiagonalMatrix& > operator=( const Matrix<MT2,SO2>& rhs );
698 
699  template< typename MT2, bool SO2 >
700  inline DisableIf_< IsComputation<MT2>, DiagonalMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
701 
702  template< typename MT2, bool SO2 >
703  inline EnableIf_< IsComputation<MT2>, DiagonalMatrix& > operator+=( const Matrix<MT2,SO2>& rhs );
704 
705  template< typename MT2, bool SO2 >
706  inline DisableIf_< IsComputation<MT2>, DiagonalMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
707 
708  template< typename MT2, bool SO2 >
709  inline EnableIf_< IsComputation<MT2>, DiagonalMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
710 
711  template< typename MT2, bool SO2 >
712  inline DiagonalMatrix& operator%=( const Matrix<MT2,SO2>& rhs );
713 
714  template< typename MT2, bool SO2 >
715  inline DiagonalMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
716 
717  template< typename Other >
718  inline EnableIf_< IsNumeric<Other>, DiagonalMatrix >& operator*=( Other rhs );
719 
720  template< typename Other >
721  inline EnableIf_< IsNumeric<Other>, DiagonalMatrix >& operator/=( Other 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( DiagonalMatrix& m ) noexcept;
744  //**********************************************************************************************
745 
746  //**Numeric functions***************************************************************************
749  template< typename Other > inline DiagonalMatrix& scale( const Other& scalar );
751  //**********************************************************************************************
752 
753  //**Debugging functions*************************************************************************
756  inline bool isIntact() const noexcept;
758  //**********************************************************************************************
759 
760  //**Expression template evaluation functions****************************************************
763  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
764  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
765 
766  inline bool isAligned () const noexcept;
767  inline bool canSMPAssign() const noexcept;
768 
769  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
770  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
771  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
773  //**********************************************************************************************
774 
775  private:
776  //**Construction functions**********************************************************************
779  inline const MT construct( size_t n , TrueType );
780  inline const MT construct( const ElementType& value, FalseType );
781 
782  template< typename MT2, bool SO2, typename T >
783  inline const MT construct( const Matrix<MT2,SO2>& m, T );
785  //**********************************************************************************************
786 
787  //**Member variables****************************************************************************
790  MT matrix_;
791 
792  //**********************************************************************************************
793 
794  //**Friend declarations*************************************************************************
795  template< bool RF, typename MT2, bool SO2, bool DF2 >
796  friend bool isDefault( const DiagonalMatrix<MT2,SO2,DF2>& m );
797 
798  template< typename MT2, bool SO2, bool DF2 >
799  friend MT2& derestrict( DiagonalMatrix<MT2,SO2,DF2>& m );
800  //**********************************************************************************************
801 
802  //**Compile time checks*************************************************************************
815  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
816  //**********************************************************************************************
817 };
819 //*************************************************************************************************
820 
821 
822 
823 
824 //=================================================================================================
825 //
826 // CONSTRUCTORS
827 //
828 //=================================================================================================
829 
830 //*************************************************************************************************
834 template< typename MT // Type of the adapted dense matrix
835  , bool SO > // Storage order of the adapted dense matrix
836 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix()
837  : matrix_() // The adapted dense matrix
838 {
839  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
840  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
841 }
843 //*************************************************************************************************
844 
845 
846 //*************************************************************************************************
864 template< typename MT // Type of the adapted dense matrix
865  , bool SO > // Storage order of the adapted dense matrix
866 template< typename A1 > // Type of the constructor argument
867 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const A1& a1 )
868  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
869 {
870  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
871  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
872 }
874 //*************************************************************************************************
875 
876 
877 //*************************************************************************************************
884 template< typename MT // Type of the adapted dense matrix
885  , bool SO > // Storage order of the adapted dense matrix
886 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( size_t n, const ElementType& init )
887  : matrix_( n, n, ElementType() ) // The adapted dense matrix
888 {
890 
891  for( size_t i=0UL; i<n; ++i )
892  matrix_(i,i) = init;
893 
894  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
895  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
896 }
898 //*************************************************************************************************
899 
900 
901 //*************************************************************************************************
924 template< typename MT // Type of the adapted dense matrix
925  , bool SO > // Storage order of the adapted dense matrix
926 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( initializer_list< initializer_list<ElementType> > list )
927  : matrix_( list ) // The adapted dense matrix
928 {
929  if( !isDiagonal( matrix_ ) ) {
930  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
931  }
932 
933  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
934 }
936 //*************************************************************************************************
937 
938 
939 //*************************************************************************************************
965 template< typename MT // Type of the adapted dense matrix
966  , bool SO > // Storage order of the adapted dense matrix
967 template< typename Other > // Data type of the initialization array
968 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( size_t n, const Other* array )
969  : matrix_( n, n, array ) // The adapted dense matrix
970 {
971  if( !isDiagonal( matrix_ ) ) {
972  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
973  }
974 
975  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
976 }
978 //*************************************************************************************************
979 
980 
981 //*************************************************************************************************
1004 template< typename MT // Type of the adapted dense matrix
1005  , bool SO > // Storage order of the adapted dense matrix
1006 template< typename Other // Data type of the initialization array
1007  , size_t N > // Number of rows and columns of the initialization array
1008 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const Other (&array)[N][N] )
1009  : matrix_( array ) // The adapted dense matrix
1010 {
1011  if( !isDiagonal( matrix_ ) ) {
1012  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1013  }
1014 
1015  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1016 }
1018 //*************************************************************************************************
1019 
1020 
1021 //*************************************************************************************************
1053 template< typename MT // Type of the adapted dense matrix
1054  , bool SO > // Storage order of the adapted dense matrix
1055 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n )
1056  : matrix_( ptr, n, n ) // The adapted dense matrix
1057 {
1058  if( !isDiagonal( matrix_ ) ) {
1059  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1060  }
1061 
1062  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1063 }
1065 //*************************************************************************************************
1066 
1067 
1068 //*************************************************************************************************
1102 template< typename MT // Type of the adapted dense matrix
1103  , bool SO > // Storage order of the adapted dense matrix
1104 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n, size_t nn )
1105  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1106 {
1107  if( !isDiagonal( matrix_ ) ) {
1108  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1109  }
1110 
1111  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1112 }
1114 //*************************************************************************************************
1115 
1116 
1117 //*************************************************************************************************
1123 template< typename MT // Type of the adapted dense matrix
1124  , bool SO > // Storage order of the adapted dense matrix
1125 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const DiagonalMatrix& m )
1126  : matrix_( m.matrix_ ) // The adapted dense matrix
1127 {
1128  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1129  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1130 }
1132 //*************************************************************************************************
1133 
1134 
1135 //*************************************************************************************************
1141 template< typename MT // Type of the adapted dense matrix
1142  , bool SO > // Storage order of the adapted dense matrix
1143 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( DiagonalMatrix&& m ) noexcept
1144  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1145 {
1146  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1147  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1148 }
1150 //*************************************************************************************************
1151 
1152 
1153 
1154 
1155 //=================================================================================================
1156 //
1157 // DATA ACCESS FUNCTIONS
1158 //
1159 //=================================================================================================
1160 
1161 //*************************************************************************************************
1177 template< typename MT // Type of the adapted dense matrix
1178  , bool SO > // Storage order of the adapted dense matrix
1180  DiagonalMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1181 {
1182  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1183  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1184 
1185  return Reference( matrix_, i, j );
1186 }
1188 //*************************************************************************************************
1189 
1190 
1191 //*************************************************************************************************
1207 template< typename MT // Type of the adapted dense matrix
1208  , bool SO > // Storage order of the adapted dense matrix
1210  DiagonalMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1211 {
1212  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1213  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1214 
1215  return matrix_(i,j);
1216 }
1218 //*************************************************************************************************
1219 
1220 
1221 //*************************************************************************************************
1238 template< typename MT // Type of the adapted dense matrix
1239  , bool SO > // Storage order of the adapted dense matrix
1241  DiagonalMatrix<MT,SO,true>::at( size_t i, size_t j )
1242 {
1243  if( i >= rows() ) {
1244  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1245  }
1246  if( j >= columns() ) {
1247  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1248  }
1249  return (*this)(i,j);
1250 }
1252 //*************************************************************************************************
1253 
1254 
1255 //*************************************************************************************************
1272 template< typename MT // Type of the adapted dense matrix
1273  , bool SO > // Storage order of the adapted dense matrix
1275  DiagonalMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1276 {
1277  if( i >= rows() ) {
1278  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1279  }
1280  if( j >= columns() ) {
1281  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1282  }
1283  return (*this)(i,j);
1284 }
1286 //*************************************************************************************************
1287 
1288 
1289 //*************************************************************************************************
1302 template< typename MT // Type of the adapted dense matrix
1303  , bool SO > // Storage order of the adapted dense matrix
1304 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1305  DiagonalMatrix<MT,SO,true>::data() const noexcept
1306 {
1307  return matrix_.data();
1308 }
1310 //*************************************************************************************************
1311 
1312 
1313 //*************************************************************************************************
1322 template< typename MT // Type of the adapted dense matrix
1323  , bool SO > // Storage order of the adapted dense matrix
1324 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1325  DiagonalMatrix<MT,SO,true>::data( size_t i ) const noexcept
1326 {
1327  return matrix_.data(i);
1328 }
1330 //*************************************************************************************************
1331 
1332 
1333 //*************************************************************************************************
1345 template< typename MT // Type of the adapted dense matrix
1346  , bool SO > // Storage order of the adapted dense matrix
1349 {
1350  if( SO )
1351  return Iterator( matrix_, 0UL, i );
1352  else
1353  return Iterator( matrix_, i, 0UL );
1354 }
1356 //*************************************************************************************************
1357 
1358 
1359 //*************************************************************************************************
1371 template< typename MT // Type of the adapted dense matrix
1372  , bool SO > // Storage order of the adapted dense matrix
1374  DiagonalMatrix<MT,SO,true>::begin( size_t i ) const
1375 {
1376  return matrix_.begin(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
1397  DiagonalMatrix<MT,SO,true>::cbegin( size_t i ) const
1398 {
1399  return matrix_.cbegin(i);
1400 }
1402 //*************************************************************************************************
1403 
1404 
1405 //*************************************************************************************************
1417 template< typename MT // Type of the adapted dense matrix
1418  , bool SO > // Storage order of the adapted dense matrix
1421 {
1422  if( SO )
1423  return Iterator( matrix_, rows(), i );
1424  else
1425  return Iterator( matrix_, i, columns() );
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  DiagonalMatrix<MT,SO,true>::end( size_t i ) const
1447 {
1448  return matrix_.end(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
1469  DiagonalMatrix<MT,SO,true>::cend( size_t i ) const
1470 {
1471  return matrix_.cend(i);
1472 }
1474 //*************************************************************************************************
1475 
1476 
1477 
1478 
1479 //=================================================================================================
1480 //
1481 // ASSIGNMENT OPERATORS
1482 //
1483 //=================================================================================================
1484 
1485 //*************************************************************************************************
1492 template< typename MT // Type of the adapted dense matrix
1493  , bool SO > // Storage order of the adapted dense matrix
1494 inline DiagonalMatrix<MT,SO,true>&
1495  DiagonalMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1496 {
1497  if( SO ) {
1498  for( size_t j=0UL; j<columns(); ++j )
1499  matrix_(j,j) = rhs;
1500  }
1501  else {
1502  for( size_t i=0UL; i<rows(); ++i )
1503  matrix_(i,i) = rhs;
1504  }
1505 
1506  return *this;
1507 }
1509 //*************************************************************************************************
1510 
1511 
1512 //*************************************************************************************************
1536 template< typename MT // Type of the adapted dense matrix
1537  , bool SO > // Storage order of the adapted dense matrix
1538 inline DiagonalMatrix<MT,SO,true>&
1539  DiagonalMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1540 {
1541  MT tmp( list );
1542 
1543  if( !isDiagonal( tmp ) ) {
1544  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1545  }
1546 
1547  matrix_ = std::move( tmp );
1548 
1549  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1550  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1551 
1552  return *this;
1553 }
1555 //*************************************************************************************************
1556 
1557 
1558 //*************************************************************************************************
1582 template< typename MT // Type of the adapted dense matrix
1583  , bool SO > // Storage order of the adapted dense matrix
1584 template< typename Other // Data type of the initialization array
1585  , size_t N > // Number of rows and columns of the initialization array
1586 inline DiagonalMatrix<MT,SO,true>&
1587  DiagonalMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1588 {
1589  MT tmp( array );
1590 
1591  if( !isDiagonal( tmp ) ) {
1592  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1593  }
1594 
1595  matrix_ = std::move( tmp );
1596 
1597  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1598  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1599 
1600  return *this;
1601 }
1603 //*************************************************************************************************
1604 
1605 
1606 //*************************************************************************************************
1616 template< typename MT // Type of the adapted dense matrix
1617  , bool SO > // Storage order of the adapted dense matrix
1618 inline DiagonalMatrix<MT,SO,true>&
1619  DiagonalMatrix<MT,SO,true>::operator=( const DiagonalMatrix& rhs )
1620 {
1621  matrix_ = rhs.matrix_;
1622 
1623  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1624  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1625 
1626  return *this;
1627 }
1629 //*************************************************************************************************
1630 
1631 
1632 //*************************************************************************************************
1639 template< typename MT // Type of the adapted dense matrix
1640  , bool SO > // Storage order of the adapted dense matrix
1641 inline DiagonalMatrix<MT,SO,true>&
1642  DiagonalMatrix<MT,SO,true>::operator=( DiagonalMatrix&& rhs ) noexcept
1643 {
1644  matrix_ = std::move( rhs.matrix_ );
1645 
1646  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1647  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1648 
1649  return *this;
1650 }
1652 //*************************************************************************************************
1653 
1654 
1655 //*************************************************************************************************
1668 template< typename MT // Type of the adapted dense matrix
1669  , bool SO > // Storage order of the adapted dense matrix
1670 template< typename MT2 // Type of the right-hand side matrix
1671  , bool SO2 > // Storage order of the right-hand side matrix
1672 inline DisableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1673  DiagonalMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1674 {
1675  if( !IsDiagonal<MT2>::value && !isDiagonal( ~rhs ) ) {
1676  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1677  }
1678 
1679  matrix_ = decldiag( ~rhs );
1680 
1681  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1682  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1683 
1684  return *this;
1685 }
1687 //*************************************************************************************************
1688 
1689 
1690 //*************************************************************************************************
1703 template< typename MT // Type of the adapted dense matrix
1704  , bool SO > // Storage order of the adapted dense matrix
1705 template< typename MT2 // Type of the right-hand side matrix
1706  , bool SO2 > // Storage order of the right-hand side matrix
1707 inline EnableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1708  DiagonalMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1709 {
1710  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1711  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1712  }
1713 
1714  if( IsDiagonal<MT2>::value ) {
1715  matrix_ = ~rhs;
1716  }
1717  else {
1718  MT tmp( ~rhs );
1719 
1720  if( !isDiagonal( tmp ) ) {
1721  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1722  }
1723 
1724  matrix_ = std::move( tmp );
1725  }
1726 
1727  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1728  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1729 
1730  return *this;
1731 }
1733 //*************************************************************************************************
1734 
1735 
1736 //*************************************************************************************************
1749 template< typename MT // Type of the adapted dense matrix
1750  , bool SO > // Storage order of the adapted dense matrix
1751 template< typename MT2 // Type of the right-hand side matrix
1752  , bool SO2 > // Storage order of the right-hand side matrix
1753 inline DisableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1754  DiagonalMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1755 {
1756  if( !IsDiagonal<MT2>::value && !isDiagonal( ~rhs ) ) {
1757  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1758  }
1759 
1760  matrix_ += decldiag( ~rhs );
1761 
1762  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1763  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1764 
1765  return *this;
1766 }
1768 //*************************************************************************************************
1769 
1770 
1771 //*************************************************************************************************
1784 template< typename MT // Type of the adapted dense matrix
1785  , bool SO > // Storage order of the adapted dense matrix
1786 template< typename MT2 // Type of the right-hand side matrix
1787  , bool SO2 > // Storage order of the right-hand side matrix
1788 inline EnableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1789  DiagonalMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1790 {
1791  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1792  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1793  }
1794 
1795  if( IsDiagonal<MT2>::value ) {
1796  matrix_ += ~rhs;
1797  }
1798  else {
1799  const ResultType_<MT2> tmp( ~rhs );
1800 
1801  if( !isDiagonal( tmp ) ) {
1802  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1803  }
1804 
1805  matrix_ += decldiag( tmp );
1806  }
1807 
1808  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1809  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1810 
1811  return *this;
1812 }
1814 //*************************************************************************************************
1815 
1816 
1817 //*************************************************************************************************
1830 template< typename MT // Type of the adapted dense matrix
1831  , bool SO > // Storage order of the adapted dense matrix
1832 template< typename MT2 // Type of the right-hand side matrix
1833  , bool SO2 > // Storage order of the right-hand side matrix
1834 inline DisableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1835  DiagonalMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1836 {
1837  if( !IsDiagonal<MT2>::value && !isDiagonal( ~rhs ) ) {
1838  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1839  }
1840 
1841  matrix_ -= decldiag( ~rhs );
1842 
1843  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1844  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1845 
1846  return *this;
1847 }
1849 //*************************************************************************************************
1850 
1851 
1852 //*************************************************************************************************
1865 template< typename MT // Type of the adapted dense matrix
1866  , bool SO > // Storage order of the adapted dense matrix
1867 template< typename MT2 // Type of the right-hand side matrix
1868  , bool SO2 > // Storage order of the right-hand side matrix
1869 inline EnableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1870  DiagonalMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1871 {
1872  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1873  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1874  }
1875 
1876  if( IsDiagonal<MT2>::value ) {
1877  matrix_ -= ~rhs;
1878  }
1879  else {
1880  const ResultType_<MT2> tmp( ~rhs );
1881 
1882  if( !isDiagonal( tmp ) ) {
1883  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1884  }
1885 
1886  matrix_ -= decldiag( tmp );
1887  }
1888 
1889  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1890  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1891 
1892  return *this;
1893 }
1895 //*************************************************************************************************
1896 
1897 
1898 //*************************************************************************************************
1909 template< typename MT // Type of the adapted dense matrix
1910  , bool SO > // Storage order of the adapted dense matrix
1911 template< typename MT2 // Type of the right-hand side matrix
1912  , bool SO2 > // Storage order of the right-hand side matrix
1913 inline DiagonalMatrix<MT,SO,true>&
1914  DiagonalMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
1915 {
1916  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1917  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1918  }
1919 
1920  matrix_ %= ~rhs;
1921 
1922  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1923  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1924 
1925  return *this;
1926 }
1928 //*************************************************************************************************
1929 
1930 
1931 //*************************************************************************************************
1943 template< typename MT // Type of the adapted dense matrix
1944  , bool SO > // Storage order of the adapted dense matrix
1945 template< typename MT2 // Type of the right-hand side matrix
1946  , bool SO2 > // Storage order of the right-hand side matrix
1947 inline DiagonalMatrix<MT,SO,true>&
1948  DiagonalMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1949 {
1950  if( matrix_.rows() != (~rhs).columns() ) {
1951  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1952  }
1953 
1954  MT tmp( matrix_ * ~rhs );
1955 
1956  if( !isDiagonal( tmp ) ) {
1957  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1958  }
1959 
1960  matrix_ = std::move( tmp );
1961 
1962  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1963  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1964 
1965  return *this;
1966 }
1968 //*************************************************************************************************
1969 
1970 
1971 //*************************************************************************************************
1979 template< typename MT // Type of the adapted dense matrix
1980  , bool SO > // Storage order of the adapted dense matrix
1981 template< typename Other > // Data type of the right-hand side scalar
1982 inline EnableIf_< IsNumeric<Other>, DiagonalMatrix<MT,SO,true> >&
1984 {
1985  matrix_ *= rhs;
1986  return *this;
1987 }
1988 //*************************************************************************************************
1989 
1990 
1991 //*************************************************************************************************
1999 template< typename MT // Type of the adapted dense matrix
2000  , bool SO > // Storage order of the adapted dense matrix
2001 template< typename Other > // Data type of the right-hand side scalar
2002 inline EnableIf_< IsNumeric<Other>, DiagonalMatrix<MT,SO,true> >&
2004 {
2005  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2006 
2007  matrix_ /= rhs;
2008  return *this;
2009 }
2011 //*************************************************************************************************
2012 
2013 
2014 
2015 
2016 //=================================================================================================
2017 //
2018 // UTILITY FUNCTIONS
2019 //
2020 //=================================================================================================
2021 
2022 //*************************************************************************************************
2028 template< typename MT // Type of the adapted dense matrix
2029  , bool SO > // Storage order of the adapted dense matrix
2030 inline size_t DiagonalMatrix<MT,SO,true>::rows() const noexcept
2031 {
2032  return matrix_.rows();
2033 }
2035 //*************************************************************************************************
2036 
2037 
2038 //*************************************************************************************************
2044 template< typename MT // Type of the adapted dense matrix
2045  , bool SO > // Storage order of the adapted dense matrix
2046 inline size_t DiagonalMatrix<MT,SO,true>::columns() const noexcept
2047 {
2048  return matrix_.columns();
2049 }
2051 //*************************************************************************************************
2052 
2053 
2054 //*************************************************************************************************
2065 template< typename MT // Type of the adapted dense matrix
2066  , bool SO > // Storage order of the adapted dense matrix
2067 inline size_t DiagonalMatrix<MT,SO,true>::spacing() const noexcept
2068 {
2069  return matrix_.spacing();
2070 }
2072 //*************************************************************************************************
2073 
2074 
2075 //*************************************************************************************************
2081 template< typename MT // Type of the adapted dense matrix
2082  , bool SO > // Storage order of the adapted dense matrix
2083 inline size_t DiagonalMatrix<MT,SO,true>::capacity() const noexcept
2084 {
2085  return matrix_.capacity();
2086 }
2088 //*************************************************************************************************
2089 
2090 
2091 //*************************************************************************************************
2103 template< typename MT // Type of the adapted dense matrix
2104  , bool SO > // Storage order of the adapted dense matrix
2105 inline size_t DiagonalMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2106 {
2107  return matrix_.capacity(i);
2108 }
2110 //*************************************************************************************************
2111 
2112 
2113 //*************************************************************************************************
2119 template< typename MT // Type of the adapted dense matrix
2120  , bool SO > // Storage order of the adapted dense matrix
2121 inline size_t DiagonalMatrix<MT,SO,true>::nonZeros() const
2122 {
2123  return matrix_.nonZeros();
2124 }
2126 //*************************************************************************************************
2127 
2128 
2129 //*************************************************************************************************
2141 template< typename MT // Type of the adapted dense matrix
2142  , bool SO > // Storage order of the adapted dense matrix
2143 inline size_t DiagonalMatrix<MT,SO,true>::nonZeros( size_t i ) const
2144 {
2145  return matrix_.nonZeros(i);
2146 }
2148 //*************************************************************************************************
2149 
2150 
2151 //*************************************************************************************************
2157 template< typename MT // Type of the adapted dense matrix
2158  , bool SO > // Storage order of the adapted dense matrix
2160 {
2161  matrix_.reset();
2162 }
2164 //*************************************************************************************************
2165 
2166 
2167 //*************************************************************************************************
2180 template< typename MT // Type of the adapted dense matrix
2181  , bool SO > // Storage order of the adapted dense matrix
2182 inline void DiagonalMatrix<MT,SO,true>::reset( size_t i )
2183 {
2184  matrix_.reset( i );
2185 }
2187 //*************************************************************************************************
2188 
2189 
2190 //*************************************************************************************************
2202 template< typename MT // Type of the adapted dense matrix
2203  , bool SO > // Storage order of the adapted dense matrix
2205 {
2206  using blaze::clear;
2207 
2208  clear( matrix_ );
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 DiagonalMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2253 {
2255 
2256  UNUSED_PARAMETER( preserve );
2257 
2258  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal 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_, 0UL, oldsize, n, increment ).reset();
2267  submatrix( matrix_, oldsize, 0UL, increment, increment ).reset();
2268  }
2269 }
2271 //*************************************************************************************************
2272 
2273 
2274 //*************************************************************************************************
2287 template< typename MT // Type of the adapted dense matrix
2288  , bool SO > // Storage order of the adapted dense matrix
2289 inline void DiagonalMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2290 {
2292 
2293  UNUSED_PARAMETER( preserve );
2294 
2295  resize( rows() + n, true );
2296 }
2297 //*************************************************************************************************
2298 
2299 
2300 //*************************************************************************************************
2310 template< typename MT // Type of the adapted dense matrix
2311  , bool SO > // Storage order of the adapted dense matrix
2312 inline void DiagonalMatrix<MT,SO,true>::reserve( size_t elements )
2313 {
2314  matrix_.reserve( elements );
2315 }
2317 //*************************************************************************************************
2318 
2319 
2320 //*************************************************************************************************
2330 template< typename MT // Type of the adapted dense matrix
2331  , bool SO > // Storage order of the adapted dense matrix
2333 {
2334  matrix_.shrinkToFit();
2335 }
2337 //*************************************************************************************************
2338 
2339 
2340 //*************************************************************************************************
2347 template< typename MT // Type of the adapted dense matrix
2348  , bool SO > // Storage order of the adapted dense matrix
2349 inline void DiagonalMatrix<MT,SO,true>::swap( DiagonalMatrix& m ) noexcept
2350 {
2351  using std::swap;
2352 
2353  swap( matrix_, m.matrix_ );
2354 }
2356 //*************************************************************************************************
2357 
2358 
2359 
2360 
2361 //=================================================================================================
2362 //
2363 // NUMERIC FUNCTIONS
2364 //
2365 //=================================================================================================
2366 
2367 //*************************************************************************************************
2385 template< typename MT // Type of the adapted dense matrix
2386  , bool SO > // Storage order of the adapted dense matrix
2387 template< typename Other > // Data type of the scalar value
2388 inline DiagonalMatrix<MT,SO,true>& DiagonalMatrix<MT,SO,true>::scale( const Other& scalar )
2389 {
2390  matrix_.scale( scalar );
2391  return *this;
2392 }
2394 //*************************************************************************************************
2395 
2396 
2397 
2398 
2399 //=================================================================================================
2400 //
2401 // DEBUGGING FUNCTIONS
2402 //
2403 //=================================================================================================
2404 
2405 //*************************************************************************************************
2415 template< typename MT // Type of the adapted dense matrix
2416  , bool SO > // Storage order of the adapted dense matrix
2417 inline bool DiagonalMatrix<MT,SO,true>::isIntact() const noexcept
2418 {
2419  using blaze::isIntact;
2420 
2421  return ( isIntact( matrix_ ) && isDiagonal( matrix_ ) );
2422 }
2424 //*************************************************************************************************
2425 
2426 
2427 
2428 
2429 //=================================================================================================
2430 //
2431 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2432 //
2433 //=================================================================================================
2434 
2435 //*************************************************************************************************
2446 template< typename MT // Type of the adapted dense matrix
2447  , bool SO > // Storage order of the adapted dense matrix
2448 template< typename Other > // Data type of the foreign expression
2449 inline bool DiagonalMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2450 {
2451  return matrix_.canAlias( alias );
2452 }
2454 //*************************************************************************************************
2455 
2456 
2457 //*************************************************************************************************
2468 template< typename MT // Type of the adapted dense matrix
2469  , bool SO > // Storage order of the adapted dense matrix
2470 template< typename Other > // Data type of the foreign expression
2471 inline bool DiagonalMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2472 {
2473  return matrix_.isAliased( alias );
2474 }
2476 //*************************************************************************************************
2477 
2478 
2479 //*************************************************************************************************
2489 template< typename MT // Type of the adapted dense matrix
2490  , bool SO > // Storage order of the adapted dense matrix
2491 inline bool DiagonalMatrix<MT,SO,true>::isAligned() const noexcept
2492 {
2493  return matrix_.isAligned();
2494 }
2496 //*************************************************************************************************
2497 
2498 
2499 //*************************************************************************************************
2510 template< typename MT // Type of the adapted dense matrix
2511  , bool SO > // Storage order of the adapted dense matrix
2512 inline bool DiagonalMatrix<MT,SO,true>::canSMPAssign() const noexcept
2513 {
2514  return matrix_.canSMPAssign();
2515 }
2517 //*************************************************************************************************
2518 
2519 
2520 //*************************************************************************************************
2536 template< typename MT // Type of the adapted dense matrix
2537  , bool SO > // Storage order of the adapted dense matrix
2538 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2539  DiagonalMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2540 {
2541  return matrix_.load( i, j );
2542 }
2544 //*************************************************************************************************
2545 
2546 
2547 //*************************************************************************************************
2563 template< typename MT // Type of the adapted dense matrix
2564  , bool SO > // Storage order of the adapted dense matrix
2565 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2566  DiagonalMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2567 {
2568  return matrix_.loada( i, j );
2569 }
2571 //*************************************************************************************************
2572 
2573 
2574 //*************************************************************************************************
2590 template< typename MT // Type of the adapted dense matrix
2591  , bool SO > // Storage order of the adapted dense matrix
2592 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2593  DiagonalMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2594 {
2595  return matrix_.loadu( i, j );
2596 }
2598 //*************************************************************************************************
2599 
2600 
2601 
2602 
2603 //=================================================================================================
2604 //
2605 // CONSTRUCTION FUNCTIONS
2606 //
2607 //=================================================================================================
2608 
2609 //*************************************************************************************************
2616 template< typename MT // Type of the adapted dense matrix
2617  , bool SO > // Storage order of the adapted dense matrix
2618 inline const MT DiagonalMatrix<MT,SO,true>::construct( size_t n, TrueType )
2619 {
2621 
2622  return MT( n, n, ElementType() );
2623 }
2625 //*************************************************************************************************
2626 
2627 
2628 //*************************************************************************************************
2635 template< typename MT // Type of the adapted dense matrix
2636  , bool SO > // Storage order of the adapted dense matrix
2637 inline const MT DiagonalMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2638 {
2641 
2642  MT tmp;
2643 
2644  for( size_t i=0UL; i<tmp.rows(); ++i )
2645  tmp(i,i) = init;
2646 
2647  return tmp;
2648 }
2650 //*************************************************************************************************
2651 
2652 
2653 //*************************************************************************************************
2664 template< typename MT // Type of the adapted dense matrix
2665  , bool SO > // Storage order of the adapted dense matrix
2666 template< typename MT2 // Type of the foreign matrix
2667  , bool SO2 // Storage order of the foreign matrix
2668  , typename T > // Type of the third argument
2669 inline const MT DiagonalMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2670 {
2671  const MT tmp( ~m );
2672 
2673  if( !IsDiagonal<MT2>::value && !isDiagonal( tmp ) ) {
2674  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
2675  }
2676 
2677  return tmp;
2678 }
2680 //*************************************************************************************************
2681 
2682 } // namespace blaze
2683 
2684 #endif
Constraint on the data type.
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3079
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:996
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
Header file for the FalseType type/value trait base class.
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Header file for the IsDiagonal type trait.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:329
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:609
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5845
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Submatrix< MT, AF > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:352
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
#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
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:1584
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:308
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:242
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:110
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a square matrix type, a compilation error is created.
Definition: Square.h:60
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
Constraint on the data type.
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Header file for the DiagonalProxy class.
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:5924
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5907
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:367
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:443
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:548
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:264
decltype(auto) operator*(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:8893
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:580
Header file for the IsNumeric type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a &#39;resize&#39; member fu...
Definition: Resizable.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:270
Constraint on the data type.
Constraint on the data type.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value...
Definition: Accuracy.h:405
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
Header file for the implementation of the base template of the DiagonalMatrix.
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
Header file for the IsResizable type trait.
System settings for the inline keywords.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TrueType type/value trait base class.