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>
59 #include <blaze/math/Exception.h>
62 #include <blaze/math/shims/Clear.h>
73 #include <blaze/math/views/Band.h>
75 #include <blaze/system/Inline.h>
76 #include <blaze/util/Assert.h>
82 #include <blaze/util/DisableIf.h>
83 #include <blaze/util/EnableIf.h>
84 #include <blaze/util/FalseType.h>
85 #include <blaze/util/mpl/If.h>
87 #include <blaze/util/TrueType.h>
88 #include <blaze/util/Types.h>
93 #include <blaze/util/Unused.h>
94 
95 
96 namespace blaze {
97 
98 //=================================================================================================
99 //
100 // CLASS TEMPLATE SPECIALIZATION FOR DENSE MATRICES
101 //
102 //=================================================================================================
103 
104 //*************************************************************************************************
112 template< typename MT // Type of the adapted dense matrix
113  , bool SO > // Storage order of the adapted dense matrix
114 class DiagonalMatrix<MT,SO,true>
115  : public DenseMatrix< DiagonalMatrix<MT,SO,true>, SO >
116 {
117  private:
118  //**Type definitions****************************************************************************
119  using OT = OppositeType_t<MT>;
120  using TT = TransposeType_t<MT>;
121  using ET = ElementType_t<MT>;
122  //**********************************************************************************************
123 
124  public:
125  //**Type definitions****************************************************************************
126  using This = DiagonalMatrix<MT,SO,true>;
127  using BaseType = DenseMatrix<This,SO>;
128  using ResultType = This;
129  using OppositeType = DiagonalMatrix<OT,!SO,true>;
130  using TransposeType = DiagonalMatrix<TT,!SO,true>;
131  using ElementType = ET;
132  using SIMDType = SIMDType_t<MT>;
133  using ReturnType = ReturnType_t<MT>;
134  using CompositeType = const This&;
135  using Reference = DiagonalProxy<MT>;
136  using ConstReference = ConstReference_t<MT>;
137  using Pointer = Pointer_t<MT>;
138  using ConstPointer = ConstPointer_t<MT>;
139  using ConstIterator = ConstIterator_t<MT>;
140  //**********************************************************************************************
141 
142  //**Rebind struct definition********************************************************************
145  template< typename NewType > // Data type of the other matrix
146  struct Rebind {
148  using Other = DiagonalMatrix< typename MT::template Rebind<NewType>::Other >;
149  };
150  //**********************************************************************************************
151 
152  //**Resize struct definition********************************************************************
155  template< size_t NewM // Number of rows of the other matrix
156  , size_t NewN > // Number of columns of the other matrix
157  struct Resize {
159  using Other = DiagonalMatrix< typename MT::template Resize<NewM,NewN>::Other >;
160  };
161  //**********************************************************************************************
162 
163  //**Iterator class definition*******************************************************************
166  class Iterator
167  {
168  public:
169  //**Type definitions*************************************************************************
170  using IteratorCategory = std::random_access_iterator_tag;
171  using ValueType = ElementType_t<MT>;
172  using PointerType = DiagonalProxy<MT>;
173  using ReferenceType = DiagonalProxy<MT>;
174  using DifferenceType = ptrdiff_t;
175 
176  // STL iterator requirements
177  using iterator_category = IteratorCategory;
178  using value_type = ValueType;
179  using pointer = PointerType;
180  using reference = ReferenceType;
181  using difference_type = DifferenceType;
182  //*******************************************************************************************
183 
184  //**Constructor******************************************************************************
187  inline Iterator() noexcept
188  : matrix_( nullptr ) // Reference to the adapted dense matrix
189  , row_ ( 0UL ) // The current row index of the iterator
190  , column_( 0UL ) // The current column index of the iterator
191  {}
192  //*******************************************************************************************
193 
194  //**Constructor******************************************************************************
201  inline Iterator( MT& matrix, size_t row, size_t column ) noexcept
202  : matrix_( &matrix ) // Reference to the adapted dense matrix
203  , row_ ( row ) // The current row-index of the iterator
204  , column_( column ) // The current column-index of the iterator
205  {}
206  //*******************************************************************************************
207 
208  //**Addition assignment operator*************************************************************
214  inline Iterator& operator+=( size_t inc ) noexcept {
215  ( SO )?( row_ += inc ):( column_ += inc );
216  return *this;
217  }
218  //*******************************************************************************************
219 
220  //**Subtraction assignment operator**********************************************************
226  inline Iterator& operator-=( size_t dec ) noexcept {
227  ( SO )?( row_ -= dec ):( column_ -= dec );
228  return *this;
229  }
230  //*******************************************************************************************
231 
232  //**Prefix increment operator****************************************************************
237  inline Iterator& operator++() noexcept {
238  ( SO )?( ++row_ ):( ++column_ );
239  return *this;
240  }
241  //*******************************************************************************************
242 
243  //**Postfix increment operator***************************************************************
248  inline const Iterator operator++( int ) noexcept {
249  const Iterator tmp( *this );
250  ++(*this);
251  return tmp;
252  }
253  //*******************************************************************************************
254 
255  //**Prefix decrement operator****************************************************************
260  inline Iterator& operator--() noexcept {
261  ( SO )?( --row_ ):( --column_ );
262  return *this;
263  }
264  //*******************************************************************************************
265 
266  //**Postfix decrement operator***************************************************************
271  inline const Iterator operator--( int ) noexcept {
272  const Iterator tmp( *this );
273  --(*this);
274  return tmp;
275  }
276  //*******************************************************************************************
277 
278  //**Element access operator******************************************************************
283  inline ReferenceType operator*() const {
284  return ReferenceType( *matrix_, row_, column_ );
285  }
286  //*******************************************************************************************
287 
288  //**Element access operator******************************************************************
293  inline PointerType operator->() const {
294  return PointerType( *matrix_, row_, column_ );
295  }
296  //*******************************************************************************************
297 
298  //**Load function****************************************************************************
308  inline SIMDType load() const {
309  return (*matrix_).load(row_,column_);
310  }
311  //*******************************************************************************************
312 
313  //**Loada function***************************************************************************
323  inline SIMDType loada() const {
324  return (*matrix_).loada(row_,column_);
325  }
326  //*******************************************************************************************
327 
328  //**Loadu function***************************************************************************
338  inline SIMDType loadu() const {
339  return (*matrix_).loadu(row_,column_);
340  }
341  //*******************************************************************************************
342 
343  //**Conversion operator**********************************************************************
348  inline operator ConstIterator() const {
349  if( SO )
350  return matrix_->begin( column_ ) + row_;
351  else
352  return matrix_->begin( row_ ) + column_;
353  }
354  //*******************************************************************************************
355 
356  //**Equality operator************************************************************************
363  friend inline bool operator==( const Iterator& lhs, const Iterator& rhs ) noexcept {
364  return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
365  }
366  //*******************************************************************************************
367 
368  //**Equality operator************************************************************************
375  friend inline bool operator==( const Iterator& lhs, const ConstIterator& rhs ) {
376  return ( ConstIterator( lhs ) == rhs );
377  }
378  //*******************************************************************************************
379 
380  //**Equality operator************************************************************************
387  friend inline bool operator==( const ConstIterator& lhs, const Iterator& rhs ) {
388  return ( lhs == ConstIterator( rhs ) );
389  }
390  //*******************************************************************************************
391 
392  //**Inequality operator**********************************************************************
399  friend inline bool operator!=( const Iterator& lhs, const Iterator& rhs ) noexcept {
400  return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
401  }
402  //*******************************************************************************************
403 
404  //**Inequality operator**********************************************************************
411  friend inline bool operator!=( const Iterator& lhs, const ConstIterator& rhs ) {
412  return ( ConstIterator( lhs ) != rhs );
413  }
414  //*******************************************************************************************
415 
416  //**Inequality operator**********************************************************************
423  friend inline bool operator!=( const ConstIterator& lhs, const Iterator& rhs ) {
424  return ( lhs != ConstIterator( rhs ) );
425  }
426  //*******************************************************************************************
427 
428  //**Less-than operator***********************************************************************
435  friend inline bool operator<( const Iterator& lhs, const Iterator& rhs ) noexcept {
436  return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
437  }
438  //*******************************************************************************************
439 
440  //**Less-than operator***********************************************************************
447  friend inline bool operator<( const Iterator& lhs, const ConstIterator& rhs ) {
448  return ( ConstIterator( lhs ) < rhs );
449  }
450  //*******************************************************************************************
451 
452  //**Less-than operator***********************************************************************
459  friend inline bool operator<( const ConstIterator& lhs, const Iterator& rhs ) {
460  return ( lhs < ConstIterator( rhs ) );
461  }
462  //*******************************************************************************************
463 
464  //**Greater-than operator********************************************************************
471  friend inline bool operator>( const Iterator& lhs, const Iterator& rhs ) noexcept {
472  return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
473  }
474  //*******************************************************************************************
475 
476  //**Greater-than operator********************************************************************
483  friend inline bool operator>( const Iterator& lhs, const ConstIterator& rhs ) {
484  return ( ConstIterator( lhs ) > rhs );
485  }
486  //*******************************************************************************************
487 
488  //**Greater-than operator********************************************************************
495  friend inline bool operator>( const ConstIterator& lhs, const Iterator& rhs ) {
496  return ( lhs > ConstIterator( rhs ) );
497  }
498  //*******************************************************************************************
499 
500  //**Less-or-equal-than operator**************************************************************
507  friend inline bool operator<=( const Iterator& lhs, const Iterator& rhs ) noexcept {
508  return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
509  }
510  //*******************************************************************************************
511 
512  //**Less-or-equal-than operator**************************************************************
519  friend inline bool operator<=( const Iterator& lhs, const ConstIterator& rhs ) {
520  return ( ConstIterator( lhs ) <= rhs );
521  }
522  //*******************************************************************************************
523 
524  //**Less-or-equal-than operator**************************************************************
531  friend inline bool operator<=( const ConstIterator& lhs, const Iterator& rhs ) {
532  return ( lhs <= ConstIterator( rhs ) );
533  }
534  //*******************************************************************************************
535 
536  //**Greater-or-equal-than operator***********************************************************
543  friend inline bool operator>=( const Iterator& lhs, const Iterator& rhs ) noexcept {
544  return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
545  }
546  //*******************************************************************************************
547 
548  //**Greater-or-equal-than operator***********************************************************
555  friend inline bool operator>=( const Iterator& lhs, const ConstIterator& rhs ) {
556  return ( ConstIterator( lhs ) >= rhs );
557  }
558  //*******************************************************************************************
559 
560  //**Greater-or-equal-than operator***********************************************************
567  friend inline bool operator>=( const ConstIterator& lhs, const Iterator& rhs ) {
568  return ( lhs >= ConstIterator( rhs ) );
569  }
570  //*******************************************************************************************
571 
572  //**Subtraction operator*********************************************************************
578  inline DifferenceType operator-( const Iterator& rhs ) const noexcept {
579  return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
580  }
581  //*******************************************************************************************
582 
583  //**Addition operator************************************************************************
590  friend inline const Iterator operator+( const Iterator& it, size_t inc ) noexcept {
591  if( SO )
592  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
593  else
594  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
595  }
596  //*******************************************************************************************
597 
598  //**Addition operator************************************************************************
605  friend inline const Iterator operator+( size_t inc, const Iterator& it ) noexcept {
606  if( SO )
607  return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
608  else
609  return Iterator( *it.matrix_, it.row_, it.column_ + inc );
610  }
611  //*******************************************************************************************
612 
613  //**Subtraction operator*********************************************************************
620  friend inline const Iterator operator-( const Iterator& it, size_t dec ) noexcept {
621  if( SO )
622  return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
623  else
624  return Iterator( *it.matrix_, it.row_, it.column_ - dec );
625  }
626  //*******************************************************************************************
627 
628  private:
629  //**Member variables*************************************************************************
630  MT* matrix_;
631  size_t row_;
632  size_t column_;
633  //*******************************************************************************************
634  };
635  //**********************************************************************************************
636 
637  //**Compilation flags***************************************************************************
639  static constexpr bool simdEnabled = MT::simdEnabled;
640 
642  static constexpr bool smpAssignable = MT::smpAssignable;
643  //**********************************************************************************************
644 
645  //**Constructors********************************************************************************
648  explicit inline DiagonalMatrix();
649  template< typename A1 > explicit inline DiagonalMatrix( const A1& a1 );
650  explicit inline DiagonalMatrix( size_t n, const ElementType& init );
651 
652  explicit inline DiagonalMatrix( initializer_list< initializer_list<ElementType> > list );
653 
654  template< typename Other >
655  explicit inline DiagonalMatrix( size_t n, const Other* array );
656 
657  template< typename Other, size_t N >
658  explicit inline DiagonalMatrix( const Other (&array)[N][N] );
659 
660  explicit inline DiagonalMatrix( ElementType* ptr, size_t n );
661  explicit inline DiagonalMatrix( ElementType* ptr, size_t n, size_t nn );
662 
663  inline DiagonalMatrix( const DiagonalMatrix& m );
664  inline DiagonalMatrix( DiagonalMatrix&& m ) noexcept;
666  //**********************************************************************************************
667 
668  //**Destructor**********************************************************************************
671  ~DiagonalMatrix() = default;
673  //**********************************************************************************************
674 
675  //**Data access functions***********************************************************************
678  inline Reference operator()( size_t i, size_t j );
679  inline ConstReference operator()( size_t i, size_t j ) const;
680  inline Reference at( size_t i, size_t j );
681  inline ConstReference at( size_t i, size_t j ) const;
682  inline ConstPointer data () const noexcept;
683  inline ConstPointer data ( size_t i ) const noexcept;
684  inline Iterator begin ( size_t i );
685  inline ConstIterator begin ( size_t i ) const;
686  inline ConstIterator cbegin( size_t i ) const;
687  inline Iterator end ( size_t i );
688  inline ConstIterator end ( size_t i ) const;
689  inline ConstIterator cend ( size_t i ) const;
691  //**********************************************************************************************
692 
693  //**Assignment operators************************************************************************
696  inline DiagonalMatrix& operator=( const ElementType& rhs );
697  inline DiagonalMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
698 
699  template< typename Other, size_t N >
700  inline DiagonalMatrix& operator=( const Other (&array)[N][N] );
701 
702  inline DiagonalMatrix& operator=( const DiagonalMatrix& rhs );
703  inline DiagonalMatrix& operator=( DiagonalMatrix&& rhs ) noexcept;
704 
705  template< typename MT2, bool SO2 >
706  inline auto operator=( const Matrix<MT2,SO2>& rhs )
707  -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >;
708 
709  template< typename MT2, bool SO2 >
710  inline auto operator=( const Matrix<MT2,SO2>& rhs )
711  -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >;
712 
713  template< typename MT2, bool SO2 >
714  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
715  -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >;
716 
717  template< typename MT2, bool SO2 >
718  inline auto operator+=( const Matrix<MT2,SO2>& rhs )
719  -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >;
720 
721  template< typename MT2, bool SO2 >
722  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
723  -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >;
724 
725  template< typename MT2, bool SO2 >
726  inline auto operator-=( const Matrix<MT2,SO2>& rhs )
727  -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >;
728 
729  template< typename MT2, bool SO2 >
730  inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> DiagonalMatrix&;
731 
732  template< typename ST >
733  inline auto operator*=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, DiagonalMatrix& >;
734 
735  template< typename ST >
736  inline auto operator/=( ST rhs ) -> EnableIf_t< IsNumeric_v<ST>, DiagonalMatrix& >;
738  //**********************************************************************************************
739 
740  //**Utility functions***************************************************************************
743  inline size_t rows() const noexcept;
744  inline size_t columns() const noexcept;
745  inline size_t spacing() const noexcept;
746  inline size_t capacity() const noexcept;
747  inline size_t capacity( size_t i ) const noexcept;
748  inline size_t nonZeros() const;
749  inline size_t nonZeros( size_t i ) const;
750  inline void reset();
751  inline void reset( size_t i );
752  inline void clear();
753  void resize ( size_t n, bool preserve=true );
754  inline void extend ( size_t n, bool preserve=true );
755  inline void reserve( size_t elements );
756  inline void shrinkToFit();
757  inline void swap( DiagonalMatrix& m ) noexcept;
759  //**********************************************************************************************
760 
761  //**Numeric functions***************************************************************************
764  template< typename Other > inline DiagonalMatrix& scale( const Other& scalar );
766  //**********************************************************************************************
767 
768  //**Debugging functions*************************************************************************
771  inline bool isIntact() const noexcept;
773  //**********************************************************************************************
774 
775  //**Expression template evaluation functions****************************************************
778  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
779  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
780 
781  inline bool isAligned () const noexcept;
782  inline bool canSMPAssign() const noexcept;
783 
784  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
785  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
786  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
788  //**********************************************************************************************
789 
790  private:
791  //**Construction functions**********************************************************************
794  inline const MT construct( size_t n , TrueType );
795  inline const MT construct( const ElementType& value, FalseType );
796 
797  template< typename MT2, bool SO2, typename T >
798  inline const MT construct( const Matrix<MT2,SO2>& m, T );
800  //**********************************************************************************************
801 
802  //**Member variables****************************************************************************
805  MT matrix_;
806 
807  //**********************************************************************************************
808 
809  //**Friend declarations*************************************************************************
810  template< bool RF, typename MT2, bool SO2, bool DF2 >
811  friend bool isDefault( const DiagonalMatrix<MT2,SO2,DF2>& m );
812 
813  template< typename MT2, bool SO2, bool DF2 >
814  friend MT2& derestrict( DiagonalMatrix<MT2,SO2,DF2>& m );
815  //**********************************************************************************************
816 
817  //**Compile time checks*************************************************************************
830  BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
831  //**********************************************************************************************
832 };
834 //*************************************************************************************************
835 
836 
837 
838 
839 //=================================================================================================
840 //
841 // CONSTRUCTORS
842 //
843 //=================================================================================================
844 
845 //*************************************************************************************************
849 template< typename MT // Type of the adapted dense matrix
850  , bool SO > // Storage order of the adapted dense matrix
851 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix()
852  : matrix_() // The adapted dense matrix
853 {
854  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
855  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
856 }
858 //*************************************************************************************************
859 
860 
861 //*************************************************************************************************
879 template< typename MT // Type of the adapted dense matrix
880  , bool SO > // Storage order of the adapted dense matrix
881 template< typename A1 > // Type of the constructor argument
882 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const A1& a1 )
883  : matrix_( construct( a1, typename IsResizable<MT>::Type() ) ) // The adapted dense matrix
884 {
885  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
886  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
887 }
889 //*************************************************************************************************
890 
891 
892 //*************************************************************************************************
899 template< typename MT // Type of the adapted dense matrix
900  , bool SO > // Storage order of the adapted dense matrix
901 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( size_t n, const ElementType& init )
902  : matrix_( n, n, ElementType() ) // The adapted dense matrix
903 {
905 
906  for( size_t i=0UL; i<n; ++i )
907  matrix_(i,i) = init;
908 
909  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
910  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
911 }
913 //*************************************************************************************************
914 
915 
916 //*************************************************************************************************
940 template< typename MT // Type of the adapted dense matrix
941  , bool SO > // Storage order of the adapted dense matrix
942 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( initializer_list< initializer_list<ElementType> > list )
943  : matrix_( list ) // The adapted dense matrix
944 {
945  if( !isDiagonal( matrix_ ) ) {
946  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
947  }
948 
949  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
950 }
952 //*************************************************************************************************
953 
954 
955 //*************************************************************************************************
981 template< typename MT // Type of the adapted dense matrix
982  , bool SO > // Storage order of the adapted dense matrix
983 template< typename Other > // Data type of the initialization array
984 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( size_t n, const Other* array )
985  : matrix_( n, n, array ) // The adapted dense matrix
986 {
987  if( !isDiagonal( matrix_ ) ) {
988  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
989  }
990 
991  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
992 }
994 //*************************************************************************************************
995 
996 
997 //*************************************************************************************************
1020 template< typename MT // Type of the adapted dense matrix
1021  , bool SO > // Storage order of the adapted dense matrix
1022 template< typename Other // Data type of the initialization array
1023  , size_t N > // Number of rows and columns of the initialization array
1024 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const Other (&array)[N][N] )
1025  : matrix_( array ) // The adapted dense matrix
1026 {
1027  if( !isDiagonal( matrix_ ) ) {
1028  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1029  }
1030 
1031  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1032 }
1034 //*************************************************************************************************
1035 
1036 
1037 //*************************************************************************************************
1069 template< typename MT // Type of the adapted dense matrix
1070  , bool SO > // Storage order of the adapted dense matrix
1071 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n )
1072  : matrix_( ptr, n, n ) // The adapted dense matrix
1073 {
1074  if( !isDiagonal( matrix_ ) ) {
1075  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1076  }
1077 
1078  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1079 }
1081 //*************************************************************************************************
1082 
1083 
1084 //*************************************************************************************************
1118 template< typename MT // Type of the adapted dense matrix
1119  , bool SO > // Storage order of the adapted dense matrix
1120 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr, size_t n, size_t nn )
1121  : matrix_( ptr, n, n, nn ) // The adapted dense matrix
1122 {
1123  if( !isDiagonal( matrix_ ) ) {
1124  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
1125  }
1126 
1127  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1128 }
1130 //*************************************************************************************************
1131 
1132 
1133 //*************************************************************************************************
1139 template< typename MT // Type of the adapted dense matrix
1140  , bool SO > // Storage order of the adapted dense matrix
1141 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( const DiagonalMatrix& m )
1142  : matrix_( m.matrix_ ) // The adapted dense matrix
1143 {
1144  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1145  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1146 }
1148 //*************************************************************************************************
1149 
1150 
1151 //*************************************************************************************************
1157 template< typename MT // Type of the adapted dense matrix
1158  , bool SO > // Storage order of the adapted dense matrix
1159 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( DiagonalMatrix&& m ) noexcept
1160  : matrix_( std::move( m.matrix_ ) ) // The adapted dense matrix
1161 {
1162  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1163  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1164 }
1166 //*************************************************************************************************
1167 
1168 
1169 
1170 
1171 //=================================================================================================
1172 //
1173 // DATA ACCESS FUNCTIONS
1174 //
1175 //=================================================================================================
1176 
1177 //*************************************************************************************************
1193 template< typename MT // Type of the adapted dense matrix
1194  , bool SO > // Storage order of the adapted dense matrix
1196  DiagonalMatrix<MT,SO,true>::operator()( size_t i, size_t j )
1197 {
1198  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1199  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1200 
1201  return Reference( matrix_, i, j );
1202 }
1204 //*************************************************************************************************
1205 
1206 
1207 //*************************************************************************************************
1223 template< typename MT // Type of the adapted dense matrix
1224  , bool SO > // Storage order of the adapted dense matrix
1226  DiagonalMatrix<MT,SO,true>::operator()( size_t i, size_t j ) const
1227 {
1228  BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
1229  BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
1230 
1231  return matrix_(i,j);
1232 }
1234 //*************************************************************************************************
1235 
1236 
1237 //*************************************************************************************************
1254 template< typename MT // Type of the adapted dense matrix
1255  , bool SO > // Storage order of the adapted dense matrix
1257  DiagonalMatrix<MT,SO,true>::at( size_t i, size_t j )
1258 {
1259  if( i >= rows() ) {
1260  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1261  }
1262  if( j >= columns() ) {
1263  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1264  }
1265  return (*this)(i,j);
1266 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1288 template< typename MT // Type of the adapted dense matrix
1289  , bool SO > // Storage order of the adapted dense matrix
1291  DiagonalMatrix<MT,SO,true>::at( size_t i, size_t j ) const
1292 {
1293  if( i >= rows() ) {
1294  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1295  }
1296  if( j >= columns() ) {
1297  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1298  }
1299  return (*this)(i,j);
1300 }
1302 //*************************************************************************************************
1303 
1304 
1305 //*************************************************************************************************
1318 template< typename MT // Type of the adapted dense matrix
1319  , bool SO > // Storage order of the adapted dense matrix
1320 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1321  DiagonalMatrix<MT,SO,true>::data() const noexcept
1322 {
1323  return matrix_.data();
1324 }
1326 //*************************************************************************************************
1327 
1328 
1329 //*************************************************************************************************
1338 template< typename MT // Type of the adapted dense matrix
1339  , bool SO > // Storage order of the adapted dense matrix
1340 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1341  DiagonalMatrix<MT,SO,true>::data( size_t i ) const noexcept
1342 {
1343  return matrix_.data(i);
1344 }
1346 //*************************************************************************************************
1347 
1348 
1349 //*************************************************************************************************
1361 template< typename MT // Type of the adapted dense matrix
1362  , bool SO > // Storage order of the adapted dense matrix
1365 {
1366  if( SO )
1367  return Iterator( matrix_, 0UL, i );
1368  else
1369  return Iterator( matrix_, i, 0UL );
1370 }
1372 //*************************************************************************************************
1373 
1374 
1375 //*************************************************************************************************
1387 template< typename MT // Type of the adapted dense matrix
1388  , bool SO > // Storage order of the adapted dense matrix
1390  DiagonalMatrix<MT,SO,true>::begin( size_t i ) const
1391 {
1392  return matrix_.begin(i);
1393 }
1395 //*************************************************************************************************
1396 
1397 
1398 //*************************************************************************************************
1410 template< typename MT // Type of the adapted dense matrix
1411  , bool SO > // Storage order of the adapted dense matrix
1413  DiagonalMatrix<MT,SO,true>::cbegin( size_t i ) const
1414 {
1415  return matrix_.cbegin(i);
1416 }
1418 //*************************************************************************************************
1419 
1420 
1421 //*************************************************************************************************
1433 template< typename MT // Type of the adapted dense matrix
1434  , bool SO > // Storage order of the adapted dense matrix
1437 {
1438  if( SO )
1439  return Iterator( matrix_, rows(), i );
1440  else
1441  return Iterator( matrix_, i, columns() );
1442 }
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1459 template< typename MT // Type of the adapted dense matrix
1460  , bool SO > // Storage order of the adapted dense matrix
1462  DiagonalMatrix<MT,SO,true>::end( size_t i ) const
1463 {
1464  return matrix_.end(i);
1465 }
1467 //*************************************************************************************************
1468 
1469 
1470 //*************************************************************************************************
1482 template< typename MT // Type of the adapted dense matrix
1483  , bool SO > // Storage order of the adapted dense matrix
1485  DiagonalMatrix<MT,SO,true>::cend( size_t i ) const
1486 {
1487  return matrix_.cend(i);
1488 }
1490 //*************************************************************************************************
1491 
1492 
1493 
1494 
1495 //=================================================================================================
1496 //
1497 // ASSIGNMENT OPERATORS
1498 //
1499 //=================================================================================================
1500 
1501 //*************************************************************************************************
1508 template< typename MT // Type of the adapted dense matrix
1509  , bool SO > // Storage order of the adapted dense matrix
1510 inline DiagonalMatrix<MT,SO,true>&
1511  DiagonalMatrix<MT,SO,true>::operator=( const ElementType& rhs )
1512 {
1513  for( size_t i=0UL; i<rows(); ++i )
1514  matrix_(i,i) = rhs;
1515 
1516  return *this;
1517 }
1519 //*************************************************************************************************
1520 
1521 
1522 //*************************************************************************************************
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=( initializer_list< initializer_list<ElementType> > list )
1551 {
1552  const InitializerMatrix<ElementType> tmp( list, list.size() );
1553 
1554  if( !isDiagonal( tmp ) ) {
1555  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1556  }
1557 
1558  matrix_ = list;
1559 
1560  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1561  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1562 
1563  return *this;
1564 }
1566 //*************************************************************************************************
1567 
1568 
1569 //*************************************************************************************************
1593 template< typename MT // Type of the adapted dense matrix
1594  , bool SO > // Storage order of the adapted dense matrix
1595 template< typename Other // Data type of the initialization array
1596  , size_t N > // Number of rows and columns of the initialization array
1597 inline DiagonalMatrix<MT,SO,true>&
1598  DiagonalMatrix<MT,SO,true>::operator=( const Other (&array)[N][N] )
1599 {
1600  MT tmp( array );
1601 
1602  if( !isDiagonal( tmp ) ) {
1603  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1604  }
1605 
1606  matrix_ = std::move( tmp );
1607 
1608  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1609  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1610 
1611  return *this;
1612 }
1614 //*************************************************************************************************
1615 
1616 
1617 //*************************************************************************************************
1627 template< typename MT // Type of the adapted dense matrix
1628  , bool SO > // Storage order of the adapted dense matrix
1629 inline DiagonalMatrix<MT,SO,true>&
1630  DiagonalMatrix<MT,SO,true>::operator=( const DiagonalMatrix& rhs )
1631 {
1632  matrix_ = rhs.matrix_;
1633 
1634  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1635  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1636 
1637  return *this;
1638 }
1640 //*************************************************************************************************
1641 
1642 
1643 //*************************************************************************************************
1650 template< typename MT // Type of the adapted dense matrix
1651  , bool SO > // Storage order of the adapted dense matrix
1652 inline DiagonalMatrix<MT,SO,true>&
1653  DiagonalMatrix<MT,SO,true>::operator=( DiagonalMatrix&& rhs ) noexcept
1654 {
1655  matrix_ = std::move( rhs.matrix_ );
1656 
1657  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1658  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1659 
1660  return *this;
1661 }
1663 //*************************************************************************************************
1664 
1665 
1666 //*************************************************************************************************
1679 template< typename MT // Type of the adapted dense matrix
1680  , bool SO > // Storage order of the adapted dense matrix
1681 template< typename MT2 // Type of the right-hand side matrix
1682  , bool SO2 > // Storage order of the right-hand side matrix
1683 inline auto DiagonalMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1684  -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1685 {
1686  if( !IsDiagonal_v<MT2> && !isDiagonal( ~rhs ) ) {
1687  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1688  }
1689 
1690  matrix_ = decldiag( ~rhs );
1691 
1692  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1693  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1694 
1695  return *this;
1696 }
1698 //*************************************************************************************************
1699 
1700 
1701 //*************************************************************************************************
1714 template< typename MT // Type of the adapted dense matrix
1715  , bool SO > // Storage order of the adapted dense matrix
1716 template< typename MT2 // Type of the right-hand side matrix
1717  , bool SO2 > // Storage order of the right-hand side matrix
1718 inline auto DiagonalMatrix<MT,SO,true>::operator=( const Matrix<MT2,SO2>& rhs )
1719  -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1720 {
1721  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1722  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1723  }
1724 
1725  if( IsDiagonal_v<MT2> ) {
1726  matrix_ = ~rhs;
1727  }
1728  else {
1729  MT tmp( ~rhs );
1730 
1731  if( !isDiagonal( tmp ) ) {
1732  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1733  }
1734 
1735  matrix_ = std::move( tmp );
1736  }
1737 
1738  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1739  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1740 
1741  return *this;
1742 }
1744 //*************************************************************************************************
1745 
1746 
1747 //*************************************************************************************************
1760 template< typename MT // Type of the adapted dense matrix
1761  , bool SO > // Storage order of the adapted dense matrix
1762 template< typename MT2 // Type of the right-hand side matrix
1763  , bool SO2 > // Storage order of the right-hand side matrix
1764 inline auto DiagonalMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1765  -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1766 {
1767  if( !IsDiagonal_v<MT2> && !isDiagonal( ~rhs ) ) {
1768  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1769  }
1770 
1771  matrix_ += decldiag( ~rhs );
1772 
1773  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1774  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1775 
1776  return *this;
1777 }
1779 //*************************************************************************************************
1780 
1781 
1782 //*************************************************************************************************
1795 template< typename MT // Type of the adapted dense matrix
1796  , bool SO > // Storage order of the adapted dense matrix
1797 template< typename MT2 // Type of the right-hand side matrix
1798  , bool SO2 > // Storage order of the right-hand side matrix
1799 inline auto DiagonalMatrix<MT,SO,true>::operator+=( const Matrix<MT2,SO2>& rhs )
1800  -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1801 {
1802  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1803  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1804  }
1805 
1806  if( IsDiagonal_v<MT2> ) {
1807  matrix_ += ~rhs;
1808  }
1809  else {
1810  const ResultType_t<MT2> tmp( ~rhs );
1811 
1812  if( !isDiagonal( tmp ) ) {
1813  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1814  }
1815 
1816  matrix_ += decldiag( tmp );
1817  }
1818 
1819  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1820  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1821 
1822  return *this;
1823 }
1825 //*************************************************************************************************
1826 
1827 
1828 //*************************************************************************************************
1841 template< typename MT // Type of the adapted dense matrix
1842  , bool SO > // Storage order of the adapted dense matrix
1843 template< typename MT2 // Type of the right-hand side matrix
1844  , bool SO2 > // Storage order of the right-hand side matrix
1845 inline auto DiagonalMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1846  -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1847 {
1848  if( !IsDiagonal_v<MT2> && !isDiagonal( ~rhs ) ) {
1849  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1850  }
1851 
1852  matrix_ -= decldiag( ~rhs );
1853 
1854  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1855  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1856 
1857  return *this;
1858 }
1860 //*************************************************************************************************
1861 
1862 
1863 //*************************************************************************************************
1876 template< typename MT // Type of the adapted dense matrix
1877  , bool SO > // Storage order of the adapted dense matrix
1878 template< typename MT2 // Type of the right-hand side matrix
1879  , bool SO2 > // Storage order of the right-hand side matrix
1880 inline auto DiagonalMatrix<MT,SO,true>::operator-=( const Matrix<MT2,SO2>& rhs )
1881  -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1882 {
1883  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1884  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1885  }
1886 
1887  if( IsDiagonal_v<MT2> ) {
1888  matrix_ -= ~rhs;
1889  }
1890  else {
1891  const ResultType_t<MT2> tmp( ~rhs );
1892 
1893  if( !isDiagonal( tmp ) ) {
1894  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1895  }
1896 
1897  matrix_ -= decldiag( tmp );
1898  }
1899 
1900  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1901  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1902 
1903  return *this;
1904 }
1906 //*************************************************************************************************
1907 
1908 
1909 //*************************************************************************************************
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 auto DiagonalMatrix<MT,SO,true>::operator%=( const Matrix<MT2,SO2>& rhs )
1925  -> DiagonalMatrix&
1926 {
1927  if( !IsSquare_v<MT2> && !isSquare( ~rhs ) ) {
1928  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to diagonal matrix" );
1929  }
1930 
1931  matrix_ %= ~rhs;
1932 
1933  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
1934  BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1935 
1936  return *this;
1937 }
1939 //*************************************************************************************************
1940 
1941 
1942 //*************************************************************************************************
1950 template< typename MT // Type of the adapted dense matrix
1951  , bool SO > // Storage order of the adapted dense matrix
1952 template< typename ST > // Data type of the right-hand side scalar
1953 inline auto DiagonalMatrix<MT,SO,true>::operator*=( ST scalar )
1954  -> EnableIf_t< IsNumeric_v<ST>, DiagonalMatrix& >
1955 {
1956  diagonal( matrix_ ) *= scalar;
1957 
1958  return *this;
1959 }
1961 //*************************************************************************************************
1962 
1963 
1964 //*************************************************************************************************
1972 template< typename MT // Type of the adapted dense matrix
1973  , bool SO > // Storage order of the adapted dense matrix
1974 template< typename ST > // Data type of the right-hand side scalar
1975 inline auto DiagonalMatrix<MT,SO,true>::operator/=( ST scalar )
1976  -> EnableIf_t< IsNumeric_v<ST>, DiagonalMatrix& >
1977 {
1978  diagonal( matrix_ ) /= scalar;
1979 
1980  return *this;
1981 }
1983 //*************************************************************************************************
1984 
1985 
1986 
1987 
1988 //=================================================================================================
1989 //
1990 // UTILITY FUNCTIONS
1991 //
1992 //=================================================================================================
1993 
1994 //*************************************************************************************************
2000 template< typename MT // Type of the adapted dense matrix
2001  , bool SO > // Storage order of the adapted dense matrix
2002 inline size_t DiagonalMatrix<MT,SO,true>::rows() const noexcept
2003 {
2004  return matrix_.rows();
2005 }
2007 //*************************************************************************************************
2008 
2009 
2010 //*************************************************************************************************
2016 template< typename MT // Type of the adapted dense matrix
2017  , bool SO > // Storage order of the adapted dense matrix
2018 inline size_t DiagonalMatrix<MT,SO,true>::columns() const noexcept
2019 {
2020  return matrix_.columns();
2021 }
2023 //*************************************************************************************************
2024 
2025 
2026 //*************************************************************************************************
2037 template< typename MT // Type of the adapted dense matrix
2038  , bool SO > // Storage order of the adapted dense matrix
2039 inline size_t DiagonalMatrix<MT,SO,true>::spacing() const noexcept
2040 {
2041  return matrix_.spacing();
2042 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2053 template< typename MT // Type of the adapted dense matrix
2054  , bool SO > // Storage order of the adapted dense matrix
2055 inline size_t DiagonalMatrix<MT,SO,true>::capacity() const noexcept
2056 {
2057  return matrix_.capacity();
2058 }
2060 //*************************************************************************************************
2061 
2062 
2063 //*************************************************************************************************
2075 template< typename MT // Type of the adapted dense matrix
2076  , bool SO > // Storage order of the adapted dense matrix
2077 inline size_t DiagonalMatrix<MT,SO,true>::capacity( size_t i ) const noexcept
2078 {
2079  return matrix_.capacity(i);
2080 }
2082 //*************************************************************************************************
2083 
2084 
2085 //*************************************************************************************************
2091 template< typename MT // Type of the adapted dense matrix
2092  , bool SO > // Storage order of the adapted dense matrix
2093 inline size_t DiagonalMatrix<MT,SO,true>::nonZeros() const
2094 {
2095  return matrix_.nonZeros();
2096 }
2098 //*************************************************************************************************
2099 
2100 
2101 //*************************************************************************************************
2113 template< typename MT // Type of the adapted dense matrix
2114  , bool SO > // Storage order of the adapted dense matrix
2115 inline size_t DiagonalMatrix<MT,SO,true>::nonZeros( size_t i ) const
2116 {
2117  return matrix_.nonZeros(i);
2118 }
2120 //*************************************************************************************************
2121 
2122 
2123 //*************************************************************************************************
2129 template< typename MT // Type of the adapted dense matrix
2130  , bool SO > // Storage order of the adapted dense matrix
2132 {
2133  matrix_.reset();
2134 }
2136 //*************************************************************************************************
2137 
2138 
2139 //*************************************************************************************************
2152 template< typename MT // Type of the adapted dense matrix
2153  , bool SO > // Storage order of the adapted dense matrix
2154 inline void DiagonalMatrix<MT,SO,true>::reset( size_t i )
2155 {
2156  matrix_.reset( i );
2157 }
2159 //*************************************************************************************************
2160 
2161 
2162 //*************************************************************************************************
2174 template< typename MT // Type of the adapted dense matrix
2175  , bool SO > // Storage order of the adapted dense matrix
2177 {
2178  using blaze::clear;
2179 
2180  clear( matrix_ );
2181 }
2183 //*************************************************************************************************
2184 
2185 
2186 //*************************************************************************************************
2222 template< typename MT // Type of the adapted dense matrix
2223  , bool SO > // Storage order of the adapted dense matrix
2224 void DiagonalMatrix<MT,SO,true>::resize( size_t n, bool preserve )
2225 {
2227 
2228  UNUSED_PARAMETER( preserve );
2229 
2230  BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square diagonal matrix detected" );
2231 
2232  const size_t oldsize( matrix_.rows() );
2233 
2234  matrix_.resize( n, n, true );
2235 
2236  if( n > oldsize ) {
2237  const size_t increment( n - oldsize );
2238  submatrix( matrix_, 0UL, oldsize, n, increment ).reset();
2239  submatrix( matrix_, oldsize, 0UL, increment, increment ).reset();
2240  }
2241 }
2243 //*************************************************************************************************
2244 
2245 
2246 //*************************************************************************************************
2259 template< typename MT // Type of the adapted dense matrix
2260  , bool SO > // Storage order of the adapted dense matrix
2261 inline void DiagonalMatrix<MT,SO,true>::extend( size_t n, bool preserve )
2262 {
2264 
2265  UNUSED_PARAMETER( preserve );
2266 
2267  resize( rows() + n, true );
2268 }
2270 //*************************************************************************************************
2271 
2272 
2273 //*************************************************************************************************
2283 template< typename MT // Type of the adapted dense matrix
2284  , bool SO > // Storage order of the adapted dense matrix
2285 inline void DiagonalMatrix<MT,SO,true>::reserve( size_t elements )
2286 {
2287  matrix_.reserve( elements );
2288 }
2290 //*************************************************************************************************
2291 
2292 
2293 //*************************************************************************************************
2303 template< typename MT // Type of the adapted dense matrix
2304  , bool SO > // Storage order of the adapted dense matrix
2306 {
2307  matrix_.shrinkToFit();
2308 }
2310 //*************************************************************************************************
2311 
2312 
2313 //*************************************************************************************************
2320 template< typename MT // Type of the adapted dense matrix
2321  , bool SO > // Storage order of the adapted dense matrix
2322 inline void DiagonalMatrix<MT,SO,true>::swap( DiagonalMatrix& m ) noexcept
2323 {
2324  using std::swap;
2325 
2326  swap( matrix_, m.matrix_ );
2327 }
2329 //*************************************************************************************************
2330 
2331 
2332 
2333 
2334 //=================================================================================================
2335 //
2336 // NUMERIC FUNCTIONS
2337 //
2338 //=================================================================================================
2339 
2340 //*************************************************************************************************
2358 template< typename MT // Type of the adapted dense matrix
2359  , bool SO > // Storage order of the adapted dense matrix
2360 template< typename Other > // Data type of the scalar value
2361 inline DiagonalMatrix<MT,SO,true>& DiagonalMatrix<MT,SO,true>::scale( const Other& scalar )
2362 {
2363  matrix_.scale( scalar );
2364  return *this;
2365 }
2367 //*************************************************************************************************
2368 
2369 
2370 
2371 
2372 //=================================================================================================
2373 //
2374 // DEBUGGING FUNCTIONS
2375 //
2376 //=================================================================================================
2377 
2378 //*************************************************************************************************
2388 template< typename MT // Type of the adapted dense matrix
2389  , bool SO > // Storage order of the adapted dense matrix
2390 inline bool DiagonalMatrix<MT,SO,true>::isIntact() const noexcept
2391 {
2392  using blaze::isIntact;
2393 
2394  return ( isIntact( matrix_ ) && isDiagonal( matrix_ ) );
2395 }
2397 //*************************************************************************************************
2398 
2399 
2400 
2401 
2402 //=================================================================================================
2403 //
2404 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2405 //
2406 //=================================================================================================
2407 
2408 //*************************************************************************************************
2419 template< typename MT // Type of the adapted dense matrix
2420  , bool SO > // Storage order of the adapted dense matrix
2421 template< typename Other > // Data type of the foreign expression
2422 inline bool DiagonalMatrix<MT,SO,true>::canAlias( const Other* alias ) const noexcept
2423 {
2424  return matrix_.canAlias( alias );
2425 }
2427 //*************************************************************************************************
2428 
2429 
2430 //*************************************************************************************************
2441 template< typename MT // Type of the adapted dense matrix
2442  , bool SO > // Storage order of the adapted dense matrix
2443 template< typename Other > // Data type of the foreign expression
2444 inline bool DiagonalMatrix<MT,SO,true>::isAliased( const Other* alias ) const noexcept
2445 {
2446  return matrix_.isAliased( alias );
2447 }
2449 //*************************************************************************************************
2450 
2451 
2452 //*************************************************************************************************
2462 template< typename MT // Type of the adapted dense matrix
2463  , bool SO > // Storage order of the adapted dense matrix
2464 inline bool DiagonalMatrix<MT,SO,true>::isAligned() const noexcept
2465 {
2466  return matrix_.isAligned();
2467 }
2469 //*************************************************************************************************
2470 
2471 
2472 //*************************************************************************************************
2483 template< typename MT // Type of the adapted dense matrix
2484  , bool SO > // Storage order of the adapted dense matrix
2485 inline bool DiagonalMatrix<MT,SO,true>::canSMPAssign() const noexcept
2486 {
2487  return matrix_.canSMPAssign();
2488 }
2490 //*************************************************************************************************
2491 
2492 
2493 //*************************************************************************************************
2509 template< typename MT // Type of the adapted dense matrix
2510  , bool SO > // Storage order of the adapted dense matrix
2511 BLAZE_ALWAYS_INLINE typename DiagonalMatrix<MT,SO,true>::SIMDType
2512  DiagonalMatrix<MT,SO,true>::load( size_t i, size_t j ) const noexcept
2513 {
2514  return matrix_.load( i, j );
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>::loada( size_t i, size_t j ) const noexcept
2540 {
2541  return matrix_.loada( 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>::loadu( size_t i, size_t j ) const noexcept
2567 {
2568  return matrix_.loadu( i, j );
2569 }
2571 //*************************************************************************************************
2572 
2573 
2574 
2575 
2576 //=================================================================================================
2577 //
2578 // CONSTRUCTION FUNCTIONS
2579 //
2580 //=================================================================================================
2581 
2582 //*************************************************************************************************
2589 template< typename MT // Type of the adapted dense matrix
2590  , bool SO > // Storage order of the adapted dense matrix
2591 inline const MT DiagonalMatrix<MT,SO,true>::construct( size_t n, TrueType )
2592 {
2594 
2595  return MT( n, n, ElementType() );
2596 }
2598 //*************************************************************************************************
2599 
2600 
2601 //*************************************************************************************************
2608 template< typename MT // Type of the adapted dense matrix
2609  , bool SO > // Storage order of the adapted dense matrix
2610 inline const MT DiagonalMatrix<MT,SO,true>::construct( const ElementType& init, FalseType )
2611 {
2614 
2615  MT tmp;
2616 
2617  for( size_t i=0UL; i<tmp.rows(); ++i )
2618  tmp(i,i) = init;
2619 
2620  return tmp;
2621 }
2623 //*************************************************************************************************
2624 
2625 
2626 //*************************************************************************************************
2637 template< typename MT // Type of the adapted dense matrix
2638  , bool SO > // Storage order of the adapted dense matrix
2639 template< typename MT2 // Type of the foreign matrix
2640  , bool SO2 // Storage order of the foreign matrix
2641  , typename T > // Type of the third argument
2642 inline const MT DiagonalMatrix<MT,SO,true>::construct( const Matrix<MT2,SO2>& m, T )
2643 {
2644  const MT tmp( ~m );
2645 
2646  if( !IsDiagonal_v<MT2> && !isDiagonal( tmp ) ) {
2647  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of diagonal matrix" );
2648  }
2649 
2650  return tmp;
2651 }
2653 //*************************************************************************************************
2654 
2655 } // namespace blaze
2656 
2657 #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
Header file for the UnderlyingNumeric type trait.
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3078
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:975
#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
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( )...
Definition: DenseMatrix.h:354
Header file for the UNUSED_PARAMETER function template.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr 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:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
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 isZero shim.
Header file for the IsDiagonal type trait.
Header file for the implementation of the Band view.
#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:332
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3075
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5828
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3079
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3084
#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:1539
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
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:3085
Header file for the extended initializer_list functionality.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Constraint on the data type.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
Constraint on the data type.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:252
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a square matrix type, a compilation error is created.
Definition: Square.h:60
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
Header file for the DisableIf class template.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3083
Header file for the DiagonalProxy class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
Header file for the If class template.
Compile time assertion.
Header file for the IsFloatingPoint type trait.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5890
Header file for the UnderlyingBuiltin type trait.
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
#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:3080
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
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:446
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:253
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Constraint on the data type.
Constraints on the storage order of matrix types.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:135
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
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
decltype(auto) diagonal(Matrix< MT, SO > &matrix, RDAs... args)
Creating a view on the diagonal of the given matrix.
Definition: Band.h:375
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:8908
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:360
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
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.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#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:281
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:408
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr 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:718
Header file for the IsInvertible type trait.
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
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.
Header file for the IsBuiltin type trait.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3082
#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
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
Header file for the IsComplex type trait.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
#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
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
#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
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
Header file for the TrueType type/value trait base class.
Header file for the clear shim.