DMatDeclDiagExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATDECLDIAGEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATDECLDIAGEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <iterator>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
66 #include <blaze/util/Assert.h>
67 #include <blaze/util/DisableIf.h>
68 #include <blaze/util/EnableIf.h>
70 #include <blaze/util/InvalidType.h>
71 #include <blaze/util/mpl/If.h>
72 #include <blaze/util/TrueType.h>
73 #include <blaze/util/Types.h>
75 
76 
77 namespace blaze {
78 
79 //=================================================================================================
80 //
81 // CLASS DMATDECLDIAGEXPR
82 //
83 //=================================================================================================
84 
85 //*************************************************************************************************
92 template< typename MT // Type of the dense matrix
93  , bool SO > // Storage order
95  : public DeclDiagExpr< DenseMatrix< DMatDeclDiagExpr<MT,SO>, SO > >
96  , public Declaration<MT>
97 {
98  private:
99  //**Type definitions****************************************************************************
101 
103  BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT( GetConstIterator, ConstIterator, INVALID_TYPE );
104  //**********************************************************************************************
105 
106  //**Serial evaluation strategy******************************************************************
108 
114  static constexpr bool useAssign = RequiresEvaluation_v<MT>;
115 
117  template< typename MT2 >
119  static constexpr bool UseAssign_v = useAssign;
121  //**********************************************************************************************
122 
123  //**Parallel evaluation strategy****************************************************************
125 
131  template< typename MT2 >
132  static constexpr bool UseSMPAssign_v = ( MT2::smpAssignable && useAssign );
134  //**********************************************************************************************
135 
136  public:
137  //**Type definitions****************************************************************************
145 
148 
150  using ConstIterator = GetConstIterator_t<MT>;
151 
153  using Operand = If_t< IsExpression_v<MT>, const MT, const MT& >;
154  //**********************************************************************************************
155 
156  //**Compilation flags***************************************************************************
158  static constexpr bool simdEnabled = MT::simdEnabled;
159 
161  static constexpr bool smpAssignable = MT::smpAssignable;
162  //**********************************************************************************************
163 
164  //**SIMD properties*****************************************************************************
166  static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
167  //**********************************************************************************************
168 
169  //**Constructor*********************************************************************************
174  explicit inline DMatDeclDiagExpr( const MT& dm ) noexcept
175  : dm_( dm ) // Dense matrix of the decldiag expression
176  {
177  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
178  }
179  //**********************************************************************************************
180 
181  //**Access operator*****************************************************************************
188  inline ReturnType operator()( size_t i, size_t j ) const {
189  BLAZE_INTERNAL_ASSERT( i < dm_.rows() , "Invalid row access index" );
190  BLAZE_INTERNAL_ASSERT( j < dm_.columns(), "Invalid column access index" );
191  return dm_(i,j);
192  }
193  //**********************************************************************************************
194 
195  //**At function*********************************************************************************
203  inline ReturnType at( size_t i, size_t j ) const {
204  if( i >= dm_.rows() ) {
205  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
206  }
207  if( j >= dm_.columns() ) {
208  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
209  }
210  return (*this)(i,j);
211  }
212  //**********************************************************************************************
213 
214  //**Load function*******************************************************************************
221  BLAZE_ALWAYS_INLINE auto load( size_t i, size_t j ) const noexcept {
222  BLAZE_INTERNAL_ASSERT( i < dm_.columns(), "Invalid row access index" );
223  BLAZE_INTERNAL_ASSERT( j < dm_.rows() , "Invalid column access index" );
224  BLAZE_INTERNAL_ASSERT( !SO || ( i % SIMDSIZE == 0UL ), "Invalid row access index" );
225  BLAZE_INTERNAL_ASSERT( SO || ( j % SIMDSIZE == 0UL ), "Invalid column access index" );
226  return dm_.load(i,j);
227  }
228  //**********************************************************************************************
229 
230  //**Low-level data access***********************************************************************
235  inline const ElementType* data() const noexcept {
236  return dm_.data();
237  }
238  //**********************************************************************************************
239 
240  //**Begin function******************************************************************************
246  inline ConstIterator begin( size_t i ) const {
247  return ConstIterator( dm_.begin(i) );
248  }
249  //**********************************************************************************************
250 
251  //**End function********************************************************************************
257  inline ConstIterator end( size_t i ) const {
258  return ConstIterator( dm_.end(i) );
259  }
260  //**********************************************************************************************
261 
262  //**Rows function*******************************************************************************
267  inline size_t rows() const noexcept {
268  return dm_.rows();
269  }
270  //**********************************************************************************************
271 
272  //**Columns function****************************************************************************
277  inline size_t columns() const noexcept {
278  return dm_.columns();
279  }
280  //**********************************************************************************************
281 
282  //**Operand access******************************************************************************
287  inline Operand operand() const noexcept {
288  return dm_;
289  }
290  //**********************************************************************************************
291 
292  //**********************************************************************************************
298  template< typename T >
299  inline bool canAlias( const T* alias ) const noexcept {
300  return dm_.canAlias( alias );
301  }
302  //**********************************************************************************************
303 
304  //**********************************************************************************************
310  template< typename T >
311  inline bool isAliased( const T* alias ) const noexcept {
312  return dm_.isAliased( alias );
313  }
314  //**********************************************************************************************
315 
316  //**********************************************************************************************
321  inline bool isAligned() const noexcept {
322  return dm_.isAligned();
323  }
324  //**********************************************************************************************
325 
326  //**********************************************************************************************
331  inline bool canSMPAssign() const noexcept {
332  return dm_.canSMPAssign();
333  }
334  //**********************************************************************************************
335 
336  private:
337  //**Member variables****************************************************************************
339  //**********************************************************************************************
340 
341  //**Assignment to dense matrices****************************************************************
353  template< typename MT2 // Type of the target dense matrix
354  , bool SO2 > // Storage order of the target dense matrix
355  friend inline auto assign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
357  {
359 
360  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
361  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
362 
363  assign( ~lhs, rhs.dm_ );
364  }
366  //**********************************************************************************************
367 
368  //**Assignment to sparse matrices***************************************************************
380  template< typename MT2 // Type of the target sparse matrix
381  , bool SO2 > // Storage order of the target dense matrix
382  friend inline auto assign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
384  {
386 
387  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
388  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
389 
390  assign( ~lhs, rhs.dm_ );
391  }
393  //**********************************************************************************************
394 
395  //**Addition assignment to dense matrices*******************************************************
407  template< typename MT2 // Type of the target dense matrix
408  , bool SO2 > // Storage order of the target dense matrix
409  friend inline auto addAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
410  -> EnableIf_t< UseAssign_v<MT2> >
411  {
413 
414  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
415  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
416 
417  addAssign( ~lhs, rhs.dm_ );
418  }
420  //**********************************************************************************************
421 
422  //**Addition assignment to sparse matrices******************************************************
434  template< typename MT2 // Type of the target sparse matrix
435  , bool SO2 > // Storage order of the target dense matrix
436  friend inline auto addAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
437  -> EnableIf_t< UseAssign_v<MT2> >
438  {
440 
441  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
442  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
443 
444  addAssign( ~lhs, rhs.dm_ );
445  }
447  //**********************************************************************************************
448 
449  //**Subtraction assignment to dense matrices****************************************************
461  template< typename MT2 // Type of the target dense matrix
462  , bool SO2 > // Storage order of the target dense matrix
463  friend inline auto subAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
464  -> EnableIf_t< UseAssign_v<MT2> >
465  {
467 
468  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
469  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
470 
471  subAssign( ~lhs, rhs.dm_ );
472  }
474  //**********************************************************************************************
475 
476  //**Subtraction assignment to sparse matrices***************************************************
488  template< typename MT2 // Type of the target sparse matrix
489  , bool SO2 > // Storage order of the target dense matrix
490  friend inline auto subAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
491  -> EnableIf_t< UseAssign_v<MT2> >
492  {
494 
495  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
496  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
497 
498  subAssign( ~lhs, rhs.dm_ );
499  }
501  //**********************************************************************************************
502 
503  //**Schur product assignment to dense matrices**************************************************
515  template< typename MT2 // Type of the target dense matrix
516  , bool SO2 > // Storage order of the target dense matrix
517  friend inline auto schurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
518  -> EnableIf_t< UseAssign_v<MT2> >
519  {
521 
522  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
523  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
524 
525  schurAssign( ~lhs, rhs.dm_ );
526  }
528  //**********************************************************************************************
529 
530  //**Schur product assignment to sparse matrices*************************************************
542  template< typename MT2 // Type of the target sparse matrix
543  , bool SO2 > // Storage order of the target dense matrix
544  friend inline auto schurAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
545  -> EnableIf_t< UseAssign_v<MT2> >
546  {
548 
549  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
550  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
551 
552  schurAssign( ~lhs, rhs.dm_ );
553  }
555  //**********************************************************************************************
556 
557  //**Multiplication assignment to dense matrices*************************************************
569  template< typename MT2 // Type of the target dense matrix
570  , bool SO2 > // Storage order of the target dense matrix
571  friend inline auto multAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
572  -> EnableIf_t< UseAssign_v<MT2> >
573  {
575 
576  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
577  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
578 
579  multAssign( ~lhs, rhs.dm_ );
580  }
582  //**********************************************************************************************
583 
584  //**Multiplication assignment to sparse matrices************************************************
596  template< typename MT2 // Type of the target sparse matrix
597  , bool SO2 > // Storage order of the target dense matrix
598  friend inline auto multAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
599  -> EnableIf_t< UseAssign_v<MT2> >
600  {
602 
603  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
604  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
605 
606  multAssign( ~lhs, rhs.dm_ );
607  }
609  //**********************************************************************************************
610 
611  //**SMP assignment to dense matrices************************************************************
623  template< typename MT2 // Type of the target dense matrix
624  , bool SO2 > // Storage order of the target dense matrix
625  friend inline auto smpAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
626  -> EnableIf_t< UseSMPAssign_v<MT2> >
627  {
629 
630  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
631  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
632 
633  smpAssign( ~lhs, rhs.dm_ );
634  }
636  //**********************************************************************************************
637 
638  //**SMP assignment to sparse matrices***********************************************************
650  template< typename MT2 // Type of the target sparse matrix
651  , bool SO2 > // Storage order of the target dense matrix
652  friend inline auto smpAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
653  -> EnableIf_t< UseSMPAssign_v<MT2> >
654  {
656 
657  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
658  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
659 
660  smpAssign( ~lhs, rhs.dm_ );
661  }
663  //**********************************************************************************************
664 
665  //**SMP addition assignment to dense matrices***************************************************
677  template< typename MT2 // Type of the target dense matrix
678  , bool SO2 > // Storage order of the target dense matrix
679  friend inline auto smpAddAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
680  -> EnableIf_t< UseSMPAssign_v<MT2> >
681  {
683 
684  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
685  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
686 
687  smpAddAssign( ~lhs, rhs.dm_ );
688  }
690  //**********************************************************************************************
691 
692  //**SMP addition assignment to sparse matrices**************************************************
704  template< typename MT2 // Type of the target sparse matrix
705  , bool SO2 > // Storage order of the target dense matrix
706  friend inline auto smpAddAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
707  -> EnableIf_t< UseSMPAssign_v<MT2> >
708  {
710 
711  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
712  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
713 
714  smpAddAssign( ~lhs, rhs.dm_ );
715  }
717  //**********************************************************************************************
718 
719  //**SMP subtraction assignment to dense matrices************************************************
731  template< typename MT2 // Type of the target dense matrix
732  , bool SO2 > // Storage order of the target dense matrix
733  friend inline auto smpSubAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
734  -> EnableIf_t< UseSMPAssign_v<MT2> >
735  {
737 
738  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
739  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
740 
741  smpSubAssign( ~lhs, rhs.dm_ );
742  }
744  //**********************************************************************************************
745 
746  //**SMP subtraction assignment to sparse matrices***********************************************
758  template< typename MT2 // Type of the target sparse matrix
759  , bool SO2 > // Storage order of the target dense matrix
760  friend inline auto smpSubAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
761  -> EnableIf_t< UseSMPAssign_v<MT2> >
762  {
764 
765  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
766  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
767 
768  smpSubAssign( ~lhs, rhs.dm_ );
769  }
771  //**********************************************************************************************
772 
773  //**SMP Schur product assignment to dense matrices**********************************************
785  template< typename MT2 // Type of the target dense matrix
786  , bool SO2 > // Storage order of the target dense matrix
787  friend inline auto smpSchurAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
788  -> EnableIf_t< UseSMPAssign_v<MT2> >
789  {
791 
792  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
793  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
794 
795  smpSchurAssign( ~lhs, rhs.dm_ );
796  }
798  //**********************************************************************************************
799 
800  //**SMP Schur product assignment to sparse matrices*********************************************
812  template< typename MT2 // Type of the target sparse matrix
813  , bool SO2 > // Storage order of the target dense matrix
814  friend inline auto smpSchurAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
815  -> EnableIf_t< UseSMPAssign_v<MT2> >
816  {
818 
819  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
820  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
821 
822  smpSchurAssign( ~lhs, rhs.dm_ );
823  }
825  //**********************************************************************************************
826 
827  //**SMP multiplication assignment to dense matrices*********************************************
840  template< typename MT2 // Type of the target dense matrix
841  , bool SO2 > // Storage order of the target dense matrix
842  friend inline auto smpMultAssign( DenseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
843  -> EnableIf_t< UseSMPAssign_v<MT2> >
844  {
846 
847  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
848  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
849 
850  smpMultAssign( ~lhs, rhs.dm_ );
851  }
853  //**********************************************************************************************
854 
855  //**SMP multiplication assignment to sparse matrices********************************************
868  template< typename MT2 // Type of the target sparse matrix
869  , bool SO2 > // Storage order of the target dense matrix
870  friend inline auto smpMultAssign( SparseMatrix<MT2,SO2>& lhs, const DMatDeclDiagExpr& rhs )
871  -> EnableIf_t< UseSMPAssign_v<MT2> >
872  {
874 
875  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
876  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
877 
878  smpMultAssign( ~lhs, rhs.dm_ );
879  }
881  //**********************************************************************************************
882 
883  //**Compile time checks*************************************************************************
890  //**********************************************************************************************
891 };
892 //*************************************************************************************************
893 
894 
895 
896 
897 //=================================================================================================
898 //
899 // GLOBAL FUNCTIONS
900 //
901 //=================================================================================================
902 
903 //*************************************************************************************************
914 template< typename MT // Type of the dense matrix
915  , bool SO // Storage order
916  , DisableIf_t< IsDiagonal_v<MT> >* = nullptr >
917 inline const DMatDeclDiagExpr<MT,SO> decldiag_backend( const DenseMatrix<MT,SO>& dm )
918 {
920 
921  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
922 
923  return DMatDeclDiagExpr<MT,SO>( ~dm );
924 }
926 //*************************************************************************************************
927 
928 
929 //*************************************************************************************************
940 template< typename MT // Type of the dense matrix
941  , bool SO // Storage order
942  , EnableIf_t< IsDiagonal_v<MT> >* = nullptr >
943 inline const MT& decldiag_backend( const DenseMatrix<MT,SO>& dm )
944 {
946 
947  BLAZE_INTERNAL_ASSERT( isSquare( ~dm ), "Non-square matrix detected" );
948 
949  return ~dm;
950 }
952 //*************************************************************************************************
953 
954 
955 //*************************************************************************************************
973 template< typename MT // Type of the dense matrix
974  , bool SO > // Storage order
975 inline decltype(auto) decldiag( const DenseMatrix<MT,SO>& dm )
976 {
978 
979  if( !isSquare( ~dm ) ) {
980  BLAZE_THROW_INVALID_ARGUMENT( "Invalid diagonal matrix specification" );
981  }
982 
983  return decldiag_backend( ~dm );
984 }
985 //*************************************************************************************************
986 
987 
988 
989 
990 //=================================================================================================
991 //
992 // GLOBAL RESTRUCTURING FUNCTIONS
993 //
994 //=================================================================================================
995 
996 //*************************************************************************************************
1010 template< typename MT // Type of the left-hand side dense matrix
1011  , typename ST // Type of the right-hand side scalar value
1012  , bool SO // Storage order
1013  , DisableIf_t< IsDiagonal_v<MT> >* = nullptr >
1014 inline decltype(auto) decldiag( const DMatScalarMultExpr<MT,ST,SO>& dm )
1015 {
1017 
1018  if( !isSquare( dm ) ) {
1019  BLAZE_THROW_INVALID_ARGUMENT( "Invalid diagonal matrix specification" );
1020  }
1021 
1022  return decldiag( dm.leftOperand() ) * dm.rightOperand();
1023 }
1025 //*************************************************************************************************
1026 
1027 
1028 
1029 
1030 //=================================================================================================
1031 //
1032 // HASCONSTDATAACCESS SPECIALIZATIONS
1033 //
1034 //=================================================================================================
1035 
1036 //*************************************************************************************************
1038 template< typename MT, bool SO >
1039 struct HasConstDataAccess< DMatDeclDiagExpr<MT,SO> >
1040  : public HasConstDataAccess<MT>
1041 {};
1043 //*************************************************************************************************
1044 
1045 
1046 
1047 
1048 //=================================================================================================
1049 //
1050 // ISALIGNED SPECIALIZATIONS
1051 //
1052 //=================================================================================================
1053 
1054 //*************************************************************************************************
1056 template< typename MT, bool SO >
1057 struct IsAligned< DMatDeclDiagExpr<MT,SO> >
1058  : public IsAligned<MT>
1059 {};
1061 //*************************************************************************************************
1062 
1063 
1064 
1065 
1066 //=================================================================================================
1067 //
1068 // ISSYMMETRIC SPECIALIZATIONS
1069 //
1070 //=================================================================================================
1071 
1072 //*************************************************************************************************
1074 template< typename MT, bool SO >
1075 struct IsSymmetric< DMatDeclDiagExpr<MT,SO> >
1076  : public TrueType
1077 {};
1079 //*************************************************************************************************
1080 
1081 
1082 
1083 
1084 //=================================================================================================
1085 //
1086 // ISLOWER SPECIALIZATIONS
1087 //
1088 //=================================================================================================
1089 
1090 //*************************************************************************************************
1092 template< typename MT, bool SO >
1093 struct IsLower< DMatDeclDiagExpr<MT,SO> >
1094  : public TrueType
1095 {};
1097 //*************************************************************************************************
1098 
1099 
1100 
1101 
1102 //=================================================================================================
1103 //
1104 // ISUPPER SPECIALIZATIONS
1105 //
1106 //=================================================================================================
1107 
1108 //*************************************************************************************************
1110 template< typename MT, bool SO >
1111 struct IsUpper< DMatDeclDiagExpr<MT,SO> >
1112  : public TrueType
1113 {};
1115 //*************************************************************************************************
1116 
1117 } // namespace blaze
1118 
1119 #endif
#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.
Header file for the decldiag trait.
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:975
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias declaration for the If class template.The If_t alias declaration provides a convenien...
Definition: If.h:109
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
BLAZE_ALWAYS_INLINE auto load(size_t i, size_t j) const noexcept
Access to the SIMD elements of the matrix.
Definition: DMatDeclDiagExpr.h:221
#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
Base class for all declaration expression templates.The Declaration class serves as a tag for all dec...
Definition: Declaration.h:70
If_t< IsExpression_v< MT >, const MT, const MT &> Operand
Composite data type of the dense matrix expression.
Definition: DMatDeclDiagExpr.h:153
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: DMatDeclDiagExpr.h:277
BLAZE_CREATE_GET_TYPE_MEMBER_TYPE_TRAIT(GetConstIterator, ConstIterator, INVALID_TYPE)
Definition of the GetConstIterator type trait.
static constexpr bool simdEnabled
Compilation switch for the expression template evaluation strategy.
Definition: DMatDeclDiagExpr.h:158
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
Header file for the RequiresEvaluation type trait.
Expression object for the explicit diagonal declaration of dense matrices.The DMatDeclDiagExpr class ...
Definition: DMatDeclDiagExpr.h:94
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
Header file for the SIMD trait.
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:137
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Header file for all forward declarations for sparse vectors and matrices.
Base class for all decldiag expression templates.The DeclDiagExpr class serves as a tag for all expre...
Definition: DeclDiagExpr.h:66
Constraint on the data type.
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
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: DMatDeclDiagExpr.h:142
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD element.
Definition: DMatDeclDiagExpr.h:166
Header file for the DisableIf class template.
Header file for the IsSymmetric type trait.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatDeclDiagExpr.h:188
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
Header file for the If class template.
Header file for the DeclDiagExpr base class.
bool canSMPAssign() const noexcept
Returns whether the expression can be used in SMP assignments.
Definition: DMatDeclDiagExpr.h:331
#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.
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: DMatDeclDiagExpr.h:144
GetConstIterator_t< MT > ConstIterator
Iterator over the elements of the dense matrix.
Definition: DMatDeclDiagExpr.h:150
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a diagonal matrix type, a compilation error is created.
Definition: Diagonal.h:79
Header file for the GetMemberType type trait.
Header file for the IsLower type trait.
Header file for the IsAligned type trait.
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatDeclDiagExpr.h:141
#define BLAZE_CONSTRAINT_MUST_NOT_BE_MATMATMULTEXPR_TYPE(T)
Constraint on the data type.In case the given data type T is a matrix/matrix multiplication expressio...
Definition: MatMatMultExpr.h:83
If_t< RequiresEvaluation_v< MT >, const ResultType, const DMatDeclDiagExpr &> CompositeType
Data type for composite expression templates.
Definition: DMatDeclDiagExpr.h:147
bool isAligned() const noexcept
Returns whether the operands of the expression are properly aligned in memory.
Definition: DMatDeclDiagExpr.h:321
Constraints on the storage order of matrix types.
Operand operand() const noexcept
Returns the dense matrix operand.
Definition: DMatDeclDiagExpr.h:287
const ElementType * data() const noexcept
Low-level data access to the matrix elements.
Definition: DMatDeclDiagExpr.h:235
DMatDeclDiagExpr(const MT &dm) noexcept
Constructor for the DMatDeclDiagExpr class.
Definition: DMatDeclDiagExpr.h:174
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: DMatDeclDiagExpr.h:267
Header file for the EnableIf class template.
ElementType_t< MT > ElementType
Resulting element type.
Definition: DMatDeclDiagExpr.h:143
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
Header file for the HasConstDataAccess type trait.
Header file for the Declaration base class.
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
Utility type for generic codes.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Constraint on the data type.
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
static constexpr bool useAssign
Compilation switch for the serial evaluation strategy of the diagonal declaration expression...
Definition: DMatDeclDiagExpr.h:114
auto smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
ResultType_t< MT > RT
Result type of the dense matrix expression.
Definition: DMatDeclDiagExpr.h:100
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: DMatDeclDiagExpr.h:161
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatDeclDiagExpr.h:246
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: DMatDeclDiagExpr.h:311
Header file for the implementation of the base template of the DiagonalMatrix.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: DMatDeclDiagExpr.h:203
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Operand dm_
Dense matrix of the decldiag expression.
Definition: DMatDeclDiagExpr.h:338
DeclDiagTrait_t< RT > ResultType
Result type for expression template evaluations.
Definition: DMatDeclDiagExpr.h:140
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatDeclDiagExpr.h:257
Header file for the IsUpper type trait.
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: DMatDeclDiagExpr.h:299
Constraint on the data type.
typename DeclDiagTrait< MT >::Type DeclDiagTrait_t
Auxiliary alias declaration for the DeclDiagTrait type trait.The DeclDiagTrait_t alias declaration pr...
Definition: DeclDiagTrait.h:160
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
#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
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the TrueType type/value trait base class.
Header file for the IsExpression type trait class.
Header file for the function trace functionality.