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  typedef OppositeType_<MT> OT;
111  typedef TransposeType_<MT> TT;
112  typedef ElementType_<MT> ET;
113  //**********************************************************************************************
114 
115  public:
116  //**Type definitions****************************************************************************
117  typedef DiagonalMatrix<MT,SO,true> This;
118  typedef DenseMatrix<This,SO> BaseType;
119  typedef This ResultType;
120  typedef DiagonalMatrix<OT,!SO,true> OppositeType;
121  typedef DiagonalMatrix<TT,!SO,true> TransposeType;
122  typedef ET ElementType;
123  typedef SIMDType_<MT> SIMDType;
124  typedef ReturnType_<MT> ReturnType;
125  typedef const This& CompositeType;
126  typedef DiagonalProxy<MT> Reference;
127  typedef ConstReference_<MT> ConstReference;
128  typedef Pointer_<MT> Pointer;
129  typedef ConstPointer_<MT> ConstPointer;
130  typedef ConstIterator_<MT> ConstIterator;
131  //**********************************************************************************************
132 
133  //**Rebind struct definition********************************************************************
136  template< typename NewType > // Data type of the other matrix
137  struct Rebind {
139  typedef DiagonalMatrix< typename MT::template Rebind<NewType>::Other > 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  typedef DiagonalMatrix< typename MT::template Resize<NewM,NewN>::Other > Other;
151  };
152  //**********************************************************************************************
153 
154  //**Iterator class definition*******************************************************************
157  class Iterator
158  {
159  public:
160  //**Type definitions*************************************************************************
161  typedef std::random_access_iterator_tag IteratorCategory;
162  typedef ElementType_<MT> ValueType;
163  typedef DiagonalProxy<MT> PointerType;
164  typedef DiagonalProxy<MT> ReferenceType;
165  typedef ptrdiff_t DifferenceType;
166 
167  // STL iterator requirements
168  typedef IteratorCategory iterator_category;
169  typedef ValueType value_type;
170  typedef PointerType pointer;
171  typedef ReferenceType reference;
172  typedef DifferenceType difference_type;
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  template< typename Deleter >
655  explicit inline DiagonalMatrix( ElementType* ptr, size_t n, Deleter d );
656 
657  template< typename Deleter >
658  explicit inline DiagonalMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d );
659 
660  inline DiagonalMatrix( const DiagonalMatrix& m );
661  inline DiagonalMatrix( DiagonalMatrix&& m ) noexcept;
663  //**********************************************************************************************
664 
665  //**Destructor**********************************************************************************
666  // No explicitly declared destructor.
667  //**********************************************************************************************
668 
669  //**Data access functions***********************************************************************
672  inline Reference operator()( size_t i, size_t j );
673  inline ConstReference operator()( size_t i, size_t j ) const;
674  inline Reference at( size_t i, size_t j );
675  inline ConstReference at( size_t i, size_t j ) const;
676  inline ConstPointer data () const noexcept;
677  inline ConstPointer data ( size_t i ) const noexcept;
678  inline Iterator begin ( size_t i );
679  inline ConstIterator begin ( size_t i ) const;
680  inline ConstIterator cbegin( size_t i ) const;
681  inline Iterator end ( size_t i );
682  inline ConstIterator end ( size_t i ) const;
683  inline ConstIterator cend ( size_t i ) const;
685  //**********************************************************************************************
686 
687  //**Assignment operators************************************************************************
690  inline DiagonalMatrix& operator=( const ElementType& rhs );
691  inline DiagonalMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
692 
693  template< typename Other, size_t N >
694  inline DiagonalMatrix& operator=( const Other (&array)[N][N] );
695 
696  inline DiagonalMatrix& operator=( const DiagonalMatrix& rhs );
697  inline DiagonalMatrix& operator=( DiagonalMatrix&& rhs ) noexcept;
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 DisableIf_< IsComputation<MT2>, DiagonalMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
713 
714  template< typename MT2, bool SO2 >
715  inline EnableIf_< IsComputation<MT2>, DiagonalMatrix& > operator-=( const Matrix<MT2,SO2>& rhs );
716 
717  template< typename MT2, bool SO2 >
718  inline DiagonalMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
719 
720  template< typename Other >
721  inline EnableIf_< IsNumeric<Other>, DiagonalMatrix >& operator*=( Other rhs );
722 
723  template< typename Other >
724  inline EnableIf_< IsNumeric<Other>, DiagonalMatrix >& operator/=( Other rhs );
726  //**********************************************************************************************
727 
728  //**Utility functions***************************************************************************
731  inline size_t rows() const noexcept;
732  inline size_t columns() const noexcept;
733  inline size_t spacing() const noexcept;
734  inline size_t capacity() const noexcept;
735  inline size_t capacity( size_t i ) const noexcept;
736  inline size_t nonZeros() const;
737  inline size_t nonZeros( size_t i ) const;
738  inline void reset();
739  inline void reset( size_t i );
740  inline void clear();
741  void resize ( size_t n, bool preserve=true );
742  inline void extend ( size_t n, bool preserve=true );
743  inline void reserve( size_t elements );
744  inline void swap( DiagonalMatrix& m ) noexcept;
746  //**********************************************************************************************
747 
748  //**Numeric functions***************************************************************************
751  template< typename Other > inline DiagonalMatrix& scale( const Other& scalar );
753  //**********************************************************************************************
754 
755  //**Debugging functions*************************************************************************
758  inline bool isIntact() const noexcept;
760  //**********************************************************************************************
761 
762  //**Expression template evaluation functions****************************************************
765  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
766  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
767 
768  inline bool isAligned () const noexcept;
769  inline bool canSMPAssign() const noexcept;
770 
771  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
772  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
773  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
775  //**********************************************************************************************
776 
777  private:
778  //**Construction functions**********************************************************************
781  inline const MT construct( size_t n , TrueType );
782  inline const MT construct( const ElementType& value, FalseType );
783 
784  template< typename MT2, bool SO2, typename T >
785  inline const MT construct( const Matrix<MT2,SO2>& m, T );
787  //**********************************************************************************************
788 
789  //**Member variables****************************************************************************
792  MT matrix_;
793 
794  //**********************************************************************************************
795 
796  //**Friend declarations*************************************************************************
797  template< bool RF, typename MT2, bool SO2, bool DF2 >
798  friend bool isDefault( const DiagonalMatrix<MT2,SO2,DF2>& m );
799 
800  template< typename MT2, bool SO2, bool DF2 >
801  friend MT2& derestrict( DiagonalMatrix<MT2,SO2,DF2>& m );
802  //**********************************************************************************************
803 
804  //**Compile time checks*************************************************************************
817  BLAZE_STATIC_ASSERT( Rows<MT>::value == Columns<MT>::value );
818  //**********************************************************************************************
819 };
821 //*************************************************************************************************
822 
823 
824 
825 
826 //=================================================================================================
827 //
828 // CONSTRUCTORS
829 //
830 //=================================================================================================
831 
832 //*************************************************************************************************
836 template< typename MT // Type of the adapted dense matrix
837  , bool SO > // Storage order of the adapted dense matrix
838 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix()
839  : matrix_() // The adapted dense matrix
840 {
841  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
842  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
843 }
845 //*************************************************************************************************
846 
847 
848 //*************************************************************************************************
866 template< typename MT // Type of the adapted dense matrix
867  , bool SO > // Storage order of the adapted dense matrix
868 template< typename A1 > // Type of the constructor argument
869 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const A1& a1 )
870  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
871 {
872  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
873  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
874 }
876 //*************************************************************************************************
877 
878 
879 //*************************************************************************************************
886 template< typename MT // Type of the adapted dense matrix
887  , bool SO > // Storage order of the adapted dense matrix
888 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( size_t n, const ElementType& init )
889  : matrix_( n, n, ElementType() ) // The adapted dense matrix
890 {
892 
893  for( size_t i=0UL; i<n; ++i )
894  matrix_(i,i) = init;
895 
896  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
897  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
898 }
900 //*************************************************************************************************
901 
902 
903 //*************************************************************************************************
926 template< typename MT // Type of the adapted dense matrix
927  , bool SO > // Storage order of the adapted dense matrix
928 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( initializer_list< initializer_list<ElementType> > list )
929  : matrix_( list ) // The adapted dense matrix
930 {
931  if( !isDiagonal( matrix_ ) ) {
932  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
933  }
934 
935  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
936 }
938 //*************************************************************************************************
939 
940 
941 //*************************************************************************************************
967 template< typename MT // Type of the adapted dense matrix
968  , bool SO > // Storage order of the adapted dense matrix
969 template< typename Other > // Data type of the initialization array
970 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( size_t n, const Other* array )
971  : matrix_( n, n, array ) // The adapted dense matrix
972 {
973  if( !isDiagonal( matrix_ ) ) {
974  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
975  }
976 
977  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
978 }
980 //*************************************************************************************************
981 
982 
983 //*************************************************************************************************
1006 template< typename MT // Type of the adapted dense matrix
1007  , bool SO > // Storage order of the adapted dense matrix
1008 template< typename Other // Data type of the initialization array
1009  , size_t N > // Number of rows and columns of the initialization array
1010 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const Other (&array)[N][N] )
1011  : matrix_( array ) // The adapted dense matrix
1012 {
1013  if( !isDiagonal( matrix_ ) ) {
1014  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1015  }
1016 
1017  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1018 }
1020 //*************************************************************************************************
1021 
1022 
1023 //*************************************************************************************************
1044 template< typename MT // Type of the adapted dense matrix
1045  , bool SO > // Storage order of the adapted dense matrix
1046 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n )
1047  : matrix_( ptr, n, n ) // The adapted dense matrix
1048 {
1049  if( !isDiagonal( matrix_ ) ) {
1050  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1051  }
1052 
1053  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1054 }
1056 //*************************************************************************************************
1057 
1058 
1059 //*************************************************************************************************
1082 template< typename MT // Type of the adapted dense matrix
1083  , bool SO > // Storage order of the adapted dense matrix
1084 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n, size_t nn )
1085  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1086 {
1087  if( !isDiagonal( matrix_ ) ) {
1088  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1089  }
1090 
1091  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1092 }
1094 //*************************************************************************************************
1095 
1096 
1097 //*************************************************************************************************
1118 template< typename MT // Type of the adapted dense matrix
1119  , bool SO > // Storage order of the adapted dense matrix
1120 template< typename Deleter > // Type of the custom deleter
1121 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n, Deleter d )
1122  : matrix_( ptr, n, n, d ) // The adapted dense matrix
1123 {
1124  if( !isDiagonal( matrix_ ) ) {
1125  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1126  }
1127 
1128  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1129 }
1131 //*************************************************************************************************
1132 
1133 
1134 //*************************************************************************************************
1156 template< typename MT // Type of the adapted dense matrix
1157  , bool SO > // Storage order of the adapted dense matrix
1158 template< typename Deleter > // Type of the custom deleter
1159 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n, size_t nn, Deleter d )
1160  : matrix_( ptr, n, n, nn, d ) // The adapted dense matrix
1161 {
1162  if( !isDiagonal( matrix_ ) ) {
1163  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1164  }
1165 
1166  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1167 }
1169 //*************************************************************************************************
1170 
1171 
1172 //*************************************************************************************************
1178 template< typename MT // Type of the adapted dense matrix
1179  , bool SO > // Storage order of the adapted dense matrix
1180 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const DiagonalMatrix& m )
1181  : matrix_( m.matrix_ ) // The adapted dense matrix
1182 {
1183  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1184  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1185 }
1187 //*************************************************************************************************
1188 
1189 
1190 //*************************************************************************************************
1196 template< typename MT // Type of the adapted dense matrix
1197  , bool SO > // Storage order of the adapted dense matrix
1198 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( DiagonalMatrix&& m ) noexcept
1199  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1200 {
1201  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1202  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1203 }
1205 //*************************************************************************************************
1206 
1207 
1208 
1209 
1210 //=================================================================================================
1211 //
1212 // DATA ACCESS FUNCTIONS
1213 //
1214 //=================================================================================================
1215 
1216 //*************************************************************************************************
1232 template< typename MT // Type of the adapted dense matrix
1233  , bool SO > // Storage order of the adapted dense matrix
1235  DiagonalMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1236 {
1237  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1238  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1239 
1240  return Reference( matrix_, i, j );
1241 }
1243 //*************************************************************************************************
1244 
1245 
1246 //*************************************************************************************************
1262 template< typename MT // Type of the adapted dense matrix
1263  , bool SO > // Storage order of the adapted dense matrix
1265  DiagonalMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1266 {
1267  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1268  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1269 
1270  return matrix_(i,j);
1271 }
1273 //*************************************************************************************************
1274 
1275 
1276 //*************************************************************************************************
1293 template< typename MT // Type of the adapted dense matrix
1294  , bool SO > // Storage order of the adapted dense matrix
1296  DiagonalMatrix<MT,SO,true>::at( size_t i, size_t j )
1297 {
1298  if( i >= rows() ) {
1299  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1300  }
1301  if( j >= columns() ) {
1302  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1303  }
1304  return (*this)(i,j);
1305 }
1307 //*************************************************************************************************
1308 
1309 
1310 //*************************************************************************************************
1327 template< typename MT // Type of the adapted dense matrix
1328  , bool SO > // Storage order of the adapted dense matrix
1330  DiagonalMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1331 {
1332  if( i >= rows() ) {
1333  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1334  }
1335  if( j >= columns() ) {
1336  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1337  }
1338  return (*this)(i,j);
1339 }
1341 //*************************************************************************************************
1342 
1343 
1344 //*************************************************************************************************
1357 template< typename MT // Type of the adapted dense matrix
1358  , bool SO > // Storage order of the adapted dense matrix
1359 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1360  DiagonalMatrix<MT,SO,true>::data() const noexcept
1361 {
1362  return matrix_.data();
1363 }
1365 //*************************************************************************************************
1366 
1367 
1368 //*************************************************************************************************
1377 template< typename MT // Type of the adapted dense matrix
1378  , bool SO > // Storage order of the adapted dense matrix
1379 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1380  DiagonalMatrix<MT,SO,true>::data( size_t i ) const noexcept
1381 {
1382  return matrix_.data(i);
1383 }
1385 //*************************************************************************************************
1386 
1387 
1388 //*************************************************************************************************
1400 template< typename MT // Type of the adapted dense matrix
1401  , bool SO > // Storage order of the adapted dense matrix
1404 {
1405  if( SO )
1406  return Iterator( matrix_, 0UL, i );
1407  else
1408  return Iterator( matrix_, i, 0UL );
1409 }
1411 //*************************************************************************************************
1412 
1413 
1414 //*************************************************************************************************
1426 template< typename MT // Type of the adapted dense matrix
1427  , bool SO > // Storage order of the adapted dense matrix
1429  DiagonalMatrix<MT,SO,true>::begin( size_t i ) const
1430 {
1431  return matrix_.begin(i);
1432 }
1434 //*************************************************************************************************
1435 
1436 
1437 //*************************************************************************************************
1449 template< typename MT // Type of the adapted dense matrix
1450  , bool SO > // Storage order of the adapted dense matrix
1452  DiagonalMatrix<MT,SO,true>::cbegin( size_t i ) const
1453 {
1454  return matrix_.cbegin(i);
1455 }
1457 //*************************************************************************************************
1458 
1459 
1460 //*************************************************************************************************
1472 template< typename MT // Type of the adapted dense matrix
1473  , bool SO > // Storage order of the adapted dense matrix
1476 {
1477  if( SO )
1478  return Iterator( matrix_, rows(), i );
1479  else
1480  return Iterator( matrix_, i, columns() );
1481 }
1483 //*************************************************************************************************
1484 
1485 
1486 //*************************************************************************************************
1498 template< typename MT // Type of the adapted dense matrix
1499  , bool SO > // Storage order of the adapted dense matrix
1501  DiagonalMatrix<MT,SO,true>::end( size_t i ) const
1502 {
1503  return matrix_.end(i);
1504 }
1506 //*************************************************************************************************
1507 
1508 
1509 //*************************************************************************************************
1521 template< typename MT // Type of the adapted dense matrix
1522  , bool SO > // Storage order of the adapted dense matrix
1524  DiagonalMatrix<MT,SO,true>::cend( size_t i ) const
1525 {
1526  return matrix_.cend(i);
1527 }
1529 //*************************************************************************************************
1530 
1531 
1532 
1533 
1534 //=================================================================================================
1535 //
1536 // ASSIGNMENT OPERATORS
1537 //
1538 //=================================================================================================
1539 
1540 //*************************************************************************************************
1547 template< typename MT // Type of the adapted dense matrix
1548  , bool SO > // Storage order of the adapted dense matrix
1549 inline DiagonalMatrix<MT,SO,true>&
1550  DiagonalMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1551 {
1552  if( SO ) {
1553  for( size_t j=0UL; j<columns(); ++j )
1554  matrix_(j,j) = rhs;
1555  }
1556  else {
1557  for( size_t i=0UL; i<rows(); ++i )
1558  matrix_(i,i) = rhs;
1559  }
1560 
1561  return *this;
1562 }
1564 //*************************************************************************************************
1565 
1566 
1567 //*************************************************************************************************
1591 template< typename MT // Type of the adapted dense matrix
1592  , bool SO > // Storage order of the adapted dense matrix
1593 inline DiagonalMatrix<MT,SO,true>&
1594  DiagonalMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1595 {
1596  MT tmp( list );
1597 
1598  if( !isDiagonal( tmp ) ) {
1599  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1600  }
1601 
1602  matrix_ = std::move( tmp );
1603 
1604  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1605  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1606 
1607  return *this;
1608 }
1610 //*************************************************************************************************
1611 
1612 
1613 //*************************************************************************************************
1637 template< typename MT // Type of the adapted dense matrix
1638  , bool SO > // Storage order of the adapted dense matrix
1639 template< typename Other // Data type of the initialization array
1640  , size_t N > // Number of rows and columns of the initialization array
1641 inline DiagonalMatrix<MT,SO,true>&
1642  DiagonalMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1643 {
1644  MT tmp( array );
1645 
1646  if( !isDiagonal( tmp ) ) {
1647  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1648  }
1649 
1650  matrix_ = std::move( tmp );
1651 
1652  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1653  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1654 
1655  return *this;
1656 }
1658 //*************************************************************************************************
1659 
1660 
1661 //*************************************************************************************************
1671 template< typename MT // Type of the adapted dense matrix
1672  , bool SO > // Storage order of the adapted dense matrix
1673 inline DiagonalMatrix<MT,SO,true>&
1674  DiagonalMatrix<MT,SO,true>::operator=( const DiagonalMatrix& rhs )
1675 {
1676  matrix_ = rhs.matrix_;
1677 
1678  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1679  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1680 
1681  return *this;
1682 }
1684 //*************************************************************************************************
1685 
1686 
1687 //*************************************************************************************************
1694 template< typename MT // Type of the adapted dense matrix
1695  , bool SO > // Storage order of the adapted dense matrix
1696 inline DiagonalMatrix<MT,SO,true>&
1697  DiagonalMatrix<MT,SO,true>::operator=( DiagonalMatrix&& rhs ) noexcept
1698 {
1699  matrix_ = std::move( rhs.matrix_ );
1700 
1701  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1702  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1703 
1704  return *this;
1705 }
1707 //*************************************************************************************************
1708 
1709 
1710 //*************************************************************************************************
1723 template< typename MT // Type of the adapted dense matrix
1724  , bool SO > // Storage order of the adapted dense matrix
1725 template< typename MT2 // Type of the right-hand side matrix
1726  , bool SO2 > // Storage order of the right-hand side matrix
1727 inline DisableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1728  DiagonalMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1729 {
1730  if( !IsDiagonal<MT2>::value && !isDiagonal( ~rhs ) ) {
1731  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1732  }
1733 
1734  matrix_ = ~rhs;
1735 
1736  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1737  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1738 
1739  return *this;
1740 }
1742 //*************************************************************************************************
1743 
1744 
1745 //*************************************************************************************************
1758 template< typename MT // Type of the adapted dense matrix
1759  , bool SO > // Storage order of the adapted dense matrix
1760 template< typename MT2 // Type of the right-hand side matrix
1761  , bool SO2 > // Storage order of the right-hand side matrix
1762 inline EnableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1763  DiagonalMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1764 {
1765  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1766  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1767  }
1768 
1769  if( IsDiagonal<MT2>::value ) {
1770  matrix_ = ~rhs;
1771  }
1772  else {
1773  MT tmp( ~rhs );
1774 
1775  if( !isDiagonal( tmp ) ) {
1776  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1777  }
1778 
1779  matrix_ = std::move( tmp );
1780  }
1781 
1782  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1783  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1784 
1785  return *this;
1786 }
1788 //*************************************************************************************************
1789 
1790 
1791 //*************************************************************************************************
1804 template< typename MT // Type of the adapted dense matrix
1805  , bool SO > // Storage order of the adapted dense matrix
1806 template< typename MT2 // Type of the right-hand side matrix
1807  , bool SO2 > // Storage order of the right-hand side matrix
1808 inline DisableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1809  DiagonalMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1810 {
1811  if( !IsDiagonal<MT2>::value && !isDiagonal( ~rhs ) ) {
1812  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1813  }
1814 
1815  matrix_ += ~rhs;
1816 
1817  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1818  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1819 
1820  return *this;
1821 }
1823 //*************************************************************************************************
1824 
1825 
1826 //*************************************************************************************************
1839 template< typename MT // Type of the adapted dense matrix
1840  , bool SO > // Storage order of the adapted dense matrix
1841 template< typename MT2 // Type of the right-hand side matrix
1842  , bool SO2 > // Storage order of the right-hand side matrix
1843 inline EnableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1844  DiagonalMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1845 {
1846  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1847  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1848  }
1849 
1850  if( IsDiagonal<MT2>::value ) {
1851  matrix_ += ~rhs;
1852  }
1853  else {
1854  const ResultType_<MT2> tmp( ~rhs );
1855 
1856  if( !isDiagonal( tmp ) ) {
1857  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1858  }
1859 
1860  matrix_ += tmp;
1861  }
1862 
1863  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1864  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1865 
1866  return *this;
1867 }
1869 //*************************************************************************************************
1870 
1871 
1872 //*************************************************************************************************
1885 template< typename MT // Type of the adapted dense matrix
1886  , bool SO > // Storage order of the adapted dense matrix
1887 template< typename MT2 // Type of the right-hand side matrix
1888  , bool SO2 > // Storage order of the right-hand side matrix
1889 inline DisableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1890  DiagonalMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1891 {
1892  if( !IsDiagonal<MT2>::value && !isDiagonal( ~rhs ) ) {
1893  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1894  }
1895 
1896  matrix_ -= ~rhs;
1897 
1898  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1899  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1900 
1901  return *this;
1902 }
1904 //*************************************************************************************************
1905 
1906 
1907 //*************************************************************************************************
1920 template< typename MT // Type of the adapted dense matrix
1921  , bool SO > // Storage order of the adapted dense matrix
1922 template< typename MT2 // Type of the right-hand side matrix
1923  , bool SO2 > // Storage order of the right-hand side matrix
1924 inline EnableIf_< IsComputation<MT2>, DiagonalMatrix<MT,SO,true>& >
1925  DiagonalMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1926 {
1927  if( !IsSquare<MT2>::value && !isSquare( ~rhs ) ) {
1928  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1929  }
1930 
1931  if( IsDiagonal<MT2>::value ) {
1932  matrix_ -= ~rhs;
1933  }
1934  else {
1935  const ResultType_<MT2> tmp( ~rhs );
1936 
1937  if( !isDiagonal( tmp ) ) {
1938  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1939  }
1940 
1941  matrix_ -= tmp;
1942  }
1943 
1944  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1945  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1946 
1947  return *this;
1948 }
1950 //*************************************************************************************************
1951 
1952 
1953 //*************************************************************************************************
1965 template< typename MT // Type of the adapted dense matrix
1966  , bool SO > // Storage order of the adapted dense matrix
1967 template< typename MT2 // Type of the right-hand side matrix
1968  , bool SO2 > // Storage order of the right-hand side matrix
1969 inline DiagonalMatrix<MT,SO,true>&
1970  DiagonalMatrix<MT,SO,true>::operator*=( const Matrix<MT2,SO2>& rhs )
1971 {
1972  if( matrix_.rows() != (~rhs).columns() ) {
1973  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1974  }
1975 
1976  MT tmp( matrix_ * ~rhs );
1977 
1978  if( !isDiagonal( tmp ) ) {
1979  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1980  }
1981 
1982  matrix_ = std::move( tmp );
1983 
1984  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1985  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1986 
1987  return *this;
1988 }
1990 //*************************************************************************************************
1991 
1992 
1993 //*************************************************************************************************
2001 template< typename MT // Type of the adapted dense matrix
2002  , bool SO > // Storage order of the adapted dense matrix
2003 template< typename Other > // Data type of the right-hand side scalar
2004 inline EnableIf_< IsNumeric<Other>, DiagonalMatrix<MT,SO,true> >&
2006 {
2007  matrix_ *= rhs;
2008  return *this;
2009 }
2010 //*************************************************************************************************
2011 
2012 
2013 //*************************************************************************************************
2021 template< typename MT // Type of the adapted dense matrix
2022  , bool SO > // Storage order of the adapted dense matrix
2023 template< typename Other > // Data type of the right-hand side scalar
2024 inline EnableIf_< IsNumeric<Other>, DiagonalMatrix<MT,SO,true> >&
2026 {
2027  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
2028 
2029  matrix_ /= rhs;
2030  return *this;
2031 }
2033 //*************************************************************************************************
2034 
2035 
2036 
2037 
2038 //=================================================================================================
2039 //
2040 // UTILITY FUNCTIONS
2041 //
2042 //=================================================================================================
2043 
2044 //*************************************************************************************************
2050 template< typename MT // Type of the adapted dense matrix
2051  , bool SO > // Storage order of the adapted dense matrix
2052 inline size_t DiagonalMatrix<MT,SO,true>::rows() const noexcept
2053 {
2054  return matrix_.rows();
2055 }
2057 //*************************************************************************************************
2058 
2059 
2060 //*************************************************************************************************
2066 template< typename MT // Type of the adapted dense matrix
2067  , bool SO > // Storage order of the adapted dense matrix
2068 inline size_t DiagonalMatrix<MT,SO,true>::columns() const noexcept
2069 {
2070  return matrix_.columns();
2071 }
2073 //*************************************************************************************************
2074 
2075 
2076 //*************************************************************************************************
2087 template< typename MT // Type of the adapted dense matrix
2088  , bool SO > // Storage order of the adapted dense matrix
2089 inline size_t DiagonalMatrix<MT,SO,true>::spacing() const noexcept
2090 {
2091  return matrix_.spacing();
2092 }
2094 //*************************************************************************************************
2095 
2096 
2097 //*************************************************************************************************
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() const noexcept
2106 {
2107  return matrix_.capacity();
2108 }
2110 //*************************************************************************************************
2111 
2112 
2113 //*************************************************************************************************
2125 template< typename MT // Type of the adapted dense matrix
2126  , bool SO > // Storage order of the adapted dense matrix
2127 inline size_t DiagonalMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2128 {
2129  return matrix_.capacity(i);
2130 }
2132 //*************************************************************************************************
2133 
2134 
2135 //*************************************************************************************************
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() const
2144 {
2145  return matrix_.nonZeros();
2146 }
2148 //*************************************************************************************************
2149 
2150 
2151 //*************************************************************************************************
2163 template< typename MT // Type of the adapted dense matrix
2164  , bool SO > // Storage order of the adapted dense matrix
2165 inline size_t DiagonalMatrix<MT,SO,true>::nonZeros( size_t i ) const
2166 {
2167  return matrix_.nonZeros(i);
2168 }
2170 //*************************************************************************************************
2171 
2172 
2173 //*************************************************************************************************
2179 template< typename MT // Type of the adapted dense matrix
2180  , bool SO > // Storage order of the adapted dense matrix
2182 {
2183  matrix_.reset();
2184 }
2186 //*************************************************************************************************
2187 
2188 
2189 //*************************************************************************************************
2202 template< typename MT // Type of the adapted dense matrix
2203  , bool SO > // Storage order of the adapted dense matrix
2204 inline void DiagonalMatrix<MT,SO,true>::reset( size_t i )
2205 {
2206  matrix_.reset( i );
2207 }
2209 //*************************************************************************************************
2210 
2211 
2212 //*************************************************************************************************
2224 template< typename MT // Type of the adapted dense matrix
2225  , bool SO > // Storage order of the adapted dense matrix
2227 {
2228  using blaze::clear;
2229 
2230  clear( matrix_ );
2231 }
2233 //*************************************************************************************************
2234 
2235 
2236 //*************************************************************************************************
2272 template< typename MT // Type of the adapted dense matrix
2273  , bool SO > // Storage order of the adapted dense matrix
2274 void DiagonalMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2275 {
2277 
2278  UNUSED_PARAMETER( preserve );
2279 
2280  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
2281 
2282  const size_t oldsize( matrix_.rows() );
2283 
2284  matrix_.resize( n, n, true );
2285 
2286  if( n > oldsize ) {
2287  const size_t increment( n - oldsize );
2288  submatrix( matrix_, 0UL, oldsize, n, increment ).reset();
2289  submatrix( matrix_, oldsize, 0UL, increment, increment ).reset();
2290  }
2291 }
2293 //*************************************************************************************************
2294 
2295 
2296 //*************************************************************************************************
2309 template< typename MT // Type of the adapted dense matrix
2310  , bool SO > // Storage order of the adapted dense matrix
2311 inline void DiagonalMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2312 {
2314 
2315  UNUSED_PARAMETER( preserve );
2316 
2317  resize( rows() + n, true );
2318 }
2319 //*************************************************************************************************
2320 
2321 
2322 //*************************************************************************************************
2332 template< typename MT // Type of the adapted dense matrix
2333  , bool SO > // Storage order of the adapted dense matrix
2334 inline void DiagonalMatrix<MT,SO,true>::reserve( size_t elements )
2335 {
2336  matrix_.reserve( elements );
2337 }
2339 //*************************************************************************************************
2340 
2341 
2342 //*************************************************************************************************
2349 template< typename MT // Type of the adapted dense matrix
2350  , bool SO > // Storage order of the adapted dense matrix
2351 inline void DiagonalMatrix<MT,SO,true>::swap( DiagonalMatrix& m ) noexcept
2352 {
2353  using std::swap;
2354 
2355  swap( matrix_, m.matrix_ );
2356 }
2358 //*************************************************************************************************
2359 
2360 
2361 
2362 
2363 //=================================================================================================
2364 //
2365 // NUMERIC FUNCTIONS
2366 //
2367 //=================================================================================================
2368 
2369 //*************************************************************************************************
2376 template< typename MT // Type of the adapted dense matrix
2377  , bool SO > // Storage order of the adapted dense matrix
2378 template< typename Other > // Data type of the scalar value
2379 inline DiagonalMatrix<MT,SO,true>& DiagonalMatrix<MT,SO,true>::scale( const Other& scalar )
2380 {
2381  matrix_.scale( scalar );
2382  return *this;
2383 }
2385 //*************************************************************************************************
2386 
2387 
2388 
2389 
2390 //=================================================================================================
2391 //
2392 // DEBUGGING FUNCTIONS
2393 //
2394 //=================================================================================================
2395 
2396 //*************************************************************************************************
2406 template< typename MT // Type of the adapted dense matrix
2407  , bool SO > // Storage order of the adapted dense matrix
2408 inline bool DiagonalMatrix<MT,SO,true>::isIntact() const noexcept
2409 {
2410  using blaze::isIntact;
2411 
2412  return ( isIntact( matrix_ ) && isDiagonal( matrix_ ) );
2413 }
2415 //*************************************************************************************************
2416 
2417 
2418 
2419 
2420 //=================================================================================================
2421 //
2422 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2423 //
2424 //=================================================================================================
2425 
2426 //*************************************************************************************************
2437 template< typename MT // Type of the adapted dense matrix
2438  , bool SO > // Storage order of the adapted dense matrix
2439 template< typename Other > // Data type of the foreign expression
2440 inline bool DiagonalMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2441 {
2442  return matrix_.canAlias( alias );
2443 }
2445 //*************************************************************************************************
2446 
2447 
2448 //*************************************************************************************************
2459 template< typename MT // Type of the adapted dense matrix
2460  , bool SO > // Storage order of the adapted dense matrix
2461 template< typename Other > // Data type of the foreign expression
2462 inline bool DiagonalMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2463 {
2464  return matrix_.isAliased( alias );
2465 }
2467 //*************************************************************************************************
2468 
2469 
2470 //*************************************************************************************************
2480 template< typename MT // Type of the adapted dense matrix
2481  , bool SO > // Storage order of the adapted dense matrix
2482 inline bool DiagonalMatrix<MT,SO,true>::isAligned() const noexcept
2483 {
2484  return matrix_.isAligned();
2485 }
2487 //*************************************************************************************************
2488 
2489 
2490 //*************************************************************************************************
2501 template< typename MT // Type of the adapted dense matrix
2502  , bool SO > // Storage order of the adapted dense matrix
2503 inline bool DiagonalMatrix<MT,SO,true>::canSMPAssign() const noexcept
2504 {
2505  return matrix_.canSMPAssign();
2506 }
2508 //*************************************************************************************************
2509 
2510 
2511 //*************************************************************************************************
2527 template< typename MT // Type of the adapted dense matrix
2528  , bool SO > // Storage order of the adapted dense matrix
2529 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2530  DiagonalMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2531 {
2532  return matrix_.load( i, j );
2533 }
2535 //*************************************************************************************************
2536 
2537 
2538 //*************************************************************************************************
2554 template< typename MT // Type of the adapted dense matrix
2555  , bool SO > // Storage order of the adapted dense matrix
2556 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2557  DiagonalMatrix<MT,SO,true>::loada( size_t i, size_t j ) const noexcept
2558 {
2559  return matrix_.loada( i, j );
2560 }
2562 //*************************************************************************************************
2563 
2564 
2565 //*************************************************************************************************
2581 template< typename MT // Type of the adapted dense matrix
2582  , bool SO > // Storage order of the adapted dense matrix
2583 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2584  DiagonalMatrix<MT,SO,true>::loadu( size_t i, size_t j ) const noexcept
2585 {
2586  return matrix_.loadu( i, j );
2587 }
2589 //*************************************************************************************************
2590 
2591 
2592 
2593 
2594 //=================================================================================================
2595 //
2596 // CONSTRUCTION FUNCTIONS
2597 //
2598 //=================================================================================================
2599 
2600 //*************************************************************************************************
2607 template< typename MT // Type of the adapted dense matrix
2608  , bool SO > // Storage order of the adapted dense matrix
2609 inline const MT DiagonalMatrix<MT,SO,true>::construct( size_t n, TrueType )
2610 {
2612 
2613  return MT( n, n, ElementType() );
2614 }
2616 //*************************************************************************************************
2617 
2618 
2619 //*************************************************************************************************
2626 template< typename MT // Type of the adapted dense matrix
2627  , bool SO > // Storage order of the adapted dense matrix
2628 inline const MT DiagonalMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2629 {
2632 
2633  MT tmp;
2634 
2635  for( size_t i=0UL; i<tmp.rows(); ++i )
2636  tmp(i,i) = init;
2637 
2638  return tmp;
2639 }
2641 //*************************************************************************************************
2642 
2643 
2644 //*************************************************************************************************
2655 template< typename MT // Type of the adapted dense matrix
2656  , bool SO > // Storage order of the adapted dense matrix
2657 template< typename MT2 // Type of the foreign matrix
2658  , bool SO2 // Storage order of the foreign matrix
2659  , typename T > // Type of the third argument
2660 inline const MT DiagonalMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2661 {
2662  const MT tmp( ~m );
2663 
2664  if( !IsDiagonal<MT2>::value && !isDiagonal( tmp ) ) {
2665  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
2666  }
2667 
2668  return tmp;
2669 }
2671 //*************************************************************************************************
2672 
2673 } // namespace blaze
2674 
2675 #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
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:102
Header file for auxiliary alias declarations.
#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:352
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:1339
Constraint on the data type.
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:194
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:699
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2935
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5556
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2928
#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:1577
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:390
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE(T)
Constraint on the data type.In case the given data type T is not a square matrix type, a compilation error is created.
Definition: Square.h:60
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:731
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1321
Constraint on the data type.
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2931
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:304
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:238
Constraint on the data type.
Constraint on the data type.
Header file for the std::initializer_list aliases.
Header file for the IsSquare type trait.
Constraint on the data type.
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the 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:5635
Compile time assertion.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5618
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2939
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
Header file for the Columns type trait.
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
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:336
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
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2932
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:544
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:260
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:2933
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
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2937
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsNumeric type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2934
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1285
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2938
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:267
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a &#39;resize&#39; member fu...
Definition: Resizable.h:81
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
Header file for the implementation of the base template of the DiagonalMatrix.
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2929
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a &#39;res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2930
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2936
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1303
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
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:168
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:677
Header file for the IsResizable type trait.
const DMatDMatMultExpr< T1, T2, false, false, false, false > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:7505
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.